#271 Format code according to PEP8.
Merged 4 years ago by apollo13. Opened 4 years ago by apollo13.
apollo13/ipsilon flake8  into  master

@@ -2,7 +2,6 @@ 

  

  from __future__ import absolute_import

  

- from ipsilon.providers.common import FACILITY

  from ipsilon.util.plugin import PluginLoader

  from ipsilon.util.log import Log

  

@@ -282,6 +282,7 @@ 

              self.debug('session %d: %s' % (count, samlsession.convert()))

              count += 1

  

+ 

  if __name__ == '__main__':

      provider1 = "http://127.0.0.10/saml2"

      provider2 = "http://127.0.0.11/saml2"

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

      f.close()

      print string

  

+ 

  cherrypy.tools.log_request_response = cherrypy.Tool('on_end_resource',

                                                      log_request_response)

  

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

  

          return allowed

  

+ 

  # Unit tests

  if __name__ == '__main__':

  

file modified
+10 -8
@@ -19,8 +19,8 @@ 

  

  

  def parse_args():

-     parser = argparse.ArgumentParser(description=\

-         'Run a test Ipsilon instance from the checkout directory')

+     parser = argparse.ArgumentParser(description='Run a test Ipsilon instance '

+                                                  'from the checkout directory')

      parser.add_argument('--workdir', default=os.path.join(os.getcwd(), 'qrun'),

                          help="Directory in which db/session files are stored")

      parser.add_argument('--cleanup', '-c', action='store_true', default=False,
@@ -28,9 +28,9 @@ 

      return vars(parser.parse_args())

  

  

- CONF_TEMPLATE="templates/install/ipsilon.conf"

+ CONF_TEMPLATE = "templates/install/ipsilon.conf"

  

- ADMIN_TEMPLATE='''

+ ADMIN_TEMPLATE = '''

  CREATE TABLE login_config (name TEXT,option TEXT,value TEXT);

  INSERT INTO login_config VALUES('global', 'enabled', 'testauth');

  CREATE TABLE provider_config (name TEXT,option TEXT,value TEXT);
@@ -45,12 +45,13 @@ 

  INSERT INTO authz_config VALUES('global', 'enabled', 'allow');

  '''

  

- USERS_TEMPLATE='''

+ USERS_TEMPLATE = '''

  CREATE TABLE users(name TEXT, option TEXT, value TEXT);

  INSERT INTO users VALUES('admin', 'is_admin', '1');

  CREATE TABLE user_consent(name TEXT, option TEXT, value TEXT);

  '''

  

+ 

  def config(workdir):

      os.makedirs(workdir)

      os.makedirs(os.path.join(workdir, 'sessions'))
@@ -94,7 +95,7 @@ 

                           'secure': 'False',

                           'cleanup_interval': 1,

                           'session_timeout': 30,

-                         })

+                          })

      conf = os.path.join(workdir, 'ipsilon.conf')

      with open(conf, 'w+') as f:

          f.write(text)
@@ -118,7 +119,7 @@ 

      rsasig = JWK(generate='RSA', size=2048, use='sig', kid='quickstart')

      keyset.add(rsasig)

      with open(keyfile, 'w') as m:

- 	m.write(keyset.export())

+         m.write(keyset.export())

  

  

  if __name__ == '__main__':
@@ -129,7 +130,8 @@ 

      penv.update(os.environ)

      penv['PYTHONPATH'] = os.getcwd()

  

-     schema_init = os.path.join(os.getcwd(), 'ipsilon/install/ipsilon-upgrade-database')

+     schema_init = os.path.join(os.getcwd(),

+                                'ipsilon/install/ipsilon-upgrade-database')

      exe = os.path.join(os.getcwd(), 'ipsilon/ipsilon')

  

      if args['cleanup']:

file modified
+52 -53
@@ -8,58 +8,57 @@ 

  DATA = 'share/ipsilon/'

  

  setup(

-     name = 'ipsilon',

-     version = '2.0.2',

-     license = 'GPLv3+',

-     maintainer = 'Ipsilon project Contributors',

-     maintainer_email = 'ipsilon@lists.fedorahosted.org',

+     name='ipsilon',

+     version='2.0.2',

+     license='GPLv3+',

+     maintainer='Ipsilon project Contributors',

+     maintainer_email='ipsilon@lists.fedorahosted.org',

      url='https://fedorahosted.org/ipsilon/',

-     packages = ['ipsilon', 'ipsilon.admin', 'ipsilon.rest',

-                 'ipsilon.login', 'ipsilon.info', 'ipsilon.util',

-                 'ipsilon.providers', 'ipsilon.providers.saml2',

-                 'ipsilon.providers.openid',

-                 'ipsilon.providers.openid.extensions',

-                 'ipsilon.providers.openidc',

-                 'ipsilon.providers.openidc.plugins',

-                 'ipsilon.providers.persona',

-                 'ipsilon.authz', 'ipsilon.user',

-                 'ipsilon.tools', 'ipsilon.helpers',

-                 'tests', 'tests.helpers'],

-     data_files = [('share/man/man7', ['man/ipsilon.7']),

-                   ('share/man/man5', ['man/ipsilon.conf.5']),

-                   ('share/man/man1', ['man/ipsilon-client-install.1',

-                                       'man/ipsilon-server-install.1']),

-                   ('share/doc/ipsilon', ['COPYING', 'README.md']),

-                   ('share/doc/ipsilon/examples', ['examples/ipsilon.conf',

-                                                   'examples/apache.conf']),

-                   (DATA+'ui/css', glob('ui/css/*.css')),

-                   (DATA+'ui/img', glob('ui/img/*')),

-                   (DATA+'ui/js', glob('ui/js/*.js')),

-                   (DATA+'ui/fonts-local', glob('ui/fonts-local/*')),

-                   (DATA+'ui/saml2sp', glob('ui/saml2sp/*.html')),

-                   (DATA+'templates', glob('templates/*.html')),

-                   (DATA+'templates/user', glob('templates/user/*.html')),

-                   (DATA+'templates/admin', glob('templates/admin/*.html')),

-                   (DATA+'templates/admin', glob('templates/admin/*.svg')),

-                   (DATA+'templates/login', glob('templates/login/*.html')),

-                   (DATA+'templates/saml2', glob('templates/saml2/*.html')),

-                   (DATA+'templates/openid', glob('templates/openid/*')),

-                   (DATA+'templates/openidc', glob('templates/openidc/*')),

-                   (DATA+'templates/persona', glob('templates/persona/*.html')),

-                   (DATA+'templates/install', glob('templates/install/*.conf')),

-                   (DATA+'templates/install/openidc',

-                    glob('templates/install/openidc/*.conf')),

-                   (DATA+'templates/install/pam',

-                    glob('templates/install/pam/*.pamd')),

-                   (DATA+'templates/install/saml2',

-                    glob('templates/install/saml2/*.conf')),

-                   (DATA+'templates/admin/providers',

-                    glob('templates/admin/providers/*.html')),

-                  ],

-     scripts = ['ipsilon/ipsilon',

-                'ipsilon/install/ipsilon-db2conf',

-                'ipsilon/install/ipsilon-upgrade-database',

-                'ipsilon/install/ipsilon-server-install',

-                'ipsilon/install/ipsilon-client-install']

+     packages=['ipsilon', 'ipsilon.admin', 'ipsilon.rest',

+               'ipsilon.login', 'ipsilon.info', 'ipsilon.util',

+               'ipsilon.providers', 'ipsilon.providers.saml2',

+               'ipsilon.providers.openid',

+               'ipsilon.providers.openid.extensions',

+               'ipsilon.providers.openidc',

+               'ipsilon.providers.openidc.plugins',

+               'ipsilon.providers.persona',

+               'ipsilon.authz', 'ipsilon.user',

+               'ipsilon.tools', 'ipsilon.helpers',

+               'tests', 'tests.helpers'],

+     data_files=[('share/man/man7', ['man/ipsilon.7']),

+                 ('share/man/man5', ['man/ipsilon.conf.5']),

+                 ('share/man/man1', ['man/ipsilon-client-install.1',

+                                     'man/ipsilon-server-install.1']),

+                 ('share/doc/ipsilon', ['COPYING', 'README.md']),

+                 ('share/doc/ipsilon/examples', ['examples/ipsilon.conf',

+                                                 'examples/apache.conf']),

+                 (DATA+'ui/css', glob('ui/css/*.css')),

+                 (DATA+'ui/img', glob('ui/img/*')),

+                 (DATA+'ui/js', glob('ui/js/*.js')),

+                 (DATA+'ui/fonts-local', glob('ui/fonts-local/*')),

+                 (DATA+'ui/saml2sp', glob('ui/saml2sp/*.html')),

+                 (DATA+'templates', glob('templates/*.html')),

+                 (DATA+'templates/user', glob('templates/user/*.html')),

+                 (DATA+'templates/admin', glob('templates/admin/*.html')),

+                 (DATA+'templates/admin', glob('templates/admin/*.svg')),

+                 (DATA+'templates/login', glob('templates/login/*.html')),

+                 (DATA+'templates/saml2', glob('templates/saml2/*.html')),

+                 (DATA+'templates/openid', glob('templates/openid/*')),

+                 (DATA+'templates/openidc', glob('templates/openidc/*')),

+                 (DATA+'templates/persona', glob('templates/persona/*.html')),

+                 (DATA+'templates/install', glob('templates/install/*.conf')),

+                 (DATA+'templates/install/openidc',

+                  glob('templates/install/openidc/*.conf')),

+                 (DATA+'templates/install/pam',

+                  glob('templates/install/pam/*.pamd')),

+                 (DATA+'templates/install/saml2',

+                  glob('templates/install/saml2/*.conf')),

+                 (DATA+'templates/admin/providers',

+                  glob('templates/admin/providers/*.html')),

+                 ],

+     scripts=['ipsilon/ipsilon',

+              'ipsilon/install/ipsilon-db2conf',

+              'ipsilon/install/ipsilon-upgrade-database',

+              'ipsilon/install/ipsilon-server-install',

+              'ipsilon/install/ipsilon-client-install']

  )

- 

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

          print "Starting second SP's httpd server"

          self.start_http_server(conf, env)

  

+ 

  if __name__ == '__main__':

  

      idpname = 'idp1'