matrice 1.0.98849__py3-none-any.whl → 1.0.98851__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.
@@ -1,8 +1,9 @@
1
1
  """Module providing task_utils functionality."""
2
2
 
3
3
  import os
4
- import shlex
5
- import subprocess
4
+ import shutil
5
+ import urllib.request
6
+ import zipfile
6
7
  from matrice.utils import log_errors
7
8
 
8
9
 
@@ -30,24 +31,46 @@ def setup_workspace_and_run_task(
30
31
  if os.path.exists(workspace_dir):
31
32
  return
32
33
  os.makedirs(workspace_dir, exist_ok=True)
33
- download_codebase_cmd = (
34
- f"curl -L -o {shlex.quote(codebase_zip_path)} {shlex.quote(model_codebase_url)}"
35
- )
36
- subprocess.run(
37
- download_codebase_cmd,
38
- shell=True,
39
- check=True,
40
- )
41
- unzip_codebase_cmd = (
42
- f"unzip -o {shlex.quote(codebase_zip_path)} -d {shlex.quote(workspace_dir)}"
43
- )
44
- subprocess.run(unzip_codebase_cmd, shell=True, check=True)
45
- move_files_cmd = f"rsync -av {shlex.quote(workspace_dir)}/*/ {shlex.quote(workspace_dir)}/ "
46
- subprocess.run(move_files_cmd, shell=True, check=True)
34
+
35
+ # Download codebase ZIP file
36
+ urllib.request.urlretrieve(model_codebase_url, codebase_zip_path)
37
+
38
+ # Extract ZIP file with overwrite
39
+ with zipfile.ZipFile(codebase_zip_path, 'r') as zip_ref:
40
+ zip_ref.extractall(workspace_dir)
41
+
42
+ # Move files from subdirectories to workspace root (equivalent to rsync -av)
43
+ for root, dirs, files in os.walk(workspace_dir):
44
+ # Skip the workspace_dir itself to avoid moving files to themselves
45
+ if root == workspace_dir:
46
+ continue
47
+
48
+ for file in files:
49
+ src_file = os.path.join(root, file)
50
+ dst_file = os.path.join(workspace_dir, file)
51
+
52
+ # If destination file exists, overwrite it (equivalent to rsync -av behavior)
53
+ if os.path.exists(dst_file):
54
+ os.remove(dst_file)
55
+
56
+ shutil.move(src_file, dst_file)
57
+
58
+ # Remove empty directories after moving files
59
+ for dir_name in dirs:
60
+ dir_path = os.path.join(root, dir_name)
61
+ if os.path.exists(dir_path) and not os.listdir(dir_path):
62
+ os.rmdir(dir_path)
63
+
64
+ # Clean up any remaining empty subdirectories
65
+ for root, dirs, files in os.walk(workspace_dir, topdown=False):
66
+ if root == workspace_dir:
67
+ continue
68
+ if not files and not dirs:
69
+ try:
70
+ os.rmdir(root)
71
+ except OSError:
72
+ pass # Directory might not be empty or might not exist
73
+
74
+ # Download requirements.txt if URL is provided
47
75
  if model_codebase_requirements_url:
48
- download_requirements_cmd = f"curl -L -o {shlex.quote(requirements_txt_path)} {shlex.quote(model_codebase_requirements_url)}"
49
- subprocess.run(
50
- download_requirements_cmd,
51
- shell=True,
52
- check=True,
53
- )
76
+ urllib.request.urlretrieve(model_codebase_requirements_url, requirements_txt_path)
@@ -413,7 +413,7 @@ class LicensePlateUseCase(BaseProcessor):
413
413
  stream_info: Optional[Dict[str, Any]] = None
414
414
  ) -> List[Dict]:
415
415
  """Generate structured tracking stats with frame-based keys, including per-frame and cumulative counts."""
416
- from datetime import datetime, timezone
416
+
417
417
 
418
418
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
419
419
  tracking_stats = [{frame_key: []}]
@@ -409,7 +409,7 @@ class PPEComplianceUseCase(BaseProcessor):
409
409
  stream_info: Optional[Dict[str, Any]] = None
410
410
  ) -> List[Dict]:
411
411
  """Generate structured tracking stats for the output format with frame-based keys, including track_ids_info."""
412
- from datetime import datetime, timezone
412
+
413
413
 
414
414
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
415
415
  tracking_stats = [{frame_key: []}]
@@ -557,7 +557,7 @@ class VehicleMonitoringUseCase(BaseProcessor):
557
557
  stream_info: Optional[Dict[str, Any]] = None
558
558
  ) -> List[Dict]:
559
559
  """Generate structured tracking stats for the output format with frame-based keys, including track_ids_info."""
560
- from datetime import datetime, timezone
560
+
561
561
 
562
562
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
563
563
  tracking_stats = [{frame_key: []}]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.98849
3
+ Version: 1.0.98851
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
@@ -31,7 +31,7 @@ matrice/compute_manager/prechecks.py,sha256=sarrX0DIUWRfWvCowTANiMvSi2VPZ-5tCEdZ
31
31
  matrice/compute_manager/resources_tracker.py,sha256=84yzWYyLZmd2wENnKMk-mBUMAhE3CZ7oyZ3-5hnAwdI,16178
32
32
  matrice/compute_manager/scaling.py,sha256=95gt9KxYLtcOskSpdbC0ddbduSgZuDD6bGsJX-SVlwc,22976
33
33
  matrice/compute_manager/shutdown_manager.py,sha256=3m0DjItl1uSyTO7fvQb-IV8lapNX31Zul8FG0yCge0M,5245
34
- matrice/compute_manager/task_utils.py,sha256=gBmlD4Fw73mm6Z3keXMSk33joF_Kkf_6CucR1iyciME,1761
34
+ matrice/compute_manager/task_utils.py,sha256=hwT3_RyCu7RTH7T83NYNHBJ8XXkS8V3sUSb3oO0QNrU,2626
35
35
  matrice/data_processing/__init__.py,sha256=JqYtcyzrQGSXN2EmQBjS4rqwj0CKe0tg9x1Nd3UAAgQ,120
36
36
  matrice/data_processing/client.py,sha256=AtimRASg8nH3mxwwih1EHvvHNeXl9NvJhIJHjLjSxHY,55309
37
37
  matrice/data_processing/client_utils.py,sha256=q0bJg6bmlUTzy83RSuViCcpazHWgRgKgx77fqDqT2kQ,50121
@@ -120,10 +120,10 @@ matrice/deploy/utils/post_processing/usecases/color_map_utils.py,sha256=SP-AEVcj
120
120
  matrice/deploy/utils/post_processing/usecases/customer_service.py,sha256=UWS83qxguyAyhh8a0JF5QH9DtKxO8I-gI2BPOjLPxBw,44642
121
121
  matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=rLaUvU5ygvjGbOmjncEJCl_Oe52SRycS1Ar23LbRssM,32863
122
122
  matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=_pPKa16ax4-V-iOHkdLp2-sYA6uJNAm7Z-75Fnv6vro,48674
123
- matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=zxFI8iakFUCBm64P83l380CEiuGGOPNzhZhHNpAaxIc,26902
123
+ matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=f38mdyAdW2Lopqy2XcT97HzI31_FcxTux-_tIdCm37g,26855
124
124
  matrice/deploy/utils/post_processing/usecases/people_counting.py,sha256=QSvq2zwFotp0o_T15EqFePAkukIyACleBZCf4fy7dHM,77973
125
- matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=4CsmjEbwmYlvQgC0kEhjEQlkwkgwuD4AG2NKwvfWqSs,27646
126
- matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=C6vLwxyjGKxuLQ9N2oaFCwQnoxKV1YsgqMA7hNflTR4,39324
125
+ matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=UhFFy7awb3vmBd4eOdFeO43um497J0Xt90Nl9v6reoQ,27599
126
+ matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=EkbZc1yYrb3rtloQQqZLNOTJsFPGPD8dyTG8J1M4ZNQ,39277
127
127
  matrice/deploy/utils/post_processing/utils/__init__.py,sha256=A49ksdXL7gRwBbIUwnU2ueFDGA67qVnEW_9lItOibtk,3626
128
128
  matrice/deploy/utils/post_processing/utils/advanced_counting_utils.py,sha256=D6jlZNRCfPtfG8COv3AMCbCfZf4_DK9rFhwzVJEYjpg,19152
129
129
  matrice/deploy/utils/post_processing/utils/advanced_helper_utils.py,sha256=W8mDqJTpg98YJgWYBod0rZUNbR4bmvYMeWAGASs14_s,11624
@@ -137,8 +137,8 @@ matrice/deploy/utils/post_processing/utils/format_utils.py,sha256=ce2VpQicTYKfxu
137
137
  matrice/deploy/utils/post_processing/utils/geometry_utils.py,sha256=BWfdM6RsdJTTLR1GqkWfdwpjMEjTCJyuBxA4zVGKdfk,9623
138
138
  matrice/deploy/utils/post_processing/utils/smoothing_utils.py,sha256=gQPykV1HGh-IMMz_3fumgtrhpyCRgXMS1hOEDcLRMO0,12542
139
139
  matrice/deploy/utils/post_processing/utils/tracking_utils.py,sha256=rWxuotnJ3VLMHIBOud2KLcu4yZfDp7hVPWUtNAq_2xw,8288
140
- matrice-1.0.98849.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
- matrice-1.0.98849.dist-info/METADATA,sha256=pBRtfgYqdmoS4hZ6RtJoGcjRrQlxJxtw1V0lreQhIzI,14624
142
- matrice-1.0.98849.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
- matrice-1.0.98849.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
- matrice-1.0.98849.dist-info/RECORD,,
140
+ matrice-1.0.98851.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
+ matrice-1.0.98851.dist-info/METADATA,sha256=HvjNufQVAR1bCTJoIT5xaBsSflOX1g3pXmezm5937uE,14624
142
+ matrice-1.0.98851.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
+ matrice-1.0.98851.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
+ matrice-1.0.98851.dist-info/RECORD,,