Skip to content
Snippets Groups Projects
Commit 4bf3d389 authored by Kaushik Kulkarni's avatar Kaushik Kulkarni Committed by Andreas Klöckner
Browse files

do not rewrite properties

parent fd199ccd
No related branches found
No related tags found
No related merge requests found
Pipeline #358929 passed
...@@ -21,7 +21,7 @@ THE SOFTWARE. ...@@ -21,7 +21,7 @@ THE SOFTWARE.
""" """
import ast import ast
from functools import lru_cache from functools import lru_cache, cached_property
# This machinery applies AST rewriting to the mapper in a mildly brutal # This machinery applies AST rewriting to the mapper in a mildly brutal
...@@ -270,6 +270,10 @@ def optimize_mapper( ...@@ -270,6 +270,10 @@ def optimize_mapper(
for name in dir(cls): for name in dir(cls):
if not name.startswith("__") or name == "__call__": if not name.startswith("__") or name == "__call__":
method = getattr(cls, name) method = getattr(cls, name)
if isinstance(method, (property, cached_property)):
# properties don't have *args, **kwargs
continue
seen_module_names.add(method.__module__) seen_module_names.add(method.__module__)
method_ast = _get_ast_for_method(method) method_ast = _get_ast_for_method(method)
if name != method_ast.name: if name != method_ast.name:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment