zpdatafetch 2.2.2__tar.gz → 2.2.4__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.
Files changed (84) hide show
  1. {zpdatafetch-2.2.2/src/zpdatafetch.egg-info → zpdatafetch-2.2.4}/PKG-INFO +2 -1
  2. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/pyproject.toml +3 -1
  3. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zp_utils.py +7 -0
  4. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpcyclist.py +2 -5
  5. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpprime.py +2 -1
  6. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpracefinish.py +3 -0
  7. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpracesignup.py +2 -2
  8. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpracesprint.py +2 -2
  9. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpteam.py +3 -3
  10. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4/src/zpdatafetch.egg-info}/PKG-INFO +2 -1
  11. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch.egg-info/requires.txt +1 -0
  12. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zr_utils.py +12 -0
  13. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/LICENSE +0 -0
  14. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/README.md +0 -0
  15. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/setup.cfg +0 -0
  16. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/__init__.py +0 -0
  17. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/cli.py +0 -0
  18. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/config.py +0 -0
  19. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/error_helpers.py +0 -0
  20. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/exceptions.py +0 -0
  21. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/http_client.py +0 -0
  22. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/json_helpers.py +0 -0
  23. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/logging.py +0 -0
  24. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/shared/validation.py +0 -0
  25. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/__init__.py +0 -0
  26. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/activity.py +0 -0
  27. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/auth.py +0 -0
  28. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/cli.py +0 -0
  29. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/config.py +0 -0
  30. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/followers.py +0 -0
  31. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/logging_config.py +0 -0
  32. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/profile.py +0 -0
  33. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/rideons.py +0 -0
  34. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/ridersinworld.py +0 -0
  35. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zdatafetch/worlds.py +0 -0
  36. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/__init__.py +0 -0
  37. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/async_zp.py +0 -0
  38. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/cli.py +0 -0
  39. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/config.py +0 -0
  40. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/logging_config.py +0 -0
  41. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zp.py +0 -0
  42. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zp_obj.py +0 -0
  43. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpcyclistfetch.py +0 -0
  44. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpleague.py +0 -0
  45. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpleaguefetch.py +0 -0
  46. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpprimesfetch.py +0 -0
  47. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpracelog.py +0 -0
  48. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpraceresult.py +0 -0
  49. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpresultfetch.py +0 -0
  50. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpsignupfetch.py +0 -0
  51. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpsprintsfetch.py +0 -0
  52. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch/zpteamfetch.py +0 -0
  53. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch.egg-info/SOURCES.txt +0 -0
  54. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch.egg-info/dependency_links.txt +0 -0
  55. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch.egg-info/entry_points.txt +0 -0
  56. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zpdatafetch.egg-info/top_level.txt +0 -0
  57. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/__init__.py +0 -0
  58. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/async_zr.py +0 -0
  59. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/cli.py +0 -0
  60. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/config.py +0 -0
  61. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/logging_config.py +0 -0
  62. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/rate_limiter.py +0 -0
  63. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zr.py +0 -0
  64. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrraceresult.py +0 -0
  65. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrresultfetch.py +0 -0
  66. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrrider.py +0 -0
  67. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrriderfetch.py +0 -0
  68. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrteamfetch.py +0 -0
  69. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zrdatafetch/zrteamroster.py +0 -0
  70. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/__init__.py +0 -0
  71. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/async_zs.py +0 -0
  72. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/cli.py +0 -0
  73. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/logging_config.py +0 -0
  74. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/__init__.py +0 -0
  75. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/component.py +0 -0
  76. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/incident.py +0 -0
  77. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/maintenance.py +0 -0
  78. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/page.py +0 -0
  79. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/status.py +0 -0
  80. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/models/summary.py +0 -0
  81. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/zs.py +0 -0
  82. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/zsincidentfetch.py +0 -0
  83. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/zsmaintenancefetch.py +0 -0
  84. {zpdatafetch-2.2.2 → zpdatafetch-2.2.4}/src/zsdatafetch/zssummaryfetch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zpdatafetch
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: A package for fetching data from Zwiftpower and Zwiftracing.app
5
5
  Author-email: Doug Morris <doug@mhost.com>
6
6
  License-Expression: MIT
@@ -18,6 +18,7 @@ Requires-Dist: httpx>=0.28.0
18
18
  Requires-Dist: keyring>=25.2.0
19
19
  Requires-Dist: keyrings-alt
20
20
  Requires-Dist: lxml>=5.4.0
21
+ Requires-Dist: protobuf>=7.34.1
21
22
  Provides-Extra: async-full
22
23
  Requires-Dist: trio>=0.26.0; extra == "async-full"
23
24
  Provides-Extra: trio
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zpdatafetch"
3
- version = "2.2.2"
3
+ version = "2.2.4"
4
4
  description = "A package for fetching data from Zwiftpower and Zwiftracing.app"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -28,6 +28,7 @@ dependencies = [
28
28
  "keyring>=25.2.0",
29
29
  "keyrings-alt",
30
30
  "lxml>=5.4.0",
31
+ "protobuf>=7.34.1",
31
32
  ]
32
33
 
33
34
  [project.urls]
@@ -175,6 +176,7 @@ deps =
175
176
  """
176
177
 
177
178
  [tool.ty]
179
+
178
180
  # Python environment configuration
179
181
  [tool.ty.environment]
180
182
  python-version = "3.10" # Minimum supported version
@@ -214,6 +214,11 @@ def extract_value(value: Any, default: Any = None) -> Any:
214
214
  def extract_numeric(value: Any, type_func: type, default: Any) -> Any:
215
215
  """Extract and convert numeric value, handling array format.
216
216
 
217
+ String inputs have US-locale thousands separators (commas) stripped before
218
+ conversion, so values like ``'7,200.0'`` parse correctly. Decimal-comma
219
+ inputs (e.g. European ``'7,2'`` meaning 7.2) are not supported and will
220
+ fall back to ``default``.
221
+
217
222
  Args:
218
223
  value: Value that may be a list or scalar
219
224
  type_func: Type conversion function (int, float)
@@ -225,6 +230,8 @@ def extract_numeric(value: Any, type_func: type, default: Any) -> Any:
225
230
  extracted = extract_value(value, default)
226
231
  if extracted == default:
227
232
  return default
233
+ if isinstance(extracted, str):
234
+ extracted = extracted.replace(',', '')
228
235
  try:
229
236
  return type_func(extracted)
230
237
  except (ValueError, TypeError):
@@ -9,6 +9,7 @@ import json
9
9
  from dataclasses import dataclass, field
10
10
  from typing import Any
11
11
 
12
+ from zpdatafetch.zp_utils import extract_numeric
12
13
  from zpdatafetch.zpracelog import ZPRacelog
13
14
 
14
15
 
@@ -206,11 +207,7 @@ class ZPCyclist:
206
207
  height = 0
207
208
 
208
209
  # Extract weight
209
- weight_value = extract_value(last_race.get('weight', 0.0))
210
- try:
211
- weight = float(weight_value) if weight_value else 0.0
212
- except (ValueError, TypeError):
213
- weight = 0.0
210
+ weight = extract_numeric(last_race.get('weight'), float, 0.0)
214
211
 
215
212
  # Extract skill
216
213
  skill_value = extract_value(last_race.get('skill', 0.0))
@@ -16,6 +16,7 @@ from typing import Any, overload
16
16
  from zpdatafetch.zp_utils import (
17
17
  convert_gender,
18
18
  convert_msec_to_iso8601,
19
+ extract_numeric,
19
20
  set_rider_category,
20
21
  )
21
22
 
@@ -117,7 +118,7 @@ class ZPPrimeResult:
117
118
  elapsed=float(data.get('elapsed', 0.0)),
118
119
  elapsed_diff=float(data.get('elapsed_diff', 0.0)),
119
120
  zftp=int(data.get('ftp', 0)) if data.get('ftp') else 0,
120
- weight=float(data.get('w', 0.0)) if data.get('w') else 0.0,
121
+ weight=extract_numeric(data.get('w'), float, 0.0),
121
122
  age=str(data.get('age', '')),
122
123
  gender=convert_gender(data.get('gender', '')),
123
124
  flag=str(data.get('flag', '')),
@@ -294,6 +294,9 @@ class ZPRaceFinish:
294
294
  return default
295
295
  # Extract from array if needed
296
296
  value = extract_array_value(value)
297
+ # Strip US thousands separators from string inputs (e.g. '7,200.0').
298
+ if isinstance(value, str) and field_type in (int, float):
299
+ value = value.replace(',', '')
297
300
  try:
298
301
  return field_type(value) if value is not None else default
299
302
  except (ValueError, TypeError):
@@ -7,6 +7,7 @@ from typing import Any
7
7
  from zpdatafetch.zp_utils import (
8
8
  convert_gender,
9
9
  convert_label_to_pen,
10
+ extract_numeric,
10
11
  extract_value,
11
12
  set_rider_category,
12
13
  )
@@ -284,8 +285,7 @@ class ZPRiderSignup:
284
285
  int(extract_value(height_raw, 0)) if extract_value(height_raw, 0) else 0
285
286
  )
286
287
 
287
- weight_raw = data.get('weight', 0)
288
- weight = float(extract_value(weight_raw, 0))
288
+ weight = extract_numeric(data.get('weight'), float, 0.0)
289
289
 
290
290
  # Category with division mapping (div: 0/5/10/20/30/40 -> empty/A+/A/B/C/D)
291
291
  category = ''
@@ -12,6 +12,7 @@ from typing import Any
12
12
  from zpdatafetch.zp_utils import (
13
13
  convert_gender,
14
14
  convert_label_to_pen,
15
+ extract_numeric,
15
16
  extract_value,
16
17
  )
17
18
 
@@ -170,8 +171,7 @@ class ZPRiderSprint:
170
171
  height_val = extract_value(data.get('height', 0), 0)
171
172
  height = int(height_val) if height_val else 0
172
173
 
173
- weight_val = extract_value(data.get('weight', 0), 0)
174
- weight = float(weight_val) if weight_val else 0.0
174
+ weight = extract_numeric(data.get('weight'), float, 0.0)
175
175
 
176
176
  # Category
177
177
  category = str(data.get('category', ''))
@@ -11,6 +11,7 @@ from typing import Any
11
11
 
12
12
  from zpdatafetch.zp_utils import (
13
13
  convert_gender,
14
+ extract_numeric,
14
15
  extract_value,
15
16
  format_time_hms,
16
17
  set_rider_category,
@@ -164,9 +165,8 @@ class ZPTeamMember:
164
165
  gender = convert_gender(data.get('gender', ''))
165
166
  flag = str(data.get('flag', ''))
166
167
 
167
- # Weight from array format or direct value (using extract_value utility)
168
- weight_val = extract_value(data.get('w', 0), 0)
169
- weight = float(weight_val) if weight_val else 0.0
168
+ # Weight from array format or direct value
169
+ weight = extract_numeric(data.get('w'), float, 0.0)
170
170
 
171
171
  # FTP from array format or direct value (using extract_value utility)
172
172
  ftp_val = extract_value(data.get('ftp', 0), 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zpdatafetch
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: A package for fetching data from Zwiftpower and Zwiftracing.app
5
5
  Author-email: Doug Morris <doug@mhost.com>
6
6
  License-Expression: MIT
@@ -18,6 +18,7 @@ Requires-Dist: httpx>=0.28.0
18
18
  Requires-Dist: keyring>=25.2.0
19
19
  Requires-Dist: keyrings-alt
20
20
  Requires-Dist: lxml>=5.4.0
21
+ Requires-Dist: protobuf>=7.34.1
21
22
  Provides-Extra: async-full
22
23
  Requires-Dist: trio>=0.26.0; extra == "async-full"
23
24
  Provides-Extra: trio
@@ -5,6 +5,7 @@ httpx>=0.28.0
5
5
  keyring>=25.2.0
6
6
  keyrings-alt
7
7
  lxml>=5.4.0
8
+ protobuf>=7.34.1
8
9
 
9
10
  [async-full]
10
11
  trio>=0.26.0
@@ -11,6 +11,9 @@ from typing import Any
11
11
  def safe_int(value: Any, default: int = 0) -> int: # noqa: ANN401
12
12
  """Safely convert value to integer.
13
13
 
14
+ String inputs have US-locale thousands separators (commas) stripped before
15
+ conversion, so values like ``'7,200'`` parse correctly.
16
+
14
17
  Args:
15
18
  value: Value to convert
16
19
  default: Default value if conversion fails (default: 0)
@@ -20,6 +23,8 @@ def safe_int(value: Any, default: int = 0) -> int: # noqa: ANN401
20
23
  """
21
24
  if value is None:
22
25
  return default
26
+ if isinstance(value, str):
27
+ value = value.replace(',', '')
23
28
  try:
24
29
  return int(value)
25
30
  except (ValueError, TypeError):
@@ -29,6 +34,11 @@ def safe_int(value: Any, default: int = 0) -> int: # noqa: ANN401
29
34
  def safe_float(value: Any, default: float = 0.0) -> float: # noqa: ANN401
30
35
  """Safely convert value to float.
31
36
 
37
+ String inputs have US-locale thousands separators (commas) stripped before
38
+ conversion, so values like ``'7,200.0'`` parse correctly. Decimal-comma
39
+ inputs (e.g. European ``'7,2'`` meaning 7.2) are not supported and will
40
+ fall back to ``default``.
41
+
32
42
  Args:
33
43
  value: Value to convert
34
44
  default: Default value if conversion fails (default: 0.0)
@@ -38,6 +48,8 @@ def safe_float(value: Any, default: float = 0.0) -> float: # noqa: ANN401
38
48
  """
39
49
  if value is None:
40
50
  return default
51
+ if isinstance(value, str):
52
+ value = value.replace(',', '')
41
53
  try:
42
54
  return float(value)
43
55
  except (ValueError, TypeError):
File without changes
File without changes
File without changes