diff --git a/python/plugin.py b/python/plugin.py index e5d2b4b..51cf98a 100644 --- a/python/plugin.py +++ b/python/plugin.py @@ -11,10 +11,6 @@ from collections import defaultdict from dataclasses import dataclass from enum import Enum -from functools import lru_cache -from typing import Dict, List, Optional, Set, Tuple, TypeVar, Union, cast - -from wn import Form # Append to path local wordsense.py sys.path.append(".") @@ -39,9 +35,11 @@ def install(package: str): # This is the quick and dirty way to get packages installed if they are not already installed try: import wn + from wn import Form except ImportError: install("wn") import wn + from wn import Form if vim is None: # pytest is running @@ -227,7 +225,10 @@ def process_related(related_synset: "wn.Synset", relation_type: str): relation_chains[word].extend(chains) # Process relations based on word class - if word_class == WordClass.NOUN or word_class == WordClass.VERB: + if ( + word_class == WordClass.NOUN # pylint: disable=consider-using-in + or word_class == WordClass.VERB # pylint: disable=consider-using-in + ): for hypernym in synset.hypernyms(): process_related(hypernym, "hypernym") for hyponym in synset.hyponyms(): @@ -252,8 +253,6 @@ def build_semantic_document( self, word: str, word_class: WordClass ) -> SemanticDocument: """Build a comprehensive semantic document for a word and its relations.""" - from collections import defaultdict - all_definitions: t.Dict[ str, t.List[t.Tuple[str, t.List[t.Tuple[str, str]]]] ] = defaultdict(list)