lockss-pybasic 0.2.0.dev3__py3-none-any.whl → 0.2.0.dev5__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.
@@ -36,4 +36,4 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
36
  POSSIBILITY OF SUCH DAMAGE.
37
37
  '''.strip()
38
38
 
39
- __version__ = '0.2.0-dev3'
39
+ __version__ = '0.2.0-dev5'
lockss/pybasic/cliutil.py CHANGED
@@ -35,9 +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
-
39
- if TYPE_CHECKING:
40
- from _typeshed import SupportsWrite
38
+ import warnings
41
39
 
42
40
  from pydantic.v1 import BaseModel, PrivateAttr, create_model
43
41
  from pydantic.v1.fields import FieldInfo
@@ -45,18 +43,25 @@ from pydantic_argparse import ArgumentParser
45
43
  from pydantic_argparse.argparse.actions import SubParsersAction
46
44
  from rich_argparse import RichHelpFormatter
47
45
 
46
+ if TYPE_CHECKING:
47
+ from _typeshed import SupportsWrite as SupportsWriteStr
48
+ else:
49
+ SupportsWriteStr = Any
50
+
48
51
 
49
52
  class StringCommand(BaseModel):
50
53
 
51
- def display(self, file: SupportsWrite[str]=sys.stdout) -> None:
52
- print(getattr(self, 'display_string'), file=file)
54
+ def display(self, file: SupportsWriteStr=sys.stdout) -> None:
55
+ print(getattr(self, '_display_string'), file=file)
53
56
 
54
57
  @staticmethod
55
58
  def make(model_name: str, option_name: str, description: str, display_string: str):
56
- return create_model(model_name,
57
- __base__=StringCommand,
58
- **{option_name: (Optional[bool], FieldInfo(False, description=description)),
59
- display_string: PrivateAttr(display_string)})
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))})
60
65
 
61
66
 
62
67
  class CopyrightCommand(StringCommand):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lockss-pybasic
3
- Version: 0.2.0.dev3
3
+ Version: 0.2.0.dev5
4
4
  Summary: Basic Python utilities
5
5
  License: BSD-3-Clause
6
6
  Author: Thib Guicherd-Callin
@@ -0,0 +1,9 @@
1
+ lockss/pybasic/__init__.py,sha256=-Q8lj5dmHarJid06shaGAk79FNGd3QUDDyFCPMVOeAY,1678
2
+ lockss/pybasic/cliutil.py,sha256=PaMrDg2eGMx_h1JEybvgLlXnvxV09CYlEFBIHS1urgA,11475
3
+ lockss/pybasic/errorutil.py,sha256=XI84PScZ851_-gfoazivJ8ceieMYWaxQr7qih5ltga0,1951
4
+ lockss/pybasic/fileutil.py,sha256=BpdoPWL70xYTuhyQRBEurScRVnPQg0mX-XW8yyKPGjw,2958
5
+ lockss/pybasic/outpututil.py,sha256=JyXKXlkaCcCGvonUvmDGRdI6PxwN5t7DPVIk64S8-2g,2345
6
+ lockss_pybasic-0.2.0.dev5.dist-info/LICENSE,sha256=O9ONND4uDxY_jucI4jZDf2liAk05ScEJaYu-Al7EOdQ,1506
7
+ lockss_pybasic-0.2.0.dev5.dist-info/METADATA,sha256=QhQmvLDES42rAOQTuNcbd_8J7IEX8hKut4uK2L5gmrQ,4247
8
+ lockss_pybasic-0.2.0.dev5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
+ lockss_pybasic-0.2.0.dev5.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- lockss/pybasic/__init__.py,sha256=MxiRIu7H0y8ISCRj4PtTzlNH0hPQ9wvEawdO1nMjFpA,1678
2
- lockss/pybasic/cliutil.py,sha256=LppP6O1Ocj0d5bxtXUPShAYMOTeotQywKkaPd63xhQ0,11185
3
- lockss/pybasic/errorutil.py,sha256=XI84PScZ851_-gfoazivJ8ceieMYWaxQr7qih5ltga0,1951
4
- lockss/pybasic/fileutil.py,sha256=BpdoPWL70xYTuhyQRBEurScRVnPQg0mX-XW8yyKPGjw,2958
5
- lockss/pybasic/outpututil.py,sha256=JyXKXlkaCcCGvonUvmDGRdI6PxwN5t7DPVIk64S8-2g,2345
6
- lockss_pybasic-0.2.0.dev3.dist-info/LICENSE,sha256=O9ONND4uDxY_jucI4jZDf2liAk05ScEJaYu-Al7EOdQ,1506
7
- lockss_pybasic-0.2.0.dev3.dist-info/METADATA,sha256=ijdZVGfvh1NBR4vHPYvUSOd02cqSbmLooDMEHZbpUAM,4247
8
- lockss_pybasic-0.2.0.dev3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
- lockss_pybasic-0.2.0.dev3.dist-info/RECORD,,