Skip to content

Commit

Permalink
Workaround pylint-dev/pylint#3090 - change the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelton committed Jan 6, 2020
1 parent 7f6fcf9 commit b6d0520
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ test:
./test.sh

test-pylint:
if pylint-3 --version | grep 'astroid 2\.3\.0' ; then echo "Skipping pylint due to https://github.com/PyCQA/pylint/issues/3090." >&2 ; \
else pylint-3 --disable=R --disable=C --indent-string="\t" lib/*/*.py setup.py ; \
fi
pylint-3 --disable=R --disable=C --indent-string="\t" lib/*/*.py setup.py

clean:
rm -rf $(shell cat .gitignore)
Expand Down
2 changes: 1 addition & 1 deletion lib/rpm2swidtag/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def cleanup_namespaces(self, e):
def _cleanup_fullname(l):
for i in l:
del i.attrib["fullname"]
#pylint: disable=protected-access
#pylint: disable=protected-access,undefined-variable
__class__._cleanup_fullname(i)

24 changes: 12 additions & 12 deletions lib/swidq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _elements_match(e1, e2):
or e1.text != e2.text \
or e1.attrib != e2.attrib:
return False
#pylint: disable=protected-access
#pylint: disable=protected-access,undefined-variable
if __class__._children_without_swidq(e1) != __class__._children_without_swidq(e2):
return False
return True
Expand Down Expand Up @@ -254,7 +254,7 @@ def with_supplemented(self, collection, seen=None):
local_seen = set()
local_seen.add(spath)
s = s.with_supplemented(collection, seen=local_seen)
__class__._attribs_into_dict(attrib_merge, s, spath, value_source)
self.__class__._attribs_into_dict(attrib_merge, s, spath, value_source)

for e in s.xml.getroot().iterfind("{%s}Entity" % SWID_XMLNS):
roles = e.get("role")
Expand All @@ -266,30 +266,30 @@ def with_supplemented(self, collection, seen=None):
ne = deepcopy(e)
ne.set("role", r)
for t in newself.xml.getroot().iterfind("{%s}Entity" % SWID_XMLNS):
if __class__._elements_match(ne, t):
__class__._add_element_source(t, spath, to_existing=True)
if self.__class__._elements_match(ne, t):
self.__class__._add_element_source(t, spath, to_existing=True)
break
te = deepcopy(t)
te.set("role", r)
if __class__._elements_match(ne, te) \
if self.__class__._elements_match(ne, te) \
and t.find("{%s}element-source" % SWIDQ_XMLNS) is None:
__class__._add_element_source(t, spath, to_existing=True)
self.__class__._add_element_source(t, spath, to_existing=True)
break
else:
__class__._add_element_source(ne, spath)
self.__class__._add_element_source(ne, spath)
newself.xml.getroot().append(ne)

for e in s.xml.getroot().iterfind("{%s}Link" % SWID_XMLNS):
rel = e.get("rel")
if not rel or rel == "supplemental":
continue
for t in newself.xml.getroot().iterfind("{%s}Link" % SWID_XMLNS):
if __class__._elements_match(e, t):
__class__._add_element_source(t, spath, to_existing=True)
if self.__class__._elements_match(e, t):
self.__class__._add_element_source(t, spath, to_existing=True)
break
else:
ne = deepcopy(e)
__class__._add_element_source(ne, spath)
self.__class__._add_element_source(ne, spath)
newself.xml.getroot().append(ne)

rs = etree.Element("{%s}supplemental" % SWIDQ_XMLNS)
Expand All @@ -298,8 +298,8 @@ def with_supplemented(self, collection, seen=None):
rs.append(s.get_xml().getroot())
supplementals.append(rs)

__class__._attribs_into_dict(attrib_merge, newself, None, value_source)
__class__._dict_into_attribs(newself, attrib_merge, value_source, last_child)
self.__class__._attribs_into_dict(attrib_merge, newself, None, value_source)
self.__class__._dict_into_attribs(newself, attrib_merge, value_source, last_child)

for e in supplementals:
newself.get_xml().getroot().append(e)
Expand Down

0 comments on commit b6d0520

Please sign in to comment.