浏览代码

Fixes flake8 warnings.

Adrien Panay 7 年前
父节点
当前提交
d39427da65
共有 1 个文件被更改,包括 13 次插入17 次删除
  1. 13 17
      tracim/tracim/config/app_cfg.py

+ 13 - 17
tracim/tracim/config/app_cfg.py 查看文件

17
 from urllib.parse import urlparse
17
 from urllib.parse import urlparse
18
 
18
 
19
 from depot.manager import DepotManager
19
 from depot.manager import DepotManager
20
-import tg
21
 from paste.deploy.converters import asbool
20
 from paste.deploy.converters import asbool
21
+import tg
22
 from tg.configuration.milestones import environment_loaded
22
 from tg.configuration.milestones import environment_loaded
23
-
24
 from tgext.pluggable import plug
23
 from tgext.pluggable import plug
25
 from tgext.pluggable import replace_template
24
 from tgext.pluggable import replace_template
26
-from tracim.lib.system import InterruptManager
27
-
28
-from tracim.lib.utils import lazy_ugettext as l_
29
 
25
 
30
 import tracim
26
 import tracim
31
 from tracim.config import TracimAppConfig
27
 from tracim.config import TracimAppConfig
34
 from tracim.lib.daemons import MailSenderDaemon
30
 from tracim.lib.daemons import MailSenderDaemon
35
 from tracim.lib.daemons import RadicaleDaemon
31
 from tracim.lib.daemons import RadicaleDaemon
36
 from tracim.lib.daemons import WsgiDavDaemon
32
 from tracim.lib.daemons import WsgiDavDaemon
33
+from tracim.lib.system import InterruptManager
34
+from tracim.lib.utils import lazy_ugettext as l_
37
 from tracim.model.data import ActionDescription
35
 from tracim.model.data import ActionDescription
38
 from tracim.model.data import ContentType
36
 from tracim.model.data import ContentType
39
 
37
 
116
 
114
 
117
 
115
 
118
 def start_daemons(manager: DaemonsManager):
116
 def start_daemons(manager: DaemonsManager):
119
-    """
120
-    Sart Tracim daemons
121
-    """
117
+    """Start Tracim daemons."""
122
     from tg import config
118
     from tg import config
123
     cfg = CFG.get_instance()
119
     cfg = CFG.get_instance()
124
     # Don't start daemons if they are disabled
120
     # Don't start daemons if they are disabled
133
 
129
 
134
 
130
 
135
 def configure_depot():
131
 def configure_depot():
136
-    """
137
-    Configure Depot
138
-    """
132
+    """Configure Depot."""
139
     depot_storage_name = 'default'
133
     depot_storage_name = 'default'
140
     depot_storage_path = CFG.get_instance().DEPOT_STORAGE_PATH
134
     depot_storage_path = CFG.get_instance().DEPOT_STORAGE_PATH
141
     depot_storage_settings = {'depot.storage_path': depot_storage_path}
135
     depot_storage_settings = {'depot.storage_path': depot_storage_path}
200
 
194
 
201
 
195
 
202
 class CFG(object):
196
 class CFG(object):
203
-    """
204
-    Singleton used for easy access to config file parameters
205
-    """
197
+    """Singleton used for easy access to config file parameters."""
206
 
198
 
207
     _instance = None
199
     _instance = None
208
 
200
 
209
     @classmethod
201
     @classmethod
210
     def get_instance(cls) -> 'CFG':
202
     def get_instance(cls) -> 'CFG':
203
+        """Get configuration singleton."""
211
         if not CFG._instance:
204
         if not CFG._instance:
212
             CFG._instance = CFG()
205
             CFG._instance = CFG()
213
         return CFG._instance
206
         return CFG._instance
214
 
207
 
215
     def __setattr__(self, key, value):
208
     def __setattr__(self, key, value):
216
         """
209
         """
217
-        Log-ready setter. this is used for logging configuration (every
218
-        parameter except password)
210
+        Log-ready setter.
211
+
212
+        This is used for logging configuration (every parameter except
213
+        password)
219
         :param key:
214
         :param key:
220
         :param value:
215
         :param value:
221
         :return:
216
         :return:
235
         self.__dict__[key] = value
230
         self.__dict__[key] = value
236
 
231
 
237
     def __init__(self):
232
     def __init__(self):
238
-
233
+        """Parse configuration file."""
239
         self.DEPOT_STORAGE_PATH = tg.config.get('depot_storage_path')
234
         self.DEPOT_STORAGE_PATH = tg.config.get('depot_storage_path')
240
         self.PREVIEW_CACHE = tg.config.get('preview_cache_dir')
235
         self.PREVIEW_CACHE = tg.config.get('preview_cache_dir')
241
 
236
 
457
         ))
452
         ))
458
 
453
 
459
     def get_tracker_js_content(self, js_tracker_file_path=None):
454
     def get_tracker_js_content(self, js_tracker_file_path=None):
455
+        """Get frontend analytics file."""
460
         result = ''
456
         result = ''
461
         js_tracker_file_path = tg.config.get('js_tracker_path', None)
457
         js_tracker_file_path = tg.config.get('js_tracker_path', None)
462
         if js_tracker_file_path:
458
         if js_tracker_file_path: