Skip to content

CLN: General print statement cleanup. #4973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bench/io_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def rountrip_archive(N, K=50, iterations=10):
pickle_time = timeit(pickle_f, iterations) / iterations
print('pandas (pickle) %7.4f seconds' % pickle_time)

# print 'Numpy (npz) %7.4f seconds' % numpy_time
# print 'larry (HDF5) %7.4f seconds' % larry_time
# print('Numpy (npz) %7.4f seconds' % numpy_time)
# print('larry (HDF5) %7.4f seconds' % larry_time)

# Delete old files
try:
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinxext/docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def __str__(self):

if self._role:
if not roles.has_key(self._role):
print "Warning: invalid role %s" % self._role
print("Warning: invalid role %s" % self._role)
out += '.. %s:: %s\n \n\n' % (roles.get(self._role, ''),
func_name)

Expand Down
2 changes: 1 addition & 1 deletion doc/sphinxext/ipython_console_highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class IPythonConsoleLexer(Lexer):
In [2]: a
Out[2]: 'foo'

In [3]: print a
In [3]: print(a)
foo

In [4]: 1 / 0
Expand Down
32 changes: 16 additions & 16 deletions doc/sphinxext/ipython_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def block_parser(part, rgxin, rgxout, fmtin, fmtout):

nextline = lines[i]
matchout = rgxout.match(nextline)
# print "nextline=%s, continuation=%s, starts=%s"%(nextline,
# continuation, nextline.startswith(continuation))
# print("nextline=%s, continuation=%s, starts=%s"%(nextline,
# continuation, nextline.startswith(continuation)))
if matchout or nextline.startswith('#'):
break
elif nextline.startswith(continuation):
Expand Down Expand Up @@ -245,7 +245,7 @@ def clear_cout(self):

def process_input_line(self, line, store_history=True):
"""process the input, capturing stdout"""
# print "input='%s'"%self.input
# print("input='%s'"%self.input)
stdout = sys.stdout
splitter = self.IP.input_splitter
try:
Expand Down Expand Up @@ -293,7 +293,7 @@ def process_input(self, data, input_prompt, lineno):
decorator, input, rest = data
image_file = None
image_directive = None
# print 'INPUT:', data # dbg
# print('INPUT:', data) # dbg
is_verbatim = decorator == '@verbatim' or self.is_verbatim
is_doctest = decorator == '@doctest' or self.is_doctest
is_suppress = decorator == '@suppress' or self.is_suppress
Expand Down Expand Up @@ -361,7 +361,7 @@ def _remove_first_space_if_any(line):
self.cout.truncate(0)
return (ret, input_lines, output, is_doctest, image_file,
image_directive)
# print 'OUTPUT', output # dbg
# print('OUTPUT', output) # dbg

def process_output(self, data, output_prompt,
input_lines, output, is_doctest, image_file):
Expand Down Expand Up @@ -390,9 +390,9 @@ def process_output(self, data, output_prompt,
'found_output="%s" and submitted output="%s"' %
(input_lines, found, submitted))
raise RuntimeError(e)
# print 'doctest PASSED for input_lines="%s" with
# found_output="%s" and submitted output="%s"'%(input_lines,
# found, submitted)
# print('''doctest PASSED for input_lines="%s" with
# found_output="%s" and submitted output="%s"''' % (input_lines,
# found, submitted))

def process_comment(self, data):
"""Process data fPblock for COMMENT token."""
Expand All @@ -406,7 +406,7 @@ def save_image(self, image_file):
self.ensure_pyplot()
command = ('plt.gcf().savefig("%s", bbox_inches="tight", '
'dpi=100)' % image_file)
# print 'SAVEFIG', command # dbg
# print('SAVEFIG', command) # dbg
self.process_input_line('bookmark ipy_thisdir', store_history=False)
self.process_input_line('cd -b ipy_savedir', store_history=False)
self.process_input_line(command, store_history=False)
Expand Down Expand Up @@ -737,12 +737,12 @@ def run(self):
lines.extend(figure.split('\n'))
lines.append('')

# print lines
# print(lines)
if len(lines) > 2:
if debug:
print '\n'.join(lines)
print('\n'.join(lines))
else: # NOTE: this raises some errors, what's it for?
# print 'INSERTING %d lines'%len(lines)
# print('INSERTING %d lines' % len(lines))
self.state_machine.insert_input(
lines, self.state_machine.input_lines.source(0))

Expand Down Expand Up @@ -813,7 +813,7 @@ def test():
In [130]: url = 'http://ichart.finance.yahoo.com/table.csv?s=CROX\
.....: &d=9&e=22&f=2009&g=d&a=1&br=8&c=2006&ignore=.csv'

In [131]: print url.split('&')
In [131]: print(url.split('&'))
['http://ichart.finance.yahoo.com/table.csv?s=CROX', 'd=9', 'e=22', 'f=2009', 'g=d', 'a=1', 'b=8', 'c=2006', 'ignore=.csv']

In [60]: import urllib
Expand Down Expand Up @@ -843,12 +843,12 @@ def test():
""",

r"""
In [106]: print x
In [106]: print(x)
jdh

In [109]: for i in range(10):
n
.....: print i
.....: print(i)
.....:
.....:
0
Expand Down Expand Up @@ -920,4 +920,4 @@ def test():
if not os.path.isdir('_static'):
os.mkdir('_static')
test()
print 'All OK? Check figures in _static/'
print('All OK? Check figures in _static/')
2 changes: 1 addition & 1 deletion doc/sphinxext/phantom_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setup(app):
def initialize(app):
fn = app.config.phantom_import_file
if (fn and os.path.isfile(fn)):
print "[numpydoc] Phantom importing modules from", fn, "..."
print("[numpydoc] Phantom importing modules from", fn, "...")
import_phantom_module(fn)

#------------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions doc/sphinxext/tests/test_docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@
>>> mean = (1,2)
>>> cov = [[1,0],[1,0]]
>>> x = multivariate_normal(mean,cov,(3,3))
>>> print x.shape
>>> print(x.shape)
(3, 3, 2)

The following is probably true, given that 0.6 is roughly twice the
standard deviation:

>>> print list( (x[0,0,:] - mean) < 0.6 )
>>> print(list( (x[0,0,:] - mean) < 0.6 ))
[True, True]

.. index:: random
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_examples():

def test_index():
assert_equal(doc['index']['default'], 'random')
print doc['index']
print(doc['index'])
assert_equal(len(doc['index']), 2)
assert_equal(len(doc['index']['refguide']), 2)

Expand Down Expand Up @@ -247,13 +247,13 @@ def test_str():
>>> mean = (1,2)
>>> cov = [[1,0],[1,0]]
>>> x = multivariate_normal(mean,cov,(3,3))
>>> print x.shape
>>> print(x.shape)
(3, 3, 2)

The following is probably true, given that 0.6 is roughly twice the
standard deviation:

>>> print list( (x[0,0,:] - mean) < 0.6 )
>>> print(list( (x[0,0,:] - mean) < 0.6 ))
[True, True]

.. index:: random
Expand Down Expand Up @@ -351,13 +351,13 @@ def test_sphinx_str():
>>> mean = (1,2)
>>> cov = [[1,0],[1,0]]
>>> x = multivariate_normal(mean,cov,(3,3))
>>> print x.shape
>>> print(x.shape)
(3, 3, 2)

The following is probably true, given that 0.6 is roughly twice the
standard deviation:

>>> print list( (x[0,0,:] - mean) < 0.6 )
>>> print(list( (x[0,0,:] - mean) < 0.6 ))
[True, True]
""")

Expand Down
4 changes: 2 additions & 2 deletions examples/regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def makeSeries():

model = ols(y=Y, x=X)

print (model)
print(model)

#-------------------------------------------------------------------------------
# Panel regression
Expand All @@ -48,4 +48,4 @@ def makeSeries():

model = ols(y=Y, x=data)

print (panelModel)
print(panelModel)
2 changes: 1 addition & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
except Exception: # pragma: no cover
import sys
e = sys.exc_info()[1] # Py25 and Py3 current exception syntax conflict
print (e)
print(e)
if 'No module named lib' in str(e):
raise ImportError('C extensions not built: if you installed already '
'verify that you are not importing from the source '
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _describe_option(pat='', _print_desc=True):
s += _build_option_description(k)

if _print_desc:
print (s)
print(s)
else:
return s

Expand Down Expand Up @@ -631,7 +631,7 @@ def pp(name, ks):
ls += pp(k, ks)
s = '\n'.join(ls)
if _print:
print (s)
print(s)
else:
return s

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ def iterrows(self):

>>> df = DataFrame([[1, 1.0]], columns=['x', 'y'])
>>> row = next(df.iterrows())[1]
>>> print row['x'].dtype
>>> print(row['x'].dtype)
float64
>>> print df['x'].dtype
>>> print(df['x'].dtype)
int64

Returns
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ def aggregate(self, func_or_funcs, *args, **kwargs):
ret = Series(result, index=index)

if not self.as_index: # pragma: no cover
print ('Warning, ignoring as_index=True')
print('Warning, ignoring as_index=True')

return ret

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def _clean_options(self, options, engine):
sep = options['delimiter']
if (sep is None and not options['delim_whitespace']):
if engine == 'c':
print ('Using Python parser to sniff delimiter')
print('Using Python parser to sniff delimiter')
engine = 'python'
elif sep is not None and len(sep) > 1:
# wait until regex engine integrated
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def open(self, mode='a'):
self._handle = h5_open(self._path, self._mode)
except IOError as e: # pragma: no cover
if 'can not be written' in str(e):
print ('Opening %s in read-only mode' % self._path)
print('Opening %s in read-only mode' % self._path)
self._handle = h5_open(self._path, 'r')
else:
raise
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def tquery(sql, con=None, cur=None, retry=True):
except Exception as e:
excName = e.__class__.__name__
if excName == 'OperationalError': # pragma: no cover
print ('Failed to commit, may need to restart interpreter')
print('Failed to commit, may need to restart interpreter')
else:
raise

Expand Down Expand Up @@ -131,7 +131,7 @@ def uquery(sql, con=None, cur=None, retry=True, params=None):

traceback.print_exc()
if retry:
print ('Looks like your connection failed, reconnecting...')
print('Looks like your connection failed, reconnecting...')
return uquery(sql, con, retry=False)
return result

Expand Down
28 changes: 14 additions & 14 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,15 +1328,15 @@ def test_big_table_frame(self):
recons = store.select('df')
assert isinstance(recons, DataFrame)

print ("\nbig_table frame [%s] -> %5.2f" % (rows, time.time() - x))
print("\nbig_table frame [%s] -> %5.2f" % (rows, time.time() - x))

def test_big_table2_frame(self):
# this is a really big table: 1m rows x 60 float columns, 20 string, 20 datetime
# columns
raise nose.SkipTest('no big table2 frame')

# create and write a big table
print ("\nbig_table2 start")
print("\nbig_table2 start")
import time
start_time = time.time()
df = DataFrame(np.random.randn(1000 * 1000, 60), index=range(int(
Expand All @@ -1346,8 +1346,8 @@ def test_big_table2_frame(self):
for x in range(20):
df['datetime%03d' % x] = datetime.datetime(2001, 1, 2, 0, 0)

print ("\nbig_table2 frame (creation of df) [rows->%s] -> %5.2f"
% (len(df.index), time.time() - start_time))
print("\nbig_table2 frame (creation of df) [rows->%s] -> %5.2f"
% (len(df.index), time.time() - start_time))

def f(chunksize):
with ensure_clean(self.path,mode='w') as store:
Expand All @@ -1357,15 +1357,15 @@ def f(chunksize):

for c in [10000, 50000, 250000]:
start_time = time.time()
print ("big_table2 frame [chunk->%s]" % c)
print("big_table2 frame [chunk->%s]" % c)
rows = f(c)
print ("big_table2 frame [rows->%s,chunk->%s] -> %5.2f"
% (rows, c, time.time() - start_time))
print("big_table2 frame [rows->%s,chunk->%s] -> %5.2f"
% (rows, c, time.time() - start_time))

def test_big_put_frame(self):
raise nose.SkipTest('no big put frame')

print ("\nbig_put start")
print("\nbig_put start")
import time
start_time = time.time()
df = DataFrame(np.random.randn(1000 * 1000, 60), index=range(int(
Expand All @@ -1375,17 +1375,17 @@ def test_big_put_frame(self):
for x in range(20):
df['datetime%03d' % x] = datetime.datetime(2001, 1, 2, 0, 0)

print ("\nbig_put frame (creation of df) [rows->%s] -> %5.2f"
% (len(df.index), time.time() - start_time))
print("\nbig_put frame (creation of df) [rows->%s] -> %5.2f"
% (len(df.index), time.time() - start_time))

with ensure_clean(self.path, mode='w') as store:
start_time = time.time()
store = HDFStore(self.path, mode='w')
store.put('df', df)

print (df.get_dtype_counts())
print ("big_put frame [shape->%s] -> %5.2f"
% (df.shape, time.time() - start_time))
print(df.get_dtype_counts())
print("big_put frame [shape->%s] -> %5.2f"
% (df.shape, time.time() - start_time))

def test_big_table_panel(self):
raise nose.SkipTest('no big table panel')
Expand All @@ -1410,7 +1410,7 @@ def test_big_table_panel(self):
recons = store.select('wp')
assert isinstance(recons, Panel)

print ("\nbig_table panel [%s] -> %5.2f" % (rows, time.time() - x))
print("\nbig_table panel [%s] -> %5.2f" % (rows, time.time() - x))

def test_append_diff_item_order(self):

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/wb.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def download(country=['MX', 'CA', 'US'], indicator=['GDPPCKD', 'GDPPCKN'],
# Warn
if len(bad_indicators) > 0:
print('Failed to obtain indicator(s): %s' % '; '.join(bad_indicators))
print ('The data may still be available for download at http://data.worldbank.org')
print('The data may still be available for download at http://data.worldbank.org')
if len(bad_countries) > 0:
print('Invalid ISO-2 codes: %s' % ' '.join(bad_countries))
# Merge WDI series
Expand Down
2 changes: 1 addition & 1 deletion pandas/stats/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def ols(**kwargs):

# Run rolling simple OLS with window of size 10.
result = ols(y=y, x=x, window_type='rolling', window=10)
print result.beta
print(result.beta)

result = ols(y=y, x=x, nw_lags=1)

Expand Down
Loading