Skip to content

Commit f0603f8

Browse files
Merge branch 'main' into arshitas/remove-unused-imports
2 parents ed55505 + e13359f commit f0603f8

File tree

14 files changed

+63
-4
lines changed

14 files changed

+63
-4
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
node_modules
1+
node_modules
2+
# Ignore virtual environments
3+
myenv/
4+
venv/
5+
.env
6+
.venv
7+
ENV/
8+
env.bak/
9+
venv.bak/

app/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# i just created this file so python know this directory is package and can import from it (needed to import extract function in root/tests/test_extract.py)
129 Bytes
Binary file not shown.

app/etl/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# i just created this file so python know this directory is package and can import from it (needed to import extract function in root/tests/test_extract.py)
133 Bytes
Binary file not shown.
1.53 KB
Binary file not shown.

app/etl/extract.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def extract(path: str = "xyz.csv") -> pd.DataFrame :
2020
if not os.path.exists(path):
2121
raise FileNotFoundError(f"❌ File not found: {path}")
2222

23-
if not path.lower().endswith('.csv'): # TODO (Find & Fix)
23+
if not str(path).lower().endswith('.csv'):
2424
raise ValueError(f"❌ File must be a CSV: {path}")
2525

2626
try:
@@ -31,12 +31,16 @@ def extract(path: str = "xyz.csv") -> pd.DataFrame :
3131
for encoding in encodings:
3232
try:
3333
# TODO (Find & Fix)
34-
pass
34+
pass
3535
except UnicodeDecodeError:
3636
print(f"Failed to read with encoding '{encoding}'") # Log the encoding that failed
37+
continue
38+
except Exception as e:
39+
print(f"Error reading with encoding '{encoding}': {e}")
40+
continue
3741

3842
if df is None:
39-
raise ValueError(f" Could not read CSV with tried encodings: {encodings}")
43+
raise ValueError(f"Could not read CSV with tried encodings: {encodings}")
4044

4145
# Validate data
4246
if df.empty:

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# i just created this file so python know this directory is package and can import from it (needed to import extract function in root/tests/test_extract.py)
131 Bytes
Binary file not shown.
2.32 KB
Binary file not shown.

0 commit comments

Comments
 (0)