File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 8585 cd stac_fastapi/api && pipenv run pytest -svvv
8686 env :
8787 ENVIRONMENT : testing
88-
88+
89+ - name : Run test suite
90+ run : |
91+ cd stac_fastapi/types && pipenv run pytest -svvv
92+ env :
93+ ENVIRONMENT : testing
94+
8995 - name : Run test suite
9096 run : |
9197 cd stac_fastapi/sqlalchemy && pipenv run pytest -svvv
Original file line number Diff line number Diff line change 99### Removed
1010
1111### Fixed
12+ * ` ciso8601 ` fails to build in some environments, instead use ` pyiso8601 ` to parse datetimes.
1213
1314## [ 2.4.0]
1415
Original file line number Diff line number Diff line change 1111 "pydantic[dotenv]" ,
1212 "stac_pydantic==2.0.*" ,
1313 "pystac==1.*" ,
14- "ciso8601~=2.2.0 " ,
14+ "iso8601~=1.0.2 " ,
1515]
1616
1717extra_reqs = {
Original file line number Diff line number Diff line change 11"""rfc3339."""
2-
2+ import re
33from datetime import datetime , timezone
44from typing import Optional , Tuple
55
6- import ciso8601
6+ import iso8601
77from pystac .utils import datetime_to_str
88
9+ RFC33339_PATTERN = r"^(\d\d\d\d)\-(\d\d)\-(\d\d)(T|t)(\d\d):(\d\d):(\d\d)([.]\d+)?(Z|([-+])(\d\d):(\d\d))$"
10+
911
1012def rfc3339_str_to_datetime (s : str ) -> datetime :
1113 """Convert a string conforming to RFC 3339 to a :class:`datetime.datetime`.
1214
13- Uses :meth:`ciso8601.parse_rfc3339 ` under the hood.
15+ Uses :meth:`iso8601.parse_date ` under the hood.
1416
1517 Args:
1618 s (str) : The string to convert to :class:`datetime.datetime`.
@@ -21,7 +23,16 @@ def rfc3339_str_to_datetime(s: str) -> datetime:
2123 Raises:
2224 ValueError: If the string is not a valid RFC 3339 string.
2325 """
24- return ciso8601 .parse_rfc3339 (s )
26+ # Uppercase the string
27+ s = s .upper ()
28+
29+ # Match against RFC3339 regex.
30+ result = re .match (RFC33339_PATTERN , s )
31+ if not result :
32+ raise ValueError ("Invalid RFC3339 datetime." )
33+
34+ # Parse with pyiso8601
35+ return iso8601 .parse_date (s )
2536
2637
2738def str_to_interval (
You can’t perform that action at this time.
0 commit comments