register() — flask Function Reference
Architecture documentation for the register() function in tag.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 231a3803_dc71_1586_3edd_5eef3c43f0df["register()"] 6ef56ba4_aac6_67ac_0434_7a801bf6f137["TaggedJSONSerializer"] 231a3803_dc71_1586_3edd_5eef3c43f0df -->|defined in| 6ef56ba4_aac6_67ac_0434_7a801bf6f137 style 231a3803_dc71_1586_3edd_5eef3c43f0df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/json/tag.py lines 256–287
def register(
self,
tag_class: type[JSONTag],
force: bool = False,
index: int | None = None,
) -> None:
"""Register a new tag with this serializer.
:param tag_class: tag class to register. Will be instantiated with this
serializer instance.
:param force: overwrite an existing tag. If false (default), a
:exc:`KeyError` is raised.
:param index: index to insert the new tag in the tag order. Useful when
the new tag is a special case of an existing tag. If ``None``
(default), the tag is appended to the end of the order.
:raise KeyError: if the tag key is already registered and ``force`` is
not true.
"""
tag = tag_class(self)
key = tag.key
if key:
if not force and key in self.tags:
raise KeyError(f"Tag '{key}' is already registered.")
self.tags[key] = tag
if index is None:
self.order.append(tag)
else:
self.order.insert(index, tag)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does register() do?
register() is a function in the flask codebase, defined in src/flask/json/tag.py.
Where is register() defined?
register() is defined in src/flask/json/tag.py at line 256.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free