async-universalis 4.1.0.dev0__tar.gz → 5.0.0.dev0__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.
- {async_universalis-4.1.0.dev0/async_universalis.egg-info → async_universalis-5.0.0.dev0}/PKG-INFO +1 -1
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/__init__.py +31 -13
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/_enums.py +20 -1
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0/async_universalis.egg-info}/PKG-INFO +1 -1
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/LICENSE +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/MANIFEST.in +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/README.md +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/_types.py +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/errors.py +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/items.json +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis/py.typed +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis.egg-info/SOURCES.txt +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis.egg-info/dependency_links.txt +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis.egg-info/requires.txt +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis.egg-info/top_level.txt +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/pyproject.toml +0 -0
- {async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/setup.cfg +0 -0
|
@@ -23,7 +23,7 @@ from __future__ import annotations
|
|
|
23
23
|
__title__ = "Universalis API wrapper"
|
|
24
24
|
__author__ = "k8thekat"
|
|
25
25
|
__license__ = "GNU"
|
|
26
|
-
__version__ = "
|
|
26
|
+
__version__ = "5.0.0-dev"
|
|
27
27
|
__credits__ = "Universalis and Square Enix"
|
|
28
28
|
|
|
29
29
|
|
|
@@ -268,7 +268,8 @@ class UniversalisAPI:
|
|
|
268
268
|
world_or_dc: Optional[DataCenter | World] = None,
|
|
269
269
|
num_listings: int = 10,
|
|
270
270
|
num_history_entries: int = 10,
|
|
271
|
-
item_quality: ItemQuality = ItemQuality.NQ,
|
|
271
|
+
# item_quality: ItemQuality = ItemQuality.NQ,
|
|
272
|
+
item_quality: Literal["HQ", "NQ"] = "NQ",
|
|
272
273
|
trim_item_fields: bool = False,
|
|
273
274
|
) -> CurrentData:
|
|
274
275
|
"""Retrieve the current Universalis marketboard data for the provided item.
|
|
@@ -323,7 +324,7 @@ class UniversalisAPI:
|
|
|
323
324
|
world_or_dc = self.default_datacenter
|
|
324
325
|
|
|
325
326
|
api_url: str = (
|
|
326
|
-
f"{self.base_api_url}/{world_or_dc.name}/{item}?listings={num_listings}&entries={num_history_entries}&hq={item_quality
|
|
327
|
+
f"{self.base_api_url}/{world_or_dc.name}/{item}?listings={num_listings}&entries={num_history_entries}&hq={item_quality}"
|
|
327
328
|
)
|
|
328
329
|
# ? Suggestion
|
|
329
330
|
# A fields class to handle querys.
|
|
@@ -343,7 +344,7 @@ class UniversalisAPI:
|
|
|
343
344
|
world_or_dc: Optional[DataCenter | World] = None,
|
|
344
345
|
num_listings: int = 10,
|
|
345
346
|
num_history_entries: int = 10,
|
|
346
|
-
item_quality:
|
|
347
|
+
item_quality: Literal["HQ", "NQ"] = "NQ",
|
|
347
348
|
trim_item_fields: bool = False,
|
|
348
349
|
) -> CurrentData | MultiPart | None:
|
|
349
350
|
"""Retrieve a bulk item search of Universalis marketboard data.
|
|
@@ -429,7 +430,7 @@ class UniversalisAPI:
|
|
|
429
430
|
for idx in range(0, len(query), 100):
|
|
430
431
|
api_url: str = (
|
|
431
432
|
f"{self.base_api_url}/{world_or_dc.name}/{','.join(query[idx : idx + 100])}?listings={num_listings}"
|
|
432
|
-
f"&entries={num_history_entries}&hq={item_quality
|
|
433
|
+
f"&entries={num_history_entries}&hq={item_quality}"
|
|
433
434
|
)
|
|
434
435
|
# If we need/want to trim fields.
|
|
435
436
|
if trim_item_fields:
|
|
@@ -734,13 +735,30 @@ class Generic:
|
|
|
734
735
|
|
|
735
736
|
def __repr__(self) -> str:
|
|
736
737
|
try:
|
|
737
|
-
|
|
738
|
-
f"{e}: {getattr(self, e)}" for e in self._repr_keys if e.startswith("_") is False
|
|
739
|
-
])
|
|
738
|
+
data = self._repr_keys
|
|
740
739
|
except AttributeError:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
740
|
+
data = sorted(self.__dict__)
|
|
741
|
+
|
|
742
|
+
temp = f"\n\n__{self.__class__.__name__}__\n"
|
|
743
|
+
for entry in data:
|
|
744
|
+
value = getattr(self, entry)
|
|
745
|
+
if value is None:
|
|
746
|
+
continue
|
|
747
|
+
if isinstance(value, str) and value.startswith("_"):
|
|
748
|
+
continue
|
|
749
|
+
# Should handle basic formatting on any large numbers without impacting data manipulation.
|
|
750
|
+
if isinstance(value, float):
|
|
751
|
+
value = f"{value:,d}"
|
|
752
|
+
temp += f"{entry}: {value}"
|
|
753
|
+
return temp
|
|
754
|
+
|
|
755
|
+
# return f"\n\n__{self.__class__.__name__}__\n" + "\n".join([
|
|
756
|
+
# f"{e}: {getattr(self, e)}" for e in self._repr_keys if e.startswith("_") is False
|
|
757
|
+
# ])
|
|
758
|
+
# except AttributeError:
|
|
759
|
+
# return f"\n\n__{self.__class__.__name__}__\n" + "\n".join([
|
|
760
|
+
# f"{e}: {getattr(self, e)}" for e in sorted(self.__dict__) if e.startswith("_") is False
|
|
761
|
+
# ])
|
|
744
762
|
|
|
745
763
|
@property
|
|
746
764
|
def world_name(self) -> Optional[str]:
|
|
@@ -1139,11 +1157,11 @@ class CurrentDataEntries(Generic):
|
|
|
1139
1157
|
Returns
|
|
1140
1158
|
-------
|
|
1141
1159
|
:class:`bool`
|
|
1142
|
-
If `<CurrentDataEntries>.
|
|
1160
|
+
If `<CurrentDataEntries>.listing_id` is equal to `<object>.listing_id`.
|
|
1143
1161
|
|
|
1144
1162
|
"""
|
|
1145
1163
|
return (
|
|
1146
|
-
isinstance(other, self.__class__) and self.
|
|
1164
|
+
isinstance(other, self.__class__) and self.listing_id == other.listing_id
|
|
1147
1165
|
) # and self.price_per_unit == other.price_per_unit
|
|
1148
1166
|
|
|
1149
1167
|
def __lt__(self, other: object) -> bool:
|
|
@@ -19,7 +19,7 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
from enum import IntEnum
|
|
22
|
-
from typing import ClassVar
|
|
22
|
+
from typing import ClassVar, Optional
|
|
23
23
|
|
|
24
24
|
__all__ = ("DataCenter", "DataCenterToWorlds", "ItemQuality", "Language", "World")
|
|
25
25
|
|
|
@@ -205,3 +205,22 @@ class DataCenterToWorlds:
|
|
|
205
205
|
World.Ultros,
|
|
206
206
|
]
|
|
207
207
|
__data_centers__: ClassVar[list[str]] = ["Crystal", "Aether", "Dynamis", "Primal"]
|
|
208
|
+
|
|
209
|
+
@classmethod
|
|
210
|
+
def get_worlds(cls, datacenter: DataCenter) -> Optional[list[World]]:
|
|
211
|
+
"""Get worlds for a given data center.
|
|
212
|
+
|
|
213
|
+
Parameters
|
|
214
|
+
----------
|
|
215
|
+
datacenter: :class:`DataCenter`
|
|
216
|
+
The DataCenter object to parse for Worlds.
|
|
217
|
+
|
|
218
|
+
Returns
|
|
219
|
+
-------
|
|
220
|
+
:class:`Optional[list[World]]`
|
|
221
|
+
Returns `None` if failed attribute lookup, else returns a list of :class:`Worlds`.
|
|
222
|
+
|
|
223
|
+
"""
|
|
224
|
+
if datacenter.name in cls.__data_centers__:
|
|
225
|
+
return getattr(cls, datacenter.name)
|
|
226
|
+
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{async_universalis-4.1.0.dev0 → async_universalis-5.0.0.dev0}/async_universalis.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|