csv-detective 0.10.1.dev2599__py3-none-any.whl → 0.10.1.dev2629__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.
@@ -7,17 +7,17 @@ proportion = 1
7
7
  tags = ["geo"]
8
8
 
9
9
  with open(join(dirname(__file__), "data", "iso_country_code_alpha3.txt"), "r") as iofile:
10
- liste_pays = iofile.read().split("\n")
10
+ liste_pays = set(iofile.read().split("\n"))
11
11
 
12
12
 
13
13
  def _is(val):
14
14
  """Renvoie True si val peut etre un code iso pays alpha-3, False sinon"""
15
- if not isinstance(val, str) or not bool(re.match(r"[A-Z]{3}$", val)):
15
+ if not isinstance(val, str) or not bool(re.match(r"[a-zA-Z]{3}$", val)):
16
16
  return False
17
- return val in set(liste_pays)
17
+ return val.upper() in liste_pays
18
18
 
19
19
 
20
20
  _test_values = {
21
- True: ["FRA"],
21
+ True: ["FRA", "brb"],
22
22
  False: ["XXX", "FR", "A"],
23
23
  }
@@ -1,4 +1,5 @@
1
1
  from csv_detective.formats.float import _is as is_float
2
+ from csv_detective.formats.int import _is as is_int
2
3
 
3
4
  proportion = 1
4
5
  tags = ["geo"]
@@ -26,12 +27,18 @@ labels = SHARED_LATITUDE_LABELS | {
26
27
 
27
28
  def _is(val):
28
29
  try:
29
- return is_float(val) and float(val) >= -90 and float(val) <= 90
30
+ return (
31
+ is_float(val)
32
+ and -90 <= float(val) <= 90
33
+ # we ideally would like a certain level of decimal precision
34
+ # but 1.200 is saved as 1.2 in csv so we just discriminate ints
35
+ and not is_int(val)
36
+ )
30
37
  except Exception:
31
38
  return False
32
39
 
33
40
 
34
41
  _test_values = {
35
- True: ["43.2", "-22"],
36
- False: ["100"],
42
+ True: ["43.2872", "-22.61", "-3.0"],
43
+ False: ["100.1973", "40"],
37
44
  }
@@ -1,5 +1,4 @@
1
- from csv_detective.formats.float import _is as is_float
2
- from csv_detective.formats.latitude_wgs import labels # noqa
1
+ from csv_detective.formats.latitude_wgs import _is as is_latitude, labels # noqa
3
2
 
4
3
  proportion = 1
5
4
  tags = ["fr", "geo"]
@@ -9,12 +8,12 @@ python_type = "float"
9
8
 
10
9
  def _is(val):
11
10
  try:
12
- return is_float(val) and float(val) >= 41.3 and float(val) <= 51.3
11
+ return is_latitude(val) and 41.3 <= float(val) <= 51.3
13
12
  except Exception:
14
13
  return False
15
14
 
16
15
 
17
16
  _test_values = {
18
- True: ["42.5"],
19
- False: ["22.5", "62.5"],
17
+ True: ["42.576", "42.5"],
18
+ False: ["22.5"],
20
19
  }
@@ -49,6 +49,6 @@ def _is(val):
49
49
 
50
50
 
51
51
  _test_values = {
52
- True: ["43.2,-22.6", "-10.7,140", "-40.7, 10.8", "[12,-0.28]"],
53
- False: ["0.1,192", "-102, 92", "[23.02,4.1", "23.02,4.1]", "160.1,-27"],
52
+ True: ["43.2,-22.6", "-10.71,140.0", "-40.791, 10.81", "[12.01,-0.28]"],
53
+ False: ["0.1,192", "-102, 92", "[23.02,4.1", "23.02,4.1]", "160.1,-27", "1,2", "43, -23"],
54
54
  }
@@ -1,4 +1,5 @@
1
1
  from csv_detective.formats.float import _is as is_float
2
+ from csv_detective.formats.int import _is as is_int
2
3
 
3
4
  proportion = 1
4
5
  tags = ["geo"]
@@ -29,12 +30,18 @@ labels = SHARED_LONGITUDE_LABELS | {
29
30
 
30
31
  def _is(val):
31
32
  try:
32
- return is_float(val) and float(val) >= -180 and float(val) <= 180
33
+ return (
34
+ is_float(val)
35
+ and -180 <= float(val) <= 180
36
+ # we ideally would like a certain level of decimal precision
37
+ # but 1.200 is saved as 1.2 in csv so we just discriminate ints
38
+ and not is_int(val)
39
+ )
33
40
  except Exception:
34
41
  return False
35
42
 
36
43
 
37
44
  _test_values = {
38
- True: ["120", "-20.2"],
39
- False: ["-200"],
45
+ True: ["120.8263", "-20.27", "31.0"],
46
+ False: ["-200", "20"],
40
47
  }
@@ -1,5 +1,4 @@
1
- from csv_detective.formats.float import _is as is_float
2
- from csv_detective.formats.longitude_wgs import labels # noqa
1
+ from csv_detective.formats.longitude_wgs import _is as is_longitude, labels # noqa
3
2
 
4
3
  proportion = 1
5
4
  tags = ["fr", "geo"]
@@ -9,12 +8,12 @@ python_type = "float"
9
8
 
10
9
  def _is(val):
11
10
  try:
12
- return is_float(val) and float(val) >= -5.5 and float(val) <= 9.8
11
+ return is_longitude(val) and -5.5 <= float(val) <= 9.8
13
12
  except Exception:
14
13
  return False
15
14
 
16
15
 
17
16
  _test_values = {
18
- True: ["-2.5"],
17
+ True: ["-2.01", "8.0"],
19
18
  False: ["12.8"],
20
19
  }
@@ -32,6 +32,6 @@ def _is(val):
32
32
 
33
33
 
34
34
  _test_values = {
35
- True: ["-22.6,43.2", "140,-10.7", "10.8, -40.7", "[-0.28,12]"],
36
- False: ["192,0.1", "92, -102", "[4.1,23.02", "4.1,23.02]", "-27,160.1"],
35
+ True: ["-22.6,43.012", "140.0,-10.70", "10.829, -40.71", "[-0.28,12.43]"],
36
+ False: ["192,0.1", "92, -102", "[4.1,23.02", "4.1,23.02]", "-27,160.1", "2,4", "-22, 43.0"],
37
37
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: csv-detective
3
- Version: 0.10.1.dev2599
3
+ Version: 0.10.1.dev2629
4
4
  Summary: Detect tabular files column content
5
5
  Keywords: CSV,data processing,encoding,guess,parser,tabular
6
6
  Author: data.gouv.fr
@@ -27,10 +27,10 @@ csv_detective/formats/code_waldec.py,sha256=j4-xpj_73c7IdgLoZJY_kRVj3HkpB7RFfGPN
27
27
  csv_detective/formats/commune.py,sha256=QVscVy5Ij9kdzKJgIG2aFC_v1IRsov5M9Zkj_SHDWgs,541
28
28
  csv_detective/formats/csp_insee.py,sha256=y1w9zPQvijQi5v1Cuye0aX87ZVDC4FeFx1YC0dLqqp8,688
29
29
  csv_detective/formats/data/csp_insee.txt,sha256=kgKaKc-5PHu5U4--ugLjpFyMNtTU9CGdZ9ANU3YAsM4,32879
30
- csv_detective/formats/data/insee_ape700.txt,sha256=nKgslakENwgE7sPkVNHqR23iXuxF02p9-v5MC2_ntx8,4398
31
- csv_detective/formats/data/iso_country_code_alpha2.txt,sha256=YyPlDqCdz65ecf4Wes_r0P4rDSJG35niXtjc4MmctXM,1740
32
- csv_detective/formats/data/iso_country_code_alpha3.txt,sha256=aYqKSohgXuBtcIBfF52f8JWYDdxL_HV_Ol1srGnWBp4,1003
33
- csv_detective/formats/data/iso_country_code_numeric.txt,sha256=2GtEhuporsHYV-pU4q9kfXU5iOtfW5C0GYBTTKQtnnA,1004
30
+ csv_detective/formats/data/insee_ape700.txt,sha256=-_N-zAmcT7rK7ACRfsrM01Ton4_XtZGcNk-7lU28VHU,4397
31
+ csv_detective/formats/data/iso_country_code_alpha2.txt,sha256=mLt_qcQ6D8hfy9zdi7fAK_zON1ojReKlKMA8c2VDoRU,752
32
+ csv_detective/formats/data/iso_country_code_alpha3.txt,sha256=XFPdGBsyZCBg4D8IDn6VgwsycCwYVfuqPbyHfNeqGv0,1003
33
+ csv_detective/formats/data/iso_country_code_numeric.txt,sha256=sdGpn0PqDMlc59-7prThkihHrf7mwB6j5uEHpxGvLFE,1003
34
34
  csv_detective/formats/date.py,sha256=Q6w1azLKNshJJVLOPBHj-77ZinXYMW_EKp_BGDshLLE,2802
35
35
  csv_detective/formats/date_fr.py,sha256=YnNXSgT6QekfTUJoS5yuRX8LeK-fmVDgLgVP9cP0e4M,505
36
36
  csv_detective/formats/datetime_aware.py,sha256=izKo6CA-MNIzmmM3Br4-FOESyqCS_YYK8N4V9D6CVEI,1909
@@ -43,19 +43,19 @@ csv_detective/formats/geojson.py,sha256=jXKpTHnEsEH_0JJ393mgvF0IYP5AoarJC_-aTuNY
43
43
  csv_detective/formats/insee_ape700.py,sha256=WxblAHFCOIxigANQKV6mMjMwKauPGQmxqvk8DIKHD2Q,833
44
44
  csv_detective/formats/insee_canton.py,sha256=_jTL47d46PosKO-1Kg5ak88QPCyeKkEP-noj1fCRMTE,545
45
45
  csv_detective/formats/int.py,sha256=VSAPL0MCxTsdi2CgtHratd2e_7FSEZHTfdUgGnVuP5U,518
46
- csv_detective/formats/iso_country_code_alpha2.py,sha256=qHvNv2xavoy4yIfqs9P5OrohjiGeTcMFXWrpg01pWfw,652
47
- csv_detective/formats/iso_country_code_alpha3.py,sha256=2f762WgNPZnUbxGFOVCkG37deU2V-gxiI6uQhcvzHUA,600
46
+ csv_detective/formats/iso_country_code_alpha2.py,sha256=4WI4vSVQOW5JURjN1lu32M8Mce5t29zshgjCPNB3dk8,644
47
+ csv_detective/formats/iso_country_code_alpha3.py,sha256=zcOb0UFECoMBuDXxvKwc46xQowyuWws_jxf5Aod8jTE,618
48
48
  csv_detective/formats/iso_country_code_numeric.py,sha256=bpBUb5IQTU-s_-E81iq9dA6_ld7hrSY9jLi0fyWNNNo,617
49
49
  csv_detective/formats/jour_de_la_semaine.py,sha256=5ScA-UU1EGP_WgycP3NpGVxTeKOyAZlNFOA2mtOuCdc,603
50
50
  csv_detective/formats/json.py,sha256=5mCr50RvKFsbMQ-Ad1ORZ6UvOS9v3GUCh6z37mNT57I,534
51
51
  csv_detective/formats/latitude_l93.py,sha256=PIXHXaOuVdlcYJKPvUJ5hcEF52U9an6Je5vQ-hyN4rs,813
52
- csv_detective/formats/latitude_wgs.py,sha256=GPjs48G3nkuisrnBCydnzgerowothC5TMQgCieuSAWI,689
53
- csv_detective/formats/latitude_wgs_fr_metropole.py,sha256=BW5WYyYqHpjmG3Z72q1Xi_DIwEOp_vedFeplaaC985Q,433
54
- csv_detective/formats/latlon_wgs.py,sha256=Nipo6Yvqc-SVEEeTLANGh1xDpzLvO-LcDbttKdL8ddE,1319
52
+ csv_detective/formats/latitude_wgs.py,sha256=PNuoUJMxPsfpHhn3wN6q4HyTqNyFjfbfhfkQGyx9L4g,975
53
+ csv_detective/formats/latitude_wgs_fr_metropole.py,sha256=IOGF6j6I_eZS35rwRmZDt9XRrnJctlt_eUGsNVXIGlw,386
54
+ csv_detective/formats/latlon_wgs.py,sha256=gEnswtAGKIemFaIUb6X1jPrh8UBPvPZkOT7-jUhETfc,1346
55
55
  csv_detective/formats/longitude_l93.py,sha256=BnY8rx0ITlMI2x68yF_GjwwS72S-X_ZXD5V3W0Mgzg4,803
56
- csv_detective/formats/longitude_wgs.py,sha256=tgXSgim-SEvS4-snjUEehD3IHU92jrQ-DXdLPQZhvcE,750
57
- csv_detective/formats/longitude_wgs_fr_metropole.py,sha256=XBnWyjWslkrWuDH6gf8qIPEM_gzesTNBCzxbOmX9q3M,425
58
- csv_detective/formats/lonlat_wgs.py,sha256=Nd2e_OiI0Mtzs0ixxHqpsgMZtoivvWSywFWUUwZq6So,1051
56
+ csv_detective/formats/longitude_wgs.py,sha256=3I5cflrVcfEH3SHd7BMK284t_-Y5C1AyOS480zDcfTI,1031
57
+ csv_detective/formats/longitude_wgs_fr_metropole.py,sha256=vhL_UBdqvEgrNdZ65A0jyga24OtthU-B4WUGEg9evpc,386
58
+ csv_detective/formats/lonlat_wgs.py,sha256=_LEbZoi-f79ez-CKvzY-HoXL8t648URcXC4DRdtjbEU,1082
59
59
  csv_detective/formats/mois_de_lannee.py,sha256=BpzzAClRX-dbLwic42t4LAzceTtZFE236oPZT53EODs,765
60
60
  csv_detective/formats/money.py,sha256=kv09gQjpsplDdPy5IZBrdtQDv1FB96Jpk22JGj5JEf4,432
61
61
  csv_detective/formats/mongo_object_id.py,sha256=7UmSIHlYsaSpmv3rcyn-0eKdZr2qu2SssaihfWqBCYI,302
@@ -86,7 +86,7 @@ csv_detective/parsing/load.py,sha256=f-8aKiNpy_47qg4Lq-UZUR4NNrbJ_-KEGvcUQZ8cmb0
86
86
  csv_detective/parsing/text.py,sha256=yDAcop5xJQc25UtbZcV0guHXAZQfm-H8WuJORTy8Rr8,1734
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.10.1.dev2599.dist-info/WHEEL,sha256=xDCZ-UyfvkGuEHPeI7BcJzYKIZzdqN8A8o1M5Om8IyA,79
90
- csv_detective-0.10.1.dev2599.dist-info/entry_points.txt,sha256=1J86TQNCanjsLMboAufdEUla03qEQaC9QmVGYgt2FCQ,57
91
- csv_detective-0.10.1.dev2599.dist-info/METADATA,sha256=uk8fyx-FqFG2Ez2Yx4_aKydaGNrqd_SfuDsYYLlyfKY,11064
92
- csv_detective-0.10.1.dev2599.dist-info/RECORD,,
89
+ csv_detective-0.10.1.dev2629.dist-info/WHEEL,sha256=xDCZ-UyfvkGuEHPeI7BcJzYKIZzdqN8A8o1M5Om8IyA,79
90
+ csv_detective-0.10.1.dev2629.dist-info/entry_points.txt,sha256=1J86TQNCanjsLMboAufdEUla03qEQaC9QmVGYgt2FCQ,57
91
+ csv_detective-0.10.1.dev2629.dist-info/METADATA,sha256=z-f-R9aaAyh6vmNZlIMCKDY3XnNssnaeY_tSJ1yTI0w,11064
92
+ csv_detective-0.10.1.dev2629.dist-info/RECORD,,