pathpilot 0.4.6__tar.gz → 0.6.0__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.4.6 → pathpilot-0.6.0}/PKG-INFO +3 -3
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/__init__.py +7 -2
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_csv.py +16 -11
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_excel.py +4 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_parquet.py +11 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/decorators.py +14 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pyproject.toml +2 -2
- {pathpilot-0.4.6 → pathpilot-0.6.0}/uv.lock +1 -1
- {pathpilot-0.4.6 → pathpilot-0.6.0}/.gitignore +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/.python-version +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/LICENSE +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/README.md +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/_utils.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/base/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/base/_decorators.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/base/core.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/base/df_dispatch_file.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_pickle.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_sqlite.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_text.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/kinds/_zip.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_file/utils.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/backup.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/_contents/__init__.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/_contents/base.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/_contents/files.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/_contents/subfolders.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/folder/core.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_folder/utils.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/_utils.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/config.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/core.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/exceptions.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/path.py +0 -0
- {pathpilot-0.4.6 → pathpilot-0.6.0}/pathpilot/utils.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pathpilot
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Simplifies file and folder manipulation
|
|
5
5
|
Project-URL: repository, https://github.com/zteinck/pathpilot
|
|
6
6
|
Project-URL: homepage, https://github.com/zteinck/pathpilot
|
|
7
7
|
Author-email: Zachary Einck <zacharyeinck@gmail.com>
|
|
@@ -7,7 +7,12 @@ from .core import (
|
|
|
7
7
|
|
|
8
8
|
from ._folder import *
|
|
9
9
|
from ._file import *
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
from .decorators import (
|
|
12
|
+
check_read_only,
|
|
13
|
+
assert_exists,
|
|
14
|
+
)
|
|
15
|
+
|
|
11
16
|
from .exceptions import ReadOnlyError
|
|
12
17
|
|
|
13
18
|
from .utils import (
|
|
@@ -21,5 +26,5 @@ from .utils import (
|
|
|
21
26
|
get_modified_date,
|
|
22
27
|
)
|
|
23
28
|
|
|
24
|
-
__version__ = '0.
|
|
29
|
+
__version__ = '0.6.0'
|
|
25
30
|
__author__ = 'Zachary Einck <zacharyeinck@gmail.com>'
|
|
@@ -3,7 +3,11 @@ import oddments as odd
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
import polars as pl
|
|
5
5
|
|
|
6
|
-
from ...decorators import
|
|
6
|
+
from ...decorators import (
|
|
7
|
+
assert_exists,
|
|
8
|
+
check_read_only,
|
|
9
|
+
)
|
|
10
|
+
|
|
7
11
|
from ..base import DfDispatchFile
|
|
8
12
|
|
|
9
13
|
|
|
@@ -21,6 +25,16 @@ class CsvFile(DfDispatchFile):
|
|
|
21
25
|
#| Instance Methods |
|
|
22
26
|
#╰-------------------------------------------------------------------------╯
|
|
23
27
|
|
|
28
|
+
@assert_exists
|
|
29
|
+
def scan(self, **kwargs):
|
|
30
|
+
return pl.scan_csv(self.path, **kwargs)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@check_read_only
|
|
34
|
+
def sink(self, lf, **kwargs):
|
|
35
|
+
lf.sink_csv(self.path, **kwargs)
|
|
36
|
+
|
|
37
|
+
|
|
24
38
|
def _read_with_pandas(self, **kwargs):
|
|
25
39
|
defaults = {
|
|
26
40
|
'encoding': 'ISO-8859-1',
|
|
@@ -41,13 +55,4 @@ class CsvFile(DfDispatchFile):
|
|
|
41
55
|
|
|
42
56
|
|
|
43
57
|
def _save_with_polars(self, obj, **kwargs):
|
|
44
|
-
obj.write_csv(self.path, **kwargs)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def scan(self, **kwargs):
|
|
48
|
-
return pl.scan_csv(self.path, **kwargs)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@check_read_only
|
|
52
|
-
def sink(self, lf, **kwargs):
|
|
53
|
-
lf.sink_csv(self.path, **kwargs)
|
|
58
|
+
obj.write_csv(self.path, **kwargs)
|
|
@@ -507,6 +507,10 @@ class ExcelFile(DfDispatchFile):
|
|
|
507
507
|
char_limit = 31
|
|
508
508
|
name = name[:char_limit]
|
|
509
509
|
|
|
510
|
+
# Excel forbids certain characters
|
|
511
|
+
forbidden_chars = {':','\\','/','?','*','[',']'}
|
|
512
|
+
name = ''.join('-' if x in forbidden_chars else x for x in name)
|
|
513
|
+
|
|
510
514
|
# ensure truncated sheet names are unique
|
|
511
515
|
sheet_names = set(self.sheet_names)
|
|
512
516
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import polars as pl
|
|
2
2
|
|
|
3
|
+
from ...decorators import (
|
|
4
|
+
assert_exists,
|
|
5
|
+
check_read_only,
|
|
6
|
+
)
|
|
7
|
+
|
|
3
8
|
from ..base import File
|
|
4
9
|
|
|
5
10
|
|
|
@@ -17,11 +22,17 @@ class ParquetFile(File):
|
|
|
17
22
|
#| Instance Methods |
|
|
18
23
|
#╰-------------------------------------------------------------------------╯
|
|
19
24
|
|
|
25
|
+
@assert_exists
|
|
20
26
|
def scan(self, **kwargs):
|
|
21
27
|
lf = pl.scan_parquet(self.path, **kwargs)
|
|
22
28
|
return lf
|
|
23
29
|
|
|
24
30
|
|
|
31
|
+
@check_read_only
|
|
32
|
+
def sink(self, lf, **kwargs):
|
|
33
|
+
lf.sink_parquet(self.path, **kwargs)
|
|
34
|
+
|
|
35
|
+
|
|
25
36
|
def read(self, **kwargs):
|
|
26
37
|
df = pl.read_parquet(self.path, **kwargs)
|
|
27
38
|
return df
|
|
@@ -21,4 +21,18 @@ def inject_read_only(func):
|
|
|
21
21
|
params = {'read_only': self.read_only} | kwargs
|
|
22
22
|
return func(self, *args, **params)
|
|
23
23
|
|
|
24
|
+
return wrapper
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def assert_exists(func):
|
|
28
|
+
|
|
29
|
+
@wraps(func)
|
|
30
|
+
def wrapper(self, *args, **kwargs):
|
|
31
|
+
if not self.exists:
|
|
32
|
+
raise FileNotFoundError(
|
|
33
|
+
f"Cannot execute '{func.__name__}()' because the path does "
|
|
34
|
+
f"not exist:\n{self.path}"
|
|
35
|
+
)
|
|
36
|
+
return func(self, *args, **kwargs)
|
|
37
|
+
|
|
24
38
|
return wrapper
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pathpilot"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.6.0"
|
|
4
|
+
description = "Simplifies file and folder manipulation"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Zachary Einck", email = "zacharyeinck@gmail.com" }
|
|
7
7
|
]
|
|
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
|
|
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
|
|
File without changes
|