Commits

Stephen Sugden committed 4f2e8eb

[coffeedomain] - pylint

Comments (0)

Files changed (2)

coffeedomain/sphinxcontrib/coffeedomain/documenters.py

 import os.path
 import json
 import re
- 
+
 from .domain import MOD_SEP
 
+
 class StubObject(object):
     """
     A python object that takes the place of the coffeescript object being
     def __repr__(self):
         return "<StubObject for %s %s>" % (self.type, self['name'])
 
+
 class CoffeedocDocumenter(Documenter):
     """
     Base class for documenters that use the output of ``coffeedoc``
         self.args = None
         self.retann = None
         return True
-            
+
     def format_name(self):
         return self.modname + MOD_SEP + '.'.join(self.objpath)
 
 
     @property
     def coffeedoc_module(self):
-        filename= self.modname + '.coffee'
+        filename = self.modname + '.coffee'
         return self._load_module(filename)
 
     def _load_module(self, filename):
         if filename in modules:
             return modules[filename]
         basedir = self.env.config.coffee_src_dir
-        parser  = self.env.config.coffee_src_parser or 'commonjs'
+        parser = self.env.config.coffee_src_parser or 'commonjs'
 
         gencmd = ['coffeedoc', '--stdout', '--renderer', 'json', '--parser',
                   parser, filename]
-        docgen = Popen(gencmd, cwd=basedir, stdout=PIPE, shell=True)
+        docgen = Popen(gencmd, cwd=basedir, stdout=PIPE)
         (stdout, stderr) = docgen.communicate()
         data = json.loads(stdout)[0]
-        data['path'] = data['path'].replace(basedir+'/', '')
+        data['path'] = data['path'].replace(basedir + '/', '')
         data['name'] = data['path'].replace('.coffee', MOD_SEP)
         modules[filename] = StubObject('module', data)
         return modules[filename]
     def import_object(self):
         raise NotImplemented("")
 
+
 class ModuleDocumenter(CoffeedocDocumenter, PyModuleDocumenter):
     objtype = 'module'
 
     documents_type = 'module'
     sub_member_keys = ('classes', 'functions')
 
-    option_spec =  {
-        'show-dependencies': bool_option
+    option_spec = {
+        'show-dependencies': bool_option,
+        'members': members_option
     }
 
     def import_object(self):
                 self.add_line('  * ``%s = require "%s"``' % (localname, module),
                               '<autodoc>')
 
+
 class SubMember(object):
     option_spec = {
         'members': members_option
                 return True
         return False
 
+
 class ModuleMember(SubMember):
     def find_parent_object(self):
         return self.coffeedoc_module
 
+
 class ClassMember(SubMember):
     def find_parent_object(self):
         module = self.coffeedoc_module
             if cpath == self.objpath[:len(cpath)]:
                 return data
 
+
 class ClassDocumenter(ModuleMember, CoffeedocDocumenter):
     objtype = 'class'
     documents_type = 'classes'
     def format_signature(self):
         return '(%s)' % ', '.join(self.object['params'])
 
+
 class FunctionDocumenter(ModuleMember, CodeDocumenter):
     objtype = 'function'
     documents_type = 'functions'
 
+
 class MethodDocumenter(ClassMember, CodeDocumenter):
     objtype = 'method'
     documents_type = 'instancemethods'
         if isinstance(member, StubObject) and member.type == cls.documents_type:
             return True
 
+
 class StaticMethodDocumenter(ClassMember, CodeDocumenter):
     objtype = 'staticmethod'
     documents_type = 'staticmethods'

coffeedomain/sphinxcontrib/coffeedomain/domain.py

 from sphinx.domains import Domain, ObjType
 from sphinx.domains.python import _pseudo_parse_arglist
 from sphinx.locale import l_, _
-from sphinx.util.docfields import TypedField, GroupedField
+from sphinx.util.docfields import GroupedField
 from sphinx.util.nodes import make_refnode
 
 MOD_SEP = '::'
 
+
 class CoffeeObj(ObjectDescription):
     doc_field_types = [
         GroupedField('parameter', label='Parameters',
         if self.display_prefix:
             signode += addnodes.desc_annotation(self.display_prefix, self.display_prefix)
 
-        fullname, _, args = sig.partition('(')
+        fullname, paren, args = sig.partition('(')
         modname, name = fullname.split(MOD_SEP)
         classname = self.env.temp_data.get('autodoc:class')
         if classname and name.startswith(classname):
         return fullname
 
     def add_target_and_index(self, fqn, sig, signode):
-        doc = self.state.document
+        #doc = self.state.document
         if fqn not in self.state.document.ids:
             signode['names'].append(fqn)
             signode['ids'].append(fqn)
                                          'module-' + modname, '')])
         return [targetnode, inode]
 
+
 class CoffeeClass(CoffeeObj):
     option_spec = {
         'module': directives.unchanged,
 
         return fullname
 
+
 class CoffeeFunction(CoffeeObj):
     option_spec = {
         'module': directives.unchanged,
 
     display_prefix = 'static method '
 
+
 class CoffeeXRefRole(XRefRole):
     def process_link(self, env, refnode, has_explicit_title, title, target):
         """ Called after CoffeeDomain.resolve_xref """
     }
 
     roles = {
-       'mod': CoffeeXRefRole(),
-       'meth': CoffeeXRefRole(),
-       'class': CoffeeXRefRole(),
-       'func': CoffeeXRefRole(),
+        'mod': CoffeeXRefRole(),
+        'meth': CoffeeXRefRole(),
+        'class': CoffeeXRefRole(),
+        'func': CoffeeXRefRole(),
     }
 
     data_version = 1