python-osw-validation 0.2.7__py3-none-any.whl → 0.2.9__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,6 +7,7 @@ from .zipfile_handler import ZipFileHandler
7
7
  from typing import Dict, Any, Optional, List
8
8
  from .extracted_data_validator import ExtractedDataValidator, OSW_DATASET_FILES
9
9
  from .version import __version__
10
+ import traceback
10
11
 
11
12
  SCHEMA_PATH = os.path.join(os.path.dirname(__file__), 'schema')
12
13
 
@@ -149,6 +150,7 @@ class OSWValidation:
149
150
  return ValidationResult(True)
150
151
  except Exception as e:
151
152
  self.errors.append(f'Unable to validate: {e}')
153
+ traceback.print_exc()
152
154
  return ValidationResult(False, self.errors)
153
155
  finally:
154
156
  del OSW_DATASET
@@ -1 +1 @@
1
- __version__ = '0.2.7'
1
+ __version__ = '0.2.9'
@@ -1,9 +1,9 @@
1
1
  import os
2
+ import glob
2
3
  import shutil
3
4
  import tempfile
4
- from typing import Optional
5
5
  import zipfile36 as zipfile
6
- import glob
6
+ from typing import Optional
7
7
 
8
8
 
9
9
  class ZipFileHandler:
@@ -21,19 +21,19 @@ class ZipFileHandler:
21
21
  try:
22
22
  # Build the full pattern with the directory
23
23
  full_pattern = os.path.join(os.path.dirname(self.zip_file_path), file_pattern)
24
-
24
+
25
25
  # Find all files in the directory matching the pattern
26
26
  files_to_zip = glob.glob(full_pattern)
27
-
27
+
28
28
  # Create a zip file and add matching files to it
29
29
  with zipfile.ZipFile(self.zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
30
30
  for file in files_to_zip:
31
31
  archive_name = os.path.relpath(file, os.path.dirname(self.zip_file_path))
32
32
  zipf.write(file, arcname=archive_name)
33
-
33
+
34
34
  # Get the full path to the created zip file
35
35
  full_zip_path = os.path.abspath(self.zip_file_path)
36
-
36
+
37
37
  # Return the full path to the zip file
38
38
  return full_zip_path
39
39
  except Exception as e:
@@ -49,22 +49,21 @@ class ZipFileHandler:
49
49
 
50
50
  if len(zip_ref.namelist()) == 0:
51
51
  raise Exception('ZIP file is empty')
52
-
52
+
53
53
  internal_folder_name = self.find_internal_folder(zip_ref)
54
- return os.path.join(self.extracted_dir,internal_folder_name)
54
+ return os.path.join(self.extracted_dir, internal_folder_name)
55
55
  except Exception as e:
56
56
  self.error = f'Error extracting ZIP file: {e}'
57
-
57
+
58
58
  # finds the first folder available in the extracted folder.
59
59
  # returns empty if there are no folders inside
60
- def find_internal_folder(self, zip_ref: zipfile.ZipFile)-> str:
60
+ def find_internal_folder(self, zip_ref: zipfile.ZipFile) -> str:
61
61
  for filename in zip_ref.namelist():
62
- path = os.path.join(self.extracted_dir,filename)
63
- if(os.path.isdir(path)):
62
+ path = os.path.join(self.extracted_dir, filename)
63
+ if (os.path.isdir(path)):
64
64
  return filename
65
65
  return ''
66
66
 
67
-
68
67
  def remove_extracted_files(self) -> None:
69
68
  if self.extracted_dir and os.path.exists(self.extracted_dir):
70
69
  shutil.rmtree(self.extracted_dir)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-osw-validation
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Python library for OSW validation
5
5
  Home-page: https://github.com/TaskarCenterAtUW/TDEI-python-lib-osw-validation
6
6
  Author: Sujata Misra
@@ -14,9 +14,9 @@ Classifier: Operating System :: OS Independent
14
14
  Requires-Python: >=3.10
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: jsonschema-rs
18
- Requires-Dist: zipfile36
19
- Requires-Dist: geopandas
17
+ Requires-Dist: jsonschema-rs==0.26.1
18
+ Requires-Dist: zipfile36==0.1.3
19
+ Requires-Dist: geopandas==0.14.4
20
20
 
21
21
  # TDEI python lib OSW validation package
22
22
 
@@ -0,0 +1,10 @@
1
+ python_osw_validation/__init__.py,sha256=BrVyTquf9n4-US7d_FZBNEjyh24LaucSz4Zd65v2tfw,7946
2
+ python_osw_validation/extracted_data_validator.py,sha256=wZyCk8NlJv10cj_GrRTAiwm4cBhTAeDethjzJU-amoI,3877
3
+ python_osw_validation/version.py,sha256=e5Klz6yLU-4Ub9zxGUBo9wADAYsST38ZylTv9ze4i60,21
4
+ python_osw_validation/zipfile_handler.py,sha256=jXnP-8O5AAOBapuNF3-XdFVM1MHiPaWpl_wlbX-aqhY,2631
5
+ python_osw_validation/schema/opensidewalks.schema.json,sha256=i0iJwb_4Tq20BVUpkpgyM_7fm4SW_d_HNXKw0xul7OA,240987
6
+ python_osw_validation-0.2.9.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
7
+ python_osw_validation-0.2.9.dist-info/METADATA,sha256=dOSaEqE-VEW2iqhkzSb27T2A72Y31AfRyuGnDlI3aqE,6140
8
+ python_osw_validation-0.2.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
+ python_osw_validation-0.2.9.dist-info/top_level.txt,sha256=GE81UPcDHEffJCxYu3M_iPz3Dt-O3axB73R5SLm_Veo,22
10
+ python_osw_validation-0.2.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- python_osw_validation/__init__.py,sha256=SKFTjvZC_TGYH45jVkdq-MctbZLMrX6ElXp88BzCfdg,7895
2
- python_osw_validation/extracted_data_validator.py,sha256=wZyCk8NlJv10cj_GrRTAiwm4cBhTAeDethjzJU-amoI,3877
3
- python_osw_validation/version.py,sha256=k14HNX-j7JGQmMcNd5V9YYE1rd2NN5QFLz4W-ttaFD0,21
4
- python_osw_validation/zipfile_handler.py,sha256=lCRraGcysxelVKswQw1r-i_9kGQGvRQk7hJkWUwiAPk,2692
5
- python_osw_validation/schema/opensidewalks.schema.json,sha256=i0iJwb_4Tq20BVUpkpgyM_7fm4SW_d_HNXKw0xul7OA,240987
6
- python_osw_validation-0.2.7.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
7
- python_osw_validation-0.2.7.dist-info/METADATA,sha256=ZFW5vh8CHW1PU1WHpXtemdzhALazinWT79OaHNGCIDE,6117
8
- python_osw_validation-0.2.7.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
9
- python_osw_validation-0.2.7.dist-info/top_level.txt,sha256=GE81UPcDHEffJCxYu3M_iPz3Dt-O3axB73R5SLm_Veo,22
10
- python_osw_validation-0.2.7.dist-info/RECORD,,