Skip to content

Commit f40fe85

Browse files
committed
Fix flake8 E123 warning
Appears in the console as E123 closing bracket does not match indentation of opening bracket's line
1 parent 22fe399 commit f40fe85

File tree

14 files changed

+185
-187
lines changed

14 files changed

+185
-187
lines changed

examples/xlrdnameAPIdemo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ def show_name_details(book, name, show_contents=0, f=sys.stdout):
5454
for nobj in nobj_list:
5555
show_name_object(book, nobj, show_contents, f)
5656

57-
def show_name_details_in_scope(
58-
book, name, scope_strg, show_contents=0, f=sys.stdout,
59-
):
57+
def show_name_details_in_scope(book, name, scope_strg, show_contents=0, f=sys.stdout):
6058
try:
6159
scope = int(scope_strg)
6260
except ValueError:

scripts/runxlrd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ def main(cmd_args):
255255
"-f", "--formatting",
256256
type="int", default=0,
257257
help="0 (default): no fmt info\n"
258-
"1: fmt info (all cells)\n"
259-
)
258+
"1: fmt info (all cells)\n",
259+
)
260260
oparser.add_option(
261261
"-g", "--gc",
262262
type="int", default=0,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ universal = 1
33

44
[flake8]
55
ignore =
6-
E123,E124,E125,E126,E128,
6+
E124,E125,E126,E128,
77
E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E266,E271,E272,
88
E301,E302,E303,E305,
99
E501,

setup.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
packages = ['xlrd'],
1212
scripts = [
1313
'scripts/runxlrd.py',
14-
],
14+
],
1515
description = (
1616
'Library for developers to extract data from '
1717
'Microsoft Excel (tm) spreadsheet files'
@@ -26,20 +26,20 @@
2626
license = 'BSD',
2727
keywords = ['xls', 'excel', 'spreadsheet', 'workbook'],
2828
classifiers = [
29-
'Development Status :: 5 - Production/Stable',
30-
'Intended Audience :: Developers',
31-
'License :: OSI Approved :: BSD License',
32-
'Programming Language :: Python',
33-
'Programming Language :: Python :: 2',
34-
'Programming Language :: Python :: 2.7',
35-
'Programming Language :: Python :: 3',
36-
'Programming Language :: Python :: 3.4',
37-
'Programming Language :: Python :: 3.5',
38-
'Programming Language :: Python :: 3.6',
39-
'Operating System :: OS Independent',
40-
'Topic :: Database',
41-
'Topic :: Office/Business',
42-
'Topic :: Software Development :: Libraries :: Python Modules',
43-
],
29+
'Development Status :: 5 - Production/Stable',
30+
'Intended Audience :: Developers',
31+
'License :: OSI Approved :: BSD License',
32+
'Programming Language :: Python',
33+
'Programming Language :: Python :: 2',
34+
'Programming Language :: Python :: 2.7',
35+
'Programming Language :: Python :: 3',
36+
'Programming Language :: Python :: 3.4',
37+
'Programming Language :: Python :: 3.5',
38+
'Programming Language :: Python :: 3.6',
39+
'Operating System :: OS Independent',
40+
'Topic :: Database',
41+
'Topic :: Office/Business',
42+
'Topic :: Software Development :: Libraries :: Python Modules',
43+
],
4444
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
4545
)

tests/test_formulas.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def get_value(self, col, row):
2929
def test_cell_B2(self):
3030
self.assertEqual(
3131
self.get_value(1, 1),
32-
r"'\u041c\u041e\u0421\u041a\u0412\u0410 \u041c\u043e\u0441\u043a\u0432\u0430'"
33-
)
32+
r"'\u041c\u041e\u0421\u041a\u0412\u0410 \u041c\u043e\u0441\u043a\u0432\u0430'",
33+
)
3434

3535
def test_cell_B3(self):
3636
self.assertEqual(self.get_value(1, 2), '0.14285714285714285')
@@ -50,8 +50,8 @@ def test_cell_B7(self):
5050
def test_cell_B8(self):
5151
self.assertEqual(
5252
self.get_value(1, 7),
53-
r"'\u041c\u041e\u0421\u041a\u0412\u0410 \u041c\u043e\u0441\u043a\u0432\u0430'"
54-
)
53+
r"'\u041c\u041e\u0421\u041a\u0412\u0410 \u041c\u043e\u0441\u043a\u0432\u0430'",
54+
)
5555

5656
class TestNameFormulas(TestCase):
5757

tests/test_open_workbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class TestOpen(TestCase):
1212
def test_names_demo(self):
1313
# For now, we just check this doesn't raise an error.
1414
open_workbook(
15-
from_this_dir(os.path.join('..','examples','namesdemo.xls'))
16-
)
15+
from_this_dir(os.path.join('..','examples','namesdemo.xls')),
16+
)
1717

1818
def test_ragged_rows_tidied_with_formatting(self):
1919
# For now, we just check this doesn't raise an error.

xlrd/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def open_workbook(filename=None,
135135
formatting_info=formatting_info,
136136
on_demand=on_demand,
137137
ragged_rows=ragged_rows,
138-
)
138+
)
139139
return bk
140140
if 'xl/workbook.bin' in component_names:
141141
raise XLRDError('Excel 2007 xlsb file; not supported')
@@ -154,7 +154,7 @@ def open_workbook(filename=None,
154154
formatting_info=formatting_info,
155155
on_demand=on_demand,
156156
ragged_rows=ragged_rows,
157-
)
157+
)
158158
return bk
159159

160160

xlrd/biffh.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ def dump(self, f=None, header=None, footer=None, indent=0):
5353
value.dump(f,
5454
header="%s%s (%s object):" % (pad, attr, value.__class__.__name__),
5555
indent=indent+4)
56-
elif attr not in self._repr_these and (
57-
isinstance(value, list_type) or isinstance(value, dict_type)
58-
):
56+
elif (attr not in self._repr_these and
57+
(isinstance(value, list_type) or isinstance(value, dict_type))):
5958
print("%s%s: %s, len = %d" % (pad, attr, type(value), len(value)), file=f)
6059
else:
6160
fprintf(f, "%s%s: %r\n", pad, attr, value)
@@ -86,7 +85,7 @@ def dump(self, f=None, header=None, footer=None, indent=0):
8685
70: "7",
8786
80: "8",
8887
85: "8X",
89-
}
88+
}
9089

9190
#: This dictionary can be used to produce a text version of the internal codes
9291
#: that Excel uses for error cells.
@@ -229,7 +228,7 @@ def dump(self, f=None, header=None, footer=None, indent=0):
229228
XL_NUMBER,
230229
XL_RK,
231230
XL_RSTRING,
232-
]
231+
]
233232
_cell_opcode_dict = {}
234233
for _cell_opcode in _cell_opcode_list:
235234
_cell_opcode_dict[_cell_opcode] = 1
@@ -630,7 +629,7 @@ def biff_count_records(mem, stream_offset, stream_len, fout=sys.stdout):
630629
10081: 'mac_turkish', # guess
631630
32768: 'mac_roman',
632631
32769: 'cp1252',
633-
}
632+
}
634633
# some more guessing, for Indic scripts
635634
# codepage 57000 range:
636635
# 2 Devanagari [0]

xlrd/book.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"Auto_Deactivate": "\x0B",
5353
"Sheet_Title": "\x0C",
5454
"_FilterDatabase": "\x0D",
55-
}
55+
}
5656
builtin_name_from_code = {}
5757
code_from_builtin_name = {}
5858
for _bin, _bic in _code_from_builtin_name.items():
@@ -82,7 +82,7 @@ def open_workbook_xls(filename=None,
8282
formatting_info=formatting_info,
8383
on_demand=on_demand,
8484
ragged_rows=ragged_rows,
85-
)
85+
)
8686
t1 = time.clock()
8787
bk.load_time_stage_1 = t1 - t0
8888
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
@@ -92,7 +92,7 @@ def open_workbook_xls(filename=None,
9292
raise XLRDError(
9393
"BIFF version %s is not supported"
9494
% biff_text_from_num[biff_version]
95-
)
95+
)
9696
bk.biff_version = biff_version
9797
if biff_version <= 40:
9898
# no workbook globals, only 1 worksheet
@@ -762,7 +762,7 @@ def handle_boundsheet(self, data):
762762
1: 'Macro sheet',
763763
2: 'Chart',
764764
6: 'Visual Basic module',
765-
}.get(sheet_type, 'UNKNOWN')
765+
}.get(sheet_type, 'UNKNOWN')
766766

767767
if DEBUG or self.verbosity >= 1:
768768
fprintf(self.logfile,
@@ -873,7 +873,7 @@ def handle_externsheet(self, data):
873873
self.logfile,
874874
"INFO: EXTERNSHEET needs %d bytes, have %d\n",
875875
bytes_reqd, len(data),
876-
)
876+
)
877877
code2, length2, data2 = self.get_record_parts()
878878
if code2 != XL_CONTINUE:
879879
raise XLRDError("Missing CONTINUE after EXTERNSHEET record")
@@ -889,7 +889,7 @@ def handle_externsheet(self, data):
889889
self.logfile,
890890
"EXTERNSHEET(b8): k = %2d, record = %2d, first_sheet = %5d, last sheet = %5d\n",
891891
k, ref_recordx, ref_first_sheetx, ref_last_sheetx,
892-
)
892+
)
893893
else:
894894
nc, ty = unpack("<BB", data[:2])
895895
if blah2:
@@ -900,7 +900,7 @@ def handle_externsheet(self, data):
900900
2: "Current sheet!!",
901901
3: "Specific sheet in own doc't",
902902
4: "Nonspecific sheet in own doc't!!",
903-
}.get(ty, "Not encoded")
903+
}.get(ty, "Not encoded")
904904
print(" %3d chars, type is %d (%s)" % (nc, ty, msg), file=self.logfile)
905905
if ty == 3:
906906
sheet_name = unicode(data[2:nc+2], self.encoding)
@@ -951,7 +951,7 @@ def handle_name(self, data):
951951
nobj.name_index = name_index
952952
self.name_obj_list.append(nobj)
953953
nobj.option_flags = option_flags
954-
for attr, mask, nshift in (
954+
attrs = [
955955
('hidden', 1, 0),
956956
('func', 2, 1),
957957
('vbasic', 4, 2),
@@ -960,7 +960,8 @@ def handle_name(self, data):
960960
('builtin', 0x20, 5),
961961
('funcgroup', 0xFC0, 6),
962962
('binary', 0x1000, 12),
963-
):
963+
]
964+
for attr, mask, nshift in attrs:
964965
setattr(nobj, attr, (option_flags & mask) >> nshift)
965966

966967
macro_flag = " M"[nobj.macro]
@@ -990,7 +991,7 @@ def handle_name(self, data):
990991
self.logfile,
991992
header="--- handle_name: name[%d] ---" % name_index,
992993
footer="-------------------",
993-
)
994+
)
994995

995996
def names_epilogue(self):
996997
blah = self.verbosity >= 2
@@ -1111,10 +1112,11 @@ def handle_supbook(self, data):
11111112
# #### FIX ME ####
11121113
# Should implement handling of CONTINUE record(s) ...
11131114
if self.verbosity:
1114-
print((
1115+
print(
11151116
"*** WARNING: unpack failure in sheet %d of %d in SUPBOOK record for file %r"
1116-
% (x, num_sheets, url)
1117-
), file=self.logfile)
1117+
% (x, num_sheets, url),
1118+
file=self.logfile,
1119+
)
11181120
break
11191121
sheet_names.append(shname)
11201122
if blah: fprintf(self.logfile, " sheetx=%d namelen=%d name=%r (next pos=%d)\n", x, len(shname), shname, pos)
@@ -1307,7 +1309,7 @@ def bof_error(msg):
13071309
0x0200: 21,
13081310
0x0300: 30,
13091311
0x0400: 40,
1310-
}.get(version2, 0)
1312+
}.get(version2, 0)
13111313
elif version1 in (0x04, 0x02, 0x00):
13121314
version = {0x04: 40, 0x02: 30, 0x00: 21}[version1]
13131315

@@ -1328,7 +1330,7 @@ def bof_error(msg):
13281330
bof_error(
13291331
'BOF not workbook/worksheet: op=0x%04x vers=0x%04x strm=0x%04x build=%d year=%d -> BIFF%d'
13301332
% (opcode, version2, streamtype, build, year, version)
1331-
)
1333+
)
13321334

13331335
# === helper functions
13341336

xlrd/compdoc.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def dump(self, DEBUG=1):
5656
"DID=%d name=%r etype=%d DIDs(left=%d right=%d root=%d parent=%d kids=%r) first_SID=%d tot_size=%d\n",
5757
self.DID, self.name, self.etype, self.left_DID,
5858
self.right_DID, self.root_DID, self.parent, self.children, self.first_SID, self.tot_size
59-
)
59+
)
6060
if DEBUG == 2:
6161
# cre_lo, cre_hi, mod_lo, mod_hi = tsinfo
6262
print("timestamp info", self.tsinfo, file=self.logfile)
@@ -300,7 +300,7 @@ def _get_stream(self, mem, base, sat, sec_size, start_sid, size=None, name='', s
300300
raise CompDocError(
301301
"OLE2 stream %r: sector allocation table invalid entry (%d)" %
302302
(name, s)
303-
)
303+
)
304304
assert s == EOCSID
305305
else:
306306
todo = size
@@ -321,7 +321,7 @@ def _get_stream(self, mem, base, sat, sec_size, start_sid, size=None, name='', s
321321
raise CompDocError(
322322
"OLE2 stream %r: sector allocation table invalid entry (%d)" %
323323
(name, s)
324-
)
324+
)
325325
assert s == EOCSID
326326
if todo != 0:
327327
fprintf(self.logfile,
@@ -407,8 +407,8 @@ def locate_named_stream(self, qname):
407407
self.SSCS, 0, self.SSAT, self.short_sec_size, d.first_SID,
408408
d.tot_size, qname + " (from SSCS)", None),
409409
0,
410-
d.tot_size
411-
)
410+
d.tot_size,
411+
)
412412

413413
def _locate_stream(self, mem, base, sat, sec_size, start_sid, expected_stream_size, qname, seen_id):
414414
# print >> self.logfile, "_locate_stream", base, sec_size, start_sid, expected_stream_size
@@ -428,10 +428,11 @@ def _locate_stream(self, mem, base, sat, sec_size, start_sid, expected_stream_si
428428
self.seen[s] = seen_id
429429
tot_found += 1
430430
if tot_found > found_limit:
431+
# Note: expected size rounded up to higher sector
431432
raise CompDocError(
432433
"%s: size exceeds expected %d bytes; corrupt?"
433434
% (qname, found_limit * sec_size)
434-
) # Note: expected size rounded up to higher sector
435+
)
435436
if s == p+1:
436437
# contiguous sectors
437438
end_pos += sec_size

0 commit comments

Comments
 (0)