temparse 0.0.4__tar.gz → 0.0.5__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.4
2
2
  Name: temparse
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: temparse is template + parse
5
5
  Author: jiang-zhexin
6
6
  Author-email: jiang-zhexin <162887873+jiang-zhexin@users.noreply.github.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "temparse"
3
- version = "0.0.4"
3
+ version = "0.0.5"
4
4
  description = "temparse is template + parse"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -1,17 +1,15 @@
1
1
  import datetime
2
2
  import functools
3
3
  import json
4
- import logging
5
4
  import re
6
5
  from collections.abc import Callable
7
6
  from string.templatelib import Interpolation, Template
8
- from typing import Any, get_origin, is_typeddict
7
+ from typing import Any, final, get_origin, is_typeddict
9
8
 
10
9
  __all__ = ["Conversion", "FormatConversion", "Parser", "parse"]
11
10
 
12
- log = logging.getLogger(__name__)
13
-
14
11
 
12
+ @final
15
13
  class Parser[*T]:
16
14
  """
17
15
  A compiled template parser that can be reused to parse multiple strings.
@@ -34,8 +32,6 @@ class Parser[*T]:
34
32
  re.escape(item) if isinstance(item, str) else r"(.+?)" for item in template
35
33
  )
36
34
 
37
- log.debug(f"match expression: {self._expression!r}")
38
-
39
35
  @functools.cached_property
40
36
  def _match_re(self) -> re.Pattern[str]:
41
37
  return re.compile(self._expression, self._flags)
@@ -51,6 +47,7 @@ class Parser[*T]:
51
47
  )
52
48
 
53
49
 
50
+ @final
54
51
  class parse[*T]:
55
52
  """
56
53
  Parse string by template.
@@ -77,6 +74,7 @@ class parse[*T]:
77
74
  return Parser(t, flags).parse(s)
78
75
 
79
76
 
77
+ @final
80
78
  class Conversion[T]:
81
79
  """
82
80
  Convert the string to your object.
@@ -104,6 +102,7 @@ class Conversion[T]:
104
102
  return self._convert(s)
105
103
 
106
104
 
105
+ @final
107
106
  class FormatConversion[T]:
108
107
  """
109
108
  Convert the string to your object with format.
File without changes
File without changes