Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Commit 122e44b

Browse files
committed
initial import of public tutorial information
0 parents  commit 122e44b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+891
-0
lines changed

80x15.png

688 Bytes

buildout/bootstrap.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
##############################################################################
2+
#
3+
# Copyright (c) 2006 Zope Corporation and Contributors.
4+
# All Rights Reserved.
5+
#
6+
# This software is subject to the provisions of the Zope Public License,
7+
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8+
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9+
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10+
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11+
# FOR A PARTICULAR PURPOSE.
12+
#
13+
##############################################################################
14+
"""Bootstrap a buildout-based project
15+
16+
Simply run this script in a directory containing a buildout.cfg.
17+
The script accepts buildout command-line options, so you can
18+
use the -c option to specify an alternate configuration file.
19+
20+
$Id$
21+
"""
22+
23+
import os, shutil, sys, tempfile, urllib2
24+
25+
tmpeggs = tempfile.mkdtemp()
26+
27+
try:
28+
import pkg_resources
29+
except ImportError:
30+
ez = {}
31+
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
32+
).read() in ez
33+
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
34+
35+
import pkg_resources
36+
37+
if sys.platform == 'win32':
38+
def quote(c):
39+
if ' ' in c:
40+
return '"%s"' % c # work around spawn lamosity on windows
41+
else:
42+
return c
43+
else:
44+
def quote (c):
45+
return c
46+
47+
cmd = 'from setuptools.command.easy_install import main; main()'
48+
ws = pkg_resources.working_set
49+
assert os.spawnle(
50+
os.P_WAIT, sys.executable, quote (sys.executable),
51+
'-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
52+
dict(os.environ,
53+
PYTHONPATH=
54+
ws.find(pkg_resources.Requirement.parse('setuptools')).location
55+
),
56+
) == 0
57+
58+
ws.add_entry(tmpeggs)
59+
ws.require('zc.buildout')
60+
import zc.buildout.buildout
61+
zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
62+
shutil.rmtree(tmpeggs)

buildout/buildout.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[buildout]
2+
parts = py
3+
versions = versions
4+
5+
[versions]
6+
xlrd=0.7.1
7+
xlwt=0.7.2
8+
xlutils=1.3.0
9+
10+
[py]
11+
recipe = zc.recipe.egg
12+
eggs =
13+
xlrd
14+
xlwt
15+
xlutils
16+
testfixtures
17+
interpreter = py

buildout/runall.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# this script should be run as:
2+
# bin\py runall.py
3+
4+
import os
5+
6+
from glob import glob
7+
from os.path import join as j, abspath
8+
from re import compile
9+
from subprocess import call,STDOUT
10+
from tempfile import TemporaryFile
11+
from testfixtures import diff
12+
13+
runner = abspath(j(os.path.split(__file__)[0],'py'))
14+
15+
sub_res = [
16+
(compile('0+x[0-9A-Fa-f]+'),'...'),
17+
(compile('".+'+os.sep.replace('\\','\\\\')+'(.+.py)"'),'"\\1"'),
18+
]
19+
20+
base = os.path.abspath('..')
21+
for path in ('xlrd','xlwt','xlutils'):
22+
dir = j(base,'students',path)
23+
expected_dir = j(base,'expected',path)
24+
os.chdir(dir)
25+
for py in glob(j(dir,'*.py')):
26+
name = os.path.split(py)[1]
27+
28+
before_listing = set(os.listdir(dir))
29+
print py
30+
31+
output = TemporaryFile('w+')
32+
expected_base = j(expected_dir,os.path.splitext(name)[0])
33+
34+
call([runner,py],stdout=output,stderr=STDOUT)
35+
36+
after_listing = set(os.listdir(dir))
37+
created = after_listing.difference(before_listing)
38+
39+
expected_names = set()
40+
if os.path.exists(expected_base):
41+
expected_names = set(os.listdir(expected_base))
42+
for name in created:
43+
ap = j(dir,name)
44+
af = open(ap,'rb')
45+
actual = af.read()
46+
af.close()
47+
if name in expected_names:
48+
expected = open(j(expected_base,name),'rb').read()
49+
expected_names.remove(name)
50+
if actual==expected:
51+
os.remove(ap)
52+
else:
53+
print 'different:',name
54+
else:
55+
print "unexpected:",name
56+
for name in expected_names:
57+
if name!='.svn':
58+
print "missing:",name
59+
60+
output.seek(0)
61+
output = output.read().strip().replace('\r','')
62+
for re,rp in sub_res:
63+
output = re.sub(rp,output)
64+
expected_path = j(expected_base+'.txt')
65+
if not os.path.exists(expected_path):
66+
expected = ''
67+
else:
68+
expected = open(expected_path).read().strip().replace('\r','')
69+
if output!=expected:
70+
print '='*len(name)
71+
print diff(expected,output)
72+
print '='*len(name)
73+

expected/xlrd/cell_access.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
text:u'S2R1CA'
2+
S2R1CA
3+
True
4+
1 S2R2CA
5+
1 S2R2CB

expected/xlrd/cell_types.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
XL_CELL_TEXT [(1, text:u'Text', u'Text'), (0, empty:'', ''), (0, empty:'', '')]
2+
XL_CELL_NUMBER [(2, number:13.0, 13.0), (2, number:4.2000000000000002, 4.2000000000000002), (0, empty:'', '')]
3+
XL_CELL_DATE [(3, xldate:39890.0, 39890.0), (3, xldate:39890.879675925928, 39890.879675925928), (3, xldate:0.87967592592592592, 0.87967592592592592)]
4+
XL_CELL_BOOLEAN [(4, bool:0, 0), (4, bool:1, 1), (0, empty:'', '')]
5+
XL_CELL_ERROR [(5, error:23, 23), (5, error:0, 0), (0, empty:'', '')]
6+
XL_CELL_BLANK [(0, empty:'', ''), (0, empty:'', ''), (0, empty:'', '')]
7+
XL_CELL_EMPTY [(0, empty:'', ''), (0, empty:'', ''), (0, empty:'', '')]
8+
9+
XL_CELL_TEXT [(1, text:u'Text' (XF:25), u'Text'), (0, empty:'' (XF:15), ''), (0, empty:'' (XF:15), '')]
10+
XL_CELL_NUMBER [(2, number:13.0 (XF:25), 13.0), (2, number:4.2000000000000002 (XF:25), 4.2000000000000002), (0, empty:'' (XF:15), '')]
11+
XL_CELL_DATE [(3, xldate:39890.0 (XF:26), 39890.0), (3, xldate:39890.879675925928 (XF:27), 39890.879675925928), (3, xldate:0.87967592592592592 (XF:28), 0.87967592592592592)]
12+
XL_CELL_BOOLEAN [(4, bool:0 (XF:29), 0), (4, bool:1 (XF:29), 1), (0, empty:'' (XF:15), '')]
13+
XL_CELL_ERROR [(5, error:23 (XF:25), 23), (5, error:0 (XF:25), 0), (0, empty:'' (XF:15), '')]
14+
XL_CELL_BLANK [(6, blank:'' (XF:24), ''), (0, empty:'' (XF:15), ''), (0, empty:'' (XF:15), '')]
15+
XL_CELL_EMPTY [(0, empty:'' (XF:15), ''), (0, empty:'' (XF:15), ''), (0, empty:'' (XF:15), '')]

expected/xlrd/dates.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2009-03-18 00:00:00 2009-03-18
2+
2009-03-18 21:06:44
3+
21:06:44
4+
Traceback (most recent call last):
5+
File "py-script.py", line 28, in <module>
6+
execfile(sys.argv[0])
7+
File "dates.py", line 13, in <module>
8+
print datetime(*time_value)
9+
ValueError: year is out of range

expected/xlrd/emptyblank.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
False False False
2+
6 ''
3+
0 ''

expected/xlrd/errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#REF!
2+
#NULL!

expected/xlrd/introspect_book.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2
2+
<xlrd.sheet.Sheet object at ...>
3+
<xlrd.sheet.Sheet object at ...>
4+
[u'Sheet1', u'Sheet2']
5+
<xlrd.sheet.Sheet object at ...>
6+
<xlrd.sheet.Sheet object at ...>
7+
<xlrd.sheet.Sheet object at ...>
8+
<xlrd.sheet.Sheet object at ...>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy