[PATCH 05 of 12 cubicweb] autopep8 on server/repository.py

Laurent Peuch cortex at worlddomination.be
Tue Jan 7 13:30:40 CET 2020


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1578394015 -3600
#      Tue Jan 07 11:46:55 2020 +0100
# Node ID 20cddc52f552ee1b2e0ac7f86eeb097c86bdbe28
# Parent  b14b764ae605da5aa25f778deb5bf9019368390f
# Available At https://hg.logilab.org/users/lpeuch/cubicweb
#              hg pull https://hg.logilab.org/users/lpeuch/cubicweb -r 20cddc52f552
autopep8 on server/repository.py

diff --git a/cubicweb/server/serverconfig.py b/cubicweb/server/serverconfig.py
--- a/cubicweb/server/serverconfig.py
+++ b/cubicweb/server/serverconfig.py
@@ -29,23 +29,24 @@ from cubicweb.cwconfig import CONFIGURAT
 from cubicweb.server import SOURCE_TYPES
 
 
-USER_OPTIONS =  (
-    ('login', {'type' : 'string',
+USER_OPTIONS = (
+    ('login', {'type': 'string',
                'default': 'admin',
                'help': "cubicweb manager account's login "
                '(this user will be created)',
                'level': 0,
                }),
-    ('password', {'type' : 'password',
+    ('password', {'type': 'password',
                   'default': lgconfig.REQUIRED,
                   'help': "cubicweb manager account's password",
                   'level': 0,
                   }),
-    )
+)
+
 
 class SourceConfiguration(lgconfig.Configuration):
     def __init__(self, appconfig, options):
-        self.appconfig = appconfig # has to be done before super call
+        self.appconfig = appconfig  # has to be done before super call
         super(SourceConfiguration, self).__init__(options=options)
 
     # make Method('default_instance_id') usable in db option defs (in native.py)
@@ -69,13 +70,13 @@ class SourceConfiguration(lgconfig.Confi
         super(SourceConfiguration, self).input_option(option, optdict, inputlevel)
 
 
-
 def ask_source_config(appconfig, type, inputlevel=0):
     options = SOURCE_TYPES[type].options
     sconfig = SourceConfiguration(appconfig, options=options)
     sconfig.input_config(inputlevel=inputlevel)
     return sconfig
 
+
 def generate_source_config(sconfig, encoding=sys.stdin.encoding):
     """serialize a repository source configuration as text"""
     stream = StringIO()
@@ -97,26 +98,26 @@ class ServerConfiguration(CubicWebConfig
     options = lgconfig.merge_options((
         # ctl configuration
         ('host',
-         {'type' : 'string',
+         {'type': 'string',
           'default': None,
           'help': 'host name if not correctly detectable through gethostname',
           'group': 'main', 'level': 1,
           }),
         ('pid-file',
-         {'type' : 'string',
+         {'type': 'string',
           'default': lgconfig.Method('default_pid_file'),
           'help': 'repository\'s pid file',
           'group': 'main', 'level': 2,
           }),
         ('uid',
-         {'type' : 'string',
+         {'type': 'string',
           'default': None,
           'help': 'unix user, if this option is set, use the specified user to start \
 the repository rather than the user running the command',
           'group': 'main', 'level': (CubicWebConfiguration.mode == 'installed') and 0 or 1,
           }),
         ('cleanup-session-time',
-         {'type' : 'time',
+         {'type': 'time',
           'default': '24h',
           'help': 'duration of inactivity after which a session '
           'will be closed, to limit memory consumption (avoid sessions that '
@@ -133,7 +134,7 @@ the repository rather than the user runn
           'group': 'main', 'level': 3,
           }),
         ('connections-pool-size',
-         {'type' : 'int',
+         {'type': 'int',
           'default': 5,
           'help': 'max size of the connections pool. Each source supporting multiple \
 connections will have this maximum number of opened connections.',
@@ -147,24 +148,24 @@ connections will have this minimum numbe
           'group': 'main', 'level': 3,
           }),
         ('rql-cache-size',
-         {'type' : 'int',
+         {'type': 'int',
           'default': 3000,
           'help': 'size of the parsed rql cache size.',
           'group': 'main', 'level': 3,
           }),
         ('undo-enabled',
-         {'type' : 'yn', 'default': False,
+         {'type': 'yn', 'default': False,
           'help': 'enable undo support',
           'group': 'main', 'level': 3,
           }),
         ('keep-transaction-lifetime',
-         {'type' : 'int', 'default': 7,
+         {'type': 'int', 'default': 7,
           'help': 'number of days during which transaction records should be \
 kept (hence undoable).',
           'group': 'main', 'level': 3,
           }),
         ('multi-sources-etypes',
-         {'type' : 'csv', 'default': (),
+         {'type': 'csv', 'default': (),
           'help': 'defines which entity types from this repository are used \
 by some other instances. You should set this properly for these instances to \
 detect updates / deletions.',
@@ -172,7 +173,7 @@ detect updates / deletions.',
           }),
 
         ('delay-full-text-indexation',
-         {'type' : 'yn', 'default': False,
+         {'type': 'yn', 'default': False,
           'help': 'When full text indexation of entity has a too important cost'
           ' to be done when entity are added/modified by users, activate this '
           'option and setup a job using cubicweb-ctl db-rebuild-fti on your '
@@ -182,8 +183,8 @@ detect updates / deletions.',
 
         # email configuration
         ('default-recipients-mode',
-         {'type' : 'choice',
-          'choices' : ('default-dest-addrs', 'users', 'none'),
+         {'type': 'choice',
+          'choices': ('default-dest-addrs', 'users', 'none'),
           'default': 'default-dest-addrs',
           'help': 'when a notification should be sent with no specific rules \
 to find recipients, recipients will be found according to this mode. Available \
@@ -193,7 +194,7 @@ account with an email set), "none" (no n
           'group': 'email', 'level': 2,
           }),
         ('default-dest-addrs',
-         {'type' : 'csv',
+         {'type': 'csv',
           'default': (),
           'help': 'comma separated list of email addresses that will be used \
 as default recipient when an email is sent and the notification has no \
@@ -201,27 +202,27 @@ specific recipient rules.',
           'group': 'email', 'level': 2,
           }),
         ('supervising-addrs',
-         {'type' : 'csv',
+         {'type': 'csv',
           'default': (),
           'help': 'comma separated list of email addresses that will be \
 notified of every changes.',
           'group': 'email', 'level': 2,
           }),
-         ('zmq-address-sub',
-          {'type' : 'csv',
-           'default' : (),
-           'help': ('List of ZMQ addresses to subscribe to (requires pyzmq) '
-                    '(of the form `tcp://<ipaddr>:<port>`)'),
-           'group': 'zmq', 'level': 1,
-           }),
-         ('zmq-address-pub',
-          {'type' : 'string',
-           'default' : None,
-           'help': ('ZMQ address to use for publishing (requires pyzmq) '
-                    '(of the form `tcp://<ipaddr>:<port>`)'),
-           'group': 'zmq', 'level': 1,
-           }),
-        ) + CubicWebConfiguration.options)
+        ('zmq-address-sub',
+         {'type': 'csv',
+          'default': (),
+          'help': ('List of ZMQ addresses to subscribe to (requires pyzmq) '
+                   '(of the form `tcp://<ipaddr>:<port>`)'),
+          'group': 'zmq', 'level': 1,
+          }),
+        ('zmq-address-pub',
+         {'type': 'string',
+          'default': None,
+          'help': ('ZMQ address to use for publishing (requires pyzmq) '
+                   '(of the form `tcp://<ipaddr>:<port>`)'),
+          'group': 'zmq', 'level': 1,
+          }),
+    ) + CubicWebConfiguration.options)
 
     # read the schema from the database
     read_instance_schema = True
@@ -340,6 +341,7 @@ notified of every changes.',
         return schema
 
     sources_mode = None
+
     def set_sources_mode(self, sources):
         self.sources_mode = sources
 



More information about the cubicweb-devel mailing list