tf2-sku-to-name 1.0.7__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Purple Barber
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Purple Barber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: tf2-sku-to-name
3
+ Version: 2.0.0
4
+ Summary: A python library that parses TF2 item SKU to the item's name and vice versa.
5
+ Home-page: https://github.com/purplebarber/tf2-sku
6
+ Author: Purple Barber
7
+ License: MIT
8
+ Keywords: tf2,tf2-sku,team fortress 2,sku,parser
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.6
11
+ Classifier: Programming Language :: Python :: 3.7
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.6
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests
22
+ Dynamic: author
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: keywords
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: requires-dist
31
+ Dynamic: requires-python
32
+ Dynamic: summary
33
+
34
+ # tf2-sku
35
+
36
+ A Python library for parsing Team Fortress 2 item SKUs to item names and vice versa.
37
+
38
+ ## Features
39
+ - Convert SKUs to item names
40
+ - Convert item names to SKUs
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install tf2-sku-to-name
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ```python
51
+ from sku import Sku
52
+
53
+ # Convert SKU to name
54
+ sku = "5021;6"
55
+ name = Sku.sku_to_name(sku)
56
+ print(name) # Output: Mann Co. Supply Crate Key
57
+
58
+ # Convert name to SKU
59
+ name = "Burning Flames Team Captain"
60
+ sku = Sku.name_to_sku(name)
61
+ print(sku) # Output: 378;5;u13
62
+
63
+ # Working with item objects
64
+ from sku import itemClass
65
+
66
+ item = itemClass()
67
+ item.Defindex = 424
68
+ item.Quality = 11
69
+ item.Killstreak = 3
70
+
71
+ sku = Sku.object_to_sku(item)
72
+ print(sku) # Output: 424;11;kt-3
73
+ ```
74
+
75
+ ## Advanced Usage
76
+
77
+ ### Schema Management
78
+
79
+ The library automatically manages TF2 schema data:
80
+
81
+ ```python
82
+ from sku import get_schema, update_schema
83
+
84
+ # Get the current schema instance
85
+ schema = get_schema()
86
+
87
+ # Access schema data
88
+ item = schema.get_item_by_defindex(5021)
89
+ print(item['item_name']) # Mann Co. Supply Crate Key
90
+
91
+ # Force update schema (by default uses autobot.tf)
92
+ update_schema()
93
+
94
+ # Or use Steam API (requires API key)
95
+ update_schema(api_key="YOUR_STEAM_API_KEY", use_autobot=False)
96
+ ```
97
+
98
+ ## Installation
99
+ ```bash
100
+ pip install tf2-sku-to-name
101
+ ```
102
+
103
+ ## Acknowledgements
104
+ [TF2Autobot's node-tf2-schema](https://github.com/TF2Autobot/node-tf2-schema) for the original JavaScript implementation\
105
+ [idinium96's tf2autobot](https://github.com/TF2Autobot/tf2autobot) for the item name schema\
106
+ Inspired by [Nicklason's node-tf2-sku](https://github.com/Nicklason/node-tf2-sku) and [TryHardDo's TF2Sku](https://github.com/TryHardDo/TF2Sku/tree/master)
@@ -0,0 +1,73 @@
1
+ # tf2-sku
2
+
3
+ A Python library for parsing Team Fortress 2 item SKUs to item names and vice versa.
4
+
5
+ ## Features
6
+ - Convert SKUs to item names
7
+ - Convert item names to SKUs
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install tf2-sku-to-name
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from sku import Sku
19
+
20
+ # Convert SKU to name
21
+ sku = "5021;6"
22
+ name = Sku.sku_to_name(sku)
23
+ print(name) # Output: Mann Co. Supply Crate Key
24
+
25
+ # Convert name to SKU
26
+ name = "Burning Flames Team Captain"
27
+ sku = Sku.name_to_sku(name)
28
+ print(sku) # Output: 378;5;u13
29
+
30
+ # Working with item objects
31
+ from sku import itemClass
32
+
33
+ item = itemClass()
34
+ item.Defindex = 424
35
+ item.Quality = 11
36
+ item.Killstreak = 3
37
+
38
+ sku = Sku.object_to_sku(item)
39
+ print(sku) # Output: 424;11;kt-3
40
+ ```
41
+
42
+ ## Advanced Usage
43
+
44
+ ### Schema Management
45
+
46
+ The library automatically manages TF2 schema data:
47
+
48
+ ```python
49
+ from sku import get_schema, update_schema
50
+
51
+ # Get the current schema instance
52
+ schema = get_schema()
53
+
54
+ # Access schema data
55
+ item = schema.get_item_by_defindex(5021)
56
+ print(item['item_name']) # Mann Co. Supply Crate Key
57
+
58
+ # Force update schema (by default uses autobot.tf)
59
+ update_schema()
60
+
61
+ # Or use Steam API (requires API key)
62
+ update_schema(api_key="YOUR_STEAM_API_KEY", use_autobot=False)
63
+ ```
64
+
65
+ ## Installation
66
+ ```bash
67
+ pip install tf2-sku-to-name
68
+ ```
69
+
70
+ ## Acknowledgements
71
+ [TF2Autobot's node-tf2-schema](https://github.com/TF2Autobot/node-tf2-schema) for the original JavaScript implementation\
72
+ [idinium96's tf2autobot](https://github.com/TF2Autobot/tf2autobot) for the item name schema\
73
+ Inspired by [Nicklason's node-tf2-sku](https://github.com/Nicklason/node-tf2-sku) and [TryHardDo's TF2Sku](https://github.com/TryHardDo/TF2Sku/tree/master)
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='tf2-sku-to-name',
5
+ version='2.0.0',
6
+ author='Purple Barber',
7
+ description="A python library that parses TF2 item SKU to the item's name and vice versa.",
8
+ long_description=open('README.md').read(),
9
+ long_description_content_type='text/markdown',
10
+ url='https://github.com/purplebarber/tf2-sku',
11
+ license='MIT',
12
+ packages=find_packages(),
13
+ install_requires=[
14
+ 'requests'
15
+ ],
16
+ classifiers=[
17
+ 'Programming Language :: Python :: 3',
18
+ 'Programming Language :: Python :: 3.6',
19
+ 'Programming Language :: Python :: 3.7',
20
+ 'Programming Language :: Python :: 3.8',
21
+ 'Programming Language :: Python :: 3.9',
22
+ 'Programming Language :: Python :: 3.10',
23
+ 'Programming Language :: Python :: 3.11',
24
+ 'License :: OSI Approved :: MIT License',
25
+ 'Operating System :: OS Independent',
26
+ ],
27
+ keywords="tf2, tf2-sku, team fortress 2, sku, parser",
28
+ python_requires='>=3.6',
29
+ )
@@ -0,0 +1,13 @@
1
+ from sku.parser import Sku, get_schema
2
+ from sku.models import itemClass
3
+ from sku.schema import Schema
4
+
5
+ __version__ = "2.0.0"
6
+ __all__ = ["Sku", "itemClass", "Schema", "get_schema", "update_schema"]
7
+
8
+ # Main functions
9
+ object_to_sku = Sku.object_to_sku
10
+ sku_to_object = Sku.sku_to_object
11
+ sku_to_name = Sku.sku_to_name
12
+ name_to_sku = Sku.name_to_sku
13
+ update_schema = Sku.update_schema
@@ -1,30 +1,30 @@
1
- from json import dumps
2
-
3
-
4
- class itemClass:
5
- def __init__(self, data=None):
6
- # Initialize the properties with their default values
7
- self.Defindex = 0
8
- self.Quality = 6
9
- self.Craftable = True
10
- self.Killstreak = 0
11
- self.Australium = False
12
- self.Festive = False
13
- self.Effect = None
14
- self.PaintKit = None
15
- self.Wear = None
16
- self.ElevatedQuality = None
17
- self.Target = None
18
- self.CraftNum = None
19
- self.CrateSn = None
20
- self.Output = None
21
- self.OutputQuality = None
22
-
23
- # Update the properties with the provided data
24
- if data is not None:
25
- self.__dict__.update(data)
26
-
27
-
28
- def __str__(self):
29
- # Serialize the object to a JSON string
30
- return dumps(self.__dict__)
1
+ from json import dumps
2
+
3
+
4
+ class itemClass:
5
+ def __init__(self, data=None):
6
+ # Initialize the properties with their default values
7
+ self.Defindex = 0
8
+ self.Quality = 6
9
+ self.Craftable = True
10
+ self.Killstreak = 0
11
+ self.Australium = False
12
+ self.Festive = False
13
+ self.Effect = None
14
+ self.PaintKit = None
15
+ self.Wear = None
16
+ self.ElevatedQuality = None
17
+ self.Target = None
18
+ self.CraftNum = None
19
+ self.CrateSn = None
20
+ self.Output = None
21
+ self.OutputQuality = None
22
+
23
+ # Update the properties with the provided data
24
+ if data is not None:
25
+ self.__dict__.update(data)
26
+
27
+
28
+ def __str__(self):
29
+ # Serialize the object to a JSON string
30
+ return dumps(self.__dict__)