Skip to content

Commit

Permalink
#35 cache getmembers result when computing is_node_property
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiostalla committed Nov 7, 2024
1 parent e297bef commit f690431
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pylasu/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class Concept(ABCMeta):

def __init__(cls, what, bases=None, dict=None):
super().__init__(what, bases, dict)
cls.__internal_properties__ = ["origin", "destination", "parent", "position", "position_override"]
cls.__internal_properties__ = \
(["origin", "destination", "parent", "position", "position_override"] +
[n for n, v in inspect.getmembers(cls, is_internal_property_or_method)])

@property
def node_properties(cls):
Expand Down Expand Up @@ -118,9 +120,7 @@ def _direct_node_properties(cls, cl, known_property_names):
yield PropertyDescription(name, False)

def is_node_property(cls, name):
return not name.startswith('_') \
and name not in cls.__internal_properties__ \
and name not in [n for n, v in inspect.getmembers(cls, is_internal_property_or_method)]
return not name.startswith('_') and name not in cls.__internal_properties__


class Node(Origin, Destination, metaclass=Concept):
Expand Down

0 comments on commit f690431

Please sign in to comment.