#293 Fix compatibility with Fedora 27 pylint
Merged 3 years ago by puiterwijk. Opened 3 years ago by puiterwijk.
puiterwijk/ipsilon pylintfixes  into  master

file modified
+2 -2
@@ -173,9 +173,9 @@ 

  	@docker run -v `pwd`:/code -t --rm ipsilon-fedora27

  	@echo "Fedora 27 passed"

  

- containertest-lint: container-centos7

+ containertest-lint: container-fedora27

  	@echo "Starting code lint tests ..."

- 	@docker run -v `pwd`:/code -t --rm --entrypoint /usr/bin/make ipsilon-centos7 lint pep8

+ 	@docker run -v `pwd`:/code -t --rm --entrypoint /usr/bin/make ipsilon-fedora27 lint pep8

  	@echo "Code lint tests passed"

  

  containertest: containertest-lint containertest-centos6 containertest-centos7 containertest-fedora26 containertest-fedora27

file modified
+2
@@ -34,6 +34,8 @@ 

          groups = set()

          getgrouplist = getattr(os, 'getgrouplist', None)

          if getgrouplist:

+             # On python2, None is not callable. On python3, this is a function

+             # pylint: disable=not-callable

              ids = getgrouplist(user, group)

              for i in ids:

                  try:

file modified
+1 -1
@@ -116,7 +116,7 @@ 

  

          return reply

  

-     def save_plugin_config(self, *args, **kwargs):

+     def save_plugin_config(self, config=None):

          raise ValueError('Configuration cannot be modified live for SSSD')

  

      def get_config_obj(self):

@@ -14,9 +14,6 @@ 

  

  class FAS(LoginFormBase):

  

-     def __init__(self, site, mgr, page):

-         super(FAS, self).__init__(site, mgr, page)

- 

      def POST(self, *args, **kwargs):

          username = kwargs.get("login_name")

          password = kwargs.get("login_password")

@@ -28,23 +28,14 @@ 

  class AuthenticationError(ProviderException):

      statuscode = 403

  

-     def __init__(self, message, code=None):

-         super(AuthenticationError, self).__init__(message, code)

- 

  

  class InvalidRequest(ProviderException):

      statuscode = 400

  

-     def __init__(self, message, code=None):

-         super(InvalidRequest, self).__init__(message, code)

- 

  

  class UnauthorizedRequest(ProviderException):

      statuscode = 401

  

-     def __init__(self, message, code=None):

-         super(UnauthorizedRequest, self).__init__(message, code)

- 

  

  class ProviderBase(ConfigHelper, PluginObject):

  

@@ -16,15 +16,15 @@ 

      def __init__(self, database_url):

          Store.__init__(self, database_url=database_url)

  

-     def storeAssociation(self, server_url, assoc):

-         iden = '%s-%s' % (server_url, assoc.handle)

-         datum = {'secret': oidutil.toBase64(assoc.secret),

-                  'issued': str(assoc.issued),

-                  'lifetime': str(assoc.lifetime),

-                  'assoc_type': assoc.assoc_type}

+     def storeAssociation(self, server_url, association):

+         iden = '%s-%s' % (server_url, association.handle)

+         datum = {'secret': oidutil.toBase64(association.secret),

+                  'issued': str(association.issued),

+                  'lifetime': str(association.lifetime),

+                  'assoc_type': association.assoc_type}

  

          data = {iden: datum}

-         self.save_unique_data('association', data, ttl=assoc.lifetime)

+         self.save_unique_data('association', data, ttl=association.lifetime)

  

      def getAssociation(self, server_url, handle=None):

          iden = '%s-%s' % (server_url, handle)

@@ -323,9 +323,15 @@ 

              return self._respond_error(request_data,

                                         'invalid_request',

                                         'claims malformed: %s' % ex)

+         if not isinstance(request_data['claims'], dict):

+             return self._respond_error(request_data,

+                                        'invalid_request',

+                                        'claims malformed')

          if 'userinfo' not in request_data['claims']:

+             # pylint: disable=unsupported-assignment-operation

              request_data['claims']['userinfo'] = {}

          if 'id_token' not in request_data['claims']:

+             # pylint: disable=unsupported-assignment-operation

              request_data['claims']['id_token'] = {}

  

          scopes_to_claim = {

@@ -67,8 +67,7 @@ 

  

  

  class ServiceProviderConfig(ConfigHelper):

-     def __init__(self):

-         super(ServiceProviderConfig, self).__init__()

+     pass

  

  

  class ServiceProvider(ServiceProviderConfig):

file modified
+3 -3
@@ -41,7 +41,7 @@ 

  

  class BaseStore(Log):

      # Some helper functions used for upgrades

-     def add_constraint(self, table):

+     def add_constraint(self, constraint):

          raise NotImplementedError()

  

      def add_index(self, index):
@@ -298,7 +298,7 @@ 

              self._config.read(self._filename)

          return self._config

  

-     def add_constraint(self, table):

+     def add_constraint(self, constraint):

          raise NotImplementedError()

  

      def add_index(self, index):
@@ -432,7 +432,7 @@ 

  

          self.is_readonly = False

  

-     def add_constraint(self, table):

+     def add_constraint(self, constraint):

          raise NotImplementedError()

  

      def add_index(self, index):

file modified
-3
@@ -6,9 +6,6 @@ 

  

  class Errors(Page):

  

-     def __init__(self, *args, **kwargs):

-         super(Errors, self).__init__(*args, **kwargs)

- 

      def _error_template(self, *args, **kwargs):

          output_page = self._template(*args, **kwargs)

          # for some reason cherrypy will choke if the output

file modified
+1
@@ -88,6 +88,7 @@ 

              else:

                  op = getattr(self, 'root', None)

                  if callable(op):

+                     # pylint: disable=not-callable

                      return op(*args, **kwargs).encode('utf-8')

  

          return self.default(*args, **kwargs).encode('utf-8')

file modified
+3 -1
@@ -117,7 +117,9 @@ 

  

  class PluginObject(Log):

  

-     def __init__(self, plugins):

+     def __init__(self, plugins=None):

+         if plugins is None:

+             raise ValueError('Please pass all the pargs on to PluginObject')

          self.name = None

          self._config = None

          self._data = AdminStore()