csv-detective 0.10.2.dev4__py3-none-any.whl → 0.10.3.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- csv_detective/formats/date.py +10 -1
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/METADATA +1 -1
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/RECORD +7 -7
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/WHEEL +0 -0
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/entry_points.txt +0 -0
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/licenses/LICENSE +0 -0
- {csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/top_level.txt +0 -0
csv_detective/formats/date.py
CHANGED
|
@@ -57,7 +57,9 @@ string_month_pattern = (
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def _is(val):
|
|
60
|
-
# early stops, to cut processing time
|
|
60
|
+
# many early stops, to cut processing time
|
|
61
|
+
# and avoid the costly use of date_casting as much as possible
|
|
62
|
+
# /!\ timestamps are considered ints, not dates
|
|
61
63
|
if not isinstance(val, str) or len(val) > 20 or len(val) < 8:
|
|
62
64
|
return False
|
|
63
65
|
# if it's a usual date pattern
|
|
@@ -70,8 +72,13 @@ def _is(val):
|
|
|
70
72
|
]
|
|
71
73
|
):
|
|
72
74
|
return True
|
|
75
|
+
if re.match(r"^-?\d+[\.|,]\d+$", val):
|
|
76
|
+
# regular floats are excluded
|
|
77
|
+
return False
|
|
78
|
+
# not enough digits => not a date (slightly arbitrary)
|
|
73
79
|
if sum([char.isdigit() for char in val]) / len(val) < threshold:
|
|
74
80
|
return False
|
|
81
|
+
# last resort
|
|
75
82
|
res = date_casting(val)
|
|
76
83
|
if not res or res.hour or res.minute or res.second:
|
|
77
84
|
return False
|
|
@@ -86,6 +93,7 @@ _test_values = {
|
|
|
86
93
|
"15 décembre 1985",
|
|
87
94
|
"02 05 2003",
|
|
88
95
|
"20030502",
|
|
96
|
+
"2003.05.02",
|
|
89
97
|
"1993-12/02",
|
|
90
98
|
],
|
|
91
99
|
False: [
|
|
@@ -96,5 +104,6 @@ _test_values = {
|
|
|
96
104
|
"12152003",
|
|
97
105
|
"20031512",
|
|
98
106
|
"02052003",
|
|
107
|
+
"6.27367393749392839",
|
|
99
108
|
],
|
|
100
109
|
}
|
|
@@ -28,7 +28,7 @@ csv_detective/formats/code_rna.py,sha256=o6Kptrux6T2bSnWHi7MBCqIfVKbMMeN4dHlxxzk
|
|
|
28
28
|
csv_detective/formats/code_waldec.py,sha256=j4-xpj_73c7IdgLoZJY_kRVj3HkpB7RFfGPN4NwPmVo,303
|
|
29
29
|
csv_detective/formats/commune.py,sha256=QVscVy5Ij9kdzKJgIG2aFC_v1IRsov5M9Zkj_SHDWgs,541
|
|
30
30
|
csv_detective/formats/csp_insee.py,sha256=y1w9zPQvijQi5v1Cuye0aX87ZVDC4FeFx1YC0dLqqp8,688
|
|
31
|
-
csv_detective/formats/date.py,sha256=
|
|
31
|
+
csv_detective/formats/date.py,sha256=caMMvcqkbON8Cxp9oDYZsfmkSXuu-PiiJi8YUbypBso,3167
|
|
32
32
|
csv_detective/formats/date_fr.py,sha256=YnNXSgT6QekfTUJoS5yuRX8LeK-fmVDgLgVP9cP0e4M,505
|
|
33
33
|
csv_detective/formats/datetime_aware.py,sha256=izKo6CA-MNIzmmM3Br4-FOESyqCS_YYK8N4V9D6CVEI,1909
|
|
34
34
|
csv_detective/formats/datetime_naive.py,sha256=DZ0apAm3vIy4cdm5DynAeRueI_8rhuHYQtAOZ5yyZ5k,1681
|
|
@@ -86,7 +86,7 @@ csv_detective/parsing/csv.py,sha256=5rw6gXZFQC1T4NT9CnW0AumidrYOkF8kjrfWGmk949I,
|
|
|
86
86
|
csv_detective/parsing/excel.py,sha256=tb65I78tdYlZci_tzvvQt8U6bZSYKjeVdn2CEvsET1o,6972
|
|
87
87
|
csv_detective/parsing/load.py,sha256=f-8aKiNpy_47qg4Lq-UZUR4NNrbJ_-KEGvcUQZ8cmb0,4317
|
|
88
88
|
csv_detective/parsing/text.py,sha256=yDAcop5xJQc25UtbZcV0guHXAZQfm-H8WuJORTy8Rr8,1734
|
|
89
|
-
csv_detective-0.10.
|
|
89
|
+
csv_detective-0.10.3.dev1.dist-info/licenses/LICENSE,sha256=A1dQrzxyxRHRih02KwibWj1khQyF7GeA6SqdOU87Gk4,1088
|
|
90
90
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
91
|
tests/test_example.py,sha256=uTWswvUzBWEADGXZmMAdZvKhKvIjvT5zWOVVABgCDN4,1987
|
|
92
92
|
tests/test_fields.py,sha256=EuD2F1JUR8y88Hm-AYuJ5X7AKkGSyLIQfsGdxYgIWng,5680
|
|
@@ -104,8 +104,8 @@ tests/data/file.ods,sha256=4dR7zWptz5djALIBVeWHQ20GaZNfA63fevIJGFIk1_U,11832
|
|
|
104
104
|
tests/data/file.xls,sha256=QYmNX3FF0QfcQSzYQMtaMJaepJf5EZpDa1miKc4wMdQ,21495
|
|
105
105
|
tests/data/file.xlsx,sha256=naWzL02PK4pdIjMzfEyfSW9GQhkYYd_e7bpJvB8Pb2w,8314
|
|
106
106
|
tests/data/xlsx_file,sha256=NyOyN_rIe7ryJuHQLqjxVdKCc8V4s5pxyHl6wWFykCM,8305
|
|
107
|
-
csv_detective-0.10.
|
|
108
|
-
csv_detective-0.10.
|
|
109
|
-
csv_detective-0.10.
|
|
110
|
-
csv_detective-0.10.
|
|
111
|
-
csv_detective-0.10.
|
|
107
|
+
csv_detective-0.10.3.dev1.dist-info/METADATA,sha256=gJcwR3wni376q4qqk8xOG6uy9W4fwA5enfmfT066990,11082
|
|
108
|
+
csv_detective-0.10.3.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
109
|
+
csv_detective-0.10.3.dev1.dist-info/entry_points.txt,sha256=JjweTReFqKJmuvkegzlew2j3D5pZzfxvbEGOtGVGmaY,56
|
|
110
|
+
csv_detective-0.10.3.dev1.dist-info/top_level.txt,sha256=KDI4gyOpkmormGgUvSWrE3jen2e0unIsxR2b96DRvcw,25
|
|
111
|
+
csv_detective-0.10.3.dev1.dist-info/RECORD,,
|
|
File without changes
|
{csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{csv_detective-0.10.2.dev4.dist-info → csv_detective-0.10.3.dev1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|