csv-detective 0.9.3.dev2241__py3-none-any.whl → 0.9.3.dev2258__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/detection/headers.py +6 -8
- csv_detective/parsing/load.py +6 -6
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/METADATA +1 -1
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/RECORD +8 -8
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/WHEEL +0 -0
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/entry_points.txt +0 -0
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/licenses/LICENSE +0 -0
- {csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/top_level.txt +0 -0
|
@@ -12,19 +12,17 @@ def detect_headers(file: TextIO, sep: str, verbose: bool = False) -> tuple[int,
|
|
|
12
12
|
logging.info("Detecting headers")
|
|
13
13
|
file.seek(0)
|
|
14
14
|
for i in range(10):
|
|
15
|
-
|
|
15
|
+
row = file.readline()
|
|
16
16
|
position = file.tell()
|
|
17
|
-
|
|
18
|
-
if
|
|
17
|
+
headers = [c for c in row.replace("\n", "").split(sep) if c]
|
|
18
|
+
if not any(col == "" for col in headers):
|
|
19
19
|
next_row = file.readline()
|
|
20
20
|
file.seek(position)
|
|
21
|
-
if
|
|
21
|
+
if row != next_row:
|
|
22
22
|
if verbose:
|
|
23
23
|
display_logs_depending_process_time(
|
|
24
24
|
f"Detected headers in {round(time() - start, 3)}s",
|
|
25
25
|
time() - start,
|
|
26
26
|
)
|
|
27
|
-
return i,
|
|
28
|
-
|
|
29
|
-
logging.info("No header detected")
|
|
30
|
-
return 0, None
|
|
27
|
+
return i, headers
|
|
28
|
+
raise ValueError("Could not retrieve headers")
|
csv_detective/parsing/load.py
CHANGED
|
@@ -47,6 +47,8 @@ def load_file(
|
|
|
47
47
|
if table.empty:
|
|
48
48
|
raise ValueError("Table seems to be empty")
|
|
49
49
|
header = table.columns.to_list()
|
|
50
|
+
if any(col.startswith("Unnamed") for col in header):
|
|
51
|
+
raise ValueError("Could not retrieve headers")
|
|
50
52
|
analysis = {
|
|
51
53
|
"engine": engine,
|
|
52
54
|
"sheet_name": sheet_name,
|
|
@@ -99,12 +101,10 @@ def load_file(
|
|
|
99
101
|
}
|
|
100
102
|
if engine is not None:
|
|
101
103
|
analysis["compression"] = engine
|
|
102
|
-
analysis
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
)
|
|
104
|
+
analysis |= {
|
|
105
|
+
"header_row_idx": header_row_idx,
|
|
106
|
+
"header": header,
|
|
107
|
+
}
|
|
108
108
|
if total_lines is not None:
|
|
109
109
|
analysis["total_lines"] = total_lines
|
|
110
110
|
if nb_duplicates is not None:
|
|
@@ -132,7 +132,7 @@ csv_detective/detection/columns.py,sha256=_JtZHBr3aoEmSWh2xVe2ISnt-G7hpnA9vqlvca
|
|
|
132
132
|
csv_detective/detection/encoding.py,sha256=KZ8W8BPfZAq9UiP5wgaeupYa5INU8KPz98E2L3XpX2Y,999
|
|
133
133
|
csv_detective/detection/engine.py,sha256=wQeDKpp2DKF-HcS1R8H6GgQyaUgQme4szPtEHgAjBII,1552
|
|
134
134
|
csv_detective/detection/formats.py,sha256=92ZZafoJFZHDSxSUR6rDCFjLGpD4f4IZorqqVgxwFY8,5595
|
|
135
|
-
csv_detective/detection/headers.py,sha256=
|
|
135
|
+
csv_detective/detection/headers.py,sha256=95pTL524Sy5PGxyQ03ofFUaamvlmkxTJQe8u6HfzOkU,1051
|
|
136
136
|
csv_detective/detection/rows.py,sha256=quf3ZTTFPOo09H-faZ9cRKibb1QGHEKHlpivFRx2Va4,742
|
|
137
137
|
csv_detective/detection/separator.py,sha256=XjeDBqhiBxVfkCPJKem9BAgJqs_hOgQltc_pxrH_-Tg,1547
|
|
138
138
|
csv_detective/detection/variables.py,sha256=-QtZOB96z3pWbqnZ-c1RU3yzoYqcO61A0JzeS6JbkxY,3576
|
|
@@ -147,9 +147,9 @@ csv_detective/parsing/columns.py,sha256=X5v3_1zgZXadnxjUG3__xLjOIvNU4n9LOiWZbix4
|
|
|
147
147
|
csv_detective/parsing/compression.py,sha256=Fnw5tj-PpBNI8NYsWj5gD-DUoWcVLnsVpiKm9MpxmIA,350
|
|
148
148
|
csv_detective/parsing/csv.py,sha256=BJ_fqoCCCCSJ61uHyiEpDmXlBdrqWLY-UKtKwkYw65c,1742
|
|
149
149
|
csv_detective/parsing/excel.py,sha256=oAVTuoDccJc4-kVjHXiIPLQx3lq3aZRRZQxkG1c06JQ,6992
|
|
150
|
-
csv_detective/parsing/load.py,sha256=
|
|
150
|
+
csv_detective/parsing/load.py,sha256=EHVWQqV9TmWOiVNLCyHr9V8x4PI_53O0iTVluzIqw78,4256
|
|
151
151
|
csv_detective/parsing/text.py,sha256=uz8wfmNTQnOd_4fjrIZ_5rxmFmgrg343hJh2szB73Hc,1770
|
|
152
|
-
csv_detective-0.9.3.
|
|
152
|
+
csv_detective-0.9.3.dev2258.dist-info/licenses/LICENSE,sha256=A1dQrzxyxRHRih02KwibWj1khQyF7GeA6SqdOU87Gk4,1088
|
|
153
153
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
154
154
|
tests/test_example.py,sha256=uTWswvUzBWEADGXZmMAdZvKhKvIjvT5zWOVVABgCDN4,1987
|
|
155
155
|
tests/test_fields.py,sha256=QoMsVR-ZhH5F9DFqYDvzP6vQCZcoalEi8JBb_fxWR44,13665
|
|
@@ -159,8 +159,8 @@ tests/test_structure.py,sha256=KGpw45weVK3iEWAg3OVHHEbj7RYALFicnZ59z7rCFuU,1450
|
|
|
159
159
|
tests/test_validation.py,sha256=9djBT-PDhu_563OFgWyE20o-wPEWEIQGXp6Pjh0_MQM,3463
|
|
160
160
|
venv/bin/activate_this.py,sha256=wS7qPipy8R-dS_0ICD8PqqUQ8F-PrtcpiJw2DUPngYM,1287
|
|
161
161
|
venv/bin/runxlrd.py,sha256=YlZMuycM_V_hzNt2yt3FyXPuwouMCmMhvj1oZaBeeuw,16092
|
|
162
|
-
csv_detective-0.9.3.
|
|
163
|
-
csv_detective-0.9.3.
|
|
164
|
-
csv_detective-0.9.3.
|
|
165
|
-
csv_detective-0.9.3.
|
|
166
|
-
csv_detective-0.9.3.
|
|
162
|
+
csv_detective-0.9.3.dev2258.dist-info/METADATA,sha256=gGV63RWaQSVUSaJl24mR9Ynk2BOV1tK6LWyNsq-AYkA,10845
|
|
163
|
+
csv_detective-0.9.3.dev2258.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
164
|
+
csv_detective-0.9.3.dev2258.dist-info/entry_points.txt,sha256=JjweTReFqKJmuvkegzlew2j3D5pZzfxvbEGOtGVGmaY,56
|
|
165
|
+
csv_detective-0.9.3.dev2258.dist-info/top_level.txt,sha256=cYKb4Ok3XgYA7rMDOYtxysjSJp_iUA9lJjynhVzue8g,30
|
|
166
|
+
csv_detective-0.9.3.dev2258.dist-info/RECORD,,
|
|
File without changes
|
{csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{csv_detective-0.9.3.dev2241.dist-info → csv_detective-0.9.3.dev2258.dist-info}/top_level.txt
RENAMED
|
File without changes
|