Skip to content

Commit 61ed771

Browse files
author
y-p
committed
DOC: RELEASE.rst mention new options disp.height/width and deprecated line_width
1 parent 546f00a commit 61ed771

File tree

2 files changed

+81
-41
lines changed

2 files changed

+81
-41
lines changed

RELEASE.rst

+8
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ pandas 0.11.0
182182
- ``min_itemsize`` parameter will now automatically create data_columns for passed keys
183183

184184
- Downcast on pivot if possible (GH3283_), adds argument ``downcast`` to ``fillna``
185+
- Introduced options `display.height/width` for explicitly specifying terminal
186+
height/width in characters. Deprecated display.line_width, now replaced by display.width.
187+
These defaults are in effect for scripts as well, so unless disabled, previously
188+
very wide output will now be output as "expand_repr" style wrapped output.
189+
- Various defaults for options (including display.max_rows) have been revised,
190+
after a brief survey concluded they were wrong for everyone. Now at w=80,h=60.
191+
- HTML repr output for dataframes is once again controlled by the option
192+
`display.notebook_repr_html`, and on by default.
185193

186194
**Bug Fixes**
187195

scripts/use_build_cache.py

+73-41
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,29 @@
1515
Tested on releases back to 0.7.0.
1616
1717
"""
18-
import argparse
19-
argparser = argparse.ArgumentParser(description="""
20-
'Program description.
21-
""".strip())
2218

23-
argparser.add_argument('-f', '--force-overwrite',
19+
try:
20+
import argparse
21+
argparser = argparse.ArgumentParser(description="""
22+
'Program description.
23+
""".strip())
24+
25+
argparser.add_argument('-f', '--force-overwrite',
2426
default=False,
2527
help='Setting this will overwrite any existing cache results for the current commit',
2628
action='store_true')
27-
argparser.add_argument('-d', '--debug',
29+
argparser.add_argument('-d', '--debug',
2830
default=False,
2931
help='Report cache hits/misses',
3032
action='store_true')
3133

32-
args = argparser.parse_args()
34+
args = argparser.parse_args()
35+
except:
36+
class Foo(object):
37+
debug=False
38+
force_overwrite=False
39+
40+
args = Foo() # for 2.6, no argparse
3341

3442
#print args.accumulate(args.integers)
3543

@@ -70,18 +78,28 @@
7078
import shutil
7179
import multiprocessing
7280
pyver = "%d.%d" % (sys.version_info[:2])
73-
files = ["pandas"]
81+
fileq = ["pandas"]
7482
to_process = dict()
75-
orig_hashes= dict((f.split("-")[0],f) for f in os.listdir(BUILD_CACHE_DIR)
76-
if "-" in f and f.endswith(pyver))
77-
post_hashes= dict((f.split("-")[1],f) for f in os.listdir(BUILD_CACHE_DIR)
78-
if "-" in f and f.endswith(pyver))
7983
80-
while files:
81-
f = files.pop()
84+
# retrieve the hashes existing in the cache
85+
orig_hashes=dict()
86+
post_hashes=dict()
87+
for path,dirs,files in os.walk(os.path.join(BUILD_CACHE_DIR,'pandas')):
88+
for f in files:
89+
s=f.split(".py-")[-1]
90+
try:
91+
prev_h,post_h,ver = s.split('-')
92+
if ver == pyver:
93+
orig_hashes[prev_h] = os.path.join(path,f)
94+
post_hashes[post_h] = os.path.join(path,f)
95+
except:
96+
pass
97+
98+
while fileq:
99+
f = fileq.pop()
82100
83101
if os.path.isdir(f):
84-
files.extend([os.path.join(f,x) for x in os.listdir(f)])
102+
fileq.extend([os.path.join(f,x) for x in os.listdir(f)])
85103
else:
86104
if not f.endswith(".py"):
87105
continue
@@ -90,40 +108,54 @@
90108
h = sha1(open(f,"rb").read()).hexdigest()
91109
except IOError:
92110
to_process[h] = f
93-
if h in orig_hashes and not BC_FORCE_OVERWRITE:
94-
src = os.path.join(BUILD_CACHE_DIR,orig_hashes[h])
95-
if BC_DEBUG:
96-
print("2to3 cache hit %s,%s" % (f,h))
97-
shutil.copyfile(src,f)
98-
elif h not in post_hashes:
99-
100-
# we're not in a dev dir with already processed files
101-
if BC_DEBUG:
102-
print("2to3 cache miss %s,%s" % (f,h))
103-
print("2to3 will process " + f)
104-
to_process[h] = f
111+
else:
112+
if h in orig_hashes and not BC_FORCE_OVERWRITE:
113+
src = orig_hashes[h]
114+
if BC_DEBUG:
115+
print("2to3 cache hit %s,%s" % (f,h))
116+
shutil.copyfile(src,f)
117+
elif h not in post_hashes:
118+
# we're not in a dev dir with already processed files
119+
if BC_DEBUG:
120+
print("2to3 cache miss (will process) %s,%s" % (f,h))
121+
to_process[h] = f
105122
106123
avail_fixes = set(refactor.get_fixers_from_package("lib2to3.fixes"))
107124
avail_fixes.discard('lib2to3.fixes.fix_next')
108125
t=refactor.RefactoringTool(avail_fixes)
109-
print("Starting 2to3 refactoring...")
110-
for f in to_process.values():
111-
if BC_DEBUG:
112-
print("2to3 on %s" % f)
113-
try:
114-
t.refactor([f],True)
115-
post_h = sha1(open(f, "rb").read()).hexdigest()
116-
cached_fname = f + "-" + post_h + "-" + pyver
126+
if to_process:
127+
print("Starting 2to3 refactoring...")
128+
for orig_h,f in to_process.items():
117129
if BC_DEBUG:
118-
print("cache put %s,%s in %s" % (f, h, cached_fname))
119-
shutil.copyfile(f, os.path.join(BUILD_CACHE_DIR, cached_fname))
130+
print("2to3 on %s" % f)
131+
try:
132+
t.refactor([f],True)
133+
post_h = sha1(open(f, "rb").read()).hexdigest()
134+
cached_fname = f + '-' + orig_h + '-' + post_h + '-' + pyver
135+
path = os.path.join(BUILD_CACHE_DIR, cached_fname)
136+
pathdir =os.path.dirname(path)
137+
if BC_DEBUG:
138+
print("cache put %s in %s" % (f, path))
139+
try:
140+
os.makedirs(pathdir)
141+
except OSError as exc:
142+
import errno
143+
if exc.errno == errno.EEXIST and os.path.isdir(pathdir):
144+
pass
145+
else:
146+
raise
120147
121-
except:
122-
pass
123-
print("2to3 done refactoring.")
148+
shutil.copyfile(f, path)
149+
150+
except Exception as e:
151+
print("While processing %s 2to3 raised: %s" % (f,str(e)))
152+
153+
pass
154+
print("2to3 done refactoring.")
124155
125156
except Exception as e:
126-
print( "Exception: " + str(e))
157+
if not isinstance(e,ZeroDivisionError):
158+
print( "Exception: " + str(e))
127159
BUILD_CACHE_DIR = None
128160
129161
class CompilationCacheMixin(object):

0 commit comments

Comments
 (0)