diff --git a/plugins/command_completions/__init__.py b/plugins/command_completions/__init__.py index 43c1a93c..b2618376 100644 --- a/plugins/command_completions/__init__.py +++ b/plugins/command_completions/__init__.py @@ -165,7 +165,7 @@ class SublimeTextCommandCompletionPythonListener(sublime_plugin.EventListener): @inhibit_word_completions def on_query_completions(self, view, prefix, locations): loc = locations[0] - python_arg_scope = ("source.python meta.function-call.arguments.python string.quoted") + python_arg_scope = "source.python meta.function-call.arguments.python string.quoted" if not view.score_selector(loc, python_arg_scope) or not is_plugin(view): return None diff --git a/plugins/create_package.py b/plugins/create_package.py index 61557b27..788284f3 100644 --- a/plugins/create_package.py +++ b/plugins/create_package.py @@ -37,7 +37,9 @@ def _create_package(name): os.mkdir(path) except FileExistsError: logger.error("Path exists already: %r", path) - except Exception: + except FileNotFoundError: + logger.error("Parent path does not exist: %r", path) + except OSError: logger.exception("Unknown error while creating path %r", path) else: return path diff --git a/plugins/lib/fileconv/dumpers.py b/plugins/lib/fileconv/dumpers.py index 4454bafe..f9501ba5 100644 --- a/plugins/lib/fileconv/dumpers.py +++ b/plugins/lib/fileconv/dumpers.py @@ -97,7 +97,8 @@ def validate_data(self, data, *args, **kwargs): (lambda x: x is None, False)) ] """ - pass + raise NotImplementedError + def _validate_data(self, data, funcs): """Check for incompatible data recursively. @@ -178,7 +179,7 @@ def dump(self, data, *args, **kwargs): def write(self, data, *args, **kwargs): """To be implemented.""" - pass + raise NotImplementedError class JSONDumper(DumperProto): diff --git a/plugins/lib/fileconv/loaders.py b/plugins/lib/fileconv/loaders.py index aa66564a..cd3254a9 100644 --- a/plugins/lib/fileconv/loaders.py +++ b/plugins/lib/fileconv/loaders.py @@ -295,7 +295,8 @@ def parse(self, *args, **kwargs): """To be implemented. Should return the parsed data from ``self.file_path`` as a Python object. """ - pass + raise NotImplementedError + class JSONLoader(LoaderProto): diff --git a/plugins/new_resource_file/__init__.py b/plugins/new_resource_file/__init__.py index 97cf6445..91307e0e 100644 --- a/plugins/new_resource_file/__init__.py +++ b/plugins/new_resource_file/__init__.py @@ -116,4 +116,4 @@ def _is_package_path(self, file_path): for fp in (real_file_path, file_path): if fp.startswith(pp): leaf = fp[len(pp):].strip(os.sep) - return (os.sep not in leaf) + return os.sep not in leaf diff --git a/plugins/syntax_dev/completions.py b/plugins/syntax_dev/completions.py index f363ccd1..d55ec800 100644 --- a/plugins/syntax_dev/completions.py +++ b/plugins/syntax_dev/completions.py @@ -232,42 +232,47 @@ def match_selector(selector, offset=0): return all(self.view.match_selector(point + offset, selector) for point in locations) + result = None + # None of our business if not match_selector("- comment - (source.regexp - keyword.other.variable)"): - return None + result = None # Scope name completions based on our scope_data database - if match_selector("meta.expect-scope, meta.scope", -1): - return self._complete_scope(prefix, locations) + elif match_selector("meta.expect-scope, meta.scope", -1): + result = self._complete_scope(prefix, locations) # Auto-completion for include values using the 'contexts' keys and for - if match_selector( + elif match_selector( "meta.expect-context-list-or-content | meta.context-list-or-content", -1, ): - return ((self._complete_keyword(prefix, locations) or []) + result = ((self._complete_keyword(prefix, locations) or []) + self._complete_context(prefix, locations)) # Auto-completion for include values using the 'contexts' keys - if match_selector( + elif match_selector( "meta.expect-context-list | meta.expect-context | meta.include | meta.context-list", -1, ): - return self._complete_context(prefix, locations) or None + result = self._complete_context(prefix, locations) or None # Auto-completion for branch points with 'fail' key - if match_selector( + elif match_selector( "meta.expect-branch-point-reference | meta.branch-point-reference", -1, ): - return self._complete_branch_point() + result = self._complete_branch_point() # Auto-completion for variables in match patterns using 'variables' keys - if match_selector("keyword.other.variable"): - return self._complete_variable() + elif match_selector("keyword.other.variable"): + result = self._complete_variable() - # Standard completions for unmatched regions - return self._complete_keyword(prefix, locations) + else: + # Standard completions for unmatched regions + result = self._complete_keyword(prefix, locations) + + return result def _line_prefix(self, point): _, col = self.view.rowcol(point)