Numerous pycharm warnings resolved

This includes:

* Better ways of checking empty lists
* Not shadowing builtin functions like filter
* Preventing invalid slash warnings by marking strings as regexps
* Removing unnecessary brackets
* Lowercase variable names
* Adding/updating parameters in docstrings
* Removing unused code (lines not chunks)
* Change in not a member tests
* Changing some methods to static
* Shorting range membership checks
* Missing parameters
* Make some exception handlers more specific
* Don't define a lambda to a variable
* A few more instance checks to help type checkers
This commit is contained in:
Mike Auty
2018-12-16 13:21:06 +00:00
parent 29d41470a4
commit 9824538bd9
30 changed files with 116 additions and 84 deletions
+3 -2
View File
@@ -67,7 +67,7 @@ class ResourceAccessor(object):
temp_filename = os.path.join(constants.CACHE_PATH,
"data_" + hashlib.sha512(bytes(url, 'latin-1')).hexdigest())
if not temp_filename in self._cached_files or not os.path.exists(temp_filename):
if temp_filename not in self._cached_files or not os.path.exists(temp_filename):
vollog.info("Caching file at: {}".format(temp_filename))
try:
@@ -154,7 +154,8 @@ class JarHandler(urllib.request.BaseHandler):
http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
"""
def default_open(self, req):
@staticmethod
def default_open(req):
"""Handles the request if it's the jar scheme"""
if req.type == 'jar':
subscheme, remainder = req.full_url.split(":")[1], ":".join(req.full_url.split(":")[2:])