winipedia-utils 0.2.0__py3-none-any.whl → 0.2.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/concurrent/concurrent.py +245 -245
- winipedia_utils/concurrent/multiprocessing.py +130 -130
- winipedia_utils/concurrent/multithreading.py +93 -93
- winipedia_utils/consts.py +21 -23
- winipedia_utils/data/__init__.py +1 -1
- winipedia_utils/data/dataframe/__init__.py +1 -1
- winipedia_utils/data/dataframe/cleaning.py +378 -378
- winipedia_utils/data/structures/__init__.py +1 -1
- winipedia_utils/data/structures/dicts.py +16 -16
- winipedia_utils/git/__init__.py +1 -1
- winipedia_utils/git/gitignore/__init__.py +1 -1
- winipedia_utils/git/gitignore/gitignore.py +136 -136
- winipedia_utils/git/pre_commit/__init__.py +1 -1
- winipedia_utils/git/pre_commit/config.py +70 -70
- winipedia_utils/git/pre_commit/hooks.py +109 -109
- winipedia_utils/git/pre_commit/run_hooks.py +49 -49
- winipedia_utils/iterating/__init__.py +1 -1
- winipedia_utils/iterating/iterate.py +29 -29
- winipedia_utils/logging/ansi.py +6 -6
- winipedia_utils/logging/config.py +64 -64
- winipedia_utils/logging/logger.py +26 -26
- winipedia_utils/modules/class_.py +119 -119
- winipedia_utils/modules/function.py +101 -101
- winipedia_utils/modules/module.py +379 -379
- winipedia_utils/modules/package.py +390 -390
- winipedia_utils/oop/mixins/meta.py +333 -333
- winipedia_utils/oop/mixins/mixin.py +37 -37
- winipedia_utils/os/__init__.py +1 -1
- winipedia_utils/os/os.py +63 -63
- winipedia_utils/projects/__init__.py +1 -1
- winipedia_utils/projects/poetry/__init__.py +1 -1
- winipedia_utils/projects/poetry/config.py +91 -91
- winipedia_utils/projects/poetry/poetry.py +31 -31
- winipedia_utils/projects/project.py +48 -48
- winipedia_utils/resources/__init__.py +1 -1
- winipedia_utils/resources/svgs/__init__.py +1 -1
- winipedia_utils/resources/svgs/download_arrow.svg +2 -2
- winipedia_utils/resources/svgs/exit_fullscreen_icon.svg +5 -5
- winipedia_utils/resources/svgs/fullscreen_icon.svg +2 -2
- winipedia_utils/resources/svgs/menu_icon.svg +3 -3
- winipedia_utils/resources/svgs/pause_icon.svg +3 -3
- winipedia_utils/resources/svgs/play_icon.svg +16 -16
- winipedia_utils/resources/svgs/plus_icon.svg +23 -23
- winipedia_utils/resources/svgs/svg.py +15 -15
- winipedia_utils/security/__init__.py +1 -1
- winipedia_utils/security/cryptography.py +29 -29
- winipedia_utils/security/keyring.py +70 -70
- winipedia_utils/setup.py +47 -47
- winipedia_utils/testing/assertions.py +23 -23
- winipedia_utils/testing/convention.py +177 -177
- winipedia_utils/testing/create_tests.py +291 -291
- winipedia_utils/testing/fixtures.py +28 -28
- winipedia_utils/testing/tests/base/fixtures/__init__.py +1 -1
- winipedia_utils/testing/tests/base/fixtures/fixture.py +6 -6
- winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +33 -33
- winipedia_utils/testing/tests/base/fixtures/scopes/function.py +7 -7
- winipedia_utils/testing/tests/base/fixtures/scopes/module.py +31 -31
- winipedia_utils/testing/tests/base/fixtures/scopes/package.py +7 -7
- winipedia_utils/testing/tests/base/fixtures/scopes/session.py +312 -312
- winipedia_utils/testing/tests/base/utils/utils.py +82 -82
- winipedia_utils/testing/tests/conftest.py +32 -32
- winipedia_utils/text/string.py +126 -126
- {winipedia_utils-0.2.0.dist-info → winipedia_utils-0.2.1.dist-info}/METADATA +1 -4
- winipedia_utils-0.2.1.dist-info/RECORD +80 -0
- {winipedia_utils-0.2.0.dist-info → winipedia_utils-0.2.1.dist-info}/licenses/LICENSE +21 -21
- winipedia_utils/django/__init__.py +0 -24
- winipedia_utils/django/bulk.py +0 -538
- winipedia_utils/django/command.py +0 -334
- winipedia_utils/django/database.py +0 -289
- winipedia_utils/pyside/__init__.py +0 -1
- winipedia_utils/pyside/core/__init__.py +0 -1
- winipedia_utils/pyside/core/py_qiodevice.py +0 -476
- winipedia_utils/pyside/ui/__init__.py +0 -1
- winipedia_utils/pyside/ui/base/__init__.py +0 -1
- winipedia_utils/pyside/ui/base/base.py +0 -180
- winipedia_utils/pyside/ui/pages/__init__.py +0 -1
- winipedia_utils/pyside/ui/pages/base/__init__.py +0 -1
- winipedia_utils/pyside/ui/pages/base/base.py +0 -92
- winipedia_utils/pyside/ui/pages/browser.py +0 -26
- winipedia_utils/pyside/ui/pages/player.py +0 -85
- winipedia_utils/pyside/ui/widgets/__init__.py +0 -1
- winipedia_utils/pyside/ui/widgets/browser.py +0 -243
- winipedia_utils/pyside/ui/widgets/clickable_widget.py +0 -57
- winipedia_utils/pyside/ui/widgets/media_player.py +0 -430
- winipedia_utils/pyside/ui/widgets/notification.py +0 -78
- winipedia_utils/pyside/ui/windows/__init__.py +0 -1
- winipedia_utils/pyside/ui/windows/base/__init__.py +0 -1
- winipedia_utils/pyside/ui/windows/base/base.py +0 -49
- winipedia_utils-0.2.0.dist-info/RECORD +0 -103
- {winipedia_utils-0.2.0.dist-info → winipedia_utils-0.2.1.dist-info}/WHEEL +0 -0
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"""Testing utilities for introspection and validation.
|
|
2
|
-
|
|
3
|
-
This module provides utility functions for working with tests, including:
|
|
4
|
-
- Asserting that all objects in the source have corresponding test objects
|
|
5
|
-
- Generating the content for a conftest.py file
|
|
6
|
-
|
|
7
|
-
Returns:
|
|
8
|
-
Various utility functions for testing introspection and validation.
|
|
9
|
-
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from collections.abc import Callable
|
|
13
|
-
from pathlib import Path
|
|
14
|
-
from types import ModuleType
|
|
15
|
-
from typing import Any
|
|
16
|
-
|
|
17
|
-
from winipedia_utils.modules.module import get_objs_from_obj, make_obj_importpath
|
|
18
|
-
from winipedia_utils.testing.assertions import assert_with_msg
|
|
19
|
-
from winipedia_utils.testing.convention import (
|
|
20
|
-
get_obj_from_test_obj,
|
|
21
|
-
make_test_obj_importpath_from_obj,
|
|
22
|
-
make_untested_summary_error_msg,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _assert_no_untested_objs(
|
|
27
|
-
test_obj: ModuleType | type | Callable[..., Any],
|
|
28
|
-
) -> None:
|
|
29
|
-
"""Assert that all objects in the source have corresponding test objects.
|
|
30
|
-
|
|
31
|
-
This function verifies that every object (function, class, or method) in the
|
|
32
|
-
source module or class has a corresponding test object in the test module or class.
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
test_obj: The test object (module, class, or function) to check
|
|
36
|
-
|
|
37
|
-
Raises:
|
|
38
|
-
AssertionError: If any object in the source lacks a corresponding test object,
|
|
39
|
-
with a detailed error message listing the untested objects
|
|
40
|
-
|
|
41
|
-
"""
|
|
42
|
-
test_objs = get_objs_from_obj(test_obj)
|
|
43
|
-
test_objs_paths = {make_obj_importpath(o) for o in test_objs}
|
|
44
|
-
|
|
45
|
-
obj = get_obj_from_test_obj(test_obj)
|
|
46
|
-
objs = get_objs_from_obj(obj)
|
|
47
|
-
supposed_test_objs_paths = {make_test_obj_importpath_from_obj(o) for o in objs}
|
|
48
|
-
|
|
49
|
-
untested_objs = supposed_test_objs_paths - test_objs_paths
|
|
50
|
-
|
|
51
|
-
assert_with_msg(not untested_objs, make_untested_summary_error_msg(untested_objs))
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _get_conftest_content() -> str:
|
|
55
|
-
"""Get the content for a conftest.py file when using winipedia_utils."""
|
|
56
|
-
return '''
|
|
57
|
-
"""Pytest configuration for tests.
|
|
58
|
-
|
|
59
|
-
This module configures pytest plugins for the test suite, setting up the necessary
|
|
60
|
-
fixtures and hooks for the different
|
|
61
|
-
test scopes (function, class, module, package, session).
|
|
62
|
-
It also import custom plugins from tests/base/scopes.
|
|
63
|
-
This file should not be modified manually.
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
pytest_plugins = ["winipedia_utils.testing.tests.conftest"]
|
|
67
|
-
'''.strip()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def _conftest_content_is_correct(conftest_path: Path) -> bool:
|
|
71
|
-
"""Check if the conftest.py file has the correct content.
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
conftest_path: The path to the conftest.py file
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
True if the conftest.py file exists and has the correct content, False otherwise
|
|
78
|
-
|
|
79
|
-
"""
|
|
80
|
-
if not conftest_path.exists():
|
|
81
|
-
return False
|
|
82
|
-
return conftest_path.read_text().startswith(_get_conftest_content())
|
|
1
|
+
"""Testing utilities for introspection and validation.
|
|
2
|
+
|
|
3
|
+
This module provides utility functions for working with tests, including:
|
|
4
|
+
- Asserting that all objects in the source have corresponding test objects
|
|
5
|
+
- Generating the content for a conftest.py file
|
|
6
|
+
|
|
7
|
+
Returns:
|
|
8
|
+
Various utility functions for testing introspection and validation.
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from collections.abc import Callable
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from types import ModuleType
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from winipedia_utils.modules.module import get_objs_from_obj, make_obj_importpath
|
|
18
|
+
from winipedia_utils.testing.assertions import assert_with_msg
|
|
19
|
+
from winipedia_utils.testing.convention import (
|
|
20
|
+
get_obj_from_test_obj,
|
|
21
|
+
make_test_obj_importpath_from_obj,
|
|
22
|
+
make_untested_summary_error_msg,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _assert_no_untested_objs(
|
|
27
|
+
test_obj: ModuleType | type | Callable[..., Any],
|
|
28
|
+
) -> None:
|
|
29
|
+
"""Assert that all objects in the source have corresponding test objects.
|
|
30
|
+
|
|
31
|
+
This function verifies that every object (function, class, or method) in the
|
|
32
|
+
source module or class has a corresponding test object in the test module or class.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
test_obj: The test object (module, class, or function) to check
|
|
36
|
+
|
|
37
|
+
Raises:
|
|
38
|
+
AssertionError: If any object in the source lacks a corresponding test object,
|
|
39
|
+
with a detailed error message listing the untested objects
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
test_objs = get_objs_from_obj(test_obj)
|
|
43
|
+
test_objs_paths = {make_obj_importpath(o) for o in test_objs}
|
|
44
|
+
|
|
45
|
+
obj = get_obj_from_test_obj(test_obj)
|
|
46
|
+
objs = get_objs_from_obj(obj)
|
|
47
|
+
supposed_test_objs_paths = {make_test_obj_importpath_from_obj(o) for o in objs}
|
|
48
|
+
|
|
49
|
+
untested_objs = supposed_test_objs_paths - test_objs_paths
|
|
50
|
+
|
|
51
|
+
assert_with_msg(not untested_objs, make_untested_summary_error_msg(untested_objs))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _get_conftest_content() -> str:
|
|
55
|
+
"""Get the content for a conftest.py file when using winipedia_utils."""
|
|
56
|
+
return '''
|
|
57
|
+
"""Pytest configuration for tests.
|
|
58
|
+
|
|
59
|
+
This module configures pytest plugins for the test suite, setting up the necessary
|
|
60
|
+
fixtures and hooks for the different
|
|
61
|
+
test scopes (function, class, module, package, session).
|
|
62
|
+
It also import custom plugins from tests/base/scopes.
|
|
63
|
+
This file should not be modified manually.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
pytest_plugins = ["winipedia_utils.testing.tests.conftest"]
|
|
67
|
+
'''.strip()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _conftest_content_is_correct(conftest_path: Path) -> bool:
|
|
71
|
+
"""Check if the conftest.py file has the correct content.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
conftest_path: The path to the conftest.py file
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
True if the conftest.py file exists and has the correct content, False otherwise
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
if not conftest_path.exists():
|
|
81
|
+
return False
|
|
82
|
+
return conftest_path.read_text().startswith(_get_conftest_content())
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"""Pytest configuration for winipedia_utils tests.
|
|
2
|
-
|
|
3
|
-
finds all the plugins in the tests directory and the package's testing module
|
|
4
|
-
and adds them to pytest_plugins. This way defining reusable fixtures is easy.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
import winipedia_utils
|
|
10
|
-
from winipedia_utils.modules.module import to_module_name, to_path
|
|
11
|
-
|
|
12
|
-
package_path = Path(winipedia_utils.__path__[0])
|
|
13
|
-
|
|
14
|
-
custom_plugin_path = to_path("tests.base.fixtures", is_package=True)
|
|
15
|
-
package_plugin_path = (
|
|
16
|
-
package_path / to_path("testing", is_package=True) / custom_plugin_path
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
custom_plugin_module_names = [
|
|
20
|
-
to_module_name(path) for path in custom_plugin_path.rglob("*.py")
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
package_plugin_module_names = [
|
|
24
|
-
to_module_name(path.relative_to(package_path.parent))
|
|
25
|
-
for path in package_plugin_path.rglob("*.py")
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
pytest_plugins = [
|
|
30
|
-
*package_plugin_module_names,
|
|
31
|
-
*custom_plugin_module_names,
|
|
32
|
-
]
|
|
1
|
+
"""Pytest configuration for winipedia_utils tests.
|
|
2
|
+
|
|
3
|
+
finds all the plugins in the tests directory and the package's testing module
|
|
4
|
+
and adds them to pytest_plugins. This way defining reusable fixtures is easy.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import winipedia_utils
|
|
10
|
+
from winipedia_utils.modules.module import to_module_name, to_path
|
|
11
|
+
|
|
12
|
+
package_path = Path(winipedia_utils.__path__[0])
|
|
13
|
+
|
|
14
|
+
custom_plugin_path = to_path("tests.base.fixtures", is_package=True)
|
|
15
|
+
package_plugin_path = (
|
|
16
|
+
package_path / to_path("testing", is_package=True) / custom_plugin_path
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
custom_plugin_module_names = [
|
|
20
|
+
to_module_name(path) for path in custom_plugin_path.rglob("*.py")
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
package_plugin_module_names = [
|
|
24
|
+
to_module_name(path.relative_to(package_path.parent))
|
|
25
|
+
for path in package_plugin_path.rglob("*.py")
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
pytest_plugins = [
|
|
30
|
+
*package_plugin_module_names,
|
|
31
|
+
*custom_plugin_module_names,
|
|
32
|
+
]
|
winipedia_utils/text/string.py
CHANGED
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
"""String manipulation utilities for text processing.
|
|
2
|
-
|
|
3
|
-
This module provides utility functions for working with strings, including
|
|
4
|
-
input handling, XML parsing, string truncation, and hashing operations.
|
|
5
|
-
These utilities simplify common string manipulation tasks throughout the application.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import hashlib
|
|
9
|
-
import textwrap
|
|
10
|
-
from io import StringIO
|
|
11
|
-
|
|
12
|
-
from defusedxml import ElementTree as DefusedElementTree
|
|
13
|
-
|
|
14
|
-
from winipedia_utils.concurrent.multiprocessing import (
|
|
15
|
-
cancel_on_timeout,
|
|
16
|
-
)
|
|
17
|
-
from winipedia_utils.logging.logger import get_logger
|
|
18
|
-
|
|
19
|
-
logger = get_logger(__name__)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def ask_for_input_with_timeout(prompt: str, timeout: int) -> str:
|
|
23
|
-
"""Request user input with a timeout constraint.
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
prompt: The text prompt to display to the user
|
|
27
|
-
timeout: Maximum time in seconds to wait for input
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
The user's input as a string
|
|
31
|
-
|
|
32
|
-
Raises:
|
|
33
|
-
TimeoutError: If the user doesn't provide input within the timeout period
|
|
34
|
-
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
@cancel_on_timeout(timeout, "Input not given within the timeout")
|
|
38
|
-
def give_input() -> str:
|
|
39
|
-
return input(prompt)
|
|
40
|
-
|
|
41
|
-
user_input: str = give_input()
|
|
42
|
-
|
|
43
|
-
return user_input
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def find_xml_namespaces(xml: str | StringIO) -> dict[str, str]:
|
|
47
|
-
"""Extract namespace declarations from XML content.
|
|
48
|
-
|
|
49
|
-
Args:
|
|
50
|
-
xml: XML content as a string or StringIO object
|
|
51
|
-
|
|
52
|
-
Returns:
|
|
53
|
-
Dictionary mapping namespace prefixes to their URIs,
|
|
54
|
-
excluding the default namespace
|
|
55
|
-
|
|
56
|
-
"""
|
|
57
|
-
if not isinstance(xml, StringIO):
|
|
58
|
-
xml = StringIO(xml)
|
|
59
|
-
# Extract the namespaces from the root tag
|
|
60
|
-
namespaces_: dict[str, str] = {}
|
|
61
|
-
iter_ns = DefusedElementTree.iterparse(xml, events=["start-ns"])
|
|
62
|
-
for _, namespace_data in iter_ns:
|
|
63
|
-
prefix, uri = namespace_data
|
|
64
|
-
namespaces_[str(prefix)] = str(uri)
|
|
65
|
-
|
|
66
|
-
namespaces_.pop("", None)
|
|
67
|
-
|
|
68
|
-
return namespaces_
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def value_to_truncated_string(value: object, max_length: int) -> str:
|
|
72
|
-
"""Convert any value to a string and truncate if longer than max_length.
|
|
73
|
-
|
|
74
|
-
Args:
|
|
75
|
-
value: Any object to convert to string
|
|
76
|
-
max_length: Maximum length of the resulting string
|
|
77
|
-
|
|
78
|
-
Returns:
|
|
79
|
-
Truncated string representation of the value
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
string = str(value)
|
|
83
|
-
return textwrap.shorten(string, width=max_length, placeholder="...")
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def get_reusable_hash(value: object) -> str:
|
|
87
|
-
"""Generate a consistent hash for any object.
|
|
88
|
-
|
|
89
|
-
Creates a SHA-256 hash of the string representation of the given value.
|
|
90
|
-
This hash is deterministic and can be used for caching or identification.
|
|
91
|
-
|
|
92
|
-
Args:
|
|
93
|
-
value: Any object to hash
|
|
94
|
-
|
|
95
|
-
Returns:
|
|
96
|
-
Hexadecimal string representation of the SHA-256 hash
|
|
97
|
-
|
|
98
|
-
"""
|
|
99
|
-
value_str = str(value)
|
|
100
|
-
return hashlib.sha256(value_str.encode("utf-8")).hexdigest()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def split_on_uppercase(string: str) -> list[str]:
|
|
104
|
-
"""Split a string on uppercase letters.
|
|
105
|
-
|
|
106
|
-
Args:
|
|
107
|
-
string: String to split
|
|
108
|
-
|
|
109
|
-
Returns:
|
|
110
|
-
List of substrings split on uppercase letters
|
|
111
|
-
|
|
112
|
-
Example:
|
|
113
|
-
split_on_uppercase("HelloWorld") -> ["Hello", "World"]
|
|
114
|
-
|
|
115
|
-
"""
|
|
116
|
-
letters = list(string)
|
|
117
|
-
parts = []
|
|
118
|
-
current_part = ""
|
|
119
|
-
for letter in letters:
|
|
120
|
-
if letter.isupper() and current_part:
|
|
121
|
-
parts.append(current_part)
|
|
122
|
-
current_part = letter
|
|
123
|
-
else:
|
|
124
|
-
current_part += letter
|
|
125
|
-
parts.append(current_part)
|
|
126
|
-
return parts
|
|
1
|
+
"""String manipulation utilities for text processing.
|
|
2
|
+
|
|
3
|
+
This module provides utility functions for working with strings, including
|
|
4
|
+
input handling, XML parsing, string truncation, and hashing operations.
|
|
5
|
+
These utilities simplify common string manipulation tasks throughout the application.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import hashlib
|
|
9
|
+
import textwrap
|
|
10
|
+
from io import StringIO
|
|
11
|
+
|
|
12
|
+
from defusedxml import ElementTree as DefusedElementTree
|
|
13
|
+
|
|
14
|
+
from winipedia_utils.concurrent.multiprocessing import (
|
|
15
|
+
cancel_on_timeout,
|
|
16
|
+
)
|
|
17
|
+
from winipedia_utils.logging.logger import get_logger
|
|
18
|
+
|
|
19
|
+
logger = get_logger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def ask_for_input_with_timeout(prompt: str, timeout: int) -> str:
|
|
23
|
+
"""Request user input with a timeout constraint.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
prompt: The text prompt to display to the user
|
|
27
|
+
timeout: Maximum time in seconds to wait for input
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
The user's input as a string
|
|
31
|
+
|
|
32
|
+
Raises:
|
|
33
|
+
TimeoutError: If the user doesn't provide input within the timeout period
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
@cancel_on_timeout(timeout, "Input not given within the timeout")
|
|
38
|
+
def give_input() -> str:
|
|
39
|
+
return input(prompt)
|
|
40
|
+
|
|
41
|
+
user_input: str = give_input()
|
|
42
|
+
|
|
43
|
+
return user_input
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def find_xml_namespaces(xml: str | StringIO) -> dict[str, str]:
|
|
47
|
+
"""Extract namespace declarations from XML content.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
xml: XML content as a string or StringIO object
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Dictionary mapping namespace prefixes to their URIs,
|
|
54
|
+
excluding the default namespace
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
if not isinstance(xml, StringIO):
|
|
58
|
+
xml = StringIO(xml)
|
|
59
|
+
# Extract the namespaces from the root tag
|
|
60
|
+
namespaces_: dict[str, str] = {}
|
|
61
|
+
iter_ns = DefusedElementTree.iterparse(xml, events=["start-ns"])
|
|
62
|
+
for _, namespace_data in iter_ns:
|
|
63
|
+
prefix, uri = namespace_data
|
|
64
|
+
namespaces_[str(prefix)] = str(uri)
|
|
65
|
+
|
|
66
|
+
namespaces_.pop("", None)
|
|
67
|
+
|
|
68
|
+
return namespaces_
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def value_to_truncated_string(value: object, max_length: int) -> str:
|
|
72
|
+
"""Convert any value to a string and truncate if longer than max_length.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
value: Any object to convert to string
|
|
76
|
+
max_length: Maximum length of the resulting string
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Truncated string representation of the value
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
string = str(value)
|
|
83
|
+
return textwrap.shorten(string, width=max_length, placeholder="...")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def get_reusable_hash(value: object) -> str:
|
|
87
|
+
"""Generate a consistent hash for any object.
|
|
88
|
+
|
|
89
|
+
Creates a SHA-256 hash of the string representation of the given value.
|
|
90
|
+
This hash is deterministic and can be used for caching or identification.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
value: Any object to hash
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Hexadecimal string representation of the SHA-256 hash
|
|
97
|
+
|
|
98
|
+
"""
|
|
99
|
+
value_str = str(value)
|
|
100
|
+
return hashlib.sha256(value_str.encode("utf-8")).hexdigest()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def split_on_uppercase(string: str) -> list[str]:
|
|
104
|
+
"""Split a string on uppercase letters.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
string: String to split
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
List of substrings split on uppercase letters
|
|
111
|
+
|
|
112
|
+
Example:
|
|
113
|
+
split_on_uppercase("HelloWorld") -> ["Hello", "World"]
|
|
114
|
+
|
|
115
|
+
"""
|
|
116
|
+
letters = list(string)
|
|
117
|
+
parts = []
|
|
118
|
+
current_part = ""
|
|
119
|
+
for letter in letters:
|
|
120
|
+
if letter.isupper() and current_part:
|
|
121
|
+
parts.append(current_part)
|
|
122
|
+
current_part = letter
|
|
123
|
+
else:
|
|
124
|
+
current_part += letter
|
|
125
|
+
parts.append(current_part)
|
|
126
|
+
return parts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winipedia-utils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A package with many utility functions
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -12,12 +12,9 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
13
|
Requires-Dist: cryptography (>=45.0.5,<46.0.0)
|
|
14
14
|
Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
|
|
15
|
-
Requires-Dist: django (>=5.2.1,<6.0.0)
|
|
16
15
|
Requires-Dist: keyring (>=25.6.0,<26.0.0)
|
|
17
16
|
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
|
18
17
|
Requires-Dist: polars (>=1.34.0,<2.0.0)
|
|
19
|
-
Requires-Dist: pyqt-toast-notification (>=1.3.3,<2.0.0)
|
|
20
|
-
Requires-Dist: pyside6 (>=6.9.1,<7.0.0)
|
|
21
18
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
22
19
|
Requires-Dist: setuptools (>=80.3.1,<81.0.0)
|
|
23
20
|
Requires-Dist: tomlkit (>=0.13.2,<0.14.0)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
winipedia_utils/__init__.py,sha256=vOWZ8n-YemVIzDLd8eWw1HVPGH3jxuT6VtDKHbmxk_A,43
|
|
2
|
+
winipedia_utils/concurrent/__init__.py,sha256=Tu0ig4gVCk_f1n74G35hDwH-WS3P3STVQGWjxTIbbo8,54
|
|
3
|
+
winipedia_utils/concurrent/concurrent.py,sha256=CU90hqsdfQzxtiGSBiuqHd9JnRFCU1kaAoiQ42r_DA8,8766
|
|
4
|
+
winipedia_utils/concurrent/multiprocessing.py,sha256=GUM9rVKDq-0ikBBIO6VF4UULwKG1lY_3aTMqp6fVoeI,4856
|
|
5
|
+
winipedia_utils/concurrent/multithreading.py,sha256=myrHoSSc6UW86SdCz1OksQcAcq29-2Rk7fa1wTT89BM,3177
|
|
6
|
+
winipedia_utils/consts.py,sha256=YCJAOKdWK8beerJD8iUTXAS-cGKyLVWr8AsW0M1M3kM,497
|
|
7
|
+
winipedia_utils/data/__init__.py,sha256=9RZFoceil00La5TyNM1baF-fjfAKKV22auLSxvJ_QD0,49
|
|
8
|
+
winipedia_utils/data/dataframe/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
|
9
|
+
winipedia_utils/data/dataframe/cleaning.py,sha256=9FYKax_Y2CMDmEh01C6zSFnXdOJ1mjWo4V6TLyxwhTI,13639
|
|
10
|
+
winipedia_utils/data/structures/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
|
11
|
+
winipedia_utils/data/structures/dicts.py,sha256=reLUI-K5iQiA16u-wHLzn6GCCTUvh5SKvlRtVR8pqwM,290
|
|
12
|
+
winipedia_utils/git/__init__.py,sha256=pPo5DDqaQkFim8L6x22DXjqthLnKAxLyXlXl7JXGUdw,48
|
|
13
|
+
winipedia_utils/git/gitignore/__init__.py,sha256=t65uvpOaNvh7ICgwuJFRr7vS2nWfxzWUGIpnJs0_jzE,58
|
|
14
|
+
winipedia_utils/git/gitignore/gitignore.py,sha256=wCU2lRztTFKQ7JrKnCqPLCsuVRjfx8wGfTy42BLgFJI,4512
|
|
15
|
+
winipedia_utils/git/pre_commit/__init__.py,sha256=2sBe5nOqmm3qb8YjhZzE4tCHhqxWOZ6R2ECljSVG7i4,59
|
|
16
|
+
winipedia_utils/git/pre_commit/config.py,sha256=bIncUO4et0B5XYPUlSJskl_8Lg6si45ALyM9cEVJpfU,2332
|
|
17
|
+
winipedia_utils/git/pre_commit/hooks.py,sha256=Q6rXvbpUf9UasQ8vSBruoLA-wjm37jamvIUkXJ1B3FE,3210
|
|
18
|
+
winipedia_utils/git/pre_commit/run_hooks.py,sha256=WoF1WDr07mS2GpKt0M-TpnuWfS0-Hwa4tP6z_9-JqlU,1572
|
|
19
|
+
winipedia_utils/iterating/__init__.py,sha256=TZ0SSFA3zCJLk0z3IsLMxJqsfGzfxOSUKbQmwW-Dsqg,54
|
|
20
|
+
winipedia_utils/iterating/iterate.py,sha256=IpV710BS5fBPSzwZTTJLUqEhSHT-gmnQxMg3uEt85CA,973
|
|
21
|
+
winipedia_utils/logging/__init__.py,sha256=AMt1LwA_E7hexYjMpGzUempoyDdAF-dowWvq59wC5aM,51
|
|
22
|
+
winipedia_utils/logging/ansi.py,sha256=54MIYKppssv-TBFavOAi28aCo4Cg--cChTzdjGsBXJY,107
|
|
23
|
+
winipedia_utils/logging/config.py,sha256=NAXCxVRkEfkf119HCg1zrdP1l37DW4cFDHvKrBEjQ0o,2959
|
|
24
|
+
winipedia_utils/logging/logger.py,sha256=tCcUwAVLVr3Bec7_i-SoKvBPNCJSEmyuvBW2gbqjPMk,727
|
|
25
|
+
winipedia_utils/modules/__init__.py,sha256=e3CFaC3FhK4ibknFOv1bqOZxA7XeVwmLqWX7oajUm78,51
|
|
26
|
+
winipedia_utils/modules/class_.py,sha256=fe0czYVM-UWGVcv6YdiP6SfMfX1asb7HeiWp1yLJVbA,3696
|
|
27
|
+
winipedia_utils/modules/function.py,sha256=h9GvY0UHMOxE751uh62YG6Eek9YDA6Cav5iBXQS_2FI,2928
|
|
28
|
+
winipedia_utils/modules/module.py,sha256=UHgkiCkpFjrUrdjBd_U1oyDOJK4ikPHxs8P-0ykPk5M,13420
|
|
29
|
+
winipedia_utils/modules/package.py,sha256=izu5OUnPP6xkn9uwS1itJIxXOn6Qg6DUdy8aFCnuuAg,13448
|
|
30
|
+
winipedia_utils/oop/__init__.py,sha256=wGjsVwLbTVEQWOfDJvN9nlvC-3NmAi8Doc2xIrm6e78,47
|
|
31
|
+
winipedia_utils/oop/mixins/__init__.py,sha256=PDK-cJcdRUfDUCz36qQ5pmMW07G133WtN49OpmILGNI,54
|
|
32
|
+
winipedia_utils/oop/mixins/meta.py,sha256=kkWfIpp2iHSk544CuOGWOHCb3ON_OmwcgOw4jxYckEc,11483
|
|
33
|
+
winipedia_utils/oop/mixins/mixin.py,sha256=sFImqDFX0TtdAAYHgepVT_UqJ50juvDdwGG9vMNa3PE,1438
|
|
34
|
+
winipedia_utils/os/__init__.py,sha256=WSLt7tb6HqWRlCGGIEwRfVksF0sLJNeEW3iZeJhGWk0,47
|
|
35
|
+
winipedia_utils/os/os.py,sha256=CXPVnagfj3dXlc8OIv1DirJpin8oaGXWetnmx2lULE4,1831
|
|
36
|
+
winipedia_utils/projects/__init__.py,sha256=6oTiSlUMAwO5xnH4SGVnvspzKcxrxo9kn1L4xkjq1p8,53
|
|
37
|
+
winipedia_utils/projects/poetry/__init__.py,sha256=0yNMuu9KmM19od4VBxBV3HLK-RdCsa0e2Zhg33J7RmQ,60
|
|
38
|
+
winipedia_utils/projects/poetry/config.py,sha256=ghJzlNDVrSfG5Mg0JjnL9Xmz6fVD-rAHl41tjbFUBb8,2993
|
|
39
|
+
winipedia_utils/projects/poetry/poetry.py,sha256=QoQ-b8NgMiWaqq85gs2HZh_436VpNqKzGogrWPS5DrU,965
|
|
40
|
+
winipedia_utils/projects/project.py,sha256=2nz1Hh51A-shjgdPCgiDw-ODrVtOtiHEHQnMPjAJZ-A,1587
|
|
41
|
+
winipedia_utils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
42
|
+
winipedia_utils/resources/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
|
43
|
+
winipedia_utils/resources/svgs/__init__.py,sha256=p-maJQh7gYbXwhkqKU4wL6UNGzRAy988JP8_qLoTZDk,24
|
|
44
|
+
winipedia_utils/resources/svgs/delete_garbage_can.svg,sha256=UxEEh46w1JD4VViUBx-Ahaq5_ZR4zOjfeJn5_aM8114,318
|
|
45
|
+
winipedia_utils/resources/svgs/download_arrow.svg,sha256=R5WNz0JOxkRi5LOuDtc_eZESZN4W0JAuvr-5_ZRqeks,244
|
|
46
|
+
winipedia_utils/resources/svgs/exit_fullscreen_icon.svg,sha256=4wpP-pWg7z4c62c9MGUcU-rWcRVUEBSl1fGiJ1HDR3g,528
|
|
47
|
+
winipedia_utils/resources/svgs/fullscreen_icon.svg,sha256=nN4Y5CA7AuwOvyhgtJWZtBT5uSzO7NFJivVRFNqooe0,408
|
|
48
|
+
winipedia_utils/resources/svgs/menu_icon.svg,sha256=HDhjlCfkcZe9hNeSERhuOXvhmKzusuhSL1Poe6vMypg,347
|
|
49
|
+
winipedia_utils/resources/svgs/pause_icon.svg,sha256=mNrEoAOhbvxsJmBg4xZ08kdahAG6gA4LqmHXYNOOKB0,182
|
|
50
|
+
winipedia_utils/resources/svgs/play_icon.svg,sha256=9X7nBxFdJRKmvt6xKZx8WdYZPL7WgxZVG4cp3Xb1sKA,969
|
|
51
|
+
winipedia_utils/resources/svgs/plus_icon.svg,sha256=CHjIzOUbDH4xHlwX5MbTsdL0HnkuMg3DHv1t0WHJSg0,575
|
|
52
|
+
winipedia_utils/resources/svgs/svg.py,sha256=-Dw6m7cm9CHT2076oZIMx7kTQw0v_ifJajXzWcpUtI0,430
|
|
53
|
+
winipedia_utils/security/__init__.py,sha256=ZBa72J6MNtYumBFMoVc0ia4jsoS7oNgjaTCW0xDb6EI,53
|
|
54
|
+
winipedia_utils/security/cryptography.py,sha256=zfxSDo7aE9ecmZNC6URMSEUYRpOuJ1iESg-WCSS5HP0,822
|
|
55
|
+
winipedia_utils/security/keyring.py,sha256=AKpIGRh7RAWzzdIjTLZRXndxgbsX5DJxdHaRk40zw7o,2343
|
|
56
|
+
winipedia_utils/setup.py,sha256=F4NneO0wVTf7JCXLorWjTOdJl36N5fLSksoWMe4p86o,1650
|
|
57
|
+
winipedia_utils/testing/__init__.py,sha256=kXhB5xw02ec5xpcW_KV--9CBKdyCjnuR-NZzAJ5tq0g,51
|
|
58
|
+
winipedia_utils/testing/assertions.py,sha256=0JF4mqVTnLQ1qkAL_FuTwyN_idr00rvVlta7aDdnUXA,851
|
|
59
|
+
winipedia_utils/testing/convention.py,sha256=NxC_hYaUXshsa6LL6nQoEEKpTzC1KwTloKL8aS2gUPI,5010
|
|
60
|
+
winipedia_utils/testing/create_tests.py,sha256=sA1RhmwWWOVVgV5RdrdjoNXGa8ZB_LdGbNhvWsYpHhw,9968
|
|
61
|
+
winipedia_utils/testing/fixtures.py,sha256=e0ax1n1zqzmLawA26k0EtNa3rYSMu10lMNVRjBuIGMs,1061
|
|
62
|
+
winipedia_utils/testing/tests/__init__.py,sha256=kL-1O6lAO5j4JPOqPdi3dHdbOQ_UXcgPFppj82HhrRU,57
|
|
63
|
+
winipedia_utils/testing/tests/base/__init__.py,sha256=dBH1yfONmqUC49zshS6BJ4ZgEcw7iFGoFCqRmU7Vhrw,62
|
|
64
|
+
winipedia_utils/testing/tests/base/fixtures/__init__.py,sha256=CeRM8RSAA1UnH81OI09ZgGWxryUDvDz6gSahGa-U2hI,72
|
|
65
|
+
winipedia_utils/testing/tests/base/fixtures/fixture.py,sha256=-MHvMCwLJwJrkie7fgVIhFA_nt-fp0-KfiisERcHb_E,187
|
|
66
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/__init__.py,sha256=-n_BLhTVC1oH7qVL0JYXm82zqFPgobQCojO-PirrKo0,78
|
|
67
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/class_.py,sha256=XCx4HZeHbJJ-C7wGsi5bQx7nPGTuAI3xhHp1FpGeom8,1133
|
|
68
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/function.py,sha256=5dW7-IPqJ_3Q2j1vftZL5FYKvNSKufqiHzLTTWYhja4,309
|
|
69
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/module.py,sha256=V0H9WFrdSV7uj__bXM_GKcCJnjResqI7fFjcxyvNaZk,1169
|
|
70
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/package.py,sha256=IKOfj6vfyjEQdRV5cJoPRQvALmePpGxWkGy23di00-w,309
|
|
71
|
+
winipedia_utils/testing/tests/base/fixtures/scopes/session.py,sha256=g7B9-OnC06Qx46zeB6HOG-YKrK6aaYrpa8RkktnC6h0,10422
|
|
72
|
+
winipedia_utils/testing/tests/base/utils/__init__.py,sha256=mC-8dCkp8xarqkQu2QQLrPjHi6Ww9hcixWdHeQHWeRs,68
|
|
73
|
+
winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23MfzacLLuwjy2AO-PQQp_aSI,2820
|
|
74
|
+
winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
|
|
75
|
+
winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
|
76
|
+
winipedia_utils/text/string.py,sha256=pK_VQXxSZa8HqHY1a6oMKfmN-OKteFE32eZaweCI22E,3508
|
|
77
|
+
winipedia_utils-0.2.1.dist-info/licenses/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
|
|
78
|
+
winipedia_utils-0.2.1.dist-info/METADATA,sha256=p1Ws1mM6eQYYocMqEwKtd0Nxq6FvY7ok0ay6yVSFy2s,12462
|
|
79
|
+
winipedia_utils-0.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
80
|
+
winipedia_utils-0.2.1.dist-info/RECORD,,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Winipedia
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Winipedia
|
|
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.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"""__init__ module for winipedia_utils.django."""
|
|
2
|
-
|
|
3
|
-
import django
|
|
4
|
-
import django_stubs_ext
|
|
5
|
-
from django.conf import settings
|
|
6
|
-
|
|
7
|
-
from winipedia_utils.logging.logger import get_logger
|
|
8
|
-
|
|
9
|
-
logger = get_logger(__name__)
|
|
10
|
-
|
|
11
|
-
django_stubs_ext.monkeypatch()
|
|
12
|
-
logger.info("Monkeypatched django-stubs")
|
|
13
|
-
|
|
14
|
-
if not settings.configured:
|
|
15
|
-
logger.info("Configuring minimal django settings")
|
|
16
|
-
settings.configure(
|
|
17
|
-
DATABASES={
|
|
18
|
-
"default": {
|
|
19
|
-
"ENGINE": "django.db.backends.sqlite3",
|
|
20
|
-
"NAME": ":memory:",
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
)
|
|
24
|
-
django.setup()
|