localdex 0.2.22__py3-none-any.whl → 0.2.24__py3-none-any.whl
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.
- localdex/core.py +23 -32
- {localdex-0.2.22.dist-info → localdex-0.2.24.dist-info}/METADATA +1 -1
- {localdex-0.2.22.dist-info → localdex-0.2.24.dist-info}/RECORD +6 -6
- {localdex-0.2.22.dist-info → localdex-0.2.24.dist-info}/WHEEL +0 -0
- {localdex-0.2.22.dist-info → localdex-0.2.24.dist-info}/entry_points.txt +0 -0
- {localdex-0.2.22.dist-info → localdex-0.2.24.dist-info}/top_level.txt +0 -0
localdex/core.py
CHANGED
@@ -169,7 +169,14 @@ class LocalDex:
|
|
169
169
|
# Load from data
|
170
170
|
pokemon_data = self.data_loader.load_pokemon_by_name(name)
|
171
171
|
if not pokemon_data:
|
172
|
-
|
172
|
+
|
173
|
+
if ' ' in name:
|
174
|
+
name = name.replace(' ', '-')
|
175
|
+
pokemon_data = self.data_loader.load_pokemon_by_name(name)
|
176
|
+
if not pokemon_data:
|
177
|
+
raise PokemonNotFoundError(name)
|
178
|
+
else:
|
179
|
+
raise PokemonNotFoundError(name)
|
173
180
|
|
174
181
|
pokemon = self._create_pokemon_from_data(pokemon_data)
|
175
182
|
|
@@ -426,54 +433,38 @@ class LocalDex:
|
|
426
433
|
base_stats_data = data.get("baseStats", {})
|
427
434
|
base_stats = BaseStats(
|
428
435
|
hp=base_stats_data.get("hp", 0),
|
429
|
-
attack=base_stats_data.get("attack",
|
430
|
-
defense=base_stats_data.get("defense",
|
431
|
-
special_attack=base_stats_data.get("
|
432
|
-
special_defense=base_stats_data.get("
|
433
|
-
speed=base_stats_data.get("speed",
|
436
|
+
attack=base_stats_data.get("attack", 0),
|
437
|
+
defense=base_stats_data.get("defense", 0),
|
438
|
+
special_attack=base_stats_data.get("special-attack", 0),
|
439
|
+
special_defense=base_stats_data.get("special-defense", 0),
|
440
|
+
speed=base_stats_data.get("speed", 0),
|
434
441
|
)
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
id=data.get("id", 0),
|
439
|
-
name=data.get("name", ""),
|
442
|
+
return Pokemon(
|
443
|
+
id=data["id"],
|
444
|
+
name=data["name"],
|
440
445
|
types=data.get("types", []),
|
441
446
|
base_stats=base_stats,
|
442
447
|
height=data.get("height"),
|
443
448
|
weight=data.get("weight"),
|
444
449
|
color=data.get("color"),
|
445
|
-
|
450
|
+
abilities=data.get("abilities", {}),
|
451
|
+
moves=data.get("moves", []),
|
452
|
+
learnset=data.get("learnset", {}),
|
453
|
+
evolutions=data.get("evolutions", []),
|
446
454
|
prevo=data.get("prevo"),
|
447
455
|
evo_level=data.get("evoLevel"),
|
448
456
|
evo_type=data.get("evoType"),
|
449
457
|
evo_condition=data.get("evoCondition"),
|
450
458
|
evo_item=data.get("evoItem"),
|
451
|
-
egg_groups=data.get("eggGroups"),
|
452
|
-
gender_ratio=data.get("genderRatio"),
|
459
|
+
egg_groups=data.get("eggGroups", []),
|
460
|
+
gender_ratio=data.get("genderRatio", {}),
|
453
461
|
generation=data.get("generation"),
|
454
462
|
description=data.get("description"),
|
455
463
|
is_legendary=data.get("isLegendary", False),
|
456
464
|
is_mythical=data.get("isMythical", False),
|
457
465
|
is_ultra_beast=data.get("isUltraBeast", False),
|
458
|
-
|
459
|
-
metadata=data
|
466
|
+
metadata=data.get("metadata", {}),
|
460
467
|
)
|
461
|
-
|
462
|
-
# Add abilities
|
463
|
-
abilities_data = data.get("abilities", {})
|
464
|
-
for slot, ability_data in abilities_data.items():
|
465
|
-
if isinstance(ability_data, dict) and "data" in ability_data:
|
466
|
-
ability = self._create_ability_from_data(ability_data["data"])
|
467
|
-
pokemon.abilities[slot] = ability
|
468
|
-
|
469
|
-
# Add moves
|
470
|
-
moves_data = data.get("moves", [])
|
471
|
-
for move_data in moves_data:
|
472
|
-
if isinstance(move_data, dict):
|
473
|
-
move = self._create_move_from_data(move_data)
|
474
|
-
pokemon.moves.append(move)
|
475
|
-
|
476
|
-
return pokemon
|
477
468
|
|
478
469
|
def _create_move_from_data(self, data: Dict[str, Any]) -> Move:
|
479
470
|
"""Create a Move object from raw data."""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
localdex/__init__.py,sha256=TTeh9Eys8nLtcw7Dg2equDqnouthIUyfsqvABtzR2vA,403
|
2
2
|
localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
|
3
|
-
localdex/core.py,sha256=
|
3
|
+
localdex/core.py,sha256=tYMtYdWYtXTTF8w-MOcczp_2BcqqKqeovvzAO08pPfM,20438
|
4
4
|
localdex/data_loader.py,sha256=hi9aSTto5Ti-OBGOgrQ-XwD5hmivsUwS1uC4rulhwQI,11366
|
5
5
|
localdex/download_data.py,sha256=T4A3OliGe2RsrRV1glyCqRcFhQIRt29KcY1K1-IqTuU,21597
|
6
6
|
localdex/exceptions.py,sha256=Z02-8Kci6jFDk2nnGdVSHZJMDDWE9vuwuASs4VM3To8,2777
|
@@ -4825,8 +4825,8 @@ localdex/models/ability.py,sha256=AQzv3XUHHl4sustMJjPDDjJOjXu2GMLTfcM3-tqQ_1w,30
|
|
4825
4825
|
localdex/models/item.py,sha256=zXao8F-jBPUGq_YLeGeYeK_dZVI7aZMXtWOPwR3qusY,4677
|
4826
4826
|
localdex/models/move.py,sha256=hfgcWI4ziz5MMvc9ddmkotxzYYdrSUqZZQ72IU5tucs,7629
|
4827
4827
|
localdex/models/pokemon.py,sha256=glnOiEhkFc25U54hJHwUkT-okUgtL2prg3269YXI3w0,5422
|
4828
|
-
localdex-0.2.
|
4829
|
-
localdex-0.2.
|
4830
|
-
localdex-0.2.
|
4831
|
-
localdex-0.2.
|
4832
|
-
localdex-0.2.
|
4828
|
+
localdex-0.2.24.dist-info/METADATA,sha256=AyCnO0DPSW81s7zKtS28IYUA-SGR9_BjNp9MJxOKLio,8016
|
4829
|
+
localdex-0.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4830
|
+
localdex-0.2.24.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
|
4831
|
+
localdex-0.2.24.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
|
4832
|
+
localdex-0.2.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|