MCPcopy Create free account
hub / github.com/Vespa314/chan.py / parse_time_column

Function parse_time_column

DataAPI/csvAPI.py:18–40  ·  view source on GitHub ↗
(inp)

Source from the content-addressed store, hash-verified

16
17
18def parse_time_column(inp):
19 # 20210902113000000
20 # 2021-09-13
21 if len(inp) == 10:
22 year = int(inp[:4])
23 month = int(inp[5:7])
24 day = int(inp[8:10])
25 hour = minute = 0
26 elif len(inp) == 17:
27 year = int(inp[:4])
28 month = int(inp[4:6])
29 day = int(inp[6:8])
30 hour = int(inp[8:10])
31 minute = int(inp[10:12])
32 elif len(inp) == 19:
33 year = int(inp[:4])
34 month = int(inp[5:7])
35 day = int(inp[8:10])
36 hour = int(inp[11:13])
37 minute = int(inp[14:16])
38 else:
39 raise Exception(f"unknown time column from csv:{inp}")
40 return CTime(year, month, day, hour, minute)
41
42
43class CSV_API(CCommonStockApi):

Callers 1

create_item_dictFunction · 0.70

Calls 1

CTimeClass · 0.90

Tested by

no test coverage detected