Skip to content

Commit f00ae91

Browse files
authored
MNT: Remove use of utcnow() and change to naive datetimes instead. (#1450)
1 parent ca9ed15 commit f00ae91

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

pyproj/sync.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ def _load_grid_geojson(target_directory: str | Path | None = None) -> dict[str,
199199
target_directory = get_user_data_dir(True)
200200
local_path = Path(target_directory, "files.geojson")
201201
if not local_path.exists() or (
202-
(datetime.utcnow() - datetime.fromtimestamp(local_path.stat().st_mtime)).days
203-
> 0
202+
(datetime.now() - datetime.fromtimestamp(local_path.stat().st_mtime)).days > 0
204203
):
205204
_download_resource_file(
206205
file_url=f"{get_proj_endpoint()}/files.geojson",

test/test_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def dummy_urlretrieve(url, local_path):
195195
@patch("pyproj.sync.Path.stat")
196196
def test__load_grid_geojson_old_file(stat_mock, tmp_path):
197197
return_timestamp = MagicMock()
198-
return_timestamp.st_mtime = (datetime.utcnow() - timedelta(days=2)).timestamp()
198+
return_timestamp.st_mtime = (datetime.now() - timedelta(days=2)).timestamp()
199199
stat_mock.return_value = return_timestamp
200200
tmp_path.joinpath("files.geojson").touch()
201201
grids = _load_grid_geojson(target_directory=tmp_path)

0 commit comments

Comments
 (0)