--- a/RefactoringRope/CodeAssistClient.py Sat Dec 23 15:48:55 2023 +0100 +++ b/RefactoringRope/CodeAssistClient.py Sat Dec 23 17:58:35 2023 +0100 @@ -17,8 +17,11 @@ import rope.base.libutils import rope.base.project import rope.contrib.codeassist + import rope.contrib.findit + from rope.base import pynames, pyobjects, pyobjectsdef from rope.base.exceptions import BadIdentifierError, ModuleSyntaxError + from rope.contrib import fixsyntax except ImportError: sys.exit(42) @@ -46,6 +49,8 @@ @param projectPath path to the project @type str """ + from FileSystemCommands import RefactoringClientFileSystemCommands # noqa: I102 + super().__init__(host, port, idString) self.__methodMapping = { @@ -60,8 +65,6 @@ "reportChanged": self.__reportChanged, } - from FileSystemCommands import RefactoringClientFileSystemCommands - self.__fsCommands = RefactoringClientFileSystemCommands(self) self.__projectpath = projectPath @@ -104,7 +107,7 @@ return errorDict - def __getConfig(self, params): + def __getConfig(self, params): # noqa: U100 """ Private method to send some configuration data to the server. @@ -119,7 +122,7 @@ self.sendJson("Config", result) - def __configChanged(self, params): + def __configChanged(self, params): # noqa: U100 """ Private method to handle a change of the configuration file. @@ -133,7 +136,7 @@ ) self.__project.validate(self.__project.root) - def __closeProject(self, params): + def __closeProject(self, params): # noqa: U100 """ Private slot to validate the project. @@ -364,9 +367,6 @@ @return tuple containing the object type and name @rtype tuple of (str, str) """ - from rope.base import pynames, pyobjects, pyobjectsdef - from rope.contrib import fixsyntax - try: fixer = fixsyntax.FixSyntax(project, sourceCode, resource, maxfixes) pyname = fixer.pyname_at(offset) @@ -412,8 +412,6 @@ the server @type dict """ - import rope.base.libutils - filename = params["FileName"] offset = params["Offset"] source = params["Source"] @@ -429,8 +427,6 @@ errorDict = {} result = {} - import rope.contrib.findit - try: location = rope.contrib.findit.find_definition( self.__project, source, offset, resource @@ -457,8 +453,6 @@ the server @type dict """ - import rope.base.libutils - filename = params["FileName"] offset = params["Offset"] line = params["Line"] @@ -474,8 +468,6 @@ errorDict = {} gotoReferences = [] - import rope.contrib.findit - try: occurrences = rope.contrib.findit.find_occurrences( self.__project, resource, offset, in_hierarchy=True