localdex 0.1.4__py3-none-any.whl → 0.1.6__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 +16 -12
- {localdex-0.1.4.dist-info → localdex-0.1.6.dist-info}/METADATA +21 -9
- {localdex-0.1.4.dist-info → localdex-0.1.6.dist-info}/RECORD +6 -6
- {localdex-0.1.4.dist-info → localdex-0.1.6.dist-info}/WHEEL +0 -0
- {localdex-0.1.4.dist-info → localdex-0.1.6.dist-info}/entry_points.txt +0 -0
- {localdex-0.1.4.dist-info → localdex-0.1.6.dist-info}/top_level.txt +0 -0
localdex/core.py
CHANGED
@@ -402,19 +402,23 @@ class LocalDex:
|
|
402
402
|
|
403
403
|
def get_all_pokemon(self) -> List[Pokemon]:
|
404
404
|
"""Get all Pokemon."""
|
405
|
-
|
405
|
+
pokemon_data_list = self.data_loader.load_all_pokemon()
|
406
|
+
return [self._create_pokemon_from_data(data) for data in pokemon_data_list]
|
406
407
|
|
407
408
|
def get_all_moves(self) -> List[Move]:
|
408
409
|
"""Get all moves."""
|
409
|
-
|
410
|
+
move_data_list = self.data_loader.load_all_moves()
|
411
|
+
return [self._create_move_from_data(data) for data in move_data_list]
|
410
412
|
|
411
413
|
def get_all_abilities(self) -> List[Ability]:
|
412
414
|
"""Get all abilities."""
|
413
|
-
|
415
|
+
ability_data_list = self.data_loader.load_all_abilities()
|
416
|
+
return [self._create_ability_from_data(data) for data in ability_data_list]
|
414
417
|
|
415
418
|
def get_all_items(self) -> List[Item]:
|
416
419
|
"""Get all items."""
|
417
|
-
|
420
|
+
item_data_list = self.data_loader.load_all_items()
|
421
|
+
return [self._create_item_from_data(data) for data in item_data_list]
|
418
422
|
|
419
423
|
def _create_pokemon_from_data(self, data: Dict[str, Any]) -> Pokemon:
|
420
424
|
"""Create a Pokemon object from raw data."""
|
@@ -422,11 +426,11 @@ class LocalDex:
|
|
422
426
|
base_stats_data = data.get("baseStats", {})
|
423
427
|
base_stats = BaseStats(
|
424
428
|
hp=base_stats_data.get("hp", 0),
|
425
|
-
attack=base_stats_data.get("atk", 0),
|
426
|
-
defense=base_stats_data.get("def", 0),
|
427
|
-
special_attack=base_stats_data.get("spa", 0),
|
428
|
-
special_defense=base_stats_data.get("spd", 0),
|
429
|
-
speed=base_stats_data.get("spe", 0)
|
429
|
+
attack=base_stats_data.get("attack", base_stats_data.get("atk", 0)),
|
430
|
+
defense=base_stats_data.get("defense", base_stats_data.get("def", 0)),
|
431
|
+
special_attack=base_stats_data.get("special_attack", base_stats_data.get("spa", 0)),
|
432
|
+
special_defense=base_stats_data.get("special_defense", base_stats_data.get("spd", 0)),
|
433
|
+
speed=base_stats_data.get("speed", base_stats_data.get("spe", 0))
|
430
434
|
)
|
431
435
|
|
432
436
|
# Create Pokemon object
|
@@ -501,9 +505,9 @@ class LocalDex:
|
|
501
505
|
"""Create an Ability object from raw data."""
|
502
506
|
return Ability(
|
503
507
|
name=data.get("name", ""),
|
504
|
-
description=data.get("desc"),
|
505
|
-
short_description=data.get("shortDesc"),
|
506
|
-
generation=data.get("gen"),
|
508
|
+
description=data.get("description", data.get("desc", "")),
|
509
|
+
short_description=data.get("short_description", data.get("shortDesc", "")),
|
510
|
+
generation=data.get("generation", data.get("gen")),
|
507
511
|
rating=data.get("rating"),
|
508
512
|
num=data.get("num"),
|
509
513
|
effect=data.get("effect"),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: localdex
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.6
|
4
4
|
Summary: A local Pokemon data repository/Pokedex with fast offline access
|
5
5
|
Home-page: https://github.com/yourusername/localdex
|
6
6
|
Author: LocalDex Team
|
@@ -144,17 +144,29 @@ print(f"{pikachu.name} - {pikachu.types}")
|
|
144
144
|
charizard = dex.get_pokemon_by_id(6)
|
145
145
|
print(f"{charizard.name} - HP: {charizard.base_stats.hp}")
|
146
146
|
|
147
|
-
#
|
148
|
-
|
149
|
-
print(f"
|
147
|
+
# Get Pokemon stats
|
148
|
+
bulbasaur = dex.get_pokemon("bulbasaur")
|
149
|
+
print(f"{bulbasaur.name} - Attack: {bulbasaur.base_stats.attack}, Speed: {bulbasaur.base_stats.speed}")
|
150
150
|
|
151
151
|
# Get moves
|
152
152
|
thunderbolt = dex.get_move("thunderbolt")
|
153
|
-
print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}")
|
154
|
-
|
155
|
-
# Get abilities
|
156
|
-
lightning_rod = dex.get_ability("
|
157
|
-
print(f"{lightning_rod.name} - {lightning_rod.
|
153
|
+
print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}, Type: {thunderbolt.type}")
|
154
|
+
|
155
|
+
# Get abilities (note: use dashes in names like "lightning-rod")
|
156
|
+
lightning_rod = dex.get_ability("lightning-rod")
|
157
|
+
print(f"{lightning_rod.name} - {lightning_rod.short_description}")
|
158
|
+
|
159
|
+
# Get all Pokemon of a specific type (basic example)
|
160
|
+
all_pokemon = dex.get_all_pokemon()
|
161
|
+
fire_pokemon = [p for p in all_pokemon if "Fire" in p.types]
|
162
|
+
print(f"Fire type Pokemon count: {len(fire_pokemon)}")
|
163
|
+
print(f"First 5 Fire Pokemon: {[p.name for p in fire_pokemon[:5]]}")
|
164
|
+
|
165
|
+
# Get all moves of a specific type
|
166
|
+
all_moves = dex.get_all_moves()
|
167
|
+
electric_moves = [m for m in all_moves if m.type == "Electric"]
|
168
|
+
print(f"Electric moves count: {len(electric_moves)}")
|
169
|
+
print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
|
158
170
|
```
|
159
171
|
|
160
172
|
## API Reference
|
@@ -1,6 +1,6 @@
|
|
1
1
|
localdex/__init__.py,sha256=rAVSDHi5KVKNiMaKgZZ04_Kl7j2KPCZuWO7OuDU6id8,748
|
2
2
|
localdex/cli.py,sha256=79NpeQQYwuDuM6wODUX1AOUppTPULD5T0qgTH5uKd2c,16797
|
3
|
-
localdex/core.py,sha256=
|
3
|
+
localdex/core.py,sha256=3uIV5F94oLfvaOF1FbXkqKG5Xigg0yaEcd6guT_44Nk,20884
|
4
4
|
localdex/data_loader.py,sha256=hi9aSTto5Ti-OBGOgrQ-XwD5hmivsUwS1uC4rulhwQI,11366
|
5
5
|
localdex/download_data.py,sha256=ibAHDxL60sV4LVN9isCmf8vvd_aI9IQbyjJpU0FHGUo,18869
|
6
6
|
localdex/exceptions.py,sha256=Z02-8Kci6jFDk2nnGdVSHZJMDDWE9vuwuASs4VM3To8,2777
|
@@ -4790,8 +4790,8 @@ localdex/models/ability.py,sha256=AQzv3XUHHl4sustMJjPDDjJOjXu2GMLTfcM3-tqQ_1w,30
|
|
4790
4790
|
localdex/models/item.py,sha256=zXao8F-jBPUGq_YLeGeYeK_dZVI7aZMXtWOPwR3qusY,4677
|
4791
4791
|
localdex/models/move.py,sha256=hfgcWI4ziz5MMvc9ddmkotxzYYdrSUqZZQ72IU5tucs,7629
|
4792
4792
|
localdex/models/pokemon.py,sha256=v5zkxY1NGGR-MczFCZe9fHt6u_BAqAjMiQZlpcLXVGc,5408
|
4793
|
-
localdex-0.1.
|
4794
|
-
localdex-0.1.
|
4795
|
-
localdex-0.1.
|
4796
|
-
localdex-0.1.
|
4797
|
-
localdex-0.1.
|
4793
|
+
localdex-0.1.6.dist-info/METADATA,sha256=MFUsMphzcwYkxi7-77LK56mZ6IELXTRJVEtecIeDIBo,11767
|
4794
|
+
localdex-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4795
|
+
localdex-0.1.6.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
|
4796
|
+
localdex-0.1.6.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
|
4797
|
+
localdex-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|