Skip to content

Commit c91410f

Browse files
committed
Fix join statement and more linting
1 parent dabb815 commit c91410f

File tree

16 files changed

+28
-28
lines changed

16 files changed

+28
-28
lines changed

asv_bench/benchmarks/frame_ctor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def setup(self, offset, n_steps):
132132
offset = getattr(offsets, offset)
133133
self.idx = get_index_for_offset(offset(n_steps, **kwargs))
134134
self.df = DataFrame(np.random.randn(len(self.idx), 10), index=self.idx)
135-
self.d = dict([(col, self.df[col]) for col in self.df.columns])
135+
self.d = dict((col, self.df[col]) for col in self.df.columns)
136136

137137
def time_frame_ctor(self, offset, n_steps):
138138
DataFrame(self.d)

asv_bench/benchmarks/io_bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class read_json_lines(object):
202202
def setup(self):
203203
self.N = 100000
204204
self.C = 5
205-
self.df = DataFrame(dict([('float{0}'.format(i), randn(self.N)) for i in range(self.C)]))
205+
self.df = DataFrame(dict(('float{0}'.format(i), randn(self.N)) for i in range(self.C)))
206206
self.df.to_json(self.fname,orient="records",lines=True)
207207

208208
def teardown(self):

asv_bench/benchmarks/packers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _setup(self):
1717
self.N = 100000
1818
self.C = 5
1919
self.index = date_range('20000101', periods=self.N, freq='H')
20-
self.df = DataFrame(dict([('float{0}'.format(i), randn(self.N)) for i in range(self.C)]), index=self.index)
20+
self.df = DataFrame(dict(('float{0}'.format(i), randn(self.N)) for i in range(self.C)), index=self.index)
2121
self.df2 = self.df.copy()
2222
self.df2['object'] = [('%08x' % randrange((16 ** 8))) for _ in range(self.N)]
2323
self.remove(self.f)

asv_bench/vbench_to_asv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def visit_ClassDef(self, node):
6969
return node
7070

7171
def visit_TryExcept(self, node):
72-
if any([isinstance(x, (ast.Import, ast.ImportFrom)) for x in node.body]):
72+
if any(isinstance(x, (ast.Import, ast.ImportFrom)) for x in node.body):
7373
self.imports.append(node)
7474
else:
7575
self.generic_visit(node)

ci/lint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if [ "$LINT" ]; then
8484
fi
8585
echo "Check for invalid testing DONE"
8686

87-
echo "Check for use of lists in built-in Python functions"
87+
echo "Check for use of lists instead of generators in built-in Python functions"
8888

8989
# Example: Avoid `any([i for i in some_iterator])` in favor of `any(i for i in some_iterator)`
9090
#
@@ -95,7 +95,7 @@ if [ "$LINT" ]; then
9595
if [ $? = "0" ]; then
9696
RET=1
9797
fi
98-
echo "Check for use of lists in built-in Python functions DONE"
98+
echo "Check for use of lists instead of generators in built-in Python functions DONE"
9999

100100
else
101101
echo "NOT Linting"

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
# JP: added from sphinxdocs
7979
autosummary_generate = False
8080

81-
if any([re.match("\s*api\s*", l) for l in index_rst_lines]):
81+
if any(re.match("\s*api\s*", l) for l in index_rst_lines):
8282
autosummary_generate = True
8383

8484
files_to_delete = []
@@ -89,7 +89,7 @@
8989

9090
_file_basename = os.path.splitext(f)[0]
9191
_regex_to_match = "\s*{}\s*$".format(_file_basename)
92-
if not any([re.match(_regex_to_match, line) for line in index_rst_lines]):
92+
if not any(re.match(_regex_to_match, line) for line in index_rst_lines):
9393
files_to_delete.append(f)
9494

9595
if files_to_delete:

doc/sphinxext/ipython_sphinxext/ipython_directive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def process_output(self, data, output_prompt,
522522
source = self.directive.state.document.current_source
523523
content = self.directive.content
524524
# Add tabs and join into a single string.
525-
content = '\n'.join([TAB + line for line in content])
525+
content = '\n'.join(TAB + line for line in content)
526526

527527
# Make sure the output contains the output prompt.
528528
ind = found.find(output_prompt)

doc/sphinxext/numpydoc/compiler_unparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def _Return(self, t):
399399
self._fill("return ")
400400
if t.value:
401401
if isinstance(t.value, Tuple):
402-
text = ', '.join([ name.name for name in t.value.asList() ])
402+
text = ', '.join(name.name for name in t.value.asList())
403403
self._write(text)
404404
else:
405405
self._dispatch(t.value)

doc/sphinxext/numpydoc/docscrape.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def _parse_summary(self):
270270
# If several signatures present, take the last one
271271
while True:
272272
summary = self._doc.read_to_next_empty_line()
273-
summary_str = " ".join([s.strip() for s in summary]).strip()
273+
summary_str = " ".join(s.strip() for s in summary).strip()
274274
if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
275275
self['Signature'] = summary_str
276276
if not self._is_at_section():
@@ -289,7 +289,7 @@ def _parse(self):
289289

290290
for (section,content) in self._read_sections():
291291
if not section.startswith('..'):
292-
section = ' '.join([s.capitalize() for s in section.split(' ')])
292+
section = ' '.join(s.capitalize() for s in section.split(' '))
293293
if section in ('Parameters', 'Returns', 'Raises', 'Warns',
294294
'Other Parameters', 'Attributes', 'Methods'):
295295
self[section] = self._parse_param_list(content)

doc/sphinxext/numpydoc/docscrape_sphinx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _str_member_list(self, name):
130130
out += [''] + autosum
131131

132132
if others:
133-
maxlen_0 = max(3, max([len(x[0]) for x in others]))
133+
maxlen_0 = max(3, max(len(x[0]) for x in others))
134134
hdr = sixu("=")*maxlen_0 + sixu(" ") + sixu("=")*10
135135
fmt = sixu('%%%ds %%s ') % (maxlen_0,)
136136
out += ['', hdr]
@@ -203,7 +203,7 @@ def _str_references(self):
203203
m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
204204
if m:
205205
items.append(m.group(1))
206-
out += [' ' + ", ".join(["[%s]_" % item for item in items]), '']
206+
out += [' ' + ", ".join("[%s]_" % item for item in items), '']
207207
return out
208208

209209
def _str_examples(self):

0 commit comments

Comments
 (0)