pathpilot 0.3.0__tar.gz → 0.3.2__tar.gz
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.
- {pathpilot-0.3.0 → pathpilot-0.3.2}/PKG-INFO +8 -9
- {pathpilot-0.3.0 → pathpilot-0.3.2}/README.md +5 -5
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/__init__.py +1 -1
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_excel.py +6 -3
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/base.py +1 -1
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_folder/base.py +1 -1
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pyproject.toml +1 -1
- {pathpilot-0.3.0 → pathpilot-0.3.2}/LICENSE +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/__init__.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_csv.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_pickle.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_sqlite.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_text.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/_zip.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_file/utils.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_folder/__init__.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_folder/backup.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/_folder/utils.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/core.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/decorators.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/exceptions.py +0 -0
- {pathpilot-0.3.0 → pathpilot-0.3.2}/pathpilot/utils.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: pathpilot
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Library that facilitates file and folder manipulation in Python.
|
|
5
|
+
Home-page: https://github.com/zteinck/pathpilot
|
|
5
6
|
License: MIT
|
|
6
7
|
Author: Zachary Einck
|
|
7
8
|
Author-email: zacharyeinck@gmail.com
|
|
@@ -13,14 +14,12 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Requires-Dist: XlsxWriter
|
|
18
18
|
Requires-Dist: cachegrab (>=0.2.2)
|
|
19
19
|
Requires-Dist: clockwork (>=0.3.4)
|
|
20
20
|
Requires-Dist: numpy
|
|
21
21
|
Requires-Dist: oddments (>=0.3.1)
|
|
22
22
|
Requires-Dist: pandas
|
|
23
|
-
Project-URL: Homepage, https://github.com/zteinck/pathpilot
|
|
24
23
|
Project-URL: Repository, https://github.com/zteinck/pathpilot
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
26
25
|
|
|
@@ -43,7 +42,7 @@ pip install pathpilot
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
## Main Features
|
|
46
|
-
- `
|
|
45
|
+
- `file_factory` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
|
|
47
46
|
- `Folder` ➔ Class for interacting with folders. It is important to be mindful of the `read_only` parameter which, if set to `True`, allows folders to be created or deleted programically.
|
|
48
47
|
|
|
49
48
|
|
|
@@ -52,7 +51,7 @@ Please note the examples below represent a small fraction of the functionality o
|
|
|
52
51
|
|
|
53
52
|
### Imports
|
|
54
53
|
```python
|
|
55
|
-
from pathpilot import Folder,
|
|
54
|
+
from pathpilot import Folder, file_factory
|
|
56
55
|
```
|
|
57
56
|
|
|
58
57
|
### Folders
|
|
@@ -80,10 +79,10 @@ new_years_file = january_folder.join('Happy New Year.txt')
|
|
|
80
79
|
```
|
|
81
80
|
|
|
82
81
|
### Files
|
|
83
|
-
First, we create an instance of the `ExcelFile` class using the `
|
|
82
|
+
First, we create an instance of the `ExcelFile` class using the `file_factory` function. This occurs automatically by virtue of the `.xlsx` file extension.
|
|
84
83
|
```python
|
|
85
84
|
# create ExcelFile instance
|
|
86
|
-
file =
|
|
85
|
+
file = file_factory(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
|
|
87
86
|
```
|
|
88
87
|
|
|
89
88
|
Next, let's check if the file exists. If not, let's save a `pandas` `DataFrame` as an Excel file.
|
|
@@ -101,7 +100,7 @@ Creating MyFile.xlsx
|
|
|
101
100
|
|
|
102
101
|
Now let's read the file we created as a `DataFrame`.
|
|
103
102
|
```python
|
|
104
|
-
# read the file we created as a pd.DataFrame
|
|
103
|
+
# read the file we created as a pd.DataFrame
|
|
105
104
|
df = file.read()
|
|
106
105
|
```
|
|
107
106
|
|
|
@@ -17,7 +17,7 @@ pip install pathpilot
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
## Main Features
|
|
20
|
-
- `
|
|
20
|
+
- `file_factory` ➔ Function that assigns new file instances to the correct child class. Many file types are supported natively including: *.xlsx*, *.csv*, *.txt*, *.pickle*, etc. The mapping of file extensions to their respective classes is managed using the `extension_mapping` global dictionary. Unmapped extensions are assigned to the `FileBase` class.
|
|
21
21
|
- `Folder` ➔ Class for interacting with folders. It is important to be mindful of the `read_only` parameter which, if set to `True`, allows folders to be created or deleted programically.
|
|
22
22
|
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ Please note the examples below represent a small fraction of the functionality o
|
|
|
26
26
|
|
|
27
27
|
### Imports
|
|
28
28
|
```python
|
|
29
|
-
from pathpilot import Folder,
|
|
29
|
+
from pathpilot import Folder, file_factory
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### Folders
|
|
@@ -54,10 +54,10 @@ new_years_file = january_folder.join('Happy New Year.txt')
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Files
|
|
57
|
-
First, we create an instance of the `ExcelFile` class using the `
|
|
57
|
+
First, we create an instance of the `ExcelFile` class using the `file_factory` function. This occurs automatically by virtue of the `.xlsx` file extension.
|
|
58
58
|
```python
|
|
59
59
|
# create ExcelFile instance
|
|
60
|
-
file =
|
|
60
|
+
file = file_factory(r'C:\Users\MyID\Documents\MyFolder\MyFile.xlsx')
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Next, let's check if the file exists. If not, let's save a `pandas` `DataFrame` as an Excel file.
|
|
@@ -75,7 +75,7 @@ Creating MyFile.xlsx
|
|
|
75
75
|
|
|
76
76
|
Now let's read the file we created as a `DataFrame`.
|
|
77
77
|
```python
|
|
78
|
-
# read the file we created as a pd.DataFrame
|
|
78
|
+
# read the file we created as a pd.DataFrame
|
|
79
79
|
df = file.read()
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -828,16 +828,19 @@ class ExcelFile(FileBase):
|
|
|
828
828
|
fmt if s.sum() - s.round().sum() == 0 \
|
|
829
829
|
else f'{fmt}_two_decimals'
|
|
830
830
|
|
|
831
|
+
clean_abs_numeric = lambda x: \
|
|
832
|
+
pd.to_numeric(x, errors='coerce').dropna().abs()
|
|
833
|
+
|
|
831
834
|
for k in numeric_columns:
|
|
832
835
|
if not df[k].isna().all():
|
|
833
|
-
s = df[k]
|
|
836
|
+
s = clean_abs_numeric(df[k])
|
|
834
837
|
if s.max() >= 1000:
|
|
835
838
|
data_format[k] = infer_format('commas', s)
|
|
836
839
|
|
|
837
840
|
for k in percent_columns:
|
|
838
841
|
if not df[k].isna().all():
|
|
839
|
-
s = df[k]
|
|
840
|
-
if s
|
|
842
|
+
s = clean_abs_numeric(df[k])
|
|
843
|
+
if s.where(s > 0).min() >= 1:
|
|
841
844
|
df[k] /= 100
|
|
842
845
|
else:
|
|
843
846
|
s *= 100
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|