spells-mtg 0.7.0__tar.gz → 0.7.1__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.
Potentially problematic release.
This version of spells-mtg might be problematic. Click here for more details.
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/PKG-INFO +2 -1
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/README.md +1 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/pyproject.toml +1 -1
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/external.py +10 -1
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/schema.py +2 -4
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/LICENSE +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/__init__.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/cache.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/cards.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/columns.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/draft_data.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/enums.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/extension.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/filter.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/spells/manifest.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/tests/__init__.py +0 -0
- {spells_mtg-0.7.0 → spells_mtg-0.7.1}/tests/filter_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spells-mtg
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: analaysis of 17Lands.com public datasets
|
|
5
5
|
Author-Email: Joel Barnes <oelarnes@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -75,6 +75,7 @@ Spells is not affiliated with 17Lands. Please review the [Usage Guidelines](http
|
|
|
75
75
|
- Caches aggregate DataFrames in the local file system automatically for instantaneous reproduction of previous analysis
|
|
76
76
|
- Manages grouping and filtering by built-in and custom columns at the row level
|
|
77
77
|
- Provides 124 explicitly specified, enumerated, documented column definitions
|
|
78
|
+
- Can aggregate over multiple sets at once, even all of them, if you want.
|
|
78
79
|
- Supports "Deck Color Data" aggregations with built-in column definitions.
|
|
79
80
|
- Lets you feed card metrics back in to column definitions to support scientific workflows like MLE
|
|
80
81
|
- Provides a CLI tool `spells [add|refresh|clean|remove|info] [SET]` to download and manage external files
|
|
@@ -64,6 +64,7 @@ Spells is not affiliated with 17Lands. Please review the [Usage Guidelines](http
|
|
|
64
64
|
- Caches aggregate DataFrames in the local file system automatically for instantaneous reproduction of previous analysis
|
|
65
65
|
- Manages grouping and filtering by built-in and custom columns at the row level
|
|
66
66
|
- Provides 124 explicitly specified, enumerated, documented column definitions
|
|
67
|
+
- Can aggregate over multiple sets at once, even all of them, if you want.
|
|
67
68
|
- Supports "Deck Color Data" aggregations with built-in column definitions.
|
|
68
69
|
- Lets you feed card metrics back in to column definitions to support scientific workflows like MLE
|
|
69
70
|
- Provides a CLI tool `spells [add|refresh|clean|remove|info] [SET]` to download and manage external files
|
|
@@ -15,6 +15,7 @@ from enum import StrEnum
|
|
|
15
15
|
|
|
16
16
|
import wget
|
|
17
17
|
import polars as pl
|
|
18
|
+
from polars.exceptions import ComputeError
|
|
18
19
|
|
|
19
20
|
from spells import cards
|
|
20
21
|
from spells import cache
|
|
@@ -231,7 +232,15 @@ def _process_zipped_file(gzip_path, target_path):
|
|
|
231
232
|
|
|
232
233
|
os.remove(gzip_path)
|
|
233
234
|
df = pl.scan_csv(csv_path, schema=schema(csv_path))
|
|
234
|
-
|
|
235
|
+
try:
|
|
236
|
+
df.sink_parquet(target_path)
|
|
237
|
+
except ComputeError:
|
|
238
|
+
df = pl.scan_csv(csv_path)
|
|
239
|
+
cache.spells_print('error', 'Bad schema found, loading dataset into memory'\
|
|
240
|
+
+ ' and attempting to cast to correct schema')
|
|
241
|
+
select = [pl.col(name).cast(dtype) for name, dtype in schema(csv_path).items()]
|
|
242
|
+
cast_df = df.select(select).collect()
|
|
243
|
+
cast_df.write_parquet(target_path)
|
|
235
244
|
|
|
236
245
|
os.remove(csv_path)
|
|
237
246
|
|
|
@@ -136,16 +136,14 @@ COLUMN_TYPES = (
|
|
|
136
136
|
(re.compile(r"^oppo_total_cards_drawn_or_tutored$"), pl.Int8),
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
|
|
140
139
|
def schema(
|
|
141
140
|
filename: str, print_missing: bool = False
|
|
142
|
-
) -> Dict[str, pl.datatypes.DataType]
|
|
141
|
+
) -> Dict[str, pl.datatypes.DataType]:
|
|
143
142
|
dtypes: Dict[str, pl.datatypes.DataType] = {}
|
|
144
143
|
with open(filename, encoding="utf-8") as f:
|
|
145
144
|
columns = csv.DictReader(f).fieldnames
|
|
146
145
|
if columns is None:
|
|
147
|
-
|
|
148
|
-
return None
|
|
146
|
+
raise ValueError(f"Could not read fieldnames from {filename}")
|
|
149
147
|
for column in columns:
|
|
150
148
|
for regex, column_type in COLUMN_TYPES:
|
|
151
149
|
if regex.match(column):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|