temparse 0.0.3__tar.gz → 0.0.4__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.3
3
+ Version: 0.0.4
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,33 +1,33 @@
1
1
  [project]
2
2
  name = "temparse"
3
- version = "0.0.3"
4
- license = "MIT"
5
- requires-python = ">=3.14"
6
- readme = "README.md"
3
+ version = "0.0.4"
7
4
  description = "temparse is template + parse"
5
+ readme = "README.md"
6
+ requires-python = ">=3.14"
7
+ license = "MIT"
8
8
  classifiers = [
9
- "Environment :: Web Environment",
10
- "Intended Audience :: Developers",
11
- "Programming Language :: Python :: 3",
12
- "Topic :: Software Development :: Code Generators",
13
- "Topic :: Software Development :: Libraries :: Python Modules",
9
+ "Environment :: Web Environment",
10
+ "Intended Audience :: Developers",
11
+ "Programming Language :: Python :: 3",
12
+ "Topic :: Software Development :: Code Generators",
13
+ "Topic :: Software Development :: Libraries :: Python Modules",
14
14
  ]
15
15
  dependencies = []
16
16
 
17
- [project.urls]
18
- homepage = "https://github.com/jiang-zhexin/temparse"
19
-
20
17
  [[project.authors]]
21
18
  name = "jiang-zhexin"
22
19
  email = "162887873+jiang-zhexin@users.noreply.github.com"
23
20
 
24
- [build-system]
25
- requires = ["uv_build>=0.11.15,<0.12.0"]
26
- build-backend = "uv_build"
21
+ [project.urls]
22
+ homepage = "https://github.com/jiang-zhexin/temparse"
27
23
 
28
24
  [dependency-groups]
29
25
  dev = [
30
- "pytest>=9.0.3",
31
- "ruff>=0.15.15",
32
- "ty>=0.0.40",
26
+ "pytest>=9.0.3",
27
+ "ruff>=0.15.15",
28
+ "ty>=0.0.43",
33
29
  ]
30
+
31
+ [build-system]
32
+ requires = ["uv_build>=0.11.15,<0.12.0"]
33
+ build-backend = "uv_build"
@@ -25,6 +25,9 @@ class Parser[*T]:
25
25
  """
26
26
 
27
27
  def __init__(self, template: Template, flags: re.RegexFlag = re.NOFLAG) -> None:
28
+ if len(template.interpolations) == 0:
29
+ raise ValueError("template must contain at least one interpolation")
30
+
28
31
  self._template = template
29
32
  self._flags = flags
30
33
  self._expression = "".join(
@@ -40,7 +43,7 @@ class Parser[*T]:
40
43
  def parse(self, s: str) -> tuple[*T]:
41
44
  m = self._match_re.fullmatch(s)
42
45
  if m is None:
43
- raise ValueError(f"Invalid format: {s!r}")
46
+ raise ValueError(f"invalid format: {s!r}")
44
47
 
45
48
  return tuple(
46
49
  _convert(text, interpolation)
File without changes
File without changes