Commits

Christoph Zwerschke committed 5600e6d

Some more PEP8 clean-up.

Comments (0)

Files changed (8)

       packages=find_packages(exclude=['ez_setup']),
       namespace_packages=['tgext'],
       include_package_data=True,
-      package_data = {'':['*.html', '*.js', '*.css', '*.png', '*.gif']},
+      package_data = {'': ['*.html', '*.js', '*.css', '*.png', '*.gif']},
       zip_safe=False,
       install_requires=[
         "TurboGears2 >= 2.1.4",

tgext/__init__.py

 # See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+
 try:
     __import__('pkg_resources').declare_namespace(__name__)
 except ImportError:
     from pkgutil import extend_path
-    __path__ = extend_path(__path__, __name__)
+    __path__ = extend_path(__path__, __name__)

tgext/debugbar/__init__.py

 from initialize import enable_debugbar
 
+
 def plugme(app_config, options):
     enable_debugbar(app_config)

tgext/debugbar/sections/__init__.py

 from logmessages import LoggingDebugSection
 from mingorm import MingDebugSection
 
-__sections__ = [TimingDebugSection(), RequestDebugSection(), SQLADebugSection(),
-                MingDebugSection(), ControllersDebugSection(), LoggingDebugSection()]
+__sections__ = [
+    TimingDebugSection(),
+    RequestDebugSection(),
+    SQLADebugSection(),
+    MingDebugSection(),
+    ControllersDebugSection(),
+    LoggingDebugSection()
+]

tgext/debugbar/sections/base.py

+"""The base debug section class."""
+
+
 class DebugSection(object):
+
     name = "Unnamed"
     is_active = False
-    hooks = dict(startup=[],
-                 shutdown=[],
-                 before_validate=[],
-                 before_call=[],
-                 before_render=[],
-                 after_render=[])
+    hooks = dict(
+        startup=[],
+        shutdown=[],
+        before_validate=[],
+        before_call=[],
+        before_render=[],
+        after_render=[])
 
     def title(self):
         raise NotImplementedError

tgext/debugbar/statics/__init__.py

+# debugbar.statics

tgext/debugbar/templates/__init__.py

 __author__ = 'amol'
-  

tgext/debugbar/utils.py

-import sys, os, tg
+import sys
+import os
+
+from tg import config
 
 try:
     from pygments import highlight
 
     mongo_tokens = {}
     mongo_tokens.update(JavascriptLexer.tokens)
-    mongo_tokens['root'].insert(0, (r'"(function(\\\\|\\"|[^"])*)"', using(InsideStringJavascriptLexer)))
+    mongo_tokens['root'].insert(0, (r'"(function(\\\\|\\"|[^"])*)"',
+        using(InsideStringJavascriptLexer)))
+
     class MongoLexer(JavascriptLexer):
         tokens = mongo_tokens
 
     HAVE_PYGMENTS = True
-except ImportError: # pragma: no cover
+except ImportError:  # pragma: no cover
     HAVE_PYGMENTS = False
 
+
 def get_root_controller():
-    module = tg.config['application_root_module']
-    if not sys.modules.has_key(module):
+    """Return the root controller of the application."""
+    module = config['application_root_module']
+    if module not in sys.modules:
         __import__(module)
     return sys.modules[module].RootController
 
+
 def format_sql(query):
-    if not HAVE_PYGMENTS: # pragma: no cover
+    """Format the given SQL query."""
+    if not HAVE_PYGMENTS:  # pragma: no cover
         return query
 
     return highlight(
         SqlLexer(encoding='utf-8'),
         HtmlFormatter(encoding='utf-8', noclasses=True, style=SQL_STYLE))
 
+
 def format_json(json):
-    if not HAVE_PYGMENTS: # pragma: no cover
+    """Format the given JSON string."""
+    if not HAVE_PYGMENTS:  # pragma: no cover
         return json
 
     return highlight(
         MongoLexer(encoding='utf-8'),
         HtmlFormatter(encoding='utf-8', noclasses=True, style=JSON_STYLE))
 
+
 def common_segment_count(path, value):
     """Return the number of path segments common to both"""
     i = 0
                 return 0
     return i
 
+
 def format_fname(value, _sys_path=None):
+    """Format the given file name."""
     if _sys_path is None:
-        _sys_path = sys.path # dependency injection
-    # If the value is not an absolute path, the it is a builtin or
-    # a relative file (thus a project file).
+        _sys_path = sys.path  # dependency injection
+    # If the value is not an absolute path, the it is a built-in
+    # or a relative file (thus a project file).
     if not os.path.isabs(value):
         if value.startswith(('{', '<')):
             return value