winipedia-utils 0.5.22__py3-none-any.whl → 0.7.1__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 winipedia-utils might be problematic. Click here for more details.
- winipedia_utils/artifacts/build.py +27 -0
- winipedia_utils/dev/artifacts/build.py +62 -0
- winipedia_utils/{text → dev/configs/base}/config.py +5 -5
- winipedia_utils/{git/gitignore/config.py → dev/configs/gitignore.py} +2 -2
- winipedia_utils/{git/pre_commit/config.py → dev/configs/pre_commit.py} +5 -5
- winipedia_utils/{projects/poetry/config.py → dev/configs/pyproject.py} +82 -16
- winipedia_utils/{testing/config.py → dev/configs/testing.py} +7 -4
- winipedia_utils/dev/configs/workflows/base/base.py +907 -0
- winipedia_utils/dev/configs/workflows/health_check.py +69 -0
- winipedia_utils/dev/configs/workflows/publish.py +51 -0
- winipedia_utils/dev/configs/workflows/release.py +91 -0
- winipedia_utils/dev/git/github/repo/__init__.py +1 -0
- winipedia_utils/{git → dev/git}/github/repo/protect.py +5 -5
- winipedia_utils/{git → dev/git}/pre_commit/hooks.py +3 -63
- winipedia_utils/{git → dev/git}/pre_commit/run_hooks.py +8 -10
- winipedia_utils/dev/projects/poetry/dev_deps.py +21 -0
- winipedia_utils/{projects → dev/projects}/poetry/poetry.py +2 -2
- winipedia_utils/{projects → dev/projects}/project.py +6 -7
- winipedia_utils/dev/testing/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/convention.py +1 -1
- winipedia_utils/{testing → dev/testing}/create_tests.py +14 -14
- winipedia_utils/dev/testing/tests/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/fixtures/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/fixture.py +1 -1
- winipedia_utils/dev/testing/tests/base/fixtures/scopes/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/class_.py +2 -2
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/module.py +2 -2
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/session.py +10 -10
- winipedia_utils/dev/testing/tests/base/utils/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/utils/utils.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/conftest.py +2 -2
- winipedia_utils/{testing/tests/base/utils → dev/testing}/utils.py +7 -24
- winipedia_utils/setup.py +9 -5
- winipedia_utils/utils/__init__.py +1 -0
- winipedia_utils/utils/data/dataframe/__init__.py +1 -0
- winipedia_utils/{data → utils/data}/dataframe/cleaning.py +1 -1
- winipedia_utils/utils/data/structures/__init__.py +1 -0
- winipedia_utils/{text → utils/data/structures/text}/string.py +36 -3
- winipedia_utils/utils/git/__init__.py +1 -0
- winipedia_utils/utils/git/github/__init__.py +1 -0
- winipedia_utils/{git → utils/git}/github/github.py +1 -1
- winipedia_utils/utils/git/github/repo/__init__.py +1 -0
- winipedia_utils/{git → utils/git}/github/repo/repo.py +1 -1
- winipedia_utils/{git → utils/git}/gitignore/gitignore.py +2 -2
- winipedia_utils/{concurrent → utils/iterating/concurrent}/concurrent.py +4 -4
- winipedia_utils/{concurrent → utils/iterating/concurrent}/multiprocessing.py +2 -2
- winipedia_utils/{concurrent → utils/iterating/concurrent}/multithreading.py +1 -1
- winipedia_utils/{logging → utils/logging}/logger.py +1 -1
- winipedia_utils/{modules → utils/modules}/class_.py +5 -5
- winipedia_utils/{modules → utils/modules}/function.py +2 -2
- winipedia_utils/{modules → utils/modules}/module.py +8 -5
- winipedia_utils/{modules → utils/modules}/package.py +9 -36
- winipedia_utils/{oop → utils/oop}/mixins/meta.py +4 -4
- winipedia_utils/{oop → utils/oop}/mixins/mixin.py +2 -2
- winipedia_utils/{os → utils/os}/os.py +2 -2
- winipedia_utils/utils/resources/__init__.py +1 -0
- winipedia_utils/utils/resources/svgs/__init__.py +1 -0
- winipedia_utils/{resources → utils/resources}/svgs/svg.py +1 -1
- winipedia_utils/utils/testing/__init__.py +1 -0
- winipedia_utils/{testing → utils/testing}/assertions.py +18 -0
- winipedia_utils/{testing → utils/testing}/skip.py +1 -1
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/METADATA +34 -33
- winipedia_utils-0.7.1.dist-info/RECORD +109 -0
- winipedia_utils/git/github/workflows/base/base.py +0 -377
- winipedia_utils/git/github/workflows/health_check.py +0 -80
- winipedia_utils/git/github/workflows/publish.py +0 -49
- winipedia_utils/git/github/workflows/release.py +0 -55
- winipedia_utils/testing/__init__.py +0 -1
- winipedia_utils/testing/tests/__init__.py +0 -1
- winipedia_utils/testing/tests/base/__init__.py +0 -1
- winipedia_utils/testing/tests/base/fixtures/__init__.py +0 -1
- winipedia_utils/testing/tests/base/fixtures/scopes/__init__.py +0 -1
- winipedia_utils/testing/tests/base/utils/__init__.py +0 -1
- winipedia_utils-0.5.22.dist-info/RECORD +0 -95
- /winipedia_utils/{data/dataframe → artifacts}/__init__.py +0 -0
- /winipedia_utils/{data/structures → dev}/__init__.py +0 -0
- /winipedia_utils/{git/github → dev/artifacts}/__init__.py +0 -0
- /winipedia_utils/{git/github/repo → dev/configs}/__init__.py +0 -0
- /winipedia_utils/{git/github/workflows → dev/configs}/base/__init__.py +0 -0
- /winipedia_utils/{git/github → dev/configs}/workflows/__init__.py +0 -0
- /winipedia_utils/{resources → dev/configs/workflows/base}/__init__.py +0 -0
- /winipedia_utils/{git → dev/git}/__init__.py +0 -0
- /winipedia_utils/{resources/svgs → dev/git/github}/__init__.py +0 -0
- /winipedia_utils/{git → dev/git}/pre_commit/__init__.py +0 -0
- /winipedia_utils/{projects → dev/projects}/__init__.py +0 -0
- /winipedia_utils/{projects → dev/projects}/poetry/__init__.py +0 -0
- /winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/function.py +0 -0
- /winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/package.py +0 -0
- /winipedia_utils/{data → utils/data}/__init__.py +0 -0
- /winipedia_utils/{data → utils/data}/structures/dicts.py +0 -0
- /winipedia_utils/{text → utils/data/structures/text}/__init__.py +0 -0
- /winipedia_utils/{git → utils/git}/gitignore/__init__.py +0 -0
- /winipedia_utils/{iterating → utils/iterating}/__init__.py +0 -0
- /winipedia_utils/{concurrent → utils/iterating/concurrent}/__init__.py +0 -0
- /winipedia_utils/{iterating → utils/iterating}/iterate.py +0 -0
- /winipedia_utils/{logging → utils/logging}/__init__.py +0 -0
- /winipedia_utils/{logging → utils/logging}/ansi.py +0 -0
- /winipedia_utils/{logging → utils/logging}/config.py +0 -0
- /winipedia_utils/{modules → utils/modules}/__init__.py +0 -0
- /winipedia_utils/{modules → utils/modules}/inspection.py +0 -0
- /winipedia_utils/{oop → utils/oop}/__init__.py +0 -0
- /winipedia_utils/{oop → utils/oop}/mixins/__init__.py +0 -0
- /winipedia_utils/{os → utils/os}/__init__.py +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/delete_garbage_can.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/download_arrow.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/exit_fullscreen_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/fullscreen_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/menu_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/pause_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/play_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/plus_icon.svg +0 -0
- /winipedia_utils/{security → utils/security}/__init__.py +0 -0
- /winipedia_utils/{security → utils/security}/cryptography.py +0 -0
- /winipedia_utils/{security → utils/security}/keyring.py +0 -0
- /winipedia_utils/{testing → utils/testing}/fixtures.py +0 -0
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/WHEEL +0 -0
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/licenses/LICENSE +0 -0
winipedia_utils/setup.py
CHANGED
|
@@ -9,16 +9,20 @@ This script is intended to be called once at the beginning of a project.
|
|
|
9
9
|
from collections.abc import Callable
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
-
from winipedia_utils.
|
|
13
|
-
from winipedia_utils.
|
|
14
|
-
from winipedia_utils.
|
|
15
|
-
from winipedia_utils.projects.project import create_project_root
|
|
12
|
+
from winipedia_utils.dev.configs.gitignore import GitIgnoreConfigFile
|
|
13
|
+
from winipedia_utils.dev.configs.pyproject import PyprojectConfigFile
|
|
14
|
+
from winipedia_utils.dev.git.pre_commit.run_hooks import run_hooks
|
|
15
|
+
from winipedia_utils.dev.projects.project import create_project_root
|
|
16
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
16
17
|
|
|
17
18
|
logger = get_logger(__name__)
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
SETUP_STEPS: list[Callable[..., Any]] = [
|
|
21
|
-
GitIgnoreConfigFile, # must be
|
|
22
|
+
GitIgnoreConfigFile, # must be before create_project_root
|
|
23
|
+
PyprojectConfigFile, # must be before create_project_root
|
|
24
|
+
PyprojectConfigFile.update_poetry, # must be before create_project_root
|
|
25
|
+
PyprojectConfigFile.update_with_dev, # must be before create_project_root
|
|
22
26
|
create_project_root,
|
|
23
27
|
run_hooks,
|
|
24
28
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -12,7 +12,7 @@ from typing import Any
|
|
|
12
12
|
import polars as pl
|
|
13
13
|
from polars.datatypes.classes import FloatType
|
|
14
14
|
|
|
15
|
-
from winipedia_utils.oop.mixins.mixin import ABCLoggingMixin
|
|
15
|
+
from winipedia_utils.utils.oop.mixins.mixin import ABCLoggingMixin
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class CleaningDF(ABCLoggingMixin):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -7,14 +7,17 @@ These utilities simplify common string manipulation tasks throughout the applica
|
|
|
7
7
|
|
|
8
8
|
import hashlib
|
|
9
9
|
import textwrap
|
|
10
|
+
from collections.abc import Callable
|
|
10
11
|
from io import StringIO
|
|
12
|
+
from types import ModuleType
|
|
13
|
+
from typing import Any
|
|
11
14
|
|
|
12
15
|
from defusedxml import ElementTree as DefusedElementTree
|
|
13
16
|
|
|
14
|
-
from winipedia_utils.concurrent.multiprocessing import (
|
|
17
|
+
from winipedia_utils.utils.iterating.concurrent.multiprocessing import (
|
|
15
18
|
cancel_on_timeout,
|
|
16
19
|
)
|
|
17
|
-
from winipedia_utils.logging.logger import get_logger
|
|
20
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
18
21
|
|
|
19
22
|
logger = get_logger(__name__)
|
|
20
23
|
|
|
@@ -114,7 +117,7 @@ def split_on_uppercase(string: str) -> list[str]:
|
|
|
114
117
|
|
|
115
118
|
"""
|
|
116
119
|
letters = list(string)
|
|
117
|
-
parts = []
|
|
120
|
+
parts: list[str] = []
|
|
118
121
|
current_part = ""
|
|
119
122
|
for letter in letters:
|
|
120
123
|
if letter.isupper() and current_part:
|
|
@@ -124,3 +127,33 @@ def split_on_uppercase(string: str) -> list[str]:
|
|
|
124
127
|
current_part += letter
|
|
125
128
|
parts.append(current_part)
|
|
126
129
|
return parts
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def make_name_from_obj(
|
|
133
|
+
package: ModuleType | Callable[..., Any] | type | str,
|
|
134
|
+
split_on: str = "_",
|
|
135
|
+
join_on: str = "-",
|
|
136
|
+
*,
|
|
137
|
+
capitalize: bool = True,
|
|
138
|
+
) -> str:
|
|
139
|
+
"""Make a name from a package.
|
|
140
|
+
|
|
141
|
+
takes a package and makes a name from it that is readable by humans.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
package (ModuleType): The package to make a name from
|
|
145
|
+
split_on (str, optional): what to split the package name on. Defaults to "_".
|
|
146
|
+
join_on (str, optional): what to join the package name with. Defaults to "-".
|
|
147
|
+
capitalize (bool, optional): Whether to capitalize each part. Defaults to True.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
str: _description_
|
|
151
|
+
"""
|
|
152
|
+
if not isinstance(package, str):
|
|
153
|
+
package_name = package.__name__.split(".")[-1]
|
|
154
|
+
else:
|
|
155
|
+
package_name = package
|
|
156
|
+
parts = package_name.split(split_on)
|
|
157
|
+
if capitalize:
|
|
158
|
+
parts = [part.capitalize() for part in parts]
|
|
159
|
+
return join_on.join(parts)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module for winipedia_utils.git."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -12,8 +12,8 @@ from pathlib import Path
|
|
|
12
12
|
|
|
13
13
|
import pathspec
|
|
14
14
|
|
|
15
|
-
from winipedia_utils.
|
|
16
|
-
from winipedia_utils.logging.logger import get_logger
|
|
15
|
+
from winipedia_utils.dev.configs.gitignore import GitIgnoreConfigFile
|
|
16
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
17
17
|
|
|
18
18
|
logger = get_logger(__name__)
|
|
19
19
|
|
|
@@ -20,8 +20,8 @@ from typing import TYPE_CHECKING, Any, cast
|
|
|
20
20
|
|
|
21
21
|
from tqdm import tqdm
|
|
22
22
|
|
|
23
|
-
from winipedia_utils.iterating.iterate import get_len_with_default
|
|
24
|
-
from winipedia_utils.logging.logger import get_logger
|
|
23
|
+
from winipedia_utils.utils.iterating.iterate import get_len_with_default
|
|
24
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
25
25
|
|
|
26
26
|
if TYPE_CHECKING:
|
|
27
27
|
from multiprocessing.pool import Pool
|
|
@@ -208,10 +208,10 @@ def concurrent_loop( # noqa: PLR0913
|
|
|
208
208
|
Returns:
|
|
209
209
|
list[Any]: Results from the process_function executions
|
|
210
210
|
"""
|
|
211
|
-
from winipedia_utils.concurrent.multiprocessing import ( # noqa: PLC0415 # avoid circular import
|
|
211
|
+
from winipedia_utils.utils.iterating.concurrent.multiprocessing import ( # noqa: PLC0415 # avoid circular import
|
|
212
212
|
get_spwan_pool,
|
|
213
213
|
)
|
|
214
|
-
from winipedia_utils.concurrent.multithreading import ( # noqa: PLC0415 # avoid circular import
|
|
214
|
+
from winipedia_utils.utils.iterating.concurrent.multithreading import ( # noqa: PLC0415 # avoid circular import
|
|
215
215
|
imap_unordered,
|
|
216
216
|
)
|
|
217
217
|
|
|
@@ -15,8 +15,8 @@ from functools import wraps
|
|
|
15
15
|
from multiprocessing.pool import Pool
|
|
16
16
|
from typing import Any
|
|
17
17
|
|
|
18
|
-
from winipedia_utils.concurrent.concurrent import concurrent_loop
|
|
19
|
-
from winipedia_utils.logging.logger import get_logger
|
|
18
|
+
from winipedia_utils.utils.iterating.concurrent.concurrent import concurrent_loop
|
|
19
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
20
20
|
|
|
21
21
|
logger = get_logger(__name__)
|
|
22
22
|
|
|
@@ -15,7 +15,7 @@ from collections.abc import Callable, Generator, Iterable
|
|
|
15
15
|
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
|
|
16
16
|
from typing import Any
|
|
17
17
|
|
|
18
|
-
from winipedia_utils.concurrent.concurrent import concurrent_loop
|
|
18
|
+
from winipedia_utils.utils.iterating.concurrent.concurrent import concurrent_loop
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def get_future_results_as_completed(
|
|
@@ -8,7 +8,7 @@ defined in the config module to ensure consistent logging behavior.
|
|
|
8
8
|
import logging
|
|
9
9
|
from logging.config import dictConfig
|
|
10
10
|
|
|
11
|
-
from winipedia_utils.logging.config import LOGGING_CONFIG
|
|
11
|
+
from winipedia_utils.utils.logging.config import LOGGING_CONFIG
|
|
12
12
|
|
|
13
13
|
dictConfig(LOGGING_CONFIG)
|
|
14
14
|
|
|
@@ -12,8 +12,8 @@ from importlib import import_module
|
|
|
12
12
|
from types import ModuleType
|
|
13
13
|
from typing import Any
|
|
14
14
|
|
|
15
|
-
from winipedia_utils.modules.function import is_func
|
|
16
|
-
from winipedia_utils.modules.inspection import get_def_line, get_obj_members
|
|
15
|
+
from winipedia_utils.utils.modules.function import is_func
|
|
16
|
+
from winipedia_utils.utils.modules.inspection import get_def_line, get_obj_members
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_all_methods_from_cls(
|
|
@@ -38,7 +38,7 @@ def get_all_methods_from_cls(
|
|
|
38
38
|
A list of callable methods from the class
|
|
39
39
|
|
|
40
40
|
"""
|
|
41
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
41
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
42
42
|
get_module_of_obj,
|
|
43
43
|
)
|
|
44
44
|
|
|
@@ -74,7 +74,7 @@ def get_all_cls_from_module(module: ModuleType | str) -> list[type]:
|
|
|
74
74
|
A list of class types defined in the module
|
|
75
75
|
|
|
76
76
|
"""
|
|
77
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
77
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
78
78
|
get_module_of_obj,
|
|
79
79
|
)
|
|
80
80
|
|
|
@@ -111,7 +111,7 @@ def get_all_subclasses(
|
|
|
111
111
|
A list of subclasses of the given class
|
|
112
112
|
|
|
113
113
|
"""
|
|
114
|
-
from winipedia_utils.modules.package import ( # noqa: PLC0415 # avoid circular import
|
|
114
|
+
from winipedia_utils.utils.modules.package import ( # noqa: PLC0415 # avoid circular import
|
|
115
115
|
walk_package,
|
|
116
116
|
)
|
|
117
117
|
|
|
@@ -12,7 +12,7 @@ from importlib import import_module
|
|
|
12
12
|
from types import ModuleType
|
|
13
13
|
from typing import Any
|
|
14
14
|
|
|
15
|
-
from winipedia_utils.modules.inspection import get_def_line, get_obj_members
|
|
15
|
+
from winipedia_utils.utils.modules.inspection import get_def_line, get_obj_members
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def is_func_or_method(obj: Any) -> bool:
|
|
@@ -77,7 +77,7 @@ def get_all_functions_from_module(
|
|
|
77
77
|
A list of callable functions defined in the module
|
|
78
78
|
|
|
79
79
|
"""
|
|
80
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
80
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
81
81
|
get_module_of_obj,
|
|
82
82
|
)
|
|
83
83
|
|
|
@@ -19,14 +19,17 @@ from pathlib import Path
|
|
|
19
19
|
from types import ModuleType
|
|
20
20
|
from typing import Any
|
|
21
21
|
|
|
22
|
-
from winipedia_utils.logging.logger import get_logger
|
|
23
|
-
from winipedia_utils.modules.class_ import (
|
|
22
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
23
|
+
from winipedia_utils.utils.modules.class_ import (
|
|
24
24
|
get_all_cls_from_module,
|
|
25
25
|
get_all_methods_from_cls,
|
|
26
26
|
)
|
|
27
|
-
from winipedia_utils.modules.function import get_all_functions_from_module
|
|
28
|
-
from winipedia_utils.modules.inspection import
|
|
29
|
-
|
|
27
|
+
from winipedia_utils.utils.modules.function import get_all_functions_from_module
|
|
28
|
+
from winipedia_utils.utils.modules.inspection import (
|
|
29
|
+
get_qualname_of_obj,
|
|
30
|
+
get_unwrapped_obj,
|
|
31
|
+
)
|
|
32
|
+
from winipedia_utils.utils.modules.package import (
|
|
30
33
|
get_modules_and_packages_from_package,
|
|
31
34
|
make_dir_with_init_file,
|
|
32
35
|
module_is_package,
|
|
@@ -26,7 +26,7 @@ from setuptools import find_namespace_packages as _find_namespace_packages
|
|
|
26
26
|
from setuptools import find_packages as _find_packages
|
|
27
27
|
|
|
28
28
|
import winipedia_utils
|
|
29
|
-
from winipedia_utils.logging.logger import get_logger
|
|
29
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
30
30
|
|
|
31
31
|
logger = get_logger(__name__)
|
|
32
32
|
|
|
@@ -46,11 +46,11 @@ def get_src_package() -> ModuleType:
|
|
|
46
46
|
if only the test package exists
|
|
47
47
|
|
|
48
48
|
"""
|
|
49
|
-
from winipedia_utils.testing.convention import ( # noqa: PLC0415 # avoid circular import
|
|
49
|
+
from winipedia_utils.dev.testing.convention import ( # noqa: PLC0415 # avoid circular import
|
|
50
50
|
TESTS_PACKAGE_NAME,
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
packages = find_packages_as_modules(depth=0)
|
|
53
|
+
packages = find_packages_as_modules(depth=0, include_namespace_packages=True)
|
|
54
54
|
return next(p for p in packages if p.__name__ != TESTS_PACKAGE_NAME)
|
|
55
55
|
|
|
56
56
|
|
|
@@ -184,7 +184,7 @@ def find_packages(
|
|
|
184
184
|
find_packages(depth=1) might return ["package1", "package2"]
|
|
185
185
|
|
|
186
186
|
"""
|
|
187
|
-
from winipedia_utils.
|
|
187
|
+
from winipedia_utils.dev.configs.gitignore import ( # noqa: PLC0415
|
|
188
188
|
GitIgnoreConfigFile, # avoid circular import
|
|
189
189
|
)
|
|
190
190
|
|
|
@@ -289,10 +289,10 @@ def make_init_modules_for_package(path: str | Path | ModuleType) -> None:
|
|
|
289
289
|
from get_default_init_module_content.
|
|
290
290
|
|
|
291
291
|
"""
|
|
292
|
-
from winipedia_utils.git.gitignore.gitignore import ( # noqa: PLC0415
|
|
292
|
+
from winipedia_utils.utils.git.gitignore.gitignore import ( # noqa: PLC0415
|
|
293
293
|
walk_os_skipping_gitignore_patterns, # avoid circular import
|
|
294
294
|
)
|
|
295
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415
|
|
295
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415
|
|
296
296
|
to_path, # avoid circular import
|
|
297
297
|
)
|
|
298
298
|
|
|
@@ -319,7 +319,7 @@ def make_init_module(path: str | Path) -> None:
|
|
|
319
319
|
Creates parent directories if they don't exist.
|
|
320
320
|
|
|
321
321
|
"""
|
|
322
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
322
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
323
323
|
get_default_init_module_content,
|
|
324
324
|
to_path,
|
|
325
325
|
)
|
|
@@ -355,7 +355,7 @@ def copy_package(
|
|
|
355
355
|
with_file_content (bool, optional): copies the content of the files.
|
|
356
356
|
|
|
357
357
|
"""
|
|
358
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
358
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
359
359
|
create_module,
|
|
360
360
|
get_isolated_obj_name,
|
|
361
361
|
get_module_content_as_str,
|
|
@@ -385,7 +385,7 @@ def get_main_package() -> ModuleType:
|
|
|
385
385
|
|
|
386
386
|
Even when this package is installed as a module.
|
|
387
387
|
"""
|
|
388
|
-
from winipedia_utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
388
|
+
from winipedia_utils.utils.modules.module import ( # noqa: PLC0415 # avoid circular import
|
|
389
389
|
to_module_name,
|
|
390
390
|
)
|
|
391
391
|
|
|
@@ -409,33 +409,6 @@ def get_main_package() -> ModuleType:
|
|
|
409
409
|
raise ValueError(msg)
|
|
410
410
|
|
|
411
411
|
|
|
412
|
-
def make_name_from_package(
|
|
413
|
-
package: ModuleType,
|
|
414
|
-
split_on: str = "_",
|
|
415
|
-
join_on: str = "-",
|
|
416
|
-
*,
|
|
417
|
-
capitalize: bool = True,
|
|
418
|
-
) -> str:
|
|
419
|
-
"""Make a name from a package.
|
|
420
|
-
|
|
421
|
-
takes a package and makes a name from it that is readable by humans.
|
|
422
|
-
|
|
423
|
-
Args:
|
|
424
|
-
package (ModuleType): The package to make a name from
|
|
425
|
-
split_on (str, optional): what to split the package name on. Defaults to "_".
|
|
426
|
-
join_on (str, optional): what to join the package name with. Defaults to "-".
|
|
427
|
-
capitalize (bool, optional): Whether to capitalize each part. Defaults to True.
|
|
428
|
-
|
|
429
|
-
Returns:
|
|
430
|
-
str: _description_
|
|
431
|
-
"""
|
|
432
|
-
package_name = package.__name__.split(".")[-1]
|
|
433
|
-
parts = package_name.split(split_on)
|
|
434
|
-
if capitalize:
|
|
435
|
-
parts = [part.capitalize() for part in parts]
|
|
436
|
-
return join_on.join(parts)
|
|
437
|
-
|
|
438
|
-
|
|
439
412
|
class DependencyGraph(nx.DiGraph): # type: ignore [type-arg]
|
|
440
413
|
"""A directed graph representing Python package dependencies."""
|
|
441
414
|
|
|
@@ -13,10 +13,10 @@ from collections.abc import Callable
|
|
|
13
13
|
from functools import wraps
|
|
14
14
|
from typing import Any, final
|
|
15
15
|
|
|
16
|
-
from winipedia_utils.
|
|
17
|
-
from winipedia_utils.
|
|
18
|
-
from winipedia_utils.modules.
|
|
19
|
-
from winipedia_utils.
|
|
16
|
+
from winipedia_utils.utils.data.structures.text.string import value_to_truncated_string
|
|
17
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
18
|
+
from winipedia_utils.utils.modules.class_ import get_all_methods_from_cls
|
|
19
|
+
from winipedia_utils.utils.modules.function import is_func, unwrap_method
|
|
20
20
|
|
|
21
21
|
logger = get_logger(__name__)
|
|
22
22
|
|
|
@@ -10,8 +10,8 @@ These utilities help create robust class hierarchies with proper implementation
|
|
|
10
10
|
enforcement and built-in logging capabilities.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
from winipedia_utils.logging.logger import get_logger
|
|
14
|
-
from winipedia_utils.oop.mixins.meta import ABCLoggingMeta, StrictABCLoggingMeta
|
|
13
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
14
|
+
from winipedia_utils.utils.oop.mixins.meta import ABCLoggingMeta, StrictABCLoggingMeta
|
|
15
15
|
|
|
16
16
|
logger = get_logger(__name__)
|
|
17
17
|
|
|
@@ -7,7 +7,7 @@ These utilities help with system-level operations and configuration.
|
|
|
7
7
|
|
|
8
8
|
import shutil
|
|
9
9
|
import subprocess # nosec: B404
|
|
10
|
-
from
|
|
10
|
+
from collections.abc import Sequence
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
13
|
|
|
@@ -34,7 +34,7 @@ def which_with_raise(cmd: str, *, raise_error: bool = True) -> str | None:
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run_subprocess(
|
|
37
|
-
args:
|
|
37
|
+
args: Sequence[str],
|
|
38
38
|
*,
|
|
39
39
|
input_: str | bytes | None = None,
|
|
40
40
|
capture_output: bool = True,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -4,7 +4,7 @@ from importlib.resources import as_file, files
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from types import ModuleType
|
|
6
6
|
|
|
7
|
-
from winipedia_utils.resources import svgs
|
|
7
|
+
from winipedia_utils.utils.resources import svgs
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def get_svg_path(svg_name: str, package: ModuleType | None = None) -> Path:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""__init__ module."""
|
|
@@ -7,6 +7,8 @@ specialized validation logic for common testing scenarios.
|
|
|
7
7
|
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
+
from winipedia_utils.utils.modules.function import is_abstractmethod
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
def assert_with_msg(expr: bool, msg: str) -> None: # noqa: FBT001
|
|
12
14
|
"""Assert that an expression is true with a custom error message.
|
|
@@ -46,3 +48,19 @@ Actual: {actual}
|
|
|
46
48
|
{msg}
|
|
47
49
|
"""
|
|
48
50
|
assert_with_msg(expr, msg)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def assert_isabstrct_method(method: Any) -> None:
|
|
54
|
+
"""Assert that a method is an abstract method.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
method: The method to check
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
AssertionError: If the method is not an abstract method
|
|
61
|
+
|
|
62
|
+
"""
|
|
63
|
+
assert_with_msg(
|
|
64
|
+
is_abstractmethod(method),
|
|
65
|
+
f"Expected {method} to be abstract method",
|
|
66
|
+
)
|
|
@@ -4,7 +4,7 @@ import functools
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from winipedia_utils.git.github.github import running_in_github_actions
|
|
7
|
+
from winipedia_utils.utils.git.github.github import running_in_github_actions
|
|
8
8
|
|
|
9
9
|
skip_fixture_test: pytest.MarkDecorator = functools.partial(
|
|
10
10
|
pytest.mark.skip,
|