csv-detective 0.8.1.dev1599__py3-none-any.whl → 0.8.1.dev1608__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/utils.py +13 -15
- {csv_detective-0.8.1.dev1599.data → csv_detective-0.8.1.dev1608.data}/data/share/csv_detective/CHANGELOG.md +1 -1
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/METADATA +1 -1
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/RECORD +10 -10
- {csv_detective-0.8.1.dev1599.data → csv_detective-0.8.1.dev1608.data}/data/share/csv_detective/LICENSE +0 -0
- {csv_detective-0.8.1.dev1599.data → csv_detective-0.8.1.dev1608.data}/data/share/csv_detective/README.md +0 -0
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/WHEEL +0 -0
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/entry_points.txt +0 -0
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/licenses/LICENSE +0 -0
- {csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/top_level.txt +0 -0
csv_detective/utils.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import math
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import pandas as pd
|
|
6
5
|
|
|
6
|
+
logging.basicConfig(level=logging.INFO)
|
|
7
|
+
logging.addLevelName(logging.CRITICAL, "\033[1;41m%s\033[1;0m" % logging.getLevelName(logging.CRITICAL))
|
|
8
|
+
logging.addLevelName(logging.WARN, "\033[1;31m%s\033[1;0m" % logging.getLevelName(logging.WARN))
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Print colored logs according to the time the operation took.
|
|
11
|
-
'''
|
|
12
|
-
logging.addLevelName(logging.CRITICAL, "\033[1;41m%s\033[1;0m" % logging.getLevelName(logging.CRITICAL))
|
|
13
|
-
logging.addLevelName(logging.WARN, "\033[1;31m%s\033[1;0m" % logging.getLevelName(logging.WARN))
|
|
10
|
+
THRESHOLD_WARN = 1
|
|
11
|
+
THRESHOLD_CRITICAL = 3
|
|
14
12
|
|
|
15
|
-
threshold_warn = 1
|
|
16
|
-
threshold_critical = 3
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
def display_logs_depending_process_time(prompt: str, duration: float) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Print colored logs according to the time the operation took.
|
|
17
|
+
"""
|
|
18
|
+
if duration < THRESHOLD_WARN:
|
|
19
19
|
logging.info(prompt)
|
|
20
|
-
elif duration <
|
|
20
|
+
elif duration < THRESHOLD_CRITICAL:
|
|
21
21
|
logging.warning(prompt)
|
|
22
22
|
else:
|
|
23
23
|
logging.critical(prompt)
|
|
@@ -30,6 +30,4 @@ def is_url(file_path: str) -> bool:
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def prevent_nan(value: float) -> Optional[float]:
|
|
33
|
-
if
|
|
34
|
-
return None
|
|
35
|
-
return value
|
|
33
|
+
return None if pd.isna(value) else value
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Current (in progress)
|
|
4
4
|
|
|
5
5
|
- Refactor label testing [#119](https://github.com/datagouv/csv-detective/pull/119)
|
|
6
|
-
- Refactor repo metadata and requirements [#120](https://github.com/datagouv/csv-detective/pull/120) [#122](https://github.com/datagouv/csv-detective/pull/122)
|
|
6
|
+
- Refactor repo metadata and requirements [#120](https://github.com/datagouv/csv-detective/pull/120) [#122](https://github.com/datagouv/csv-detective/pull/122) [#135](https://github.com/datagouv/csv-detective/pull/135)
|
|
7
7
|
- Better URL detection [#121](https://github.com/datagouv/csv-detective/pull/121)
|
|
8
8
|
- For big files, analyse on sample then validate on whole file [#124](https://github.com/datagouv/csv-detective/pull/124) [#129](https://github.com/datagouv/csv-detective/pull/129)
|
|
9
9
|
- Fix imports [#125](https://github.com/datagouv/csv-detective/pull/125) [#126](https://github.com/datagouv/csv-detective/pull/126) [#127](https://github.com/datagouv/csv-detective/pull/127) [#128](https://github.com/datagouv/csv-detective/pull/128)
|
|
@@ -3,7 +3,7 @@ csv_detective/cli.py,sha256=VNztFz2nc90E3zkghF8PYtXTEZ6TrBSCQMi9v1ljkJs,1414
|
|
|
3
3
|
csv_detective/explore_csv.py,sha256=VEeAJaz3FPOmGmQ-Yuf3FuSRRPULM03FrTf3qwZX52s,9222
|
|
4
4
|
csv_detective/load_tests.py,sha256=GILvfkd4OVI-72mA4nzbPlZqgcXZ4wznOhGfZ1ucWkM,2385
|
|
5
5
|
csv_detective/s3_utils.py,sha256=1cIVdQUYY2ovErbMwp72Gqtqx2bkB8nfVhn-QaOFTT0,1451
|
|
6
|
-
csv_detective/utils.py,sha256
|
|
6
|
+
csv_detective/utils.py,sha256=_1XWlA6Ef8ug4M6wbWIqaQOgFx-wCCm1q7FToAY3QFI,1007
|
|
7
7
|
csv_detective/validate.py,sha256=5Li_vfvU9wdfoZjNjef-MBUoKcKoJ-c7381QoX9aDXY,2818
|
|
8
8
|
csv_detective/detect_fields/__init__.py,sha256=0A5SZTp_IhhJ9z7lWeH4K5_0uwMK_VdMudjPm7oggVg,1000
|
|
9
9
|
csv_detective/detect_fields/FR/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -150,10 +150,10 @@ csv_detective/parsing/csv.py,sha256=11mibDnJhIjykXLGZvA5ZEU5U7KgxIrbyO6BNv6jlro,
|
|
|
150
150
|
csv_detective/parsing/excel.py,sha256=AslE2S1e67o8yTIAIhp-lAnJ6-XqeBBRz1-VMFqhZBM,7055
|
|
151
151
|
csv_detective/parsing/load.py,sha256=u6fbGFZsL2GwPQRzhAXgt32JpUur7vbQdErREHxNJ-w,3661
|
|
152
152
|
csv_detective/parsing/text.py,sha256=_TprGi0gHZlRsafizI3dqQhBehZW4BazqxmypMcAZ-o,1824
|
|
153
|
-
csv_detective-0.8.1.
|
|
154
|
-
csv_detective-0.8.1.
|
|
155
|
-
csv_detective-0.8.1.
|
|
156
|
-
csv_detective-0.8.1.
|
|
153
|
+
csv_detective-0.8.1.dev1608.data/data/share/csv_detective/CHANGELOG.md,sha256=1WSrNCAX67Vp17fq5DFatI_OwWKjkFJuX1w-byNkips,9705
|
|
154
|
+
csv_detective-0.8.1.dev1608.data/data/share/csv_detective/LICENSE,sha256=A1dQrzxyxRHRih02KwibWj1khQyF7GeA6SqdOU87Gk4,1088
|
|
155
|
+
csv_detective-0.8.1.dev1608.data/data/share/csv_detective/README.md,sha256=gKLFmC8kuCCywS9eAhMak_JNriUWWNOsBKleAu5TIEY,8501
|
|
156
|
+
csv_detective-0.8.1.dev1608.dist-info/licenses/LICENSE,sha256=A1dQrzxyxRHRih02KwibWj1khQyF7GeA6SqdOU87Gk4,1088
|
|
157
157
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
158
158
|
tests/test_example.py,sha256=JeHxSK0IVDcSrOhSZlNGSQv4JAc_r6mzvJM8PfmLTMw,2018
|
|
159
159
|
tests/test_fields.py,sha256=IwMpjOn8W5kDCvJYp3Cer4m571qomzjupOAvSRFMg_Q,11819
|
|
@@ -161,8 +161,8 @@ tests/test_file.py,sha256=0bHV9wx9mSRoav_DVF19g694yohb1p0bw7rtcBeKG-8,8451
|
|
|
161
161
|
tests/test_labels.py,sha256=Nkr645bUewrj8hjNDKr67FQ6Sy_TID6f3E5Kfkl231M,464
|
|
162
162
|
tests/test_structure.py,sha256=bv-tjgXohvQAxwmxzH0BynFpK2TyPjcxvtIAmIRlZmA,1393
|
|
163
163
|
tests/test_validation.py,sha256=CTGonR6htxcWF9WH8MxumDD8cF45Y-G4hm94SM4lFjU,3246
|
|
164
|
-
csv_detective-0.8.1.
|
|
165
|
-
csv_detective-0.8.1.
|
|
166
|
-
csv_detective-0.8.1.
|
|
167
|
-
csv_detective-0.8.1.
|
|
168
|
-
csv_detective-0.8.1.
|
|
164
|
+
csv_detective-0.8.1.dev1608.dist-info/METADATA,sha256=gy24TRDVBUmdkyP-ji6U_lOkGd6QNQxOfGkDtv3h5iw,10443
|
|
165
|
+
csv_detective-0.8.1.dev1608.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
166
|
+
csv_detective-0.8.1.dev1608.dist-info/entry_points.txt,sha256=JjweTReFqKJmuvkegzlew2j3D5pZzfxvbEGOtGVGmaY,56
|
|
167
|
+
csv_detective-0.8.1.dev1608.dist-info/top_level.txt,sha256=M0Nv646VHo-49zWjPkwo2C48UmtfddV8_9mEZeIxy8Q,20
|
|
168
|
+
csv_detective-0.8.1.dev1608.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{csv_detective-0.8.1.dev1599.dist-info → csv_detective-0.8.1.dev1608.dist-info}/top_level.txt
RENAMED
|
File without changes
|