pyhabitat 1.0.12__py3-none-any.whl → 1.0.15__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.

Potentially problematic release.


This version of pyhabitat might be problematic. Click here for more details.

pyhabitat/__init__.py CHANGED
@@ -20,7 +20,7 @@ from .environment import (
20
20
  is_pipx,
21
21
  interactive_terminal_is_available,
22
22
  web_browser_is_available,
23
- open_text_file_in_default_app,
23
+ open_text_file_for_editing,
24
24
  )
25
25
 
26
26
  # Optional: Set __all__ for explicit documentation and cleaner imports
@@ -44,5 +44,5 @@ __all__ = [
44
44
  'is_pipx',
45
45
  'interactive_terminal_is_available',
46
46
  'web_browser_is_available',
47
- 'open_text_file_in_default_app',
47
+ 'open_text_file_for_editing',
48
48
  ]
pyhabitat/environment.py CHANGED
@@ -12,8 +12,7 @@ import shutil
12
12
  from pathlib import Path
13
13
  import subprocess
14
14
  import io
15
-
16
- from pipeline.helpers import check_if_zip
15
+ import zipfile
17
16
 
18
17
  # Global cache for tkinter and matplotlib (mpl) availability
19
18
  _TKINTER_AVAILABILITY: bool | None = None
@@ -277,7 +276,7 @@ def is_pyz(exec_path: Path=None, debug=False) -> bool:
277
276
  if not str(exec_path).endswith(".pyz"):
278
277
  return False
279
278
 
280
- if not check_if_zip():
279
+ if not _check_if_zip():
281
280
  return False
282
281
 
283
282
  def is_windows_portable_executable(exec_path: Path = None, debug=False) -> bool:
@@ -522,3 +521,13 @@ def _get_pipx_paths():
522
521
  pipx_venv_base = Path.home() / '.local' / 'share' / 'pipx' / 'venvs'
523
522
 
524
523
  return pipx_bin_path, pipx_venv_base.resolve()
524
+
525
+
526
+ def _check_if_zip(file_path: str | Path) -> bool:
527
+ """Checks if the file at the given path is a valid ZIP archive."""
528
+ try:
529
+ return zipfile.is_zipfile(file_path)
530
+ except Exception:
531
+ # Handle cases where the path might be invalid, or other unexpected errors
532
+ return False
533
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhabitat
3
- Version: 1.0.12
3
+ Version: 1.0.15
4
4
  Summary: A lightweight library for detecting system environment, GUI, and build properties.
5
5
  Author-email: George Clayton Bennett <george.bennett@memphistn.gov>
6
6
  License-Expression: MIT
@@ -110,7 +110,7 @@ Key Question: "What could I do next?"
110
110
 
111
111
  | Function | Description |
112
112
  | :--- | :--- |
113
- | `open_text_file_in_default_app()` | Smoothly opens a text file for editing (for configuration editing prompted by a CLI flag). |
113
+ | `open_text_file_for_editing()` | Smoothly opens a text file for editing (for configuration editing prompted by a CLI flag). |
114
114
 
115
115
  </details>
116
116
 
@@ -177,7 +177,7 @@ Use this function to smoothly open a text file for editing.
177
177
  Ideal use case: Edit a configuration file, if prompted by a CLI command like 'config --textedit'.
178
178
 
179
179
  ```python
180
- open_text_file_in_default_app(filepath=Path('./config.json'))
180
+ open_text_file_for_editing(filepath=Path('./config.json'))
181
181
  ```
182
182
  </details>
183
183
 
@@ -0,0 +1,7 @@
1
+ pyhabitat/__init__.py,sha256=XVMOgp7YPR0xYD1F_4-VEhG4rTwx3ga3CttdRKpkyxA,1115
2
+ pyhabitat/environment.py,sha256=K1It1gvUhYHXixIxHoEMl6grTwZJkGVWbt18_Qeh1qQ,20532
3
+ pyhabitat-1.0.15.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
4
+ pyhabitat-1.0.15.dist-info/METADATA,sha256=PrG9ruoa2F0RJzIogXh4GX55PUPWn0resJRITDnsqac,8813
5
+ pyhabitat-1.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ pyhabitat-1.0.15.dist-info/top_level.txt,sha256=zXYK44Qu8EqxUETREvd2diMUaB5JiGRErkwFaoLQnnI,10
7
+ pyhabitat-1.0.15.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- pyhabitat/__init__.py,sha256=HCsuYmUpq5qmAMUgmPrJbXp4Ojq_HLfHOsqTOHDShc4,1121
2
- pyhabitat/environment.py,sha256=c_eUqlqiAYGBX2LLCMo3PctOYhwTywOrCBrvjg_rXUs,20248
3
- pyhabitat-1.0.12.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
4
- pyhabitat-1.0.12.dist-info/METADATA,sha256=ZN8eb1aqT8gWu2XuAYdB6hwdTtwsPVSimRoZj5ycgAs,8819
5
- pyhabitat-1.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- pyhabitat-1.0.12.dist-info/top_level.txt,sha256=zXYK44Qu8EqxUETREvd2diMUaB5JiGRErkwFaoLQnnI,10
7
- pyhabitat-1.0.12.dist-info/RECORD,,