5
5
6
6
from __future__ import annotations
7
7
8
- import datetime
9
8
import json
10
9
import re
10
+ from datetime import datetime , timezone
11
11
from typing import TYPE_CHECKING
12
12
from warnings import warn
13
13
@@ -302,7 +302,7 @@ def from_cif_str(
302
302
source = "uploaded cif"
303
303
source_info = {
304
304
"source" : source ,
305
- "datetime" : str (datetime .datetime . now (tz = datetime . timezone .utc )),
305
+ "datetime" : str (datetime .now (tz = timezone .utc )),
306
306
"original_file" : raw_str ,
307
307
"cif_data" : cif_dict [cif_keys [0 ]],
308
308
}
@@ -330,7 +330,7 @@ def from_poscar_str(
330
330
struct = poscar .structure
331
331
source_info = {
332
332
"source" : "POSCAR" ,
333
- "datetime" : str (datetime .datetime . now (tz = datetime . timezone .utc )),
333
+ "datetime" : str (datetime .now (tz = timezone .utc )),
334
334
"original_file" : raw_str ,
335
335
}
336
336
return cls (struct , transformations , history = [source_info ])
@@ -341,7 +341,7 @@ def as_dict(self) -> dict[str, Any]:
341
341
dct ["@module" ] = type (self ).__module__
342
342
dct ["@class" ] = type (self ).__name__
343
343
dct ["history" ] = jsanitize (self .history )
344
- dct ["last_modified" ] = str (datetime .datetime . now (datetime . timezone .utc ))
344
+ dct ["last_modified" ] = str (datetime .now (timezone .utc ))
345
345
dct ["other_parameters" ] = jsanitize (self .other_parameters )
346
346
return dct
347
347
0 commit comments