Skip to content

Commit

Permalink
Add prEDH to scryfall models
Browse files Browse the repository at this point in the history
  • Loading branch information
gwax committed Feb 23, 2023
1 parent 66bbf8f commit 43929be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ Development

- ...

2.5.2
-----

- Add prEDH legality to models.

2.5.1
-----

Expand Down
7 changes: 4 additions & 3 deletions mtg_ssm/scryfall/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _value_from_validation_error(data: JSON, verr: ValidationError) -> Dict[str,
loc = error["loc"]
value = data
for field in loc:
if field == "__root__":
if field in {"__root__", "__key__"}:
break
if isinstance(value, Mapping) and isinstance(field, str):
value = value[field]
Expand Down Expand Up @@ -100,10 +100,11 @@ def _deserialize_cards(card_jsons: List[JSON]) -> List[ScryCard]:
try:
cards_data.append(ScryCard.parse_obj(card_json))
except ValidationError as err:
print("Failed with pydantic errors on values:")
pprint.pp(_value_from_validation_error(card_json, err))
print("Failed with pydantic errors")
print("Failed on:")
pprint.pp(card_json)
print("Failed on values:")
pprint.pp(_value_from_validation_error(card_json, err))
raise
except Exception:
print("Failed on:")
Expand Down
1 change: 1 addition & 0 deletions mtg_ssm/scryfall/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class ScryFormat(str, Enum):
ALCHEMY = "alchemy"
PAUPERCOMMANDER = "paupercommander"
PREMODERN = "premodern"
PREDH = "predh"


class ScryLegality(str, Enum):
Expand Down

0 comments on commit 43929be

Please sign in to comment.