diff options
author | umarcor <unai.martinezcorral@ehu.eus> | 2021-06-22 19:31:18 +0200 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2021-06-23 17:09:44 +0200 |
commit | 6e1bbc43fc29528ceaf5d422461206e29e801744 (patch) | |
tree | a3273f25e220b2c69869c4c8376f31e8229dbcda /pyGHDL/lsp | |
parent | c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52 (diff) | |
download | ghdl-6e1bbc43fc29528ceaf5d422461206e29e801744.tar.gz ghdl-6e1bbc43fc29528ceaf5d422461206e29e801744.tar.bz2 ghdl-6e1bbc43fc29528ceaf5d422461206e29e801744.zip |
fix more codacy issues
Diffstat (limited to 'pyGHDL/lsp')
-rw-r--r-- | pyGHDL/lsp/document.py | 2 | ||||
-rw-r--r-- | pyGHDL/lsp/lsp.py | 6 | ||||
-rw-r--r-- | pyGHDL/lsp/lsptools.py | 4 | ||||
-rw-r--r-- | pyGHDL/lsp/references.py | 4 | ||||
-rw-r--r-- | pyGHDL/lsp/workspace.py | 22 |
5 files changed, 22 insertions, 16 deletions
diff --git a/pyGHDL/lsp/document.py b/pyGHDL/lsp/document.py index a6f9ae217..d60f216d4 100644 --- a/pyGHDL/lsp/document.py +++ b/pyGHDL/lsp/document.py @@ -146,7 +146,7 @@ class Document(object): return tree def parse_document(self): - """Parse a document and put the units in the library""" + """Parse a document and put the units in the library.""" assert self._tree == nodes.Null_Iir tree = sem_lib.Load_File(self._fe) if tree == nodes.Null_Iir: diff --git a/pyGHDL/lsp/lsp.py b/pyGHDL/lsp/lsp.py index 43b8c47c8..d76c04616 100644 --- a/pyGHDL/lsp/lsp.py +++ b/pyGHDL/lsp/lsp.py @@ -162,7 +162,7 @@ class LanguageProtocolServer(object): self.conn.write(output) def notify(self, method, params): - """Send a notification""" + """Send a notification.""" body = { "jsonrpc": "2.0", "method": method, @@ -171,7 +171,7 @@ class LanguageProtocolServer(object): self.write_output(body) def send_request(self, method, params): - """Send a request""" + """Send a request.""" self._next_id += 1 body = { "jsonrpc": "2.0", @@ -182,7 +182,7 @@ class LanguageProtocolServer(object): self.write_output(body) def shutdown(self): - """Prepare to shutdown the server""" + """Prepare to shutdown the server.""" self.running = False def show_message(self, typ, message): diff --git a/pyGHDL/lsp/lsptools.py b/pyGHDL/lsp/lsptools.py index 648f0a8c0..29e0b3292 100644 --- a/pyGHDL/lsp/lsptools.py +++ b/pyGHDL/lsp/lsptools.py @@ -5,7 +5,7 @@ from . import lsp def lsp2json(): - "Utility that transforms lsp log file to a JSON list" + """Utility that transforms lsp log file to a JSON list.""" conn = lsp.LSPConn(sys.stdin.buffer, sys.stdout.buffer) ls = lsp.LanguageProtocolServer(None, conn) res = [] @@ -18,7 +18,7 @@ def lsp2json(): def json2lsp(): - "Utility that transform a JSON list to an lsp file" + """Utility that transform a JSON list to an lsp file.""" res = json.load(sys.stdin) conn = lsp.LSPConn(sys.stdin.buffer, sys.stdout.buffer) ls = lsp.LanguageProtocolServer(None, conn) diff --git a/pyGHDL/lsp/references.py b/pyGHDL/lsp/references.py index c7d0f730d..44a5f8c13 100644 --- a/pyGHDL/lsp/references.py +++ b/pyGHDL/lsp/references.py @@ -18,7 +18,7 @@ def find_def_chain(first, loc): def find_def(n, loc): - "Return the node at location :param loc:, or None if not under :param n:" + """Return the node at location :param loc:, or None if not under :param n:.""" if n == nodes.Null_Iir: return None k = nodes.Get_Kind(n) @@ -86,7 +86,7 @@ def find_def(n, loc): def goto_definition(n, loc): - "Return the declaration (as a node) under :param loc: or None" + """Return the declaration (as a node) under :param loc: or None.""" ref = find_def(n, loc) log.debug("for loc %u found node %s", loc, ref) if ref is None: diff --git a/pyGHDL/lsp/workspace.py b/pyGHDL/lsp/workspace.py index cb392be9b..55d4cbe85 100644 --- a/pyGHDL/lsp/workspace.py +++ b/pyGHDL/lsp/workspace.py @@ -23,7 +23,7 @@ log = logging.getLogger(__name__) class ProjectError(Exception): - "Exception raised in case of unrecoverable error in the project file." + """Exception raised in case of unrecoverable error in the project file.""" def __init__(self, msg): super().__init__() @@ -110,8 +110,11 @@ class Workspace(object): return res def get_document(self, doc_uri): - """Get a document from :param doc_uri: Note that the document may not exist, - and this function may return None.""" + """ + Get a document from :param doc_uri: + + Note that the document may not exist, and this function may return None. + """ return self._docs.get(doc_uri) def put_document(self, doc_uri, source, version=None): @@ -126,8 +129,11 @@ class Workspace(object): return doc def sfe_to_document(self, sfe): - """Get the document correspond to :param sfe: source file. - Can create the document if needed.""" + """ + Get the document correspond to :param sfe: source file. + + Can create the document if needed. + """ assert sfe != 0 doc = self._fe_map.get(sfe, None) if doc is None: @@ -288,7 +294,7 @@ class Workspace(object): self.publish_diagnostics(doc.uri, []) def obsolete_dependent_units(self, unit, antideps): - """Obsolete units that depends of :param unit:""" + """Obsolete units that depends of :param unit:.""" udeps = antideps.get(unit, None) if udeps is None: # There are no units. @@ -375,7 +381,7 @@ class Workspace(object): ) def declaration_to_location(self, decl): - "Convert declaration :param decl: to an LSP Location" + """Convert declaration :param decl: to an LSP Location.""" decl_loc = nodes.Get_Location(decl) if decl_loc == std_package.Std_Location.value: # There is no real file for the std.standard package. @@ -472,7 +478,7 @@ class Workspace(object): } def compute_anti_dependences(self): - """Return a dictionnary of anti dependencies for design unit""" + """Return a dictionnary of anti dependencies for design unit.""" res = {} lib = libraries.Get_Libraries_Chain() while lib != nodes.Null_Iir: |