Skip to content

Commit fd067a4

Browse files
authored
Merge pull request #403 from SublimeText/feature/pylint-interventions
Address some pylint notices
2 parents 767a6f1 + e4a5d59 commit fd067a4

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

plugins/command_completions/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class SublimeTextCommandCompletionPythonListener(sublime_plugin.EventListener):
165165
@inhibit_word_completions
166166
def on_query_completions(self, view, prefix, locations):
167167
loc = locations[0]
168-
python_arg_scope = ("source.python meta.function-call.arguments.python string.quoted")
168+
python_arg_scope = "source.python meta.function-call.arguments.python string.quoted"
169169
if not view.score_selector(loc, python_arg_scope) or not is_plugin(view):
170170
return None
171171

plugins/create_package.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def _create_package(name):
3737
os.mkdir(path)
3838
except FileExistsError:
3939
logger.error("Path exists already: %r", path)
40-
except Exception:
40+
except FileNotFoundError:
41+
logger.error("Parent path does not exist: %r", path)
42+
except OSError:
4143
logger.exception("Unknown error while creating path %r", path)
4244
else:
4345
return path

plugins/lib/fileconv/dumpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def validate_data(self, data, *args, **kwargs):
9797
(lambda x: x is None, False))
9898
]
9999
"""
100-
pass
100+
raise NotImplementedError
101101

102102
def _validate_data(self, data, funcs):
103103
"""Check for incompatible data recursively.
@@ -178,7 +178,7 @@ def dump(self, data, *args, **kwargs):
178178

179179
def write(self, data, *args, **kwargs):
180180
"""To be implemented."""
181-
pass
181+
raise NotImplementedError
182182

183183

184184
class JSONDumper(DumperProto):

plugins/lib/fileconv/loaders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def parse(self, *args, **kwargs):
295295
"""To be implemented. Should return the parsed data from
296296
``self.file_path`` as a Python object.
297297
"""
298-
pass
298+
raise NotImplementedError
299299

300300

301301
class JSONLoader(LoaderProto):

plugins/new_resource_file/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ def _is_package_path(self, file_path):
116116
for fp in (real_file_path, file_path):
117117
if fp.startswith(pp):
118118
leaf = fp[len(pp):].strip(os.sep)
119-
return (os.sep not in leaf)
119+
return os.sep not in leaf

plugins/syntax_dev/completions.py

+21-14
Original file line numberDiff line numberDiff line change
@@ -232,42 +232,49 @@ def match_selector(selector, offset=0):
232232
return all(self.view.match_selector(point + offset, selector)
233233
for point in locations)
234234

235+
result = None
236+
235237
# None of our business
236238
if not match_selector("- comment - (source.regexp - keyword.other.variable)"):
237-
return None
239+
result = None
238240

239241
# Scope name completions based on our scope_data database
240-
if match_selector("meta.expect-scope, meta.scope", -1):
241-
return self._complete_scope(prefix, locations)
242+
elif match_selector("meta.expect-scope, meta.scope", -1):
243+
result = self._complete_scope(prefix, locations)
242244

243245
# Auto-completion for include values using the 'contexts' keys and for
244-
if match_selector(
246+
elif match_selector(
245247
"meta.expect-context-list-or-content | meta.context-list-or-content",
246248
-1,
247249
):
248-
return ((self._complete_keyword(prefix, locations) or [])
249-
+ self._complete_context(prefix, locations))
250+
result = (
251+
(self._complete_keyword(prefix, locations) or [])
252+
+ self._complete_context(prefix, locations)
253+
)
250254

251255
# Auto-completion for include values using the 'contexts' keys
252-
if match_selector(
256+
elif match_selector(
253257
"meta.expect-context-list | meta.expect-context | meta.include | meta.context-list",
254258
-1,
255259
):
256-
return self._complete_context(prefix, locations) or None
260+
result = self._complete_context(prefix, locations) or None
257261

258262
# Auto-completion for branch points with 'fail' key
259-
if match_selector(
263+
elif match_selector(
260264
"meta.expect-branch-point-reference | meta.branch-point-reference",
261265
-1,
262266
):
263-
return self._complete_branch_point()
267+
result = self._complete_branch_point()
264268

265269
# Auto-completion for variables in match patterns using 'variables' keys
266-
if match_selector("keyword.other.variable"):
267-
return self._complete_variable()
270+
elif match_selector("keyword.other.variable"):
271+
result = self._complete_variable()
272+
273+
else:
274+
# Standard completions for unmatched regions
275+
result = self._complete_keyword(prefix, locations)
268276

269-
# Standard completions for unmatched regions
270-
return self._complete_keyword(prefix, locations)
277+
return result
271278

272279
def _line_prefix(self, point):
273280
_, col = self.view.rowcol(point)

0 commit comments

Comments
 (0)