Mercurial > hg > cc > azure
annotate master/bin/fixDates.py @ 68:1f04bce6ead7 default tip
use basefile instead of transferfile, and remove cleanup: belt and braces wrt lossage of sac_schemes.py in 15% of 1000_k3,
this as used in a_2
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Thu, 04 Jun 2020 20:44:44 +0000 |
parents | 3313edbab3b0 |
children |
rev | line source |
---|---|
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
1 #!/usr/bin/env python3 |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
2 import sys,re |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
3 from array import array |
33
4c117ee8ed75
fixDates, _fixAndMerge, _doFetch
Henry S. Thompson <ht@markup.co.uk>
parents:
32
diff
changeset
|
4 from time import strftime |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
5 ok=re.compile('(https?) ([^ ]*) ((?:19|20)..) ([0-9][0-9]*)$') |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
6 #parseable=re.compile('.*[-:/]\w+[-:/]|\w+\s\d{4}|\d{10}') |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
7 from dateparser import parse |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
8 |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
9 n=0 |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
10 bogons=0 |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
11 HTTP=0 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
12 HTTPS=1 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
13 sn=['http','https'] |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
14 http_ytab=list(201*[None]) # 1900--2100 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
15 https_ytab=list(201*[None]) |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
16 tab=[http_ytab,https_ytab] |
34
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
17 nd=[0,0] # no date |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
18 ed=[0,0] # date < 1900 |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
19 ld=[0,0] # date > 2100 |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
20 mn=[None,'Jan','Feb','Mar','Apr','May','Jun', |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
21 'Jul','Aug','Sep','Oct','Nov','Dec'] |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
22 months=dict(zip(mn[1:],range(1,13))) |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
23 for l in sys.stdin: |
33
4c117ee8ed75
fixDates, _fixAndMerge, _doFetch
Henry S. Thompson <ht@markup.co.uk>
parents:
32
diff
changeset
|
24 if l[0]=='#': |
34
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
25 print('#1 %s'%strftime('%Y-%m-%d %H:%M:%S'),file=sys.stderr) |
33
4c117ee8ed75
fixDates, _fixAndMerge, _doFetch
Henry S. Thompson <ht@markup.co.uk>
parents:
32
diff
changeset
|
26 continue |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
27 n+=1 |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
28 ff=ok.match(l) |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
29 if ff is not None: |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
30 #print(l,end='') |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
31 scheme=HTTP if ff.group(1)=='http' else HTTPS |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
32 count=None |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
33 try: |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
34 # More alphas then numerics... |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
35 count=int(ff.group(4)) |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
36 try: |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
37 month=months[ff.group(2)] |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
38 except KeyError: |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
39 month=int(ff.group(2)) |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
40 year=int(ff.group(3)) |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
41 except: |
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
42 # Unusual month or year field |
27
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
43 try: |
41
3313edbab3b0
simpler fix for d-o-m default
Henry S. Thompson <ht@markup.co.uk>
parents:
39
diff
changeset
|
44 # settings is because w/o it the default is today's is used, which may |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
45 # fail if it's e.g. 31 March today and the string is "April 2017" |
41
3313edbab3b0
simpler fix for d-o-m default
Henry S. Thompson <ht@markup.co.uk>
parents:
39
diff
changeset
|
46 d=parse("%s %s"%(ff.group(2),ff.group(3)), |
3313edbab3b0
simpler fix for d-o-m default
Henry S. Thompson <ht@markup.co.uk>
parents:
39
diff
changeset
|
47 settings={'PREFER_DAY_OF_MONTH': 'first'}) |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
48 if d is None or count is None: |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
49 print(5,ff.group(1),ff.group(2),ff.group(3),ff.group(4), |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
50 file=sys.stderr) |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
51 bogons+=1 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
52 continue |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
53 elif d.year<1900 or d.year>2100: |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
54 # Shouldn't happen |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
55 print(7,ff.group(1),ff.group(2),ff.group(3),ff.group(4), |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
56 file=sys.stderr) |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
57 bogons+=1 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
58 continue |
27
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
59 else: |
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
60 month=d.month |
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
61 year=d.year |
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
62 except Exception as e: |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
63 print(6,ff.group(1),e,l,file=sys.stderr) |
27
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
64 bogons+=1 |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
65 continue |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
66 else: |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
67 cols=l.split() |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
68 scheme=cols[0] |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
69 if scheme[-1]==':': |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
70 scheme=scheme[0:-1] |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
71 if scheme not in ('http','https'): |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
72 # The last 3 lines are needed because we get both http: with nothing else, when there was no last-mod |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
73 # header, or http by itself, when the last-mod consisted entirely of TZ info, which then gets deleted |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
74 print(1,scheme,l,file=sys.stderr) |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
75 bogons+=1 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
76 continue |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
77 scheme=HTTP if scheme=='http' else HTTPS |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
78 try: |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
79 cols=cols[1:] |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
80 count=int(cols.pop()) |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
81 except: |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
82 print(2,sn[scheme],count,l,file=sys.stderr) |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
83 bogons+=1 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
84 continue |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
85 if cols==[]: |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
86 nd[scheme]+=count |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
87 continue |
24
b4e3beb2227e
improved error handling,
Henry S. Thompson <ht@markup.co.uk>
parents:
20
diff
changeset
|
88 else: |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
89 l=' '.join(cols) |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
90 try: |
41
3313edbab3b0
simpler fix for d-o-m default
Henry S. Thompson <ht@markup.co.uk>
parents:
39
diff
changeset
|
91 d=parse(l, |
3313edbab3b0
simpler fix for d-o-m default
Henry S. Thompson <ht@markup.co.uk>
parents:
39
diff
changeset
|
92 settings={'PREFER_DAY_OF_MONTH': 'first'}) |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
93 if d is None: |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
94 print(3,sn[scheme],l,count,file=sys.stderr) |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
95 bogons+=1 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
96 continue |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
97 elif d.year<1900 or d.year>2100: |
34
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
98 # Jan 0001 does show up, so log these as early / late |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
99 (ed if d.year<1900 else ld)[scheme]+=count |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
100 continue |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
101 else: |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
102 year=d.year |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
103 month=d.month |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
104 except Exception as e: |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
105 print(4,sn[scheme],e,l,count,file=sys.stderr) |
31
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
106 bogons+=1 |
580cc12c9712
partway to rework after failure of mergedWhich.x64700
Henry S. Thompson <ht@markup.co.uk>
parents:
27
diff
changeset
|
107 continue |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
108 # log it |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
109 yy=tab[scheme] |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
110 y=year-1900 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
111 if yy[y] is None: |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
112 yy[y]=mm=array('L',13*[0]) |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
113 else: |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
114 mm=yy[y] |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
115 mm[month]+=count |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
116 if n==0: |
27
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
117 # ssh screwed up |
dd19cf97b6dd
attempt to fix robustness pblms
Henry S. Thompson <ht@markup.co.uk>
parents:
24
diff
changeset
|
118 exit(1) |
34
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
119 print('#2 %s'%strftime('%Y-%m-%d %H:%M:%S'),file=sys.stderr) |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
120 for s in (HTTP,HTTPS): |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
121 if nd[s]!=0: |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
122 print(sn[s],0,0,nd[s],sep='\t') |
34
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
123 if ed[s]!=0: |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
124 print(sn[s],0,1,ed[s],sep='\t') |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
125 if ld[s]!=0: |
ad6eff2bc6f9
fixes to logging and efficiency, see also notes.txt wrt patches to dateparser
Henry S. Thompson <ht@markup.co.uk>
parents:
33
diff
changeset
|
126 print(sn[s],0,2,ld[s],sep='\t') |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
127 yy=tab[s] |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
128 for y in range(201): |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
129 mm=yy[y] |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
130 if mm is not None: |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
131 for m in range(1,13): |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
132 if mm[m]!=0: |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
133 print(sn[s],mn[m],y+1900,mm[m],sep='\t') |
39
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
134 print('#3 %s %s %s'%(strftime('%Y-%m-%d %H:%M:%S'), |
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
135 n,bogons), |
bb09db2afe6b
try to fix a few more niggling bugs
Henry S. Thompson <ht@markup.co.uk>
parents:
34
diff
changeset
|
136 file=sys.stderr) |
32
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
137 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
138 |
9342f6269edf
rewritten to be faster, maybe, and avoid earlier bug
Henry S. Thompson <ht@markup.co.uk>
parents:
31
diff
changeset
|
139 |