baseballcommand 0.0.4__tar.gz → 0.0.5__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.
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/PKG-INFO +1 -1
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/pyproject.toml +3 -2
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/src/baseballcommand/commands/players.py +8 -5
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/src/baseballcommand/__init__.py +0 -0
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/src/baseballcommand/cli.py +0 -0
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/src/baseballcommand/commands/schedule.py +0 -0
- {baseballcommand-0.0.4 → baseballcommand-0.0.5}/src/baseballcommand/utils.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "baseballcommand"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.5"
|
|
8
8
|
description = "This is a tool that will retrieve Major League Baseball scores and stats in your command line."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Owen Powell",email = "opowell2899@gmail.com"}
|
|
@@ -21,5 +21,6 @@ base = "baseballcommand:cli" # CLI entry point
|
|
|
21
21
|
|
|
22
22
|
[dependency-groups]
|
|
23
23
|
dev = [
|
|
24
|
-
"ruff (>=0.16.5,<0.17.0)"
|
|
24
|
+
"ruff (>=0.16.5,<0.17.0)",
|
|
25
|
+
"pytest (>=9.2.0,<10.0.0)"
|
|
25
26
|
]
|
|
@@ -34,14 +34,17 @@ def get_active_players(season):
|
|
|
34
34
|
return response.json().get('people', [])
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
def player_names(player):
|
|
38
|
+
# Both the full name and the name the player goes by (e.g. "Mike" vs "Michael")
|
|
39
|
+
return {normalize_name(player['fullName']),
|
|
40
|
+
normalize_name(f'{player.get("useName", "")} {player.get("lastName", "")}')}
|
|
41
|
+
|
|
42
|
+
|
|
37
43
|
def find_players(name, players):
|
|
38
44
|
target = normalize_name(name)
|
|
39
45
|
names = {}
|
|
40
46
|
for player in players:
|
|
41
|
-
|
|
42
|
-
keys = {normalize_name(player['fullName']),
|
|
43
|
-
normalize_name(f'{player.get("useName", "")} {player.get("lastName", "")}')}
|
|
44
|
-
for key in keys:
|
|
47
|
+
for key in player_names(player):
|
|
45
48
|
names.setdefault(key, []).append(player)
|
|
46
49
|
|
|
47
50
|
if target in names:
|
|
@@ -107,7 +110,7 @@ def player_search(first_name, last_name):
|
|
|
107
110
|
print('No player selected.')
|
|
108
111
|
return
|
|
109
112
|
|
|
110
|
-
if normalize_name(
|
|
113
|
+
if normalize_name(name) not in player_names(player):
|
|
111
114
|
print(f'Showing results for {player["fullName"]}')
|
|
112
115
|
|
|
113
116
|
position = player['primaryPosition']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|