Skip to content

Commit

Permalink
fix new ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Fuchs committed Jul 31, 2023
1 parent a2ab16b commit 3695fe7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flair/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def save(self, savefile):
def __setstate__(self, d):
self.__dict__ = d
# set 'add_unk' if the dictionary was created with a version of Flair older than 0.9
if "add_unk" not in self.__dict__.keys():
if "add_unk" not in self.__dict__:
self.__dict__["add_unk"] = b"<unk>" in self.__dict__["idx2item"]

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion flair/embeddings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def embedding_type(self) -> str:
def _everything_embedded(self, data_points: Sequence[Sentence]) -> bool:
for sentence in data_points:
for token in sentence.tokens:
if self.name not in token._embeddings.keys():
if self.name not in token._embeddings:
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion flair/embeddings/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ def embed(self, sentences: Union[List[Sentence], Sentence]):
sentences = [sentences]

for sentence in sentences:
if self.name not in sentence._embeddings.keys():
if self.name not in sentence._embeddings:
everything_embedded = False

if not everything_embedded:
Expand Down

0 comments on commit 3695fe7

Please sign in to comment.