Skip to content

Commit

Permalink
Merge pull request #2054 from cclauss/patch-1
Browse files Browse the repository at this point in the history
Use ==/!= to compare str, bytes, and int literals
  • Loading branch information
jneves committed Mar 1, 2020
2 parents a07524d + 185c431 commit 23cede8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
- TESTCASE=tests/tests.py
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script:
Expand Down
8 changes: 4 additions & 4 deletions zappa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ def colorize_invoke_command(self, string):
# UUIDs
for token in final_string.replace('\t', ' ').split(' '):
try:
if token.count('-') is 4 and token.replace('-', '').isalnum():
if token.count('-') == 4 and token.replace('-', '').isalnum():
final_string = final_string.replace(
token,
click.style(token, fg='magenta')
Expand Down Expand Up @@ -2517,7 +2517,7 @@ def is_http_log_entry(self, string):
# IP address filter
for token in string.replace('\t', ' ').split(' '):
try:
if (token.count('.') is 3 and token.replace('.', '').isnumeric()):
if (token.count('.') == 3 and token.replace('.', '').isnumeric()):
return True
except Exception: # pragma: no cover
pass
Expand Down Expand Up @@ -2552,14 +2552,14 @@ def colorize_log_entry(self, string):
# And UUIDs
for token in final_string.replace('\t', ' ').split(' '):
try:
if token.count('-') is 4 and token.replace('-', '').isalnum():
if token.count('-') == 4 and token.replace('-', '').isalnum():
final_string = final_string.replace(token, click.style(token, fg="magenta"))
except Exception: # pragma: no cover
pass

# And IP addresses
try:
if token.count('.') is 3 and token.replace('.', '').isnumeric():
if token.count('.') == 3 and token.replace('.', '').isnumeric():
final_string = final_string.replace(token, click.style(token, fg="red"))
except Exception: # pragma: no cover
pass
Expand Down

0 comments on commit 23cede8

Please sign in to comment.