parseapi 1.9.1__tar.gz → 1.9.2__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 (35) hide show
  1. {parseapi-1.9.1 → parseapi-1.9.2}/PKG-INFO +3 -1
  2. {parseapi-1.9.1 → parseapi-1.9.2}/README.md +2 -0
  3. {parseapi-1.9.1 → parseapi-1.9.2}/pyproject.toml +1 -1
  4. {parseapi-1.9.1 → parseapi-1.9.2}/src/parseapi/__init__.py +1 -1
  5. {parseapi-1.9.1 → parseapi-1.9.2}/src/parseapi/_client.py +2 -0
  6. parseapi-1.9.2/tests/fixtures/measure-response.json +51 -0
  7. parseapi-1.9.2/tests/test_measure_response.py +18 -0
  8. {parseapi-1.9.1 → parseapi-1.9.2}/.github/workflows/publish.yml +0 -0
  9. {parseapi-1.9.1 → parseapi-1.9.2}/.github/workflows/test.yml +0 -0
  10. {parseapi-1.9.1 → parseapi-1.9.2}/.gitignore +0 -0
  11. {parseapi-1.9.1 → parseapi-1.9.2}/CHANGELOG.md +0 -0
  12. {parseapi-1.9.1 → parseapi-1.9.2}/LICENSE +0 -0
  13. {parseapi-1.9.1 → parseapi-1.9.2}/api/public.json +0 -0
  14. {parseapi-1.9.1 → parseapi-1.9.2}/scripts/public_api.py +0 -0
  15. {parseapi-1.9.1 → parseapi-1.9.2}/smoke/smoke.py +0 -0
  16. {parseapi-1.9.1 → parseapi-1.9.2}/src/parseapi/py.typed +0 -0
  17. {parseapi-1.9.1 → parseapi-1.9.2}/tests/bank-fixtures.json +0 -0
  18. {parseapi-1.9.1 → parseapi-1.9.2}/tests/fixtures/emoji-artwork.json +0 -0
  19. {parseapi-1.9.1 → parseapi-1.9.2}/tests/fixtures/emoji-catalog.json +0 -0
  20. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_bank.py +0 -0
  21. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_card_dx.py +0 -0
  22. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_client.py +0 -0
  23. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_company_directory.py +0 -0
  24. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_email_enrichment.py +0 -0
  25. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_emoji.py +0 -0
  26. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_language.py +0 -0
  27. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_name_formatting.py +0 -0
  28. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_postal_localities.py +0 -0
  29. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_public_api.py +0 -0
  30. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_stack.py +0 -0
  31. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_tariff.py +0 -0
  32. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_time_complete.py +0 -0
  33. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_time_gaps.py +0 -0
  34. {parseapi-1.9.1 → parseapi-1.9.2}/tests/test_version.py +0 -0
  35. {parseapi-1.9.1 → parseapi-1.9.2}/tests/typing_company_directory.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: parseapi
3
- Version: 1.9.1
3
+ Version: 1.9.2
4
4
  Summary: Official ParseAPI client for Python. One key, minimal JSON, fast.
5
5
  Project-URL: Homepage, https://parseapi.com
6
6
  Project-URL: Documentation, https://parseapi.com/docs
@@ -260,6 +260,8 @@ units = parse.measure.units(unit="m")
260
260
 
261
261
  `amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
262
262
 
263
+ Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available.
264
+
263
265
  Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
264
266
 
265
267
  ## Place statistics and optional detail
@@ -241,6 +241,8 @@ units = parse.measure.units(unit="m")
241
241
 
242
242
  `amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
243
243
 
244
+ Successful HTTP JSON contains `measure`, `valid`, `type`, `amount`, and `unit`. Invalid input adds `reason`. `choices` appears only when unit alternatives are available.
245
+
244
246
  Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
245
247
 
246
248
  ## Place statistics and optional detail
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "parseapi"
7
- version = "1.9.1"
7
+ version = "1.9.2"
8
8
  description = "Official ParseAPI client for Python. One key, minimal JSON, fast."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -2,5 +2,5 @@
2
2
 
3
3
  from ._client import AsyncParseAPI, ParseAPI, ParseAPIError
4
4
 
5
- __version__ = "1.9.0"
5
+ __version__ = "1.9.2"
6
6
  __all__ = ["ParseAPI", "AsyncParseAPI", "ParseAPIError", "__version__"]
@@ -1176,6 +1176,7 @@ class _MeasureSync:
1176
1176
  def __call__(self, measure: str, *, to: Optional[str] = None, locale: Optional[str] = None, system: Optional[str] = None) -> Json:
1177
1177
  """Parse or convert a measurement. Amount is a decimal string. Without to, use the
1178
1178
  type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
1179
+ Successful JSON omits reason and choices. Invalid input adds reason and alternatives add choices.
1179
1180
  Invalid measurements return valid=False and a reason. Invalid targets raise an API error.
1180
1181
  """
1181
1182
  return self._client._get(f"/measure/{_seg(measure)}", {"to": to, "locale": locale, "system": system})
@@ -1192,6 +1193,7 @@ class _MeasureAsync:
1192
1193
  async def __call__(self, measure: str, *, to: Optional[str] = None, locale: Optional[str] = None, system: Optional[str] = None) -> Json:
1193
1194
  """Parse or convert a measurement. Amount is a decimal string. Without to, use the
1194
1195
  type's canonical unit. Locale and system (us or imperial) resolve explicit ambiguity.
1196
+ Successful JSON omits reason and choices. Invalid input adds reason and alternatives add choices.
1195
1197
  Invalid measurements return valid=False and a reason. Invalid targets raise an API error.
1196
1198
  """
1197
1199
  return await self._client._get(f"/measure/{_seg(measure)}", {"to": to, "locale": locale, "system": system})
@@ -0,0 +1,51 @@
1
+ [
2
+ {
3
+ "measure": "0 m",
4
+ "valid": true,
5
+ "type": "length",
6
+ "amount": "0",
7
+ "unit": "m"
8
+ },
9
+ {
10
+ "measure": "1.00000000000000000001 m",
11
+ "valid": true,
12
+ "type": "length",
13
+ "amount": "1",
14
+ "unit": "m"
15
+ },
16
+ {
17
+ "measure": "180",
18
+ "valid": false,
19
+ "type": null,
20
+ "amount": null,
21
+ "unit": null,
22
+ "reason": "missing_unit"
23
+ },
24
+ {
25
+ "measure": "1 gallon",
26
+ "valid": false,
27
+ "type": null,
28
+ "amount": null,
29
+ "unit": null,
30
+ "reason": "ambiguous_unit",
31
+ "choices": [
32
+ {
33
+ "unit": "gal_us",
34
+ "name": "US gallon"
35
+ },
36
+ {
37
+ "unit": "gal_imp",
38
+ "name": "imperial gallon"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "measure": "0 m",
44
+ "valid": true,
45
+ "type": "length",
46
+ "amount": "0",
47
+ "unit": "m",
48
+ "reason": null,
49
+ "choices": []
50
+ }
51
+ ]
@@ -0,0 +1,18 @@
1
+ import asyncio
2
+ import json
3
+ from pathlib import Path
4
+
5
+ import httpx
6
+ from parseapi import AsyncParseAPI, ParseAPI
7
+
8
+ CASES = json.loads((Path(__file__).parent / 'fixtures/measure-response.json').read_text())
9
+
10
+ def test_clean_and_legacy_measure_responses_sync_and_async():
11
+ for body in CASES:
12
+ transport = httpx.MockTransport(lambda request: httpx.Response(200, json=body))
13
+ with ParseAPI('fixture', transport=transport) as client:
14
+ assert client.measure(body['measure']) == body
15
+ async def check():
16
+ async with AsyncParseAPI('fixture', transport=transport) as client:
17
+ assert await client.measure(body['measure']) == body
18
+ asyncio.run(check())
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes