Skip to content

Commit c88aee1

Browse files
committed
Fix pylint issues
1 parent dc443d7 commit c88aee1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

minfraud/validation.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
# objects below. Given the consistent use of them, the current names seem
2222
# preferable to blindly following pylint.
2323
#
24-
# pylint: disable=invalid-name,redefined-variable-type,undefined-variable
24+
# pylint: disable=invalid-name,undefined-variable
2525

2626
if sys.version_info[0] >= 3:
27+
_unicode = str
2728
_unicode_or_printable_ascii = str
2829
else:
30+
_unicode = unicode
2931
_unicode_or_printable_ascii = Any(unicode, Match(r'^[\x20-\x7E]*$'))
30-
# pylint: enable=redefined-variable-type
3132

3233
_any_string = Any(_unicode_or_printable_ascii, str)
3334

@@ -43,12 +44,8 @@
4344

4445

4546
def _ip_address(s):
46-
# ipaddress accepts numeric IPs, which we don't want. Pylint on Python 3
47-
# doesn't like "unicode"
48-
#
49-
# pylint: disable=undefined-variable
50-
if (isinstance(s, str) or isinstance(s, unicode)) \
51-
and not re.match(r'^\d+$', s):
47+
# ipaddress accepts numeric IPs, which we don't want.
48+
if isinstance(s, (str, _unicode)) and not re.match(r'^\d+$', s):
5249
return str(compat_ip_address(s))
5350
raise ValueError
5451

minfraud/webservice.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def _copy_and_clean(self, data):
141141
if v is not None)
142142
elif isinstance(data, (list, set, tuple)):
143143
return [self._copy_and_clean(x) for x in data if x is not None]
144-
else:
145-
return data
144+
return data
146145

147146
def _user_agent(self):
148147
"""Create User-Agent header."""

0 commit comments

Comments
 (0)