ruff: Fix FLY002 Consider f-string instead of string join.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
fcd4fe330d
commit
2f581293d9
2 changed files with 7 additions and 45 deletions
|
@ -154,15 +154,7 @@ class BaremetricsHandler:
|
||||||
plans_data = plans_response.json()
|
plans_data = plans_response.json()
|
||||||
plans_data = plans_data["plans"]
|
plans_data = plans_data["plans"]
|
||||||
|
|
||||||
template = "\n".join(
|
template = "{_count}.Name: {name}\nActive: {active}\nInterval: {interval}\nInterval Count: {interval_count}\nAmounts:"
|
||||||
[
|
|
||||||
"{_count}.Name: {name}",
|
|
||||||
"Active: {active}",
|
|
||||||
"Interval: {interval}",
|
|
||||||
"Interval Count: {interval_count}",
|
|
||||||
"Amounts:",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
response = ["**Listing plans:**"]
|
response = ["**Listing plans:**"]
|
||||||
for index, plan in enumerate(plans_data):
|
for index, plan in enumerate(plans_data):
|
||||||
response += (
|
response += (
|
||||||
|
@ -181,17 +173,7 @@ class BaremetricsHandler:
|
||||||
customers_data = customers_data["customers"]
|
customers_data = customers_data["customers"]
|
||||||
|
|
||||||
# FIXME BUG here? mismatch of name and display name?
|
# FIXME BUG here? mismatch of name and display name?
|
||||||
template = "\n".join(
|
template = "{_count}.Name: {display_name}\nDisplay Name: {name}\nOID: {oid}\nActive: {is_active}\nEmail: {email}\nNotes: {notes}\nCurrent Plans:"
|
||||||
[
|
|
||||||
"{_count}.Name: {display_name}",
|
|
||||||
"Display Name: {name}",
|
|
||||||
"OID: {oid}",
|
|
||||||
"Active: {is_active}",
|
|
||||||
"Email: {email}",
|
|
||||||
"Notes: {notes}",
|
|
||||||
"Current Plans:",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
response = ["**Listing customers:**"]
|
response = ["**Listing customers:**"]
|
||||||
for index, customer in enumerate(customers_data):
|
for index, customer in enumerate(customers_data):
|
||||||
response += (
|
response += (
|
||||||
|
@ -209,17 +191,7 @@ class BaremetricsHandler:
|
||||||
subscriptions_data = subscriptions_response.json()
|
subscriptions_data = subscriptions_response.json()
|
||||||
subscriptions_data = subscriptions_data["subscriptions"]
|
subscriptions_data = subscriptions_data["subscriptions"]
|
||||||
|
|
||||||
template = "\n".join(
|
template = "{_count}.Customer Name: {name}\nCustomer Display Name: {display_name}\nCustomer OID: {oid}\nCustomer Email: {email}\nActive: {_active}\nPlan Name: {_plan_name}\nPlan Amounts:"
|
||||||
[
|
|
||||||
"{_count}.Customer Name: {name}",
|
|
||||||
"Customer Display Name: {display_name}",
|
|
||||||
"Customer OID: {oid}",
|
|
||||||
"Customer Email: {email}",
|
|
||||||
"Active: {_active}",
|
|
||||||
"Plan Name: {_plan_name}",
|
|
||||||
"Plan Amounts:",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
response = ["**Listing subscriptions:**"]
|
response = ["**Listing subscriptions:**"]
|
||||||
for index, subscription in enumerate(subscriptions_data):
|
for index, subscription in enumerate(subscriptions_data):
|
||||||
response += (
|
response += (
|
||||||
|
|
|
@ -97,9 +97,7 @@ def get_team_hash(team_name: str) -> str:
|
||||||
|
|
||||||
def team_info(team_name: str) -> str:
|
def team_info(team_name: str) -> str:
|
||||||
data = api_show_team(get_team_hash(team_name))
|
data = api_show_team(get_team_hash(team_name))
|
||||||
return "\n".join(["Team Name: {name}", "ID: `{hash_id}`", "Created at: {created_at}"]).format(
|
return "Team Name: {name}\nID: `{hash_id}`\nCreated at: {created_at}".format(**data)
|
||||||
**data
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def entries_list(team_name: str) -> str:
|
def entries_list(team_name: str) -> str:
|
||||||
|
@ -110,17 +108,9 @@ def entries_list(team_name: str) -> str:
|
||||||
data = api_list_entries()
|
data = api_list_entries()
|
||||||
response = "Entries for all teams:"
|
response = "Entries for all teams:"
|
||||||
for entry in data:
|
for entry in data:
|
||||||
response += "\n".join(
|
response += "\n * {body_formatted}\n * Created at: {created_at}\n * Status: {status}\n * User: {username}\n * Team: {teamname}\n * ID: {hash_id}".format(
|
||||||
[
|
username=entry["user"]["full_name"], teamname=entry["team"]["name"], **entry
|
||||||
"",
|
)
|
||||||
" * {body_formatted}",
|
|
||||||
" * Created at: {created_at}",
|
|
||||||
" * Status: {status}",
|
|
||||||
" * User: {username}",
|
|
||||||
" * Team: {teamname}",
|
|
||||||
" * ID: {hash_id}",
|
|
||||||
]
|
|
||||||
).format(username=entry["user"]["full_name"], teamname=entry["team"]["name"], **entry)
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue