Skip to content

Commit c8c1c2b

Browse files
committed
chore: fix spacing/indent, ignore rule, reduce if/elif with or
1 parent 884f53b commit c8c1c2b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

roundup/anypy/strings.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ def u2s(u):
6262

6363
def us2u(s, errors='strict'):
6464
"""Convert a string or Unicode string to a Unicode string."""
65-
if _py3:
66-
return s
67-
elif isinstance(s, unicode): # noqa: F821
65+
if _py3 or isinstance(s, unicode): # noqa: F821
6866
return s
6967
else:
7068
return unicode(s, 'utf-8', errors) # noqa: F821
@@ -148,7 +146,7 @@ def eval_import(s):
148146
# int ('issue', 5002L, "status") rather than as a
149147
# string. This was a bug that existed and was fixed
150148
# before or with v1.2.0
151-
import re
149+
import re # noqa: PLC0415
152150
v = ast.literal_eval(re.sub(r', ([0-9]+)L,', r', \1,', s))
153151

154152
if isinstance(v, str):
@@ -166,10 +164,9 @@ def eval_import(s):
166164
else:
167165
return v
168166
else:
169-
return ast.literal_eval(s)
167+
return ast.literal_eval(s)
170168

171169
except (ValueError, SyntaxError) as e:
172170
raise ValueError(
173171
("Error %(exception)s trying to parse value '%(value)s'") %
174-
{ 'exception': e, 'value': s})
175-
172+
{'exception': e, 'value': s})

0 commit comments

Comments
 (0)