10000 Fix datetime related deprecation warnings in update scripts · dotbit1/python-stdnum@01e87f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 01e87f9

Browse files
committed
Fix datetime related deprecation warnings in update scripts
1 parent 37320ea commit 01e87f9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

update/cn_loc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# update/cn_loc.py - script to fetch data from the CN Open Data community
44
#
55
# Copyright (C) 2014-2015 Jiangge Zhang
6-
# Copyright (C) 2015-2022 Arthur de Jong
6+
# Copyright (C) 2015-2025 Arthur de Jong
77
#
88
# This library is free software; you can redistribute it and/or
99
# modify it under the terms of the GNU Lesser General Public
@@ -25,9 +25,9 @@
2525

2626
from __future__ import print_function, unicode_literals
2727

28+
import datetime
2829
import sys
2930
from collections import OrderedDict
30-
from datetime import datetime
3131

3232
import requests
3333

@@ -87,7 +87,7 @@ def group_data(data_collection):
8787
"""Output a data file in the right format."""
8888
print("# generated from National Bureau of Statistics of the People's")
8989
print('# Republic of China, downloaded from %s' % data_url)
90-
print('# %s' % datetime.utcnow())
90+
print('# %s' % datetime.datetime.now(datetime.UTC))
9191
data_collection = fetch_data()
9292
for data in group_data(data_collection):
9393
print('%s county="%s" prefecture="%s" province="%s"' % data)

update/gs1_ai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# update/gs1_ai.py - script to get GS1 application identifiers
44
#
5-
# Copyright (C) 2019-2024 Arthur de Jong
5+
# Copyright (C) 2019-2025 Arthur de Jong
66
#
77
# This library is free software; you can redistribute it and/or
88
# modify it under the terms of the GNU Lesser General Public
@@ -75,7 +75,7 @@ def group_ai_ranges():
7575

7676
if __name__ == '__main__':
7777
print('# generated from %s' % download_url)
78-
print('# on %s' % datetime.datetime.utcnow())
78+
print('# on %s' % datetime.datetime.now(datetime.UTC))
7979
for ai1, ai2, format, require_fnc1, name, description in group_ai_ranges():
8080
_type = 'str'
8181
if re.match(r'^(N[68]\[?\+)?N[0-9]*[.]*[0-9]+\]?$', format) and 'date' in description.lower():

0 commit comments

Comments
 (0)
0