localdex 0.1.6__py3-none-any.whl → 0.1.7__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/cli.py CHANGED
@@ -27,6 +27,7 @@ Examples:
27
27
  localdex ability lightningrod
28
28
  localdex list-pokemon --generation 1
29
29
  localdex export --format json --output pokemon_data.json
30
+ localdex demo
30
31
  """
31
32
  )
32
33
 
@@ -89,6 +90,10 @@ Examples:
89
90
  stats_parser = subparsers.add_parser("stats", help="Show data statistics")
90
91
  stats_parser.add_argument("--format", choices=["text", "json"], default="text", help="Output format")
91
92
 
93
+ # Demo command
94
+ demo_parser = subparsers.add_parser("demo", help="Run the LocalDex demo")
95
+ demo_parser.add_argument("--quiet", action="store_true", help="Suppress output (for testing)")
96
+
92
97
  args = parser.parse_args()
93
98
 
94
99
  if not args.command:
@@ -116,6 +121,8 @@ Examples:
116
121
  return handle_export_command(dex, args)
117
122
  elif args.command == "stats":
118
123
  return handle_stats_command(dex, args)
124
+ elif args.command == "demo":
125
+ return handle_demo_command(dex, args)
119
126
  else:
120
127
  print(f"Unknown command: {args.command}")
121
128
  return 1
@@ -371,6 +378,64 @@ def handle_stats_command(dex: LocalDex, args) -> int:
371
378
  return 1
372
379
 
373
380
 
381
+ def handle_demo_command(dex: LocalDex, args) -> int:
382
+ """Handle the demo command."""
383
+ try:
384
+ if not args.quiet:
385
+ print("=== LocalDex Demo ===\n")
386
+
387
+ # Get Pokemon by name
388
+ pikachu = dex.get_pokemon("pikachu")
389
+ if not args.quiet:
390
+ print(f"{pikachu.name} - {pikachu.types}")
391
+
392
+ # Get Pokemon by ID
393
+ charizard = dex.get_pokemon_by_id(6)
394
+ if not args.quiet:
395
+ print(f"{charizard.name} - HP: {charizard.base_stats.hp}")
396
+
397
+ # Get Pokemon stats
398
+ bulbasaur = dex.get_pokemon("bulbasaur")
399
+ if not args.quiet:
400
+ print(f"{bulbasaur.name} - Attack: {bulbasaur.base_stats.attack}, Speed: {bulbasaur.base_stats.speed}")
401
+
402
+ # Get moves
403
+ thunderbolt = dex.get_move("thunderbolt")
404
+ if not args.quiet:
405
+ print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}, Type: {thunderbolt.type}")
406
+
407
+ # Get abilities (note: use dashes in names like "lightning-rod")
408
+ lightning_rod = dex.get_ability("lightning-rod")
409
+ if not args.quiet:
410
+ print(f"{lightning_rod.name} - {lightning_rod.description}")
411
+
412
+ # Search Pokemon by type (case-insensitive)
413
+ fire_types = dex.search_pokemon(type="fire")
414
+ if not args.quiet:
415
+ print(f"Fire type Pokemon: {[p.name for p in fire_types[:5]]}")
416
+
417
+ # Search Pokemon by stat
418
+ fast_pokemon = dex.search_pokemon(min_speed=120)
419
+ if not args.quiet:
420
+ print(f"Very fast Pokemon: {[p.name for p in fast_pokemon[:5]]}")
421
+
422
+ # Get all moves of a specific type (case-insensitive)
423
+ all_moves = dex.get_all_moves()
424
+ electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
425
+ if not args.quiet:
426
+ print(f"Electric moves count: {len(electric_moves)}")
427
+ print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
428
+
429
+ if not args.quiet:
430
+ print("\n=== Demo completed successfully! ===")
431
+
432
+ return 0
433
+
434
+ except Exception as e:
435
+ print(f"Error running demo: {e}", file=sys.stderr)
436
+ return 1
437
+
438
+
374
439
  def print_pokemon_text(pokemon) -> None:
375
440
  """Print Pokemon information in text format."""
376
441
  print(f"Pokemon: {pokemon.name} (#{pokemon.id})")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: localdex
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
@@ -154,17 +154,19 @@ print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}, Type: {thunderbolt
154
154
 
155
155
  # Get abilities (note: use dashes in names like "lightning-rod")
156
156
  lightning_rod = dex.get_ability("lightning-rod")
157
- print(f"{lightning_rod.name} - {lightning_rod.short_description}")
157
+ print(f"{lightning_rod.name} - {lightning_rod.description}")
158
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]]}")
159
+ # Search Pokemon by type (case-insensitive)
160
+ fire_types = dex.search_pokemon(type="fire")
161
+ print(f"Fire type Pokemon: {[p.name for p in fire_types[:5]]}")
164
162
 
165
- # Get all moves of a specific type
163
+ # Search Pokemon by stat
164
+ fast_pokemon = dex.search_pokemon(min_speed=120)
165
+ print(f"Very fast Pokemon: {[p.name for p in fast_pokemon[:5]]}")
166
+
167
+ # Get all moves of a specific type (case-insensitive)
166
168
  all_moves = dex.get_all_moves()
167
- electric_moves = [m for m in all_moves if m.type == "Electric"]
169
+ electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
168
170
  print(f"Electric moves count: {len(electric_moves)}")
169
171
  print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
170
172
  ```
@@ -1,5 +1,5 @@
1
1
  localdex/__init__.py,sha256=rAVSDHi5KVKNiMaKgZZ04_Kl7j2KPCZuWO7OuDU6id8,748
2
- localdex/cli.py,sha256=79NpeQQYwuDuM6wODUX1AOUppTPULD5T0qgTH5uKd2c,16797
2
+ localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
3
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
@@ -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.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,,
4793
+ localdex-0.1.7.dist-info/METADATA,sha256=0h70MedTspOD4BdGcyPyM6b7TePyViVwWKpz8d7k3Yw,11808
4794
+ localdex-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4795
+ localdex-0.1.7.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
4796
+ localdex-0.1.7.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
4797
+ localdex-0.1.7.dist-info/RECORD,,