Skip to content

Commit

Permalink
fix: undo last minute edit and try to get make checkin clean.
Browse files Browse the repository at this point in the history
Fixed admin.py.

Change # noqa: 821 to # noqa: F821 to make ruff ignore undefined
variable in the python 2 branch of the code. Hopefully the flake8
run in CI will accept the change from 821 to F821 and not error with
an undefined variable.
  • Loading branch information
rouilj committed Mar 1, 2024
1 parent 6d5c217 commit ad80273
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion roundup/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,12 +877,13 @@ def do_get(self, args):

# get the class
cl = self.get_class(classname)
prop_obj = properties[propname]
try:
if not (self.separator or self.print_designator):
print(cl.get(nodeid, propname))
continue

properties = cl.getprops()
prop_obj = properties[propname]
if not (isinstance(prop_obj,
(hyperdb.Link, hyperdb.Multilink))):
raise UsageError(_(
Expand Down
14 changes: 7 additions & 7 deletions roundup/anypy/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def s2u(s, errors='strict'):
if _py3:
return s
else:
return unicode(s, 'utf-8', errors) # noqa: 821
return unicode(s, 'utf-8', errors) # noqa: F821


def u2s(u):
Expand All @@ -64,18 +64,18 @@ def us2u(s, errors='strict'):
if _py3:
return s
else:
if isinstance(s, unicode): # noqa: 821
if isinstance(s, unicode): # noqa: F821
return s
else:
return unicode(s, 'utf-8', errors) # noqa: 821
return unicode(s, 'utf-8', errors) # noqa: F821


def us2s(u):
"""Convert a string or Unicode string to the internal string format."""
if _py3:
return u
else:
if isinstance(u, unicode): # noqa: 821
if isinstance(u, unicode): # noqa: F821
return u.encode('utf-8')
else:
return u
Expand All @@ -88,7 +88,7 @@ def uany2s(u):
if _py3:
return str(u)
else:
if isinstance(u, unicode): # noqa: 821
if isinstance(u, unicode): # noqa: F821
return u.encode('utf-8')
else:
return str(u)
Expand All @@ -99,15 +99,15 @@ def is_us(s):
if _py3:
return isinstance(s, str)
else:
return isinstance(s, str) or isinstance(s, unicode) # noqa: 821
return isinstance(s, str) or isinstance(s, unicode) # noqa: F821


def uchr(c):
"""Return the Unicode string containing the given character."""
if _py3:
return chr(c)
else:
return unichr(c) # noqa: 821
return unichr(c) # noqa: F821

# CSV files used for export and import represent strings in the style
# used by repr in Python 2; this means that each byte of the UTF-8
Expand Down

0 comments on commit ad80273

Please sign in to comment.