We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b35e82c commit e1f6f47Copy full SHA for e1f6f47
docs/examples/python/custom_router_easy_resolver.py
@@ -1,13 +1,15 @@
1
+from typing import ClassVar
2
+
3
from reactpy_router.resolvers import ConversionInfo, ReactPyResolver
4
5
6
# Create a custom resolver that uses the following pattern: "{name:type}"
7
class CustomResolver(ReactPyResolver):
8
# Match parameters that use the "<name:type>" format
- param_pattern = r"<(?P<name>\w+)(?P<type>:\w+)?>"
9
+ param_pattern: str = r"<(?P<name>\w+)(?P<type>:\w+)?>"
10
11
# Enable matching for the following types: int, str, any
- converters = {
12
+ converters: ClassVar[dict[str, ConversionInfo]] = {
13
"int": ConversionInfo(regex=r"\d+", func=int),
14
"str": ConversionInfo(regex=r"[^/]+", func=str),
15
"any": ConversionInfo(regex=r".*", func=str),
0 commit comments