Skip to content

Commit 8e2086a

Browse files
committed
update json_prop_names to set
1 parent 0e7e636 commit 8e2086a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/gino/declarative.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,14 @@ def _init_table(cls, sub_cls):
351351
for k, v in updates.items():
352352
setattr(sub_cls, k, v)
353353

354-
json_prop_names = []
354+
json_prop_names = set()
355355
for each_cls in sub_cls.__mro__[::-1]:
356356
for k, v in each_cls.__dict__.items():
357357
if isinstance(v, json_support.JSONProperty):
358358
if not v.name:
359359
v.name = k
360360
if v.prop_name not in json_prop_names:
361-
json_prop_names.append(v.prop_name)
361+
json_prop_names.add(v.prop_name)
362362
json_col = getattr(
363363
sub_cls.__dict__.get(v.prop_name), "column", None
364364
)

src/gino/json_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_profile(self, instance):
5555
props = type(instance).__dict__
5656
instance.__profile__ = {}
5757
profiles = {}
58-
for prop_name in getattr(instance, "__json_prop_names__", []):
58+
for prop_name in getattr(instance, "__json_prop_names__", set()):
5959
profiles.update(getattr(instance, prop_name, None) or {})
6060
for key, value in profiles.items():
6161
if key not in props:

0 commit comments

Comments
 (0)