Skip to content

Commit 7c19a79

Browse files
committed
small restructure
1 parent 05f0ac2 commit 7c19a79

19 files changed

+258
-262
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,3 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175-
176-
# Other
177-
_build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2024 offish
3+
Copyright (c) 2019-2025 offish
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ tf2-utils
44

55
``tf2-utils`` is a collection of tools and utilities for TF2 trading.
66
Use 3rd party inventory providers, SKUs formatting, interact with various APIs, websockets and more.
7-
``tf2-utils`` is built on top of `tf2-sku <https://github.com/offish/tf2-sku>`_ and `tf2-data <https://github.com/offish/tf2-data>`_.
7+
``tf2-utils`` is built on top of `tf2-sku <https://github.com/offish/tf2-sku>`_, `tf2-data <https://github.com/offish/tf2-data>`_
8+
and `backpack-tf <https://github.com/offish/backpack-tf>`_.
89
``tf2-utils`` is a key dependency of `tf2-express <https://github.com/offish/tf2-express>`_.
910

1011
Donate
1112
------
1213

13-
- BTC: ``bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2``
14+
- BTC: ``bc1q9gmh5x2g9s0pw3282a5ypr6ms8qvuxh3fd7afh``
1415
- `Steam Trade Offer <https://steamcommunity.com/tradeoffer/new/?partner=293059984&token=0-l_idZR>`_
1516

1617
You can reach me at `Steam <https://steamcommunity.com/id/confern>`_,
@@ -54,9 +55,9 @@ Updating
5455

5556
.. code-block:: bash
5657
57-
pip install --upgrade tf2-utils tf2-sku tf2-data
58+
pip install --upgrade tf2-utils tf2-sku tf2-data bptf
5859
# or
59-
python -m pip install --upgrade tf2-utils tf2-sku tf2-data
60+
python -m pip install --upgrade tf2-utils tf2-sku tf2-data bptf
6061
6162
6263
Development
@@ -67,7 +68,7 @@ Testing
6768
.. code-block:: bash
6869
6970
# tf2-utils/
70-
python -m unittest
71+
pytest
7172
7273
Documentation
7374
~~~~~~~~~~~~~
@@ -85,7 +86,7 @@ License
8586
-------
8687
MIT License
8788

88-
Copyright (c) 2019-2024 offish (`confern <https://steamcommunity.com/id/confern>`_)
89+
Copyright (c) 2019-2025 offish (`confern <https://steamcommunity.com/id/confern>`_)
8990

9091
Permission is hereby granted, free of charge, to any person obtaining a copy
9192
of this software and associated documentation files (the "Software"), to deal

conftest.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
from os import getenv
2+
13
import pytest
4+
from dotenv import load_dotenv
5+
6+
assert load_dotenv()
7+
8+
MARKETPLACE_TF_API_KEY = getenv("MARKETPLACE_TF_API_KEY")
9+
BACKPACK_TF_TOKEN = getenv("BACKPACK_TF_TOKEN")
210

311

412
@pytest.fixture
513
def marketplace_tf_api_key() -> str:
6-
return "api_key"
14+
return MARKETPLACE_TF_API_KEY
715

816

917
@pytest.fixture
1018
def backpack_tf_token() -> str:
11-
return "backpack_tf_token"
19+
return BACKPACK_TF_TOKEN

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Table of Contents
1313
pages/marketplace_tf
1414
pages/offer
1515
pages/prices_tf
16+
pages/prices_tf_websocket
1617
pages/schema
1718
pages/sku
18-
pages/sockets
1919
pages/utils
2020

2121

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ PricesTF Example
77
.. literalinclude:: ../usage/prices_tf_socket.py
88
:language: python3
99

10-
.. automodule:: src.tf2_utils.sockets
10+
.. automodule:: src.tf2_utils.prices_tf_websocket
1111
:members:
1212
:undoc-members:

example.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MARKETPLACE_TF_API_KEY=apikey
2+
BACKPACK_TF_TOKEN=token

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ classifiers = [
1616
"License :: OSI Approved :: MIT License",
1717
"Operating System :: OS Independent",
1818
]
19-
dependencies = ["tf2-sku", "tf2-data", "backpack-tf", "requests", "websocket-client"]
19+
dependencies = ["tf2-sku", "tf2-data", "bptf", "requests", "websocket-client"]
2020
dynamic = ["version"]
2121

2222
[project.urls]

src/tf2_utils/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
__version__ = "2.3.0"
55
__license__ = "MIT"
66

7-
from .sku import *
7+
from .currency import CurrencyExchange
8+
from .exceptions import *
9+
from .inventory import Inventory, map_inventory
810
from .item import Item
11+
from .marketplace_tf import *
912
from .offer import Offer
10-
from .utils import *
13+
from .prices_tf import PricesTF
14+
from .prices_tf_websocket import PricesTFWebsocket
1115
from .schema import SchemaItemsUtils
12-
from .sockets import PricesTFWebsocket
13-
from .prices_tf import *
14-
from .inventory import Inventory, map_inventory
15-
from .currency import CurrencyExchange
16-
from .marketplace_tf import *
16+
from .sku import *
17+
from .utils import *

src/tf2_utils/currency.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,17 @@ def __init__(
3333
self.our_combination = [] # list of metal names
3434

3535
def get_pure_value(self, name: str) -> int:
36-
match name:
37-
# refined
38-
case "Mann Co. Supply Crate Key":
39-
return self.key_price
36+
if name == "Mann Co. Supply Crate Key":
37+
return self.key_price
4038

41-
case "Refined Metal":
42-
return 9
39+
if name == "Refined Metal":
40+
return 9
4341

44-
# reclaimed
45-
case "Reclaimed Metal":
46-
return 3
42+
if name == "Reclaimed Metal":
43+
return 3
4744

48-
# scrap
49-
case "Scrap Metal":
50-
return 1
45+
if name == "Scrap Metal":
46+
return 1
5147

5248
raise ValueError(f"{name} is not pure")
5349

0 commit comments

Comments
 (0)