lint: Clean up E712 PEP-8 rule.

This commit is contained in:
Tim Abbott 2017-01-23 21:11:18 -08:00
parent e385b93448
commit 9640a9e864
5 changed files with 16 additions and 16 deletions

View File

@ -121,7 +121,7 @@ class Command(BaseCommand):
print("%d messages sent via the API" % (self.api_messages(realm, days_ago),)) print("%d messages sent via the API" % (self.api_messages(realm, days_ago),))
print("%d group private messages" % (self.group_private_messages(realm, days_ago),)) print("%d group private messages" % (self.group_private_messages(realm, days_ago),))
num_notifications_enabled = len([x for x in active_users if x.enable_desktop_notifications == True]) num_notifications_enabled = len([x for x in active_users if x.enable_desktop_notifications])
self.report_percentage(num_notifications_enabled, num_active, self.report_percentage(num_notifications_enabled, num_active,
"active users have desktop notifications enabled") "active users have desktop notifications enabled")

View File

@ -143,7 +143,7 @@ class TicTacToeGame(object):
# The check is done by replacing the blank locations with o's and seeing if the computer would win in each case. # The check is done by replacing the blank locations with o's and seeing if the computer would win in each case.
for row, col in blank_locations: for row, col in blank_locations:
my_board[row][col] = "o" my_board[row][col] = "o"
if self.win_conditions(my_board, self.triplets) == True: if self.win_conditions(my_board, self.triplets):
board[row][col] = "o" board[row][col] = "o"
return board return board
else: else:
@ -171,7 +171,7 @@ class TicTacToeGame(object):
# random blank location from a set of better locations to play. These locations are determined by seeing if # random blank location from a set of better locations to play. These locations are determined by seeing if
# there are two blanks and an 'o' in each row, column, and diagonal (done in two_blanks). # there are two blanks and an 'o' in each row, column, and diagonal (done in two_blanks).
# If smarter is False, all blank locations can be chosen. # If smarter is False, all blank locations can be chosen.
if self.smarter == True: if self.smarter:
blanks = [] blanks = []
for triplet in self.triplets: for triplet in self.triplets:
result = self.two_blanks(triplet, board) result = self.two_blanks(triplet, board)
@ -234,11 +234,11 @@ class TicTacToeGame(object):
return_string += self.display_board(board) return_string += self.display_board(board)
# Check to see if the user won/drew after they made their move. If not, it's the computer's turn. # Check to see if the user won/drew after they made their move. If not, it's the computer's turn.
if self.win_conditions(board, self.triplets) == True: if self.win_conditions(board, self.triplets):
return_string += output_mode("Game over! You've won!", mode) return_string += output_mode("Game over! You've won!", mode)
return return_string return return_string
if self.board_is_full(board) == True: if self.board_is_full(board):
return_string += output_mode("It's a draw! Neither of us was able to win.", mode) return_string += output_mode("It's a draw! Neither of us was able to win.", mode)
return return_string return return_string
@ -248,7 +248,7 @@ class TicTacToeGame(object):
# Checks to see if the computer won after it makes its move. (The computer can't draw, so there's no point # Checks to see if the computer won after it makes its move. (The computer can't draw, so there's no point
# in checking.) If the computer didn't win, the user gets another turn. # in checking.) If the computer didn't win, the user gets another turn.
if self.win_conditions(board, self.triplets) == True: if self.win_conditions(board, self.triplets):
return_string += output_mode("Game over! I've won!", mode) return_string += output_mode("Game over! I've won!", mode)
return return_string return return_string
@ -306,7 +306,7 @@ class ticTacToeHandler(object):
return_content += TicTacToeGame.positions return_content += TicTacToeGame.positions
elif command == 'help': elif command == 'help':
return_content = TicTacToeGame.detailed_help_message return_content = TicTacToeGame.detailed_help_message
elif (user_game) and TicTacToeGame.check_validity(user_game, TicTacToeGame.sanitize_move(user_game, command)) == True: elif (user_game) and TicTacToeGame.check_validity(user_game, TicTacToeGame.sanitize_move(user_game, command)):
user_board = user_game.board user_board = user_game.board
return_content = TicTacToeGame.tictactoe(user_game, user_board, command) return_content = TicTacToeGame.tictactoe(user_game, user_board, command)
elif (user_game) and command == 'quit': elif (user_game) and command == 'quit':

View File

@ -37,14 +37,14 @@ def get_members(client):
assert len(members) == 1 assert len(members) == 1
iago = members[0] iago = members[0]
assert iago['is_admin'] == False assert not iago['is_admin']
assert iago['full_name'] == 'New User' assert iago['full_name'] == 'New User'
def get_profile(client): def get_profile(client):
# type: (Client) -> None # type: (Client) -> None
result = client.get_profile() result = client.get_profile()
assert result['is_admin'] == True assert result['is_admin']
assert result['email'] == 'iago@zulip.com' assert result['email'] == 'iago@zulip.com'
assert result['full_name'] == 'Iago' assert result['full_name'] == 'Iago'

View File

@ -88,7 +88,7 @@ def check_pep8(files):
# actually be cleaned up. # actually be cleaned up.
# #
'E123', 'E126', 'E226', 'E241', 'E261', 'E302', 'E123', 'E126', 'E226', 'E241', 'E261', 'E302',
'E401', 'E501', 'E702', 'E711', 'E712', 'E401', 'E501', 'E702', 'E711',
# #
# Each of these rules are ignored for the explained reason. # Each of these rules are ignored for the explained reason.

View File

@ -389,10 +389,10 @@ def api_dev_fetch_api_key(request, username=REQ()):
user_profile = authenticate(username=username, user_profile = authenticate(username=username,
realm_subdomain=get_subdomain(request), realm_subdomain=get_subdomain(request),
return_data=return_data) return_data=return_data)
if return_data.get("inactive_realm") == True: if return_data.get("inactive_realm"):
return json_error(_("Your realm has been deactivated."), return json_error(_("Your realm has been deactivated."),
data={"reason": "realm deactivated"}, status=403) data={"reason": "realm deactivated"}, status=403)
if return_data.get("inactive_user") == True: if return_data.get("inactive_user"):
return json_error(_("Your account has been disabled."), return json_error(_("Your account has been disabled."),
data={"reason": "user disable"}, status=403) data={"reason": "user disable"}, status=403)
login(request, user_profile) login(request, user_profile)
@ -424,17 +424,17 @@ def api_fetch_api_key(request, username=REQ(), password=REQ()):
password=password, password=password,
realm_subdomain=get_subdomain(request), realm_subdomain=get_subdomain(request),
return_data=return_data) return_data=return_data)
if return_data.get("inactive_user") == True: if return_data.get("inactive_user"):
return json_error(_("Your account has been disabled."), return json_error(_("Your account has been disabled."),
data={"reason": "user disable"}, status=403) data={"reason": "user disable"}, status=403)
if return_data.get("inactive_realm") == True: if return_data.get("inactive_realm"):
return json_error(_("Your realm has been deactivated."), return json_error(_("Your realm has been deactivated."),
data={"reason": "realm deactivated"}, status=403) data={"reason": "realm deactivated"}, status=403)
if return_data.get("password_auth_disabled") == True: if return_data.get("password_auth_disabled"):
return json_error(_("Password auth is disabled in your team."), return json_error(_("Password auth is disabled in your team."),
data={"reason": "password auth disabled"}, status=403) data={"reason": "password auth disabled"}, status=403)
if user_profile is None: if user_profile is None:
if return_data.get("valid_attestation") == True: if return_data.get("valid_attestation"):
# We can leak that the user is unregistered iff they present a valid authentication string for the user. # We can leak that the user is unregistered iff they present a valid authentication string for the user.
return json_error(_("This user is not registered; do so from a browser."), return json_error(_("This user is not registered; do so from a browser."),
data={"reason": "unregistered"}, status=403) data={"reason": "unregistered"}, status=403)