lockss-pybasic 0.1.0.dev4__tar.gz → 0.1.0.dev6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lockss-pybasic
3
- Version: 0.1.0.dev4
3
+ Version: 0.1.0.dev6
4
4
  Summary: Basic Python utilities
5
5
  License: BSD-3-Clause
6
6
  Author: Thib Guicherd-Callin
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lockss-pybasic"
3
- version = "0.1.0-dev4"
3
+ version = "0.1.0-dev6"
4
4
  description = "Basic Python utilities"
5
5
  authors = [
6
6
  { name = "Thib Guicherd-Callin", email = "thib@cs.stanford.edu" }
@@ -32,4 +32,4 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
32
  POSSIBILITY OF SUCH DAMAGE.
33
33
  '''.strip()
34
34
 
35
- __version__ = '0.1.0-dev4'
35
+ __version__ = '0.1.0-dev6'
@@ -30,15 +30,20 @@
30
30
 
31
31
  import sys
32
32
 
33
- from pydantic.v1.fields import FieldInfo
33
+ from pydantic.v1 import BaseModel, Field
34
34
 
35
- class VersionCommand(FieldInfo):
35
+ class VersionCommand:
36
36
 
37
- def __init__(self, version: str, *args, **kwargs):
38
- kwargs.setdefault(description='print the version number and exit')
39
- super().__init__(*args, **kwargs)
40
- self._version = version
41
- self._validate() # Same as the Field(...) function
37
+ @staticmethod
38
+ def make(version):
39
+ class VersionModel(BaseModel):
42
40
 
43
- def print_version(self, file=sys.stdout):
44
- print(self._version, file=file)
41
+ def print_version(self, file=sys.stdout):
42
+ print(version, file=file)
43
+ sys.exit(0)
44
+
45
+ return VersionModel
46
+
47
+ @staticmethod
48
+ def field():
49
+ return Field(description='print the version number and exit')