MCPcopy
hub / github.com/pallets/flask / __init_subclass__

Method __init_subclass__

src/flask/views.py:165–180  ·  view source on GitHub ↗
(cls, **kwargs: t.Any)

Source from the content-addressed store, hash-verified

163 """
164
165 def __init_subclass__(cls, **kwargs: t.Any) -> None:
166 super().__init_subclass__(**kwargs)
167
168 if "methods" not in cls.__dict__:
169 methods = set()
170
171 for base in cls.__bases__:
172 if getattr(base, "methods", None):
173 methods.update(base.methods) # type: ignore[attr-defined]
174
175 for key in http_method_funcs:
176 if hasattr(cls, key):
177 methods.add(key.upper())
178
179 if methods:
180 cls.methods = methods
181
182 def dispatch_request(self, **kwargs: t.Any) -> ft.ResponseReturnValue:
183 meth = getattr(self, request.method.lower(), None)

Callers

nothing calls this directly

Calls 2

setFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected