Skip to content

Address some pylint notices #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/command_completions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion plugins/create_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions plugins/lib/fileconv/dumpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ 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.
Expand Down Expand Up @@ -178,7 +178,7 @@ def dump(self, data, *args, **kwargs):

def write(self, data, *args, **kwargs):
"""To be implemented."""
pass
raise NotImplementedError


class JSONDumper(DumperProto):
Expand Down
2 changes: 1 addition & 1 deletion plugins/lib/fileconv/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ 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):
Expand Down
2 changes: 1 addition & 1 deletion plugins/new_resource_file/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 21 additions & 14 deletions plugins/syntax_dev/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,42 +232,49 @@ 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 [])
+ self._complete_context(prefix, locations))
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()

else:
# Standard completions for unmatched regions
result = self._complete_keyword(prefix, locations)

# Standard completions for unmatched regions
return self._complete_keyword(prefix, locations)
return result

def _line_prefix(self, point):
_, col = self.view.rowcol(point)
Expand Down