Skip to content

Commit 921f581

Browse files
committed
flake8 E228 missing whitespace around modulo operator
plus some indenting fixes to realign lines.
1 parent 3eb29c3 commit 921f581

File tree

1 file changed

+55
-53
lines changed

1 file changed

+55
-53
lines changed

roundup/cgi/templating.py

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,9 +2342,9 @@ def popcal(self, width=300, height=200, label="(cal)",
23422342

23432343
return ('<a class="classhelp" %s href="javascript:help_window('
23442344
"'%s?@template=calendar&amp;property=%s&amp;form=%s%s', %d, %d)"
2345-
'">%s</a>'%(self.cgi_escape_attrs(**data_attr),
2346-
self._classname, self._name, form, date, width,
2347-
height, label))
2345+
'">%s</a>' % (self.cgi_escape_attrs(**data_attr),
2346+
self._classname, self._name, form, date, width,
2347+
height, label))
23482348

23492349

23502350
class IntervalHTMLProperty(HTMLProperty):
@@ -2415,7 +2415,7 @@ def nothing(*args, **kw):
24152415
return ''
24162416
return nothing
24172417
msg = self._('Attempt to look up %(attr)s on a missing value')
2418-
return MissingValue(msg%locals())
2418+
return MissingValue(msg % locals())
24192419
i = HTMLItem(self._client, self._prop.classname, self._value)
24202420
return getattr(i, attr)
24212421

@@ -2426,7 +2426,7 @@ def __getitem__(self, item):
24262426
"""
24272427
if not self._value:
24282428
msg = self._('Attempt to look up %(item)s on a missing value')
2429-
return MissingValue(msg%locals())
2429+
return MissingValue(msg % locals())
24302430
i = HTMLItem(self._client, self._prop.classname, self._value)
24312431
return i[item]
24322432

@@ -2523,13 +2523,13 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
25232523
value = None
25242524

25252525
linkcl = self._db.getclass(self._prop.classname)
2526-
l = ['<select %s>'%self.cgi_escape_attrs(name=self._formname,
2526+
l = ['<select %s>' % self.cgi_escape_attrs(name=self._formname,
25272527
**html_kwargs)]
25282528
k = linkcl.labelprop(1)
25292529
s = ''
25302530
if value is None:
25312531
s = 'selected="selected" '
2532-
l.append(self._('<option %svalue="-1">- no selection -</option>')%s)
2532+
l.append(self._('<option %svalue="-1">- no selection -</option>') % s)
25332533

25342534
if sort_on is not None:
25352535
if not isinstance(sort_on, tuple):
@@ -2588,9 +2588,9 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
25882588

25892589
# figure the label
25902590
if showid:
2591-
lab = '%s%s: %s'%(self._prop.classname, optionid, option)
2591+
lab = '%s%s: %s' % (self._prop.classname, optionid, option)
25922592
elif not option:
2593-
lab = '%s%s'%(self._prop.classname, optionid)
2593+
lab = '%s%s' % (self._prop.classname, optionid)
25942594
else:
25952595
lab = option
25962596

@@ -2602,14 +2602,14 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
26022602
m = []
26032603
for fn in additional_fns:
26042604
m.append(str(fn(optionid)))
2605-
lab = lab + ' (%s)'%', '.join(m)
2605+
lab = lab + ' (%s)' % ', '.join(m)
26062606

26072607
# and generate
26082608
tr = str
26092609
if translate:
26102610
tr = self._
26112611
lab = html_escape(tr(lab))
2612-
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
2612+
l.append('<option %svalue="%s">%s</option>' % (s, optionid, lab))
26132613
l.append('</select>')
26142614
return '\n'.join(l)
26152615

@@ -2746,7 +2746,7 @@ def plain(self, escape=0):
27462746
except IndexError:
27472747
label = None
27482748
# fall back to designator if label is None
2749-
if label is None: label = '%s%s'%(self._prop.classname, k)
2749+
if label is None: label = '%s%s' % (self._prop.classname, k)
27502750
else:
27512751
label = v
27522752
labels.append(label)
@@ -2837,9 +2837,8 @@ def menu(self, size=None, height=None, showid=0, additional=[],
28372837
# The "no selection" option.
28382838
height += 1
28392839
height = min(height, 7)
2840-
l = ['<select multiple %s>'%self.cgi_escape_attrs(name=self._formname,
2841-
size=height,
2842-
**html_kwargs)]
2840+
l = ['<select multiple %s>' % self.cgi_escape_attrs(
2841+
name=self._formname, size=height, **html_kwargs)]
28432842
k = linkcl.labelprop(1)
28442843

28452844
if value: # FIXME '- no selection -' mark for translation
@@ -2873,7 +2872,7 @@ def menu(self, size=None, height=None, showid=0, additional=[],
28732872

28742873
# figure the label
28752874
if showid:
2876-
lab = '%s%s: %s'%(self._prop.classname, optionid, option)
2875+
lab = '%s%s: %s' % (self._prop.classname, optionid, option)
28772876
else:
28782877
lab = option
28792878
# truncate if it's too long
@@ -2883,15 +2882,15 @@ def menu(self, size=None, height=None, showid=0, additional=[],
28832882
m = []
28842883
for fn in additional_fns:
28852884
m.append(str(fn(optionid)))
2886-
lab = lab + ' (%s)'%', '.join(m)
2885+
lab = lab + ' (%s)' % ', '.join(m)
28872886

28882887
# and generate
28892888
tr = str
28902889
if translate:
28912890
tr = self._
28922891
lab = html_escape(tr(lab))
2893-
l.append('<option %svalue="%s">%s</option>'%(s, optionid,
2894-
lab))
2892+
l.append('<option %svalue="%s">%s</option>' % (s, optionid,
2893+
lab))
28952894
l.append('</select>')
28962895
return '\n'.join(l)
28972896

@@ -2975,7 +2974,7 @@ class HTMLRequest(HTMLInputMixin):
29752974
- "search_text" text to perform a full-text search on for an index
29762975
"""
29772976
def __repr__(self):
2978-
return '<HTMLRequest %r>'%self.__dict__
2977+
return '<HTMLRequest %r>' % self.__dict__
29792978

29802979
def __init__(self, client):
29812980
# _client is needed by HTMLInputMixin
@@ -3018,17 +3017,17 @@ def _parse_sort(self, var, name):
30183017
dirs = []
30193018
for special in '@:':
30203019
idx = 0
3021-
key = '%s%s%d'%(special, name, idx)
3020+
key = '%s%s%d' % (special, name, idx)
30223021
while self._form_has_key(key):
30233022
self.special_char = special
30243023
fields.append(self.form.getfirst(key))
3025-
dirkey = '%s%sdir%d'%(special, name, idx)
3024+
dirkey = '%s%sdir%d' % (special, name, idx)
30263025
if dirkey in self.form:
30273026
dirs.append(self.form.getfirst(dirkey))
30283027
else:
30293028
dirs.append(None)
30303029
idx += 1
3031-
key = '%s%s%d'%(special, name, idx)
3030+
key = '%s%s%d' % (special, name, idx)
30323031
# backward compatible (and query) URL format
30333032
key = special + name
30343033
dirkey = key + 'dir'
@@ -3054,7 +3053,8 @@ def _parse_sort(self, var, name):
30543053
# if no classname, just append the propname unchecked.
30553054
# this may be valid for some actions that bypass classes.
30563055
if self.classname and cls.get_transitive_prop(propname) is None:
3057-
self.client.add_error_message("Unknown %s property %s"%(name, propname))
3056+
self.client.add_error_message("Unknown %s property %s" % (
3057+
name, propname))
30583058
else:
30593059
var.append((dir, propname))
30603060

@@ -3175,14 +3175,14 @@ def description(self):
31753175
s = [self.client.db.config.TRACKER_NAME]
31763176
if self.classname:
31773177
if self.client.nodeid:
3178-
s.append('- %s%s'%(self.classname, self.client.nodeid))
3178+
s.append('- %s%s' % (self.classname, self.client.nodeid))
31793179
else:
31803180
if self.template == 'item':
3181-
s.append('- new %s'%self.classname)
3181+
s.append('- new %s' % self.classname)
31823182
elif self.template == 'index':
3183-
s.append('- %s index'%self.classname)
3183+
s.append('- %s index' % self.classname)
31843184
else:
3185-
s.append('- %s %s'%(self.classname, self.template))
3185+
s.append('- %s %s' % (self.classname, self.template))
31863186
else:
31873187
s.append('- home')
31883188
return ' '.join(s)
@@ -3192,11 +3192,11 @@ def __str__(self):
31923192
d.update(self.__dict__)
31933193
f = ''
31943194
for k in self.form.keys():
3195-
f += '\n %r=%r'%(k, handleListCGIValue(self.form[k]))
3195+
f += '\n %r=%r' % (k, handleListCGIValue(self.form[k]))
31963196
d['form'] = f
31973197
e = ''
31983198
for k, v in self.env.items():
3199-
e += '\n %r=%r'%(k, v)
3199+
e += '\n %r=%r' % (k, v)
32003200
d['env'] = e
32013201
return """
32023202
form: %(form)s
@@ -3211,7 +3211,7 @@ def __str__(self):
32113211
pagesize: %(pagesize)r
32123212
startwith: %(startwith)r
32133213
env: %(env)s
3214-
"""%d
3214+
""" % d
32153215

32163216
def indexargs_form(self, columns=1, sort=1, group=1, filter=1,
32173217
filterspec=1, search_text=1, exclude=[]):
@@ -3284,7 +3284,7 @@ def indexargs_url(self, url, args):
32843284
"""
32853285
q = urllib_.quote
32863286
sc = self.special_char
3287-
l = ['%s=%s'%(k, is_us(v) and q(v) or v)
3287+
l = ['%s=%s' % (k, is_us(v) and q(v) or v)
32883288
for k, v in args.items() if v is not None]
32893289
# pull out the special values (prefixed by @ or :)
32903290
specials = {}
@@ -3294,31 +3294,31 @@ def indexargs_url(self, url, args):
32943294

32953295
# ok, now handle the specials we received in the request
32963296
if self.columns and 'columns' not in specials:
3297-
l.append(sc+'columns=%s'%(','.join(self.columns)))
3297+
l.append(sc+'columns=%s' % (','.join(self.columns)))
32983298
if self.sort and 'sort' not in specials:
32993299
val = []
33003300
for dir, attr in self.sort:
33013301
if dir == '-':
33023302
val.append('-'+attr)
33033303
else:
33043304
val.append(attr)
3305-
l.append(sc+'sort=%s'%(','.join(val)))
3305+
l.append(sc+'sort=%s' % (','.join(val)))
33063306
if self.group and 'group' not in specials:
33073307
val = []
33083308
for dir, attr in self.group:
33093309
if dir == '-':
33103310
val.append('-'+attr)
33113311
else:
33123312
val.append(attr)
3313-
l.append(sc+'group=%s'%(','.join(val)))
3313+
l.append(sc+'group=%s' % (','.join(val)))
33143314
if self.filter and 'filter' not in specials:
3315-
l.append(sc+'filter=%s'%(','.join(self.filter)))
3315+
l.append(sc+'filter=%s' % (','.join(self.filter)))
33163316
if self.search_text and 'search_text' not in specials:
3317-
l.append(sc+'search_text=%s'%q(self.search_text))
3317+
l.append(sc+'search_text=%s' % q(self.search_text))
33183318
if 'pagesize' not in specials:
3319-
l.append(sc+'pagesize=%s'%self.pagesize)
3319+
l.append(sc+'pagesize=%s' % self.pagesize)
33203320
if 'startwith' not in specials:
3321-
l.append(sc+'startwith=%s'%self.startwith)
3321+
l.append(sc+'startwith=%s' % self.startwith)
33223322

33233323
# finally, the remainder of the filter args in the request
33243324
if self.classname and self.filterspec:
@@ -3328,12 +3328,14 @@ def indexargs_url(self, url, args):
33283328
if isinstance(v, list):
33293329
prop = cls.get_transitive_prop(k)
33303330
if k != 'id' and isinstance(prop, hyperdb.String):
3331-
l.append('%s=%s'%(k, '%20'.join([q(i) for i in v])))
3331+
l.append('%s=%s' % (
3332+
k, '%20'.join([q(i) for i in v])))
33323333
else:
3333-
l.append('%s=%s'%(k, ','.join([q(i) for i in v])))
3334+
l.append('%s=%s' % (
3335+
k, ','.join([q(i) for i in v])))
33343336
else:
3335-
l.append('%s=%s'%(k, q(v)))
3336-
return '%s?%s'%(url, '&'.join(l))
3337+
l.append('%s=%s' % (k, q(v)))
3338+
return '%s?%s' % (url, '&'.join(l))
33373339
indexargs_href = indexargs_url
33383340

33393341
def base_javascript(self):
@@ -3354,7 +3356,7 @@ def base_javascript(self):
33543356
HelpWin.focus ()
33553357
}
33563358
</script>
3357-
"""%(self._client.client_nonce, self.base)
3359+
""" % (self._client.client_nonce, self.base)
33583360

33593361
def batch(self, permission='View'):
33603362
""" Return a batch object for results from the "current search"
@@ -3592,13 +3594,13 @@ def html_calendar(self, request):
35923594
# month
35933595
res.append('<table class="calendar"><tr><td>')
35943596
res.append(' <table width="100%" class="calendar_nav"><tr>')
3595-
link = "&display=%s"%date_prev_month
3597+
link = "&display=%s" % date_prev_month
35963598
if date_prev_month:
35973599
res.append(' <td><a href="%s&display=%s">&lt;</a></td>'
35983600
% (base_link, date_prev_month))
35993601
else:
36003602
res.append(' <td></td>')
3601-
res.append(' <td>%s</td>'%calendar.month_name[display.month])
3603+
res.append(' <td>%s</td>' % calendar.month_name[display.month])
36023604
if date_next_month:
36033605
res.append(' <td><a href="%s&display=%s">&gt;</a></td>'
36043606
% (base_link, date_next_month))
@@ -3612,7 +3614,7 @@ def html_calendar(self, request):
36123614
% (base_link, date_prev_year))
36133615
else:
36143616
res.append(' <td></td>')
3615-
res.append(' <td>%s</td>'%display.year)
3617+
res.append(' <td>%s</td>' % display.year)
36163618
if date_next_year:
36173619
res.append(' <td><a href="%s&display=%s">&gt;</a></td>'
36183620
% (base_link, date_next_year))
@@ -3625,22 +3627,22 @@ def html_calendar(self, request):
36253627
res.append(' <tr><td><table class="calendar_display">')
36263628
res.append(' <tr class="weekdays">')
36273629
for day in calendar.weekheader(3).split():
3628-
res.append(' <td>%s</td>'%day)
3630+
res.append(' <td>%s</td>' % day)
36293631
res.append(' </tr>')
36303632
for week in calendar.monthcalendar(display.year, display.month):
36313633
res.append(' <tr>')
36323634
for day in week:
36333635
link = "javascript:form[field].value = '%d-%02d-%02d'; " \
36343636
"if ('createEvent' in document) { var evt = document.createEvent('HTMLEvents'); evt.initEvent('change', true, true); form[field].dispatchEvent(evt); } else { form[field].fireEvent('onchange'); }" \
3635-
"window.close ();"%(display.year, display.month, day)
3637+
"window.close ();" % (display.year, display.month, day)
36363638
if (day == curr_date.day and display.month == curr_date.month
36373639
and display.year == curr_date.year):
36383640
# highlight
36393641
style = "today"
36403642
else:
36413643
style = ""
36423644
if day:
3643-
res.append(' <td class="%s"><a href="%s">%s</a></td>'%(
3645+
res.append(' <td class="%s"><a href="%s">%s</a></td>' % (
36443646
style, link, day))
36453647
else:
36463648
res.append(' <td></td>')
@@ -3674,9 +3676,9 @@ def __bool__(self): return False
36743676
def __contains__(self, key): return False
36753677
def __eq__(self, rhs): return False
36763678
def __ne__(self, rhs): return False
3677-
def __str__(self): return '[%s]'%self.__description
3678-
def __repr__(self): return '<MissingValue 0x%x "%s">'%(id(self),
3679-
self.__description)
3679+
def __str__(self): return '[%s]' % self.__description
3680+
def __repr__(self): return '<MissingValue 0x%x "%s">' % (
3681+
id(self), self.__description)
36803682

36813683
def gettext(self, str): return str
36823684
_ = gettext

0 commit comments

Comments
 (0)