cubicweb/pylintext.py
changeset 11220 ffef75b7a26e
parent 11219 0796b6191cea
equal deleted inserted replaced
11219:0796b6191cea 11220:ffef75b7a26e
     3 Done:
     3 Done:
     4 * turn functions decorated by @objectify_predicate into classes
     4 * turn functions decorated by @objectify_predicate into classes
     5 * add yams base types to yams.buildobjs module
     5 * add yams base types to yams.buildobjs module
     6 * add data() function to uiprops module's namespace
     6 * add data() function to uiprops module's namespace
     7 * avoid 'abstract method not implemented' for `cell_call`, `entity_call`, `render_body`
     7 * avoid 'abstract method not implemented' for `cell_call`, `entity_call`, `render_body`
       
     8 * avoid invalid-name on schema relation class names
     8 
     9 
     9 TODO:
    10 TODO:
    10 * avoid invalid class name for predicates and predicates
    11 * avoid invalid class name for predicates and predicates
    11 * W:188, 0: Method '__lt__' is abstract in class 'Entity' but is not overridden (abstract-method)
    12 * W:188, 0: Method '__lt__' is abstract in class 'Entity' but is not overridden (abstract-method)
    12 * generate entity attributes from the schema?
    13 * generate entity attributes from the schema?
    61         fake = AstroidBuilder(MANAGER).string_build('''
    62         fake = AstroidBuilder(MANAGER).string_build('''
    62 def data(string):
    63 def data(string):
    63   return u''
    64   return u''
    64 ''')
    65 ''')
    65         module.locals['data'] = fake.locals['data']
    66         module.locals['data'] = fake.locals['data']
       
    67     # handle lower case with underscores for relation names in schema.py
       
    68     if not module.qname().endswith('.schema'):
       
    69         return
       
    70     schema_locals = module.locals
       
    71     for assnodes in schema_locals.values():
       
    72         for node in assnodes:
       
    73             if not isinstance(node, ClassDef):
       
    74                 continue
       
    75             # XXX can we infer ancestor classes? it would be better to know for sure that
       
    76             # one of the mother classes is yams.buildobjs.RelationDefinition for instance
       
    77             for base in node.basenames:
       
    78                 if base in ('RelationDefinition', 'ComputedRelation', 'RelationType'):
       
    79                     new_name = node.name.replace('_', '').capitalize()
       
    80                     schema_locals[new_name] = schema_locals[node.name]
       
    81                     del schema_locals[node.name]
       
    82                     node.name = new_name
    66 
    83 
    67 
    84 
    68 def cubicweb_abstractmethods_transform(classdef):
    85 def cubicweb_abstractmethods_transform(classdef):
    69     if class_is_abstract(classdef):
    86     if class_is_abstract(classdef):
    70         return
    87         return