csv-detective 0.9.3.dev2500__py3-none-any.whl → 0.9.3.dev2514__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.
@@ -12,13 +12,14 @@ pat = (
12
12
  + r"(T|\s)(0\d|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(.\d{1,6})"
13
13
  + r"?(([+-](0\d|1[0-9]|2[0-3]):([0-5][0-9]))|Z)$"
14
14
  )
15
+ prefix = r"^\d{4}"
15
16
 
16
17
 
17
18
  def _is(val):
18
19
  # early stops, to cut processing time
19
20
  # 16 is the minimal length of a datetime format YYMMDDTHH:MM:SSZ
20
21
  # 32 is the maximal length of an ISO datetime format YYYY-MM-DDTHH:MM:SS.dddddd+HH:MM, keeping some slack
21
- if not isinstance(val, str) or len(val) > 35 or len(val) < 16:
22
+ if not isinstance(val, str) or len(val) > 35 or len(val) < 16 or not re.match(prefix, val):
22
23
  return False
23
24
  # if usual format, no need to parse
24
25
  if bool(re.match(pat, val)):
@@ -41,5 +42,10 @@ _test_values = {
41
42
  "2024-12-19T10:53:36.428000+00:00",
42
43
  "1996/06/22 10:20:10 GMT",
43
44
  ],
44
- False: ["2021-06-22T30:20:10", "Sun, 06 Nov 1994 08:49:37 GMT", "2021-06-44 10:20:10"],
45
+ False: [
46
+ "2021-06-22T30:20:10",
47
+ "Sun, 06 Nov 1994 08:49:37 GMT",
48
+ "2021-06-44 10:20:10",
49
+ "0.001175692961729795",
50
+ ],
45
51
  }
@@ -2,7 +2,7 @@ import re
2
2
  from typing import Any
3
3
 
4
4
  from csv_detective.formats.date import aaaammjj_pattern, date_casting
5
- from csv_detective.formats.datetime_aware import labels # noqa
5
+ from csv_detective.formats.datetime_aware import labels, prefix # noqa
6
6
 
7
7
  proportion = 1
8
8
  tags = ["temp", "type"]
@@ -20,7 +20,7 @@ def _is(val: Any | None) -> bool:
20
20
  # early stops, to cut processing time
21
21
  # 15 is the minimal length of a datetime format YYMMDDTHH:MM:SS
22
22
  # 26 is the maximal length of an ISO datetime format YYYY-MM-DDTHH:MM:SS.dddddd, keeping some slack
23
- if not isinstance(val, str) or len(val) > 30 or len(val) < 15:
23
+ if not isinstance(val, str) or len(val) > 30 or len(val) < 15 or not re.match(prefix, val):
24
24
  return False
25
25
  # if usual format, no need to parse
26
26
  if bool(re.match(pat, val)):
@@ -44,5 +44,6 @@ _test_values = {
44
44
  "1999-12-01T00:00:00Z",
45
45
  "2021-06-44",
46
46
  "15 décembre 1985",
47
+ "0.001175692961729795",
47
48
  ],
48
49
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: csv-detective
3
- Version: 0.9.3.dev2500
3
+ Version: 0.9.3.dev2514
4
4
  Summary: Detect tabular files column content
5
5
  Keywords: CSV,data processing,encoding,guess,parser,tabular
6
6
  Author: data.gouv.fr
@@ -33,8 +33,8 @@ csv_detective/formats/data/iso_country_code_alpha3.txt,sha256=aYqKSohgXuBtcIBfF5
33
33
  csv_detective/formats/data/iso_country_code_numeric.txt,sha256=2GtEhuporsHYV-pU4q9kfXU5iOtfW5C0GYBTTKQtnnA,1004
34
34
  csv_detective/formats/date.py,sha256=X4ohXaFO8cXPJktUSumc3bfdlbDIWEYTG8S9ugVRcsE,2730
35
35
  csv_detective/formats/date_fr.py,sha256=3hTw5RommrhcgECFRSt9KgyB9zyi1j4W3UygEHmRgoE,502
36
- csv_detective/formats/datetime_aware.py,sha256=-1ZBix6vYlYXTvhXrijP-98AN7iPB0x_DbbwU1QjMCI,1470
37
- csv_detective/formats/datetime_naive.py,sha256=nvA8qT1fb2RmpXN5_Cw9YZA6pC4BryX_B0V-E6O2UbU,1521
36
+ csv_detective/formats/datetime_aware.py,sha256=kSEVLAovUJEYYFMFk4RiHY50rnPkDlrjfUFwk7ogJYQ,1587
37
+ csv_detective/formats/datetime_naive.py,sha256=CVC-yey5uoPAAr8VnrY_HbLUGOk9dqduM5yLAvAhgfc,1591
38
38
  csv_detective/formats/datetime_rfc822.py,sha256=l-SLb34hSuHxC2JQ-9SD-nG38JqzoozwUZiGtoybb0A,601
39
39
  csv_detective/formats/departement.py,sha256=UP9UF23BFq_-mIS8N10K5XkoCXwPmDeSoa_7lCAkI4w,768
40
40
  csv_detective/formats/email.py,sha256=Qen2EBDYY5TtWXwxrrTGWRrbIybz0ySlVpl4ZRk8pzA,517
@@ -86,7 +86,7 @@ csv_detective/parsing/load.py,sha256=f-8aKiNpy_47qg4Lq-UZUR4NNrbJ_-KEGvcUQZ8cmb0
86
86
  csv_detective/parsing/text.py,sha256=uz8wfmNTQnOd_4fjrIZ_5rxmFmgrg343hJh2szB73Hc,1770
87
87
  csv_detective/utils.py,sha256=RJ_zFOJ1DRY8HtDrKPiCdNk5gU6-KwOrOKOyfSkBZZY,1118
88
88
  csv_detective/validate.py,sha256=CjZXhhDP-n6wGgEqbwrGRqebU8L5bidwnvQp-TbnvFA,5424
89
- csv_detective-0.9.3.dev2500.dist-info/WHEEL,sha256=z-mOpxbJHqy3cq6SvUThBZdaLGFZzdZPtgWLcP2NKjQ,79
90
- csv_detective-0.9.3.dev2500.dist-info/entry_points.txt,sha256=1J86TQNCanjsLMboAufdEUla03qEQaC9QmVGYgt2FCQ,57
91
- csv_detective-0.9.3.dev2500.dist-info/METADATA,sha256=Xei7oHRc7gmW58t75DcUOF8Jp43mZ6yWZ_WJCj2RHxo,11063
92
- csv_detective-0.9.3.dev2500.dist-info/RECORD,,
89
+ csv_detective-0.9.3.dev2514.dist-info/WHEEL,sha256=z-mOpxbJHqy3cq6SvUThBZdaLGFZzdZPtgWLcP2NKjQ,79
90
+ csv_detective-0.9.3.dev2514.dist-info/entry_points.txt,sha256=1J86TQNCanjsLMboAufdEUla03qEQaC9QmVGYgt2FCQ,57
91
+ csv_detective-0.9.3.dev2514.dist-info/METADATA,sha256=nn_n8NNMWKukhPPKSl4w5wHuChJpDprBiS6qxp9PUyE,11063
92
+ csv_detective-0.9.3.dev2514.dist-info/RECORD,,