thds.core 1.34.20250408__py3-none-any.whl → 1.34.20250415__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 thds.core might be problematic. Click here for more details.
- thds/core/source/__init__.py +1 -0
- thds/core/source/_construct_tree.py +18 -0
- thds/core/source/tree.py +9 -2
- {thds_core-1.34.20250408.dist-info → thds_core-1.34.20250415.dist-info}/METADATA +1 -1
- {thds_core-1.34.20250408.dist-info → thds_core-1.34.20250415.dist-info}/RECORD +8 -7
- {thds_core-1.34.20250408.dist-info → thds_core-1.34.20250415.dist-info}/WHEEL +0 -0
- {thds_core-1.34.20250408.dist-info → thds_core-1.34.20250415.dist-info}/entry_points.txt +0 -0
- {thds_core-1.34.20250408.dist-info → thds_core-1.34.20250415.dist-info}/top_level.txt +0 -0
thds/core/source/__init__.py
CHANGED
|
@@ -5,5 +5,6 @@ yet will not be downloaded (if non-local) until it is actually opened or unwrapp
|
|
|
5
5
|
|
|
6
6
|
from . import serde, tree # noqa: F401
|
|
7
7
|
from ._construct import from_file, from_uri, path_from_uri, register_from_uri_handler # noqa: F401
|
|
8
|
+
from ._construct_tree import tree_from_directory # noqa: F401
|
|
8
9
|
from ._download import Downloader, register_download_handler # noqa: F401
|
|
9
10
|
from .src import Source # noqa: F401
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import typing as ty
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from ..files import path_from_uri
|
|
6
|
+
from ._construct import from_file
|
|
7
|
+
from .tree import SourceTree
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def tree_from_directory(dirpath: ty.Union[str, os.PathLike]) -> SourceTree:
|
|
11
|
+
path = path_from_uri(dirpath) if isinstance(dirpath, str) else Path(dirpath)
|
|
12
|
+
|
|
13
|
+
if path.exists() and not path.is_dir():
|
|
14
|
+
raise NotADirectoryError(f"File '{path}' is not a directory")
|
|
15
|
+
if not path.exists():
|
|
16
|
+
raise FileNotFoundError(f"Directory '{path}' not found")
|
|
17
|
+
|
|
18
|
+
return SourceTree(sources=[from_file(file) for file in path.glob("**/*") if file.is_file()])
|
thds/core/source/tree.py
CHANGED
|
@@ -93,8 +93,15 @@ class SourceTree(os.PathLike):
|
|
|
93
93
|
)
|
|
94
94
|
)
|
|
95
95
|
]
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
|
|
97
|
+
if len(local_paths) == 1:
|
|
98
|
+
local_logical_root = local_paths[0].parent.resolve()
|
|
99
|
+
else:
|
|
100
|
+
local_logical_root = Path(
|
|
101
|
+
logical_root.find(map(str, local_paths), self.higher_logical_root)
|
|
102
|
+
)
|
|
103
|
+
assert local_logical_root.is_dir()
|
|
104
|
+
|
|
98
105
|
if not dest_dir:
|
|
99
106
|
return local_logical_root
|
|
100
107
|
|
|
@@ -46,12 +46,13 @@ thds/core/log/json_formatter.py,sha256=C5bRsSbAqaQqfTm88jc3mYe3vwKZZLAxET8s7_u7a
|
|
|
46
46
|
thds/core/log/kw_formatter.py,sha256=9-MVOd2r5NEkYNne9qWyFMeR5lac3w7mjHXsDa681i0,3379
|
|
47
47
|
thds/core/log/kw_logger.py,sha256=CyZVPnkUMtrUL2Lyk261AIEPmoP-buf_suFAhQlU1io,4063
|
|
48
48
|
thds/core/log/logfmt.py,sha256=i66zoG2oERnE1P_0TVXdlfJ1YgUmvtMjqRtdV5u2SvU,10366
|
|
49
|
-
thds/core/source/__init__.py,sha256=
|
|
49
|
+
thds/core/source/__init__.py,sha256=0Zy3mwJgwLtc4jq14Cwu6d_Rq-aZOMIlu4zaADeKgmo,487
|
|
50
50
|
thds/core/source/_construct.py,sha256=plSyQZRe8h0X7PpbfMjhm1qkFgrcyuSrReyWQo28YfA,3121
|
|
51
|
+
thds/core/source/_construct_tree.py,sha256=5Zk3a5a0uVxklWw6q4JOvI_bErqwlBngUz4TyEAWn1g,616
|
|
51
52
|
thds/core/source/_download.py,sha256=pUhkphHdB7y4ZpxZZ6ITIS5giXMHuRf420yYAJwx6aE,2924
|
|
52
53
|
thds/core/source/serde.py,sha256=wXCfuv_Dv3QvJJr-uebGmTrfhCU_1a8VX3VJnXhVHfU,3539
|
|
53
54
|
thds/core/source/src.py,sha256=9A_8kSBUc5k6OLAYe5EW_VogpXFIqofow7Rxl8xv-eg,4559
|
|
54
|
-
thds/core/source/tree.py,sha256=
|
|
55
|
+
thds/core/source/tree.py,sha256=iNCoCE655MwXQwc2Y0IIm1HMVk5Inj0NGVU9U8Wl_90,4317
|
|
55
56
|
thds/core/sqlite/__init__.py,sha256=tDMzuO76qTtckJHldPQ6nPZ6kcvhhoJrVuuW42JtaSQ,606
|
|
56
57
|
thds/core/sqlite/connect.py,sha256=l4QaSAI8RjP7Qh2FjmJ3EwRgfGf65Z3-LjtC9ocHM_U,977
|
|
57
58
|
thds/core/sqlite/copy.py,sha256=y3IRQTBrWDfKuVIfW7fYuEgwRCRKHjN0rxVFkIb9VrQ,1155
|
|
@@ -67,8 +68,8 @@ thds/core/sqlite/structured.py,sha256=SvZ67KcVcVdmpR52JSd52vMTW2ALUXmlHEeD-VrzWV
|
|
|
67
68
|
thds/core/sqlite/types.py,sha256=oUkfoKRYNGDPZRk29s09rc9ha3SCk2SKr_K6WKebBFs,1308
|
|
68
69
|
thds/core/sqlite/upsert.py,sha256=BmKK6fsGVedt43iY-Lp7dnAu8aJ1e9CYlPVEQR2pMj4,5827
|
|
69
70
|
thds/core/sqlite/write.py,sha256=z0219vDkQDCnsV0WLvsj94keItr7H4j7Y_evbcoBrWU,3458
|
|
70
|
-
thds_core-1.34.
|
|
71
|
-
thds_core-1.34.
|
|
72
|
-
thds_core-1.34.
|
|
73
|
-
thds_core-1.34.
|
|
74
|
-
thds_core-1.34.
|
|
71
|
+
thds_core-1.34.20250415.dist-info/METADATA,sha256=hKvrKssYHF18xNzWH5gB_RvxAZo583s5eqstHJeoNfw,2269
|
|
72
|
+
thds_core-1.34.20250415.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
73
|
+
thds_core-1.34.20250415.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
|
|
74
|
+
thds_core-1.34.20250415.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
|
|
75
|
+
thds_core-1.34.20250415.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|