stac-fastapi.types 2.5.0__tar.gz → 2.5.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 (24) hide show
  1. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/PKG-INFO +1 -1
  2. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/rfc3339.py +11 -6
  3. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/version.py +1 -1
  4. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/PKG-INFO +1 -1
  5. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/tests/test_rfc3339.py +7 -0
  6. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/README.md +0 -0
  7. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/setup.cfg +0 -0
  8. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/setup.py +0 -0
  9. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/__init__.py +0 -0
  10. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/config.py +0 -0
  11. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/conformance.py +0 -0
  12. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/core.py +0 -0
  13. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/errors.py +0 -0
  14. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/extension.py +0 -0
  15. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/links.py +0 -0
  16. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/requests.py +0 -0
  17. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/search.py +0 -0
  18. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi/types/stac.py +0 -0
  19. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/SOURCES.txt +0 -0
  20. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/dependency_links.txt +0 -0
  21. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/not-zip-safe +0 -0
  22. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/requires.txt +0 -0
  23. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/stac_fastapi.types.egg-info/top_level.txt +0 -0
  24. {stac_fastapi_types-2.5.0 → stac_fastapi_types-2.5.2}/tests/test_limit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.types
3
- Version: 2.5.0
3
+ Version: 2.5.2
4
4
  Summary: An implementation of STAC API based on the FastAPI framework.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi
6
6
  Author: Arturo Engineering
@@ -45,9 +45,7 @@ def rfc3339_str_to_datetime(s: str) -> datetime:
45
45
  return iso8601.parse_date(s)
46
46
 
47
47
 
48
- def str_to_interval(
49
- interval: str,
50
- ) -> Optional[DateTimeType]:
48
+ def str_to_interval(interval: Optional[str]) -> Optional[DateTimeType]:
51
49
  """Extract a tuple of datetimes from an interval string.
52
50
 
53
51
  Interval strings are defined by
@@ -56,12 +54,19 @@ def str_to_interval(
56
54
  or end (but not both) to be open-ended with '..' or ''.
57
55
 
58
56
  Args:
59
- interval (str) : The interval string to convert to a :class:`datetime.datetime`
60
- tuple.
57
+ interval (str or None): The interval string to convert to a tuple of
58
+ datetime.datetime objects, or None if no datetime is specified.
59
+
60
+ Returns:
61
+ Optional[DateTimeType]: A tuple of datetime.datetime objects or None if
62
+ input is None.
61
63
 
62
64
  Raises:
63
- ValueError: If the string is not a valid interval string.
65
+ ValueError: If the string is not a valid interval string and not None.
64
66
  """
67
+ if interval is None:
68
+ return None
69
+
65
70
  if not interval:
66
71
  raise ValueError("Empty interval string is invalid.")
67
72
 
@@ -1,2 +1,2 @@
1
1
  """Library version."""
2
- __version__ = "2.5.0"
2
+ __version__ = "2.5.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.types
3
- Version: 2.5.0
3
+ Version: 2.5.2
4
4
  Summary: An implementation of STAC API based on the FastAPI framework.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi
6
6
  Author: Arturo Engineering
@@ -103,3 +103,10 @@ def test_now_functions() -> None:
103
103
  assert now1.tzinfo == timezone.utc
104
104
 
105
105
  rfc3339_str_to_datetime(now_to_rfc3339_str())
106
+
107
+
108
+ def test_str_to_interval_with_none():
109
+ """Test that str_to_interval returns None when provided with None."""
110
+ assert (
111
+ str_to_interval(None) is None
112
+ ), "str_to_interval should return None when input is None"