Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
klebster2 committed Nov 15, 2024
1 parent cba90b5 commit c7fc741
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions python/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ def install(package: str):
), f"Failed to find a Wordnet dataset for language {TARGET_LANGUAGE}"


"""
WordNet completion plugin for Vim/Neovim.
Provides word completion and documentation based on WordNet semantic relations.
"""

# Setup language configuration
TARGET_LANGUAGE = "en" if vim is None else vim.eval("g:wn_cmp_language")

Expand Down Expand Up @@ -117,15 +112,6 @@ class WordSense: # pylint: disable=too-many-instance-attributes
relation_chain: Optional[Tuple[str, ...]] = None


@dataclass(frozen=True)
class CompletionItem:
"""A completion item with all necessary metadata."""

word: str
meta: CompletionMeta
documentation: str


@dataclass(frozen=True)
class RelationChain:
"""Represents a chain of semantic relations."""
Expand Down Expand Up @@ -162,11 +148,11 @@ def _normalize_word(self, word: str) -> str:

def _get_sense_synonyms(
self, synset: "wn.Synset"
) -> t.List[t.Tuple[Form, str, None]]:
) -> t.List[t.Tuple[Form, t.Optional[str]]]:
"""Get all synonyms for a specific word sense with their definitions."""
return [(lemma, synset.definition()) for lemma in synset.lemmas()]

def _explore_synset(
def _explore_synset( # pylint: disable=too-many-positional-arguments, too-many-locals,
self,
synset: "wn.Synset",
word_class: WordClass,
Expand All @@ -191,8 +177,6 @@ def _explore_synset(
seen_synsets.add(synset.id)

# Initialize defaultdict for definitions
from collections import defaultdict

definitions: t.Dict[str, t.List[t.Tuple[str, t.List[t.Tuple[str, str]]]]] = (
defaultdict(list)
)
Expand All @@ -206,7 +190,7 @@ def _explore_synset(
# Add definition and synonyms for each lemma
for lemma in synset.lemmas():
lemma_str = str(lemma)
definitions[lemma_str].append((synset.definition(), sense_synonyms))
definitions[lemma_str].append((synset.definition(), sense_synonyms)) # type: ignore

def process_related(related_synset: "wn.Synset", relation_type: str):
for lemma in related_synset.lemmas():
Expand Down

0 comments on commit c7fc741

Please sign in to comment.