spells-mtg 0.2.2__tar.gz → 0.2.3__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -11,7 +11,7 @@ dependencies = [
11
11
  ]
12
12
  requires-python = ">=3.11"
13
13
  readme = "README.md"
14
- version = "0.2.2"
14
+ version = "0.2.3"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -24,7 +24,7 @@ class ColumnDefinition:
24
24
  name: str
25
25
  col_type: ColType
26
26
  expr: pl.Expr | tuple[pl.Expr, ...]
27
- views: tuple[View, ...]
27
+ views: set[View]
28
28
  dependencies: tuple[str, ...]
29
29
  signature: str
30
30
 
@@ -53,22 +53,23 @@ def _get_names(set_code: str) -> tuple[str, ...]:
53
53
 
54
54
 
55
55
  def _hydrate_col_defs(set_code: str, col_spec_map: dict[str, ColumnSpec]):
56
- def get_views(spec: ColumnSpec) -> list[View]:
56
+ def get_views(spec: ColumnSpec) -> set[View]:
57
57
  if spec.name == ColName.NAME or spec.col_type == ColType.AGG:
58
- return []
58
+ return set()
59
59
  if spec.col_type == ColType.CARD_ATTR:
60
- return [View.CARD]
60
+ return {View.CARD}
61
61
  if spec.views is not None:
62
- return spec.views
62
+ return set(spec.views)
63
63
  assert (
64
64
  spec.dependencies is not None
65
65
  ), f"Col {spec.name} should have dependencies"
66
66
 
67
- views = []
68
- for dep in spec.dependencies:
69
- views.extend(get_views(col_spec_map[dep]))
67
+ views = functools.reduce(
68
+ lambda prev, curr: prev.intersection(curr),
69
+ [get_views(col_spec_map[dep]) for dep in spec.dependencies],
70
+ )
70
71
 
71
- return list(set(views))
72
+ return views
72
73
 
73
74
  names = _get_names(set_code)
74
75
  assert len(names) > 0, "there should be names"
@@ -118,7 +119,7 @@ def _hydrate_col_defs(set_code: str, col_spec_map: dict[str, ColumnSpec]):
118
119
  cdef = ColumnDefinition(
119
120
  name=spec.name,
120
121
  col_type=spec.col_type,
121
- views=tuple(views),
122
+ views=views,
122
123
  expr=expr,
123
124
  dependencies=dependencies,
124
125
  signature=signature,
@@ -99,8 +99,6 @@ def _resolve_view_cols(
99
99
  For each view ('game', 'draft', and 'card'), return the columns
100
100
  that must be present at the aggregation step. 'name' need not be
101
101
  included, and 'pick' will be added if needed.
102
-
103
- Dependencies within base views will be resolved by `col_df`.
104
102
  """
105
103
  unresolved_cols = col_set
106
104
  view_resolution = {}
@@ -169,7 +167,7 @@ def create(
169
167
  needed_views = frozenset()
170
168
  for view, cols_for_view in view_cols.items():
171
169
  for col in cols_for_view:
172
- if col_def_map[col].views == (view,): # only found in this view
170
+ if col_def_map[col].views == {view}: # only found in this view
173
171
  needed_views = needed_views.union({view})
174
172
 
175
173
  view_cols = {v: view_cols[v] for v in needed_views}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes