Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #55

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_stages: [commit, manual]
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.3.2
hooks:
- id: ruff
args: [
Expand All @@ -17,7 +17,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: [types-requests]
Expand All @@ -35,7 +35,7 @@ repos:
]

- repo: https://github.com/dosisod/refurb
rev: v1.24.0
rev: v2.0.0
hooks:
- id: refurb
args: [--python-version, "3.12"]
Expand Down
5 changes: 1 addition & 4 deletions market_arbitrage.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def apply_workflow(
retrieve_market_orders_online = True

print(
"Overwriting two arguments:\n\ti) retrieve listings: {},\n\tii) retrieve market orders: {}.".format(
retrieve_listings_from_scratch,
retrieve_market_orders_online,
),
f"Overwriting two arguments:\n\ti) retrieve listings: {retrieve_listings_from_scratch},\n\tii) retrieve market orders: {retrieve_market_orders_online}.",
)

filtered_badge_data = get_filtered_badge_data(
Expand Down
13 changes: 2 additions & 11 deletions src/creation_time_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ def fill_in_badges_with_next_creation_times_loaded_from_disk(
app_name = aggregated_badge_data[app_id]["name"]
if previously_loaded_next_creation_time is None:
print(
"Loading the next creation time ({}) for {} (appID = {}) from disk.".format(
next_creation_time,
app_name,
app_id,
),
f"Loading the next creation time ({next_creation_time}) for {app_name} (appID = {app_id}) from disk.",
)
else:
# NB: Data stored in data/next_creation_times.json is assumed to be more up-to-date compared to
Expand All @@ -53,12 +49,7 @@ def fill_in_badges_with_next_creation_times_loaded_from_disk(
# and you should delete it. Therefore, if the .json file is present on your disk, it can be
# assumed that it was created by running this program, thus is more recent than the .txt file.
print(
"Replacing the next creation time ({}) for {} (appID = {}) with {}, loaded from disk.".format(
previously_loaded_next_creation_time,
app_name,
app_id,
next_creation_time,
),
f"Replacing the next creation time ({previously_loaded_next_creation_time}) for {app_name} (appID = {app_id}) with {next_creation_time}, loaded from disk.",
)

return aggregated_badge_data
Expand Down
8 changes: 4 additions & 4 deletions src/download_steam_card_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
dico[app_id]["app_id"] = app_id
dico[app_id]["name"] = app_name
dico[app_id]["num_cards_per_set"] = num_cards_per_set
dico[app_id][
"gem_amount"
] = compute_gem_amount_required_to_craft_booster_pack(
num_cards_per_set,
dico[app_id]["gem_amount"] = (

Check warning on line 132 in src/download_steam_card_exchange.py

View check run for this annotation

Codecov / codecov/patch

src/download_steam_card_exchange.py#L132

Added line #L132 was not covered by tests
compute_gem_amount_required_to_craft_booster_pack(
num_cards_per_set,
)
)

print(f"{len(dico)} games found in the database.")
Expand Down
8 changes: 1 addition & 7 deletions src/list_possible_lures.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,7 @@ def filter_app_ids_with_potential_profit(
negative = sorted(set(app_ids).difference(filtered_app_ids), key=int)

print(
"\nPositive ({}): {}\n\nNegative ({}): {}\n\nTotal ({})".format(
len(positive),
positive,
len(negative),
negative,
len(app_ids),
),
f"\nPositive ({len(positive)}): {positive}\n\nNegative ({len(negative)}): {negative}\n\nTotal ({len(app_ids)})",
)

return filtered_app_ids
Expand Down
37 changes: 8 additions & 29 deletions src/market_arbitrage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@

if verbose:
print(
"There are {} booster packs which are tracked, as they were crafted at least once. ({} omitted)".format(
len(filtered_badge_data),
len(aggregated_badge_data) - len(filtered_badge_data),
),
f"There are {len(filtered_badge_data)} booster packs which are tracked, as they were crafted at least once. ({len(aggregated_badge_data) - len(filtered_badge_data)} omitted)",
)

return filtered_badge_data
Expand Down Expand Up @@ -77,10 +74,7 @@

if verbose:
print(
"There are {} booster packs which can be immediately crafted. ({} excluded because of cooldown)".format(
len(filtered_badge_data),
len(aggregated_badge_data) - len(filtered_badge_data),
),
f"There are {len(filtered_badge_data)} booster packs which can be immediately crafted. ({len(aggregated_badge_data) - len(filtered_badge_data)} excluded because of cooldown)",
)

return filtered_badge_data
Expand Down Expand Up @@ -169,13 +163,7 @@

if verbose:
print(
"There are {} {} with sell price unknown ({}) or strictly higher than {} ({}).".format(
len(filtered_badge_data),
category_name,
unknown_price_counter,
threshold_name,
len(filtered_badge_data) - unknown_price_counter,
),
f"There are {len(filtered_badge_data)} {category_name} with sell price unknown ({unknown_price_counter}) or strictly higher than {threshold_name} ({len(filtered_badge_data) - unknown_price_counter}).",
)

return filtered_badge_data
Expand Down Expand Up @@ -209,9 +197,7 @@

if verbose:
print(
"Bid not found for {}. Reason is likely that you asked not to retrieve market orders.".format(
listing_hash,
),
f"Bid not found for {listing_hash}. Reason is likely that you asked not to retrieve market orders.",
)

bid_without_fee = compute_sell_price_without_fee(bid_including_fee)
Expand Down Expand Up @@ -244,9 +230,9 @@
]
except KeyError:
badge_arbitrages[listing_hash]["gem_amount"] = None
badge_arbitrages[listing_hash][
"gem_price_including_fee"
] = individual_badge_data["gem_price"]
badge_arbitrages[listing_hash]["gem_price_including_fee"] = (
individual_badge_data["gem_price"]
)
badge_arbitrages[listing_hash]["sell_price"] = individual_badge_data[
"sell_price"
]
Expand Down Expand Up @@ -305,14 +291,7 @@
replace_spaces=True,
)

listing_hash_formatted_for_markdown = (
"[[store]({})][[market]({})] [{}]({})".format(
get_steam_store_url(app_id),
markdown_compatible_steam_market_url,
listing_hash,
get_steamcardexchange_url(app_id),
)
)
listing_hash_formatted_for_markdown = f"[[store]({get_steam_store_url(app_id)})][[market]({markdown_compatible_steam_market_url})] [{listing_hash}]({get_steamcardexchange_url(app_id)})"

Check warning on line 294 in src/market_arbitrage_utils.py

View check run for this annotation

Codecov / codecov/patch

src/market_arbitrage_utils.py#L294

Added line #L294 was not covered by tests
else:
listing_hash_formatted_for_markdown = listing_hash

Expand Down
25 changes: 5 additions & 20 deletions src/market_buzz_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,12 @@
num_different_items_of_uncommon_rarity = item_rarity_pattern["uncommon"]
num_different_items_of_rare_rarity = item_rarity_pattern["rare"]

item_rarity_pattern_info = (
" ; rarity pattern C/UC/R: {}/{}/{} items".format(
num_different_items_of_common_rarity,
num_different_items_of_uncommon_rarity,
num_different_items_of_rare_rarity,
)
)
item_rarity_pattern_info = f" ; rarity pattern C/UC/R: {num_different_items_of_common_rarity}/{num_different_items_of_uncommon_rarity}/{num_different_items_of_rare_rarity} items"

Check warning on line 148 in src/market_buzz_utils.py

View check run for this annotation

Codecov / codecov/patch

src/market_buzz_utils.py#L148

Added line #L148 was not covered by tests
except (TypeError, KeyError):
item_rarity_pattern_info = ""

print(
"{:3}) [[store]({})][[market]({})] [{}]({}) ; bid: {}€ (volume: {}){}".format(
i + 1,
get_steam_store_url(app_id),
markdown_compatible_steam_market_url,
app_name,
get_steamcardexchange_url(app_id),
bid,
bid_volume,
item_rarity_pattern_info,
),
f"{i + 1:3}) [[store]({get_steam_store_url(app_id)})][[market]({markdown_compatible_steam_market_url})] [{app_name}]({get_steamcardexchange_url(app_id)}) ; bid: {bid}€ (volume: {bid_volume}){item_rarity_pattern_info}",
)


Expand Down Expand Up @@ -212,9 +197,9 @@
"gem_amount"
]

aggregated_badge_data[app_id][
"gem_amount"
] = gem_amount_required_to_craft_booster_pack
aggregated_badge_data[app_id]["gem_amount"] = (

Check warning on line 200 in src/market_buzz_utils.py

View check run for this annotation

Codecov / codecov/patch

src/market_buzz_utils.py#L200

Added line #L200 was not covered by tests
gem_amount_required_to_craft_booster_pack
)
aggregated_badge_data[app_id]["gem_price"] = (
gem_amount_required_to_craft_booster_pack * gem_price
)
Expand Down
10 changes: 2 additions & 8 deletions src/market_foil_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,7 @@ def find_listing_hashes_with_unknown_goo_value(

if verbose:
print(
"Unknown goo values for:\n{}\nTotal: {} appIDs with unknown goo value.".format(
app_ids_with_unknown_goo_value,
len(app_ids_with_unknown_goo_value),
),
f"Unknown goo values for:\n{app_ids_with_unknown_goo_value}\nTotal: {len(app_ids_with_unknown_goo_value)} appIDs with unknown goo value.",
)

return app_ids_with_unknown_goo_value
Expand Down Expand Up @@ -725,10 +722,7 @@ def find_app_ids_with_unknown_item_type_for_their_representatives(

if verbose:
print(
"Unknown item types for:\n{}\nTotal: {} appIDs with unknown item type for their representative listing hashes.".format(
app_ids_with_unreliable_goo_details,
len(app_ids_with_unreliable_goo_details),
),
f"Unknown item types for:\n{app_ids_with_unreliable_goo_details}\nTotal: {len(app_ids_with_unreliable_goo_details)} appIDs with unknown item type for their representative listing hashes.",
)

return app_ids_with_unreliable_goo_details
Expand Down
9 changes: 1 addition & 8 deletions src/market_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,7 @@ def download_market_order_data(

if verbose:
print(
"Listing: {} ; item id: {} ; ask: {:.2f}€ ({}) ; bid: {:.2f}€ ({})".format(
listing_hash,
item_nameid,
ask_price,
ask_volume,
bid_price,
bid_volume,
),
f"Listing: {listing_hash} ; item id: {item_nameid} ; ask: {ask_price:.2f}€ ({ask_volume}) ; bid: {bid_price:.2f}€ ({bid_volume})",
)

return bid_price, ask_price, bid_volume, ask_volume
Expand Down
11 changes: 4 additions & 7 deletions src/market_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ def filter_out_dubious_listing_hashes(

if verbose:
print(
"There are {} seemingly valid market listings. ({} omitted because of a dubious listing hash)".format(
len(filtered_listings),
len(all_listings) - len(filtered_listings),
),
f"There are {len(filtered_listings)} seemingly valid market listings. ({len(all_listings) - len(filtered_listings)} omitted because of a dubious listing hash)",
)

return filtered_listings
Expand Down Expand Up @@ -161,9 +158,9 @@ def aggregate_badge_data(
aggregated_badge_data[app_id] = {}
aggregated_badge_data[app_id]["name"] = app_name
aggregated_badge_data[app_id]["listing_hash"] = listing_hash
aggregated_badge_data[app_id][
"gem_amount"
] = gem_amount_required_to_craft_booster_pack
aggregated_badge_data[app_id]["gem_amount"] = (
gem_amount_required_to_craft_booster_pack
)
aggregated_badge_data[app_id]["gem_price"] = (
gem_amount_required_to_craft_booster_pack * gem_price
)
Expand Down
10 changes: 2 additions & 8 deletions src/sack_of_gems.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,13 @@ def get_gem_price(
else:
sack_of_gems_price = enforced_sack_of_gems_price
print(
"[manual input] A sack of {} gems can allegedly be bought for {:.2f} €.".format(
get_num_gems_per_sack_of_gems(),
sack_of_gems_price,
),
f"[manual input] A sack of {get_num_gems_per_sack_of_gems()} gems can allegedly be bought for {sack_of_gems_price:.2f} €.",
)

if minimum_allowed_sack_of_gems_price is not None:
sack_of_gems_price = max(minimum_allowed_sack_of_gems_price, sack_of_gems_price)
print(
"[manual adjustment] The price of a sack of gems is set to {:.2f} € (minimum allowed: {:.2f} €).".format(
sack_of_gems_price,
minimum_allowed_sack_of_gems_price,
),
f"[manual adjustment] The price of a sack of gems is set to {sack_of_gems_price:.2f} € (minimum allowed: {minimum_allowed_sack_of_gems_price:.2f} €).",
)

num_gems_per_sack_of_gems = get_num_gems_per_sack_of_gems()
Expand Down
Loading