cleanup: Move line breaks before binary operators.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
6f40bcf745
commit
17cf26aa1f
12 changed files with 152 additions and 77 deletions
|
@ -147,10 +147,14 @@ class BaremetricsHandler:
|
|||
'Amounts:'])
|
||||
response = ['**Listing plans:**']
|
||||
for index, plan in enumerate(plans_data):
|
||||
response += ([template.format(_count=index + 1, **plan)] +
|
||||
[' - {amount} {currency}'.format(**amount)
|
||||
for amount in plan['amounts']] +
|
||||
[''])
|
||||
response += (
|
||||
[template.format(_count=index + 1, **plan)]
|
||||
+ [
|
||||
' - {amount} {currency}'.format(**amount)
|
||||
for amount in plan['amounts']
|
||||
]
|
||||
+ ['']
|
||||
)
|
||||
|
||||
return '\n'.join(response)
|
||||
|
||||
|
@ -171,10 +175,11 @@ class BaremetricsHandler:
|
|||
'Current Plans:'])
|
||||
response = ['**Listing customers:**']
|
||||
for index, customer in enumerate(customers_data):
|
||||
response += ([template.format(_count=index + 1, **customer)] +
|
||||
[' - {name}'.format(**plan)
|
||||
for plan in customer['current_plans']] +
|
||||
[''])
|
||||
response += (
|
||||
[template.format(_count=index + 1, **customer)]
|
||||
+ [' - {name}'.format(**plan) for plan in customer['current_plans']]
|
||||
+ ['']
|
||||
)
|
||||
|
||||
return '\n'.join(response)
|
||||
|
||||
|
@ -194,13 +199,21 @@ class BaremetricsHandler:
|
|||
'Plan Amounts:'])
|
||||
response = ['**Listing subscriptions:**']
|
||||
for index, subscription in enumerate(subscriptions_data):
|
||||
response += ([template.format(_count=index + 1,
|
||||
_active=subscription['active'],
|
||||
_plan_name=subscription['plan']['name'],
|
||||
**subscription['customer'])] +
|
||||
[' - {amount} {symbol}'.format(**amount)
|
||||
for amount in subscription['plan']['amounts']] +
|
||||
[''])
|
||||
response += (
|
||||
[
|
||||
template.format(
|
||||
_count=index + 1,
|
||||
_active=subscription['active'],
|
||||
_plan_name=subscription['plan']['name'],
|
||||
**subscription['customer']
|
||||
)
|
||||
]
|
||||
+ [
|
||||
' - {amount} {symbol}'.format(**amount)
|
||||
for amount in subscription['plan']['amounts']
|
||||
]
|
||||
+ ['']
|
||||
)
|
||||
|
||||
return '\n'.join(response)
|
||||
|
||||
|
|
|
@ -95,8 +95,10 @@ def get_bot_converter_response(message: Dict[str, str], bot_handler: Any) -> str
|
|||
base_unit = uf_to_std[2]
|
||||
if uf_to_std[2] != ut_to_std[2]:
|
||||
unit_from = unit_from.capitalize() if uf_to_std[2] == 'kelvin' else unit_from
|
||||
results.append('`' + unit_to.capitalize() + '` and `' + unit_from + '`' +
|
||||
' are not from the same category. ' + utils.QUICK_HELP)
|
||||
results.append(
|
||||
'`' + unit_to.capitalize() + '` and `' + unit_from + '`'
|
||||
+ ' are not from the same category. ' + utils.QUICK_HELP
|
||||
)
|
||||
continue
|
||||
|
||||
# perform the conversion between the units
|
||||
|
|
|
@ -332,14 +332,14 @@ def check_is_editing_something(match: Any) -> bool:
|
|||
- match: The regex match object.
|
||||
'''
|
||||
return bool(
|
||||
match.group('summary') or
|
||||
match.group('project_key') or
|
||||
match.group('type_name') or
|
||||
match.group('description') or
|
||||
match.group('assignee') or
|
||||
match.group('priority_name') or
|
||||
match.group('labels') or
|
||||
match.group('due_date')
|
||||
match.group('summary')
|
||||
or match.group('project_key')
|
||||
or match.group('type_name')
|
||||
or match.group('description')
|
||||
or match.group('assignee')
|
||||
or match.group('priority_name')
|
||||
or match.group('labels')
|
||||
or match.group('due_date')
|
||||
)
|
||||
|
||||
handler_class = JiraHandler
|
||||
|
|
|
@ -75,8 +75,11 @@ class MentionHandler:
|
|||
'sources': ['web']
|
||||
} # type: Any
|
||||
|
||||
response = requests.post('https://api.mention.net/api/accounts/' + self.account_id +
|
||||
'/alerts', data=create_alert_data, headers=create_alert_header)
|
||||
response = requests.post(
|
||||
'https://api.mention.net/api/accounts/' + self.account_id
|
||||
+ '/alerts',
|
||||
data=create_alert_data, headers=create_alert_header,
|
||||
)
|
||||
data_json = response.json()
|
||||
alert_id = data_json['alert']['id']
|
||||
return alert_id
|
||||
|
@ -86,8 +89,11 @@ class MentionHandler:
|
|||
'Authorization': 'Bearer ' + self.access_token,
|
||||
'Accept-Version': '1.15',
|
||||
}
|
||||
response = requests.get('https://api.mention.net/api/accounts/' + self.account_id +
|
||||
'/alerts/' + alert_id + '/mentions', headers=get_mentions_header)
|
||||
response = requests.get(
|
||||
'https://api.mention.net/api/accounts/' + self.account_id
|
||||
+ '/alerts/' + alert_id + '/mentions',
|
||||
headers=get_mentions_header,
|
||||
)
|
||||
data_json = response.json()
|
||||
mentions = data_json['mentions']
|
||||
return mentions
|
||||
|
|
|
@ -56,8 +56,12 @@ class TicTacToeModel:
|
|||
''' Returns true if all coordinates in a triplet have the same value in them (x or o) and no coordinates
|
||||
in the triplet are blank. '''
|
||||
for triplet in self.triplets:
|
||||
if (self.get_value(board, triplet[0]) == self.get_value(board, triplet[1]) ==
|
||||
self.get_value(board, triplet[2]) != 0):
|
||||
if (
|
||||
self.get_value(board, triplet[0])
|
||||
== self.get_value(board, triplet[1])
|
||||
== self.get_value(board, triplet[2])
|
||||
!= 0
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -144,8 +148,12 @@ class TicTacToeModel:
|
|||
|
||||
# Assuming nobody will win in their next move, now I'll find the best place for the computer to win.
|
||||
for row, col in blank_locations:
|
||||
if (1 not in my_board[row] and my_board[0][col] != 1 and my_board[1][col] !=
|
||||
1 and my_board[2][col] != 1):
|
||||
if (
|
||||
1 not in my_board[row]
|
||||
and my_board[0][col] != 1
|
||||
and my_board[1][col] != 1
|
||||
and my_board[2][col] != 1
|
||||
):
|
||||
board[row][col] = 2
|
||||
return board
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue