diff options
| author | Abhishek Koneru <akoneru@redhat.com> | 2013-07-17 14:21:30 -0400 |
|---|---|---|
| committer | Abhishek Koneru <akoneru@redhat.com> | 2013-07-18 11:40:31 -0400 |
| commit | c1bdf93bd774a7a8553afd9fe3cabd25be0a2b2e (patch) | |
| tree | 0fb58115ab73ac027aaa04fecd9786d2a8890122 | |
| parent | 9b83091ec85a2f0afaf2936ed6388b2ee53ef656 (diff) | |
Fixes for issues reported by pylint.
Fixed the warning W0202 - attributes defined outside init and
error E0202 - An instance attribute hiding a method (which is actually
an error in json.encoder.JSONEncoder line 157.)
| -rw-r--r-- | base/common/python/pki/encoder.py | 17 | ||||
| -rw-r--r-- | base/common/python/pki/system.py | 2 | ||||
| -rw-r--r-- | base/server/src/engine/pkihelper.py | 8 | ||||
| -rw-r--r-- | base/server/src/engine/pkimanifest.py | 9 | ||||
| -rw-r--r-- | base/server/src/engine/pkiparser.py | 2 |
5 files changed, 32 insertions, 6 deletions
diff --git a/base/common/python/pki/encoder.py b/base/common/python/pki/encoder.py index 8d8a9c101..e947bbc7c 100644 --- a/base/common/python/pki/encoder.py +++ b/base/common/python/pki/encoder.py @@ -12,6 +12,23 @@ class CustomTypeEncoder(json.JSONEncoder): type to which the object belongs. That single key maps to another object literal which is just the __dict__ of the object encoded.""" + """Reason for ignoring the error + E0202 - An attribute affected in json.encoder line 157 hide this method + reported by pylint: + + The error is in json.encoder.JSONEncoder class. + There is a default method (which is overridden here) and also a class attribute + self.default initialized in the init method of the class. + The intention of such usage being that a custom default method object can + be passed to init when creating an instance of JSONEncoder, which is then assigned + to class's default method. (which is valid) + But pylint raises an issue due to the usage of same name for a method and an attribute + in which case the attribute definition hides the method. + The reason and example for the issue: (top rated comment) + http://stackoverflow.com/questions/12949064/python-what-happens- + when-instance-variable-name-is-same-as-method-name + """ + # pylint: disable-msg=E0202 def default(self, obj): for k, v in TYPES.items(): if isinstance(obj, v): diff --git a/base/common/python/pki/system.py b/base/common/python/pki/system.py index 4dd3baac2..9ea93677a 100644 --- a/base/common/python/pki/system.py +++ b/base/common/python/pki/system.py @@ -25,7 +25,7 @@ import xml.etree.ElementTree as ET class SecurityDomainInfo: def __init__(self): - pass + self.name = None class SecurityDomainClient: diff --git a/base/server/src/engine/pkihelper.py b/base/server/src/engine/pkihelper.py index 39a0b8b9e..6d47a902b 100644 --- a/base/server/src/engine/pkihelper.py +++ b/base/server/src/engine/pkihelper.py @@ -1041,7 +1041,7 @@ class Instance: raise def get_instance_status(self): - self.connection = pki.client.PKIConnection( + connection = pki.client.PKIConnection( protocol='https', hostname=self.master_dict['pki_hostname'], port=self.master_dict['pki_https_port'], @@ -1049,7 +1049,7 @@ class Instance: accept='application/xml') try: - client = pki.system.SystemStatusClient(self.connection) + client = pki.system.SystemStatusClient(connection) response = client.getStatus() config.pki_log.debug(response, extra=config.PKI_INDENTATION_LEVEL_3) @@ -3070,14 +3070,14 @@ class ConfigClient: config.pki_log.info(log.PKI_CONFIG_CONFIGURING_PKI_DATA, extra=config.PKI_INDENTATION_LEVEL_2) - self.connection = pki.client.PKIConnection( + connection = pki.client.PKIConnection( protocol='https', hostname=self.master_dict['pki_hostname'], port=self.master_dict['pki_https_port'], subsystem=self.master_dict['pki_subsystem_type']) try: - client = pki.system.SystemConfigClient(self.connection) + client = pki.system.SystemConfigClient(connection) response = client.configure(data) config.pki_log.debug(log.PKI_CONFIG_RESPONSE_STATUS + \ diff --git a/base/server/src/engine/pkimanifest.py b/base/server/src/engine/pkimanifest.py index 09079b433..dea2af275 100644 --- a/base/server/src/engine/pkimanifest.py +++ b/base/server/src/engine/pkimanifest.py @@ -45,7 +45,14 @@ class Record(object): "acls", def __init__(self): - pass + self.name = None + self.type = None + self.user = None + self.group = None + self.uid = None + self.gid = None + self.permissions = None + self.acls = None def items(self): "dict style items" diff --git a/base/server/src/engine/pkiparser.py b/base/server/src/engine/pkiparser.py index dfd48b00d..8dbed8deb 100644 --- a/base/server/src/engine/pkiparser.py +++ b/base/server/src/engine/pkiparser.py @@ -83,6 +83,8 @@ class PKIConfigParser: help='directory prefix to specify local directory ' '[TEST ONLY]') self.indent = 0 + self.ds_connection = None + self.sd_connection = None # Master and Slot dictionaries self.pki_master_dict = dict() |
