Commit 0394d67d authored by James Ennis's avatar James Ennis

pylint - disabled no-member, bad-exception-context and catching-non-exception warnings

parent 4741d137
......@@ -114,8 +114,6 @@ disable=#####################################
logging-format-interpolation,
no-member,
# We use assert(<>), which should perhaps be assert <>
superfluous-parens,
......@@ -136,11 +134,6 @@ disable=#####################################
simplifiable-if-statement,
# These messages occur when excepting a GError - these should
# be individually marked
bad-exception-context,
catching-non-exception,
bad-whitespace
# Enable the message, report, category or checker with the given id(s). You can
......@@ -197,7 +190,7 @@ contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
generated-members=__enter__
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
......@@ -214,13 +207,13 @@ ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
ignored-classes=optparse.Values,thread._local,_thread._local,contextlib.closing,gi.repository.GLib.GError
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=pkg_resources
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
......
......@@ -22,6 +22,10 @@
#
# Code based on Jürg's artifact cache and Andrew's ostree plugin
#
# Disable pylint warnings that are not appicable to this module
# pylint: disable=bad-exception-context,catching-non-exception
import os
from ._exceptions import BstError, ErrorDomain
......
......@@ -64,7 +64,8 @@ class FilterElement(Element):
build_deps = list(self.dependencies(Scope.BUILD, recurse=False))
if len(build_deps) != 1:
detail = "Full list of build-depends:\n"
detail += " \n".join([x.name for x in build_deps])
deps_list = " \n".join([x.name for x in build_deps])
detail += deps_list
raise ElementError("{}: {} element must have exactly 1 build-dependency, actually have {}"
.format(self, type(self).__name__, len(build_deps)),
detail=detail, reason="filter-bdepend-wrong-count")
......@@ -73,7 +74,8 @@ class FilterElement(Element):
runtime_deps = list(self.dependencies(Scope.RUN, recurse=False))
if build_deps[0] in runtime_deps:
detail = "Full list of runtime depends:\n"
detail += " \n".join([x.name for x in runtime_deps])
deps_list = " \n".join([x.name for x in runtime_deps])
detail += deps_list
raise ElementError("{}: {} element's build dependency must not also be a runtime dependency"
.format(self, type(self).__name__),
detail=detail, reason="filter-bdepend-also-rdepend")
......
......@@ -115,11 +115,13 @@ class DownloadableFileSource(Source):
return (sha256, etag)
except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError) as e:
if isinstance(e, urllib.error.HTTPError) and e.code == 304:
# Already cached and not modified
except urllib.error.HTTPError as e:
if e.code == 304:
return (self.ref, self.etag)
raise SourceError("{}: Error mirroring {}: {}"
.format(self, self.url, e)) from e
except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError) as e:
raise SourceError("{}: Error mirroring {}: {}"
.format(self, self.url, e)) from e
......
......@@ -161,6 +161,10 @@ if __name__ == '__main__':
sys.exit({2}())'''
# Modify the get_args() function of the ScriptWriter class
# Note: the pylint no-member warning has been disabled as the functions: get_header(),
# ensure_safe_name() and _get_script_args() are all members of this class.
# pylint: disable=no-member
@classmethod
def get_args(cls, dist, header=None):
if header is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment