Skip to content

Commit 5ef9ae4

Browse files
committed
chore(lint): formatting whitespace consolidate nested if ...
1 parent 3fae549 commit 5ef9ae4

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

roundup/admin.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def help_commands(self):
230230
commands = ['']
231231
for command in self.commands.values():
232232
h = _(command.__doc__).split('\n')[0]
233-
commands.append(' '+h[7:])
233+
commands.append(' ' + h[7:])
234234
commands.sort()
235235
commands.append(_(
236236
"""Commands may be abbreviated as long as the abbreviation
@@ -550,7 +550,7 @@ def do_display(self, args):
550550
raise UsageError(_('Not enough arguments supplied'))
551551

552552
display_protected = self.settings['display_protected']
553-
display_header = self.settings['display_header']
553+
display_header = self.settings['display_header']
554554

555555
# decode the node designator
556556
for designator in args[0].split(','):
@@ -627,7 +627,7 @@ class colon_separated(csv.excel):
627627
sys.stdout.write('Exporting %s WITHOUT the files\r\n' %
628628
classname)
629629

630-
with open(os.path.join(export_dir, classname+'.csv'), 'w') as f:
630+
with open(os.path.join(export_dir, classname + '.csv'), 'w') as f:
631631
writer = csv.writer(f, colon_separated)
632632

633633
propnames = cl.export_propnames()
@@ -676,7 +676,8 @@ class colon_separated(csv.excel):
676676
cl.export_files(export_dir, nodeid)
677677

678678
# export the journals
679-
with open(os.path.join(export_dir, classname+'-journals.csv'), 'w') as jf:
679+
with open(os.path.join(export_dir,
680+
classname + '-journals.csv'), 'w') as jf:
680681
if self.verbose:
681682
sys.stdout.write("\nExporting Journal for %s\n" %
682683
classname)
@@ -766,7 +767,7 @@ def do_filter(self, args):
766767
try:
767768
output_items = cl.filter(None, **props)
768769
if self.print_designator:
769-
output_items = [ classname + i for i in output_items ]
770+
output_items = [classname + i for i in output_items]
770771

771772
if self.separator:
772773
print(self.separator.join(output_items))
@@ -815,7 +816,7 @@ def do_find(self, args):
815816
try:
816817
output_items = cl.find(**props)
817818
if self.print_designator:
818-
output_items = [ classname + i for i in output_items ]
819+
output_items = [classname + i for i in output_items]
819820

820821
if self.separator:
821822
print(self.separator.join(output_items))
@@ -995,6 +996,7 @@ def do_history(self, args):
995996
raw = 'raw' in args[1:]
996997

997998
getclass = self.db.getclass
999+
9981000
def get_prop_name(key, prop_name):
9991001
# getclass and classname from enclosing method
10001002
klass = getclass(classname)
@@ -1064,7 +1066,7 @@ def format_report_class(_data):
10641066
"""Eat the empty data dictionary or None"""
10651067
return classname
10661068

1067-
def format_link (data):
1069+
def format_link(data):
10681070
'''data = ('issue', '157', 'dependson')'''
10691071
# .Hint added issue23 to superseder
10701072
f = _("added %(class)s%(item_id)s to %(propname)s")
@@ -1089,7 +1091,7 @@ def format_set(data):
10891091
# where assignedto is the property
10901092
# admin is the key name for value 1
10911093
_("%(prop)s was %(name)s(%(value)s)") % {
1092-
"prop": prop, "name": name, "value": value })
1094+
"prop": prop, "name": name, "value": value})
10931095
else:
10941096
# use repr so strings with embedded \n etc. don't
10951097
# generate newlines in output. Try to keep each
@@ -1108,8 +1110,8 @@ def format_set(data):
11081110
else:
11091111
prop_class = get_prop_class(prop)
11101112
if prop_class: # noqa: SIM108
1111-
list_items = [ "%s%s" % (prop_class, v)
1112-
for v in value ]
1113+
list_items = ["%s%s" % (prop_class, v)
1114+
for v in value]
11131115
else:
11141116
list_items = value
11151117

@@ -1128,7 +1130,7 @@ def format_set(data):
11281130

11291131
return '; '.join(result)
11301132

1131-
def format_unlink (data):
1133+
def format_unlink(data):
11321134
'''data = ('issue', '157', 'dependson')'''
11331135
return "removed %s%s from %s" % (data[0], data[1], data[2])
11341136

@@ -1252,10 +1254,10 @@ class colon_separated(csv.excel):
12521254
cl.import_journals(reader)
12531255

12541256
# (print to sys.stdout here to allow tests to squash it .. ugh)
1255-
print('setting', classname, maxid+1, file=sys.stdout)
1257+
print('setting', classname, maxid + 1, file=sys.stdout)
12561258

12571259
# set the id counter
1258-
self.db.setid(classname, str(maxid+1))
1260+
self.db.setid(classname, str(maxid + 1))
12591261

12601262
self.db_uncommitted = True
12611263
return 0
@@ -1487,7 +1489,7 @@ def do_list(self, args):
14871489
# create a list of propnames since user specified propname
14881490
proplist = []
14891491
try:
1490-
proplist = [ cl.get(nodeid, propname) for nodeid in
1492+
proplist = [cl.get(nodeid, propname) for nodeid in
14911493
cl.getnodeids(retired=retired)]
14921494
except KeyError:
14931495
raise UsageError(_('%(classname)s has no property '
@@ -1638,15 +1640,15 @@ def do_perftest(self, args):
16381640
return
16391641

16401642
if props['scheme'].startswith('PBKDF2'):
1641-
(rounds, salt, _raw_salt, digest) = password.pbkdf2_unpack(
1643+
(rounds, _salt, _raw_salt, _digest) = password.pbkdf2_unpack(
16421644
pw_hash)
16431645
else:
16441646
rounds = _("scheme does not support rounds.")
16451647

16461648
print(_(
16471649
"Hash time: %(time)0.9f seconds, scheme: %(scheme)s, "
16481650
"rounds: %(rounds)s") %
1649-
{"time": toc-tic, "scheme": props['scheme'],
1651+
{"time": toc - tic, "scheme": props['scheme'],
16501652
"rounds": rounds})
16511653

16521654
def do_pragma(self, args):
@@ -2348,8 +2350,7 @@ def interactive(self):
23482350
self.db.commit()
23492351

23502352
# looks like histfile is saved with mode 600
2351-
if readline:
2352-
if self.history_features('save_history'):
2353+
if readline and self.history_features('save_history'):
23532354
readline.write_history_file(histfile)
23542355
return 0
23552356

@@ -2405,7 +2406,7 @@ def main(self): # noqa: PLR0912, PLR0911
24052406
try:
24062407
self.do_pragma([arg])
24072408
except UsageError as e:
2408-
print('\n%s\n' % e)
2409+
print('\n%s\n' % e)
24092410
elif opt == '-u':
24102411
login_opt = arg.split(':')
24112412
self.name = login_opt[0]

0 commit comments

Comments
 (0)