Skip to content

Commit

Permalink
Use sets instead of lists
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Nov 14, 2023
1 parent 77e02ab commit 14b0475
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/sssom/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import uuid
from enum import Enum
from functools import lru_cache
from typing import Any, Dict, List, Literal
from typing import Any, Dict, List, Literal, Set

import pkg_resources
import yaml
Expand Down Expand Up @@ -247,14 +247,14 @@ def mapping_set_slots(self) -> List[str]:
return self.view.get_class("mapping set").slots

@property
def multivalued_slots(self) -> List[str]:
def multivalued_slots(self) -> Set[str]:
"""Return list of multivalued slots."""
return [c for c in self.view.all_slots() if self.view.get_slot(c).multivalued]
return {c for c in self.view.all_slots() if self.view.get_slot(c).multivalued}

@property
def entity_reference_slots(self) -> List[str]:
def entity_reference_slots(self) -> Set[str]:
"""Return list of entity reference slots."""
return [c for c in self.view.all_slots() if self.view.get_slot(c).range == ENTITY_REFERENCE]
return {c for c in self.view.all_slots() if self.view.get_slot(c).range == ENTITY_REFERENCE}


@lru_cache(1)
Expand Down
2 changes: 1 addition & 1 deletion src/sssom/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ def get_prefixes_used_in_table(df: pd.DataFrame, converter: Converter) -> Set[st
if df.empty:
return prefixes
sssom_schema_object = _get_sssom_schema_object()
entity_reference_slots = set(sssom_schema_object.entity_reference_slots) & set(df.columns)
entity_reference_slots = sssom_schema_object.entity_reference_slots & set(df.columns)
new_prefixes = {
converter.parse_curie(row).prefix
for col in entity_reference_slots
Expand Down

0 comments on commit 14b0475

Please sign in to comment.