Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance #62

Merged
merged 1 commit into from
May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions itemadapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,17 @@ def __init__(self, item: Any) -> None:

@classmethod
def is_item(cls, item: Any) -> bool:
return any(adapter_class.is_item(item) for adapter_class in cls.ADAPTER_CLASSES)
for adapter_class in cls.ADAPTER_CLASSES:
if adapter_class.is_item(item):
return True
return False

@classmethod
def is_item_class(cls, item_class: type) -> bool:
return any(
adapter_class.is_item_class(item_class) for adapter_class in cls.ADAPTER_CLASSES
)
for adapter_class in cls.ADAPTER_CLASSES:
if adapter_class.is_item_class(item_class):
return True
return False

@classmethod
def get_field_meta_from_class(cls, item_class: type, field_name: str) -> MappingProxyType:
Expand Down