lockss-pybasic 0.2.0.dev4__tar.gz → 0.2.0.dev5__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.
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/PKG-INFO +1 -1
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/pyproject.toml +1 -1
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/src/lockss/pybasic/__init__.py +1 -1
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/src/lockss/pybasic/cliutil.py +8 -5
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/CHANGELOG.rst +0 -0
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/LICENSE +0 -0
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/README.rst +0 -0
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/src/lockss/pybasic/errorutil.py +0 -0
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/src/lockss/pybasic/fileutil.py +0 -0
- {lockss_pybasic-0.2.0.dev4 → lockss_pybasic-0.2.0.dev5}/src/lockss/pybasic/outpututil.py +0 -0
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
[project]
|
|
30
30
|
name = "lockss-pybasic"
|
|
31
|
-
version = "0.2.0-
|
|
31
|
+
version = "0.2.0-dev5" # Always change in __init__.py, and at release time in README.rst and CHANGELOG.rst
|
|
32
32
|
description = "Basic Python utilities"
|
|
33
33
|
license = { text = "BSD-3-Clause" }
|
|
34
34
|
readme = "README.rst"
|
|
@@ -35,6 +35,7 @@ Command line utilities.
|
|
|
35
35
|
from collections.abc import Callable
|
|
36
36
|
import sys
|
|
37
37
|
from typing import Any, ClassVar, Dict, Generic, Optional, TypeVar, TYPE_CHECKING
|
|
38
|
+
import warnings
|
|
38
39
|
|
|
39
40
|
from pydantic.v1 import BaseModel, PrivateAttr, create_model
|
|
40
41
|
from pydantic.v1.fields import FieldInfo
|
|
@@ -51,14 +52,16 @@ else:
|
|
|
51
52
|
class StringCommand(BaseModel):
|
|
52
53
|
|
|
53
54
|
def display(self, file: SupportsWriteStr=sys.stdout) -> None:
|
|
54
|
-
print(getattr(self, '
|
|
55
|
+
print(getattr(self, '_display_string'), file=file)
|
|
55
56
|
|
|
56
57
|
@staticmethod
|
|
57
58
|
def make(model_name: str, option_name: str, description: str, display_string: str):
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
with warnings.catch_warnings():
|
|
60
|
+
warnings.simplefilter("ignore") # Pydantic v1 demands that PrivateAttr begins with a hyphen but raises a warning that such names are for private attributes
|
|
61
|
+
return create_model(model_name,
|
|
62
|
+
__base__=StringCommand,
|
|
63
|
+
_display_string=PrivateAttr(display_string),
|
|
64
|
+
**{option_name: (Optional[bool], FieldInfo(False, description=description))})
|
|
62
65
|
|
|
63
66
|
|
|
64
67
|
class CopyrightCommand(StringCommand):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|