Skip to content

Commit f40370a

Browse files
committed
setup: pylint: Enable protected-access check
1 parent fe5e135 commit f40370a

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

bugzilla/bug.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ def __getattr__(self, name):
7070
# have never been called.
7171
return self.__dict__[name]
7272

73-
# Check field aliases
74-
for newname, oldname in self.bugzilla._get_bug_aliases():
73+
# pylint: disable=protected-access
74+
aliases = self.bugzilla._get_bug_aliases()
75+
# pylint: enable=protected-access
76+
77+
for newname, oldname in aliases:
7578
if name == oldname and newname in self.__dict__:
7679
return self.__dict__[newname]
7780

@@ -100,8 +103,10 @@ def refresh(self, extra_fields=None):
100103
'''
101104
Refresh the bug with the latest data from bugzilla
102105
'''
106+
# pylint: disable=protected-access
103107
r = self.bugzilla._getbug(self.bug_id,
104108
extra_fields=self._bug_fields + (extra_fields or []))
109+
# pylint: enable=protected-access
105110
self._update_dict(r)
106111
reload = refresh
107112

@@ -113,7 +118,11 @@ def _update_dict(self, newdict):
113118
if self.bugzilla:
114119
self.bugzilla.post_translation({}, newdict)
115120

116-
for newname, oldname in self.bugzilla._get_bug_aliases():
121+
# pylint: disable=protected-access
122+
aliases = self.bugzilla._get_bug_aliases()
123+
# pylint: enable=protected-access
124+
125+
for newname, oldname in aliases:
117126
if not oldname in newdict:
118127
continue
119128

setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ def _run(self):
144144
# R0201: Method could be a function
145145
"--disable R0201 "
146146

147-
# Would be nice to disable these 2 but it just
148-
# ain't work reorganizing the code to not trigger them
149-
# W0212: Access to a protected member of a client class
150-
"--disable W0212 "
151-
152147
"bugzilla/ bin-bugzilla tests/*.py ")
153148

154149
os.system("pep8 --format=pylint "

tests/createbug.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def testMultiOpts(self):
7777
)
7878

7979
def testFieldConversion(self):
80-
out = self.bz._validate_createbug(product="foo", component="bar",
80+
vc = self.bz._validate_createbug # pylint: disable=protected-access
81+
out = vc(product="foo", component="bar",
8182
version="12", description="foo", short_desc="bar",
8283
check_args=False)
8384
self.assertDictEqual(out,

tests/rw_functional.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ def test11UserUpdate(self):
615615
616616
group = "fedora_contrib"
617617

618-
if not self._check_have_admin(bz, sys._getframe().f_code.co_name):
618+
fn = sys._getframe().f_code.co_name # pylint: disable=protected-access
619+
if not self._check_have_admin(bz, fn):
619620
return
620621

621622
user = bz.getuser(email)
@@ -654,12 +655,14 @@ def test11ComponentEditing(self):
654655
"component": component,
655656
}
656657

657-
if not self._check_have_admin(bz, sys._getframe().f_code.co_name):
658+
fn = sys._getframe().f_code.co_name # pylint: disable=protected-access
659+
if not self._check_have_admin(bz, fn):
658660
return
659661

660662

661663
def compare(data, newid):
662-
products = bz._proxy.Product.get({"names": [basedata["product"]]})
664+
proxy = bz._proxy # pylint: disable=protected-access
665+
products = proxy.Product.get({"names": [basedata["product"]]})
663666
compdata = None
664667
for c in products["products"][0]["components"]:
665668
if int(c["id"]) == int(newid):
@@ -700,7 +703,9 @@ def compare(data, newid):
700703

701704
def test12SetCookie(self):
702705
bz = self.bzclass(url=self.url, cookiefile=cf)
703-
if not self._check_rh_privs(bz, sys._getframe().f_code.co_name):
706+
707+
fn = sys._getframe().f_code.co_name # pylint: disable=protected-access
708+
if not self._check_rh_privs(bz, fn):
704709
return
705710

706711
try:

0 commit comments

Comments
 (0)