On Wednesday, December 13, 2017 at 7:44:57 AM UTC-6, vitalije wrote:

Here is my attempt to show in code what I couldn't explain with the words. 
>
... 

> current version successfully adds entries to map of known_classes. In 
> particular it adds injected theTagController to the Command class ivars.
>
> Value that my code adds for each of those entries is AST node, containing 
> all relevant information. It can be examined further when resolving. 
>

Many thanks for this excellent work.  The code snippets are great tools. 
I'll use something like this as the basis of the production version.

It may take awhile for me to adjust to this way of thinking, but it is 
obviously better than my previous ast code.

Edward

P.S. A nit.  I dislike "ok and" pattern.  For example, I would rewrite 
is_assign_to this way:

def is_assign_to(node, _id):
    '''
    returns True if this node is assignment to some attribute of variable 
named _id.
    
    Something like: `_id.<some ivar> = ...`
    '''
    if isinstance(node, ast.Assign) and len(node.targets) == 1:
        arg = node.targets[0]
        return (
            isinstance(arg, ast.Attribute) and
            isinstance(arg.value, ast.Name) and
            arg.value.id == _id
        )
    else:
        return False

And I also prefer docstrings to comments ;-)

P.P.S. The new ProjectUtils. leo_core_files method is preferable to the 
leoFiles list.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to