File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 9
9
import datetime
10
10
import gzip
11
11
import importlib .resources
12
+ import importlib .resources .abc
12
13
import json
13
14
14
15
import platformdirs
17
18
18
19
content : dict [str , str ] = {"START" : "1970-01-01" , "OFFSETS_GZ" : "H4sIAFNx1mYC/wMAAAAAAAAAAAA=" }
19
20
21
+ path : importlib .resources .abc .Traversable
20
22
21
- for location in [
23
+ for location in [ # pragma no branch
22
24
platformdirs .user_data_path ("wwvbpy" , "unpythonic.net" ),
23
25
platformdirs .site_data_path ("wwvbpy" , "unpythonic.net" ),
24
- importlib .resources .files ("wwvb" ),
25
26
]:
26
27
path = location / "iersdata.json"
27
- if path .exists (): # pragma no cover
28
- content = json .loads (path .read_text (encoding = "utf-8" ))
28
+ if path .exists (): # pragma no branch
29
29
break
30
+ else : # pragma no cover
31
+ path = importlib .resources .files ("wwvb" ) / "iersdata.json"
32
+
33
+ content = json .loads (path .read_text (encoding = "utf-8" ))
30
34
31
35
DUT1_DATA_START = datetime .date .fromisoformat (content ["START" ])
32
36
DUT1_OFFSETS = gzip .decompress (binascii .a2b_base64 (content ["OFFSETS_GZ" ])).decode ("ascii" )
You can’t perform that action at this time.
0 commit comments