unctools 0.1.0__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.
- unctools/__init__.py +100 -0
- unctools/converter.py +378 -0
- unctools/detector.py +531 -0
- unctools/operations.py +562 -0
- unctools/utils/__init__.py +40 -0
- unctools/utils/compat.py +331 -0
- unctools/utils/logger.py +228 -0
- unctools/utils/validation.py +321 -0
- unctools/windows/__init__.py +45 -0
- unctools/windows/network.py +490 -0
- unctools/windows/registry.py +410 -0
- unctools/windows/security.py +586 -0
- unctools-0.1.0.dist-info/METADATA +189 -0
- unctools-0.1.0.dist-info/RECORD +17 -0
- unctools-0.1.0.dist-info/WHEEL +5 -0
- unctools-0.1.0.dist-info/licenses/LICENSE +21 -0
- unctools-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unctools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A comprehensive toolkit for handling UNC paths, network drives, and substituted drives
|
|
5
|
+
Home-page: https://github.com/djdacy/unctools
|
|
6
|
+
Author: Dustin Darcy
|
|
7
|
+
Author-email: Dustin Darcy <your.email@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/djdarcy/unctools
|
|
10
|
+
Project-URL: Bug Reports, https://github.com/djdarcy/unctools/issues
|
|
11
|
+
Project-URL: Source, https://github.com/djdarcy/unctools
|
|
12
|
+
Project-URL: Documentation, https://github.com/djdarcy/unctools#readme
|
|
13
|
+
Keywords: unc,network,windows,path,file,share,subst
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
24
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
25
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
26
|
+
Classifier: Topic :: System :: Filesystems
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.6
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: pathlib; python_version < "3.4"
|
|
32
|
+
Provides-Extra: windows
|
|
33
|
+
Requires-Dist: pywin32>=223; extra == "windows"
|
|
34
|
+
Requires-Dist: pypiwin32>=223; extra == "windows"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=3.8.0; extra == "dev"
|
|
39
|
+
Requires-Dist: black>=20.8b1; extra == "dev"
|
|
40
|
+
Requires-Dist: tox>=3.20.0; extra == "dev"
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: sphinx>=4.0.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "docs"
|
|
44
|
+
Requires-Dist: myst-parser>=0.15.0; extra == "docs"
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: home-page
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
Dynamic: requires-python
|
|
49
|
+
|
|
50
|
+
# UNCtools
|
|
51
|
+
|
|
52
|
+
A comprehensive toolkit for handling UNC paths, network drives, and substituted drives across different environments.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- Convert between UNC paths (\\\\server\\share) and local drive paths (Z:\\)
|
|
57
|
+
- Detect UNC paths, network drives, and substituted drives
|
|
58
|
+
- Handle Windows security zones for improved UNC path access
|
|
59
|
+
- Provide high-level file operations that work seamlessly with UNC paths
|
|
60
|
+
- Cross-platform compatibility with graceful degradation
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
### Standard Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install unctools
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### With Windows-specific Support
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install unctools[windows]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Development Mode
|
|
77
|
+
|
|
78
|
+
For development and testing:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/yourusername/unctools.git
|
|
82
|
+
cd unctools
|
|
83
|
+
pip install -e .[dev]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### Basic Path Conversion
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from unctools import convert_to_local, convert_to_unc
|
|
92
|
+
|
|
93
|
+
# Convert UNC path to local drive path
|
|
94
|
+
local_path = convert_to_local("\\\\server\\share\\folder\\file.txt")
|
|
95
|
+
# Result (if mapped): "Z:\\folder\\file.txt"
|
|
96
|
+
|
|
97
|
+
# Convert local drive path back to UNC
|
|
98
|
+
unc_path = convert_to_unc("Z:\\folder\\file.txt")
|
|
99
|
+
# Result: "\\\\server\\share\\folder\\file.txt"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Path Detection
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from unctools import is_unc_path, is_network_drive, is_subst_drive, get_path_type
|
|
106
|
+
|
|
107
|
+
# Check if a path is a UNC path
|
|
108
|
+
if is_unc_path("\\\\server\\share\\file.txt"):
|
|
109
|
+
print("This is a UNC path")
|
|
110
|
+
|
|
111
|
+
# Check if a drive is a network drive
|
|
112
|
+
if is_network_drive("Z:"):
|
|
113
|
+
print("Z: is a network drive")
|
|
114
|
+
|
|
115
|
+
# Get the type of a path
|
|
116
|
+
path_type = get_path_type("C:\\Users\\")
|
|
117
|
+
# Result: "local", "network", "subst", "unc", etc.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Safe File Operations
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from unctools import safe_open, safe_copy, batch_convert
|
|
124
|
+
|
|
125
|
+
# Open a file, handling UNC paths automatically
|
|
126
|
+
with safe_open("\\\\server\\share\\file.txt", "r") as f:
|
|
127
|
+
content = f.read()
|
|
128
|
+
|
|
129
|
+
# Copy a file, handling path conversions
|
|
130
|
+
safe_copy("\\\\server\\share\\file.txt", "local_copy.txt")
|
|
131
|
+
|
|
132
|
+
# Convert multiple paths at once
|
|
133
|
+
paths = ["\\\\server\\share\\file1.txt", "\\\\server\\share\\file2.txt"]
|
|
134
|
+
converted = batch_convert(paths, to_unc=False)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Windows Security Zones
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from unctools.windows import fix_security_zone, add_to_intranet_zone
|
|
141
|
+
|
|
142
|
+
# Fix security zone issues for a server
|
|
143
|
+
fix_security_zone("server")
|
|
144
|
+
|
|
145
|
+
# Add a server to the Local Intranet zone
|
|
146
|
+
add_to_intranet_zone("server")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Network Drive Management
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from unctools.windows import create_network_mapping, remove_network_mapping
|
|
153
|
+
|
|
154
|
+
# Create a network drive mapping
|
|
155
|
+
success, drive = create_network_mapping("\\\\server\\share", "Z:")
|
|
156
|
+
|
|
157
|
+
# Remove a network drive mapping
|
|
158
|
+
remove_network_mapping("Z:")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Platform Compatibility
|
|
162
|
+
|
|
163
|
+
UNCtools is designed to work across various platforms:
|
|
164
|
+
|
|
165
|
+
- **Windows**: Full functionality including security zones and network drive management
|
|
166
|
+
- **Linux/macOS**: Basic path conversion and detection, with graceful degradation for Windows-specific features
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
### Running Tests
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pytest
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Code Style
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
black unctools
|
|
180
|
+
flake8 unctools
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
unctools/__init__.py,sha256=cji_gJGF-01x-ucOrQG0fU1YJ7FM8NlGGA8MoXGbCAA,3220
|
|
2
|
+
unctools/converter.py,sha256=k1sm7Ltlss3XxK3hNypyG_5ltwwhaGn8MUN9UCIcC6U,13193
|
|
3
|
+
unctools/detector.py,sha256=gQtXgXlH-hTsG3DJdDIUqDvN5To-cQNdwD-aoKK8INQ,16772
|
|
4
|
+
unctools/operations.py,sha256=CCjHl8bIzaNHr0WaGYaUYdDkkKp6i1GQaMuumYDbf5c,22320
|
|
5
|
+
unctools/utils/__init__.py,sha256=n_6aZ2-_5WtdBsHGJwK_MF_sTJaChVhy4Qpm4pGA8ls,1126
|
|
6
|
+
unctools/utils/compat.py,sha256=bBUxLx9tJ0hjDgdcZE22GQYx3-Cqr7FOtQGxlAPkz5E,10452
|
|
7
|
+
unctools/utils/logger.py,sha256=OGG01fDH5jImYeKHQb_VWEUelmKA4aoTGZDTyLNM21U,7117
|
|
8
|
+
unctools/utils/validation.py,sha256=qBejCmdZSnCoiTTpX9YosAECe4W4tHMu9E1sY2Gq0Ds,10181
|
|
9
|
+
unctools/windows/__init__.py,sha256=u770IPv5AJYeRwp_voMu_l9EBFhemw30CwVL1CFwTKM,1314
|
|
10
|
+
unctools/windows/network.py,sha256=NbPqgagUB2PzPFOavIkJ3KeWS6y0g-wPOmgjslmmj8U,17601
|
|
11
|
+
unctools/windows/registry.py,sha256=h8ZpkXJC9O13OacTmtgTIg6KQG6OGr3QnkRKpeGVNf4,14382
|
|
12
|
+
unctools/windows/security.py,sha256=ZPa3OhimL5MSXereAQuEn5cnaKCHPTsAyj6MLCWolY8,20930
|
|
13
|
+
unctools-0.1.0.dist-info/licenses/LICENSE,sha256=RQAVi2YlNpQjw2D-MUYldWco2xlAN5aIlfmAL4aNwzI,1069
|
|
14
|
+
unctools-0.1.0.dist-info/METADATA,sha256=se4QQ_R8BQ0As94arQEE3FSHWcWSL4sblPqZP8IpFQo,5204
|
|
15
|
+
unctools-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
unctools-0.1.0.dist-info/top_level.txt,sha256=h-Q1zzHpAbeMS7Rc121tixFXL-3ddudlbbzvkTJ1uFg,9
|
|
17
|
+
unctools-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dustin Darcy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
unctools
|