Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(7)  |  Derive(0)  |  Import(5)
A node tuple for obj.attr

        def Attr(obj, attr):
    """A node tuple for obj.attr"""
    return [obj, Node(syms.trailer, [Dot(), attr])]
        


src/p/y/py3kwarn-HEAD/py3kwarn2to3/fixes/fix_callable.py   py3kwarn(Download)
# Local imports
from py3kwarn2to3 import fixer_base
from py3kwarn2to3.fixer_util import Call, Name, String, Attr, touch_import
 
class FixCallable(fixer_base.BaseFix):
 
        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix)
 

src/p/y/py3kwarn-0.4.4/py3kwarn2to3/fixes/fix_callable.py   py3kwarn(Download)
# Local imports
from py3kwarn2to3 import fixer_base
from py3kwarn2to3.fixer_util import Call, Name, String, Attr, touch_import
 
class FixCallable(fixer_base.BaseFix):
 
        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix)
 

src/p/y/py3kwarn-HEAD/py3kwarn2to3/fixes/fix_exitfunc.py   py3kwarn(Download)
 
from py3kwarn2to3 import pytree, fixer_base
from py3kwarn2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms
 
 
        func.prefix = u""
        register = pytree.Node(syms.power,
                               Attr(Name(u"atexit"), Name(u"register"))
                               )
        call = Call(register, [func], node.prefix)

src/p/y/py3kwarn-0.4.4/py3kwarn2to3/fixes/fix_exitfunc.py   py3kwarn(Download)
 
from py3kwarn2to3 import pytree, fixer_base
from py3kwarn2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms
 
 
        func.prefix = u""
        register = pytree.Node(syms.power,
                               Attr(Name(u"atexit"), Name(u"register"))
                               )
        call = Call(register, [func], node.prefix)

src/p/y/py3kwarn-HEAD/py3kwarn2to3/tests/test_util.py   py3kwarn(Download)
from py3kwarn2to3.pytree import Node, Leaf
from py3kwarn2to3 import fixer_util
from py3kwarn2to3.fixer_util import Attr, Name, Call, Comma
from py3kwarn2to3.pgen2 import token
 
    def test(self):
        call = parse("foo()", strip_levels=2)
 
        self.assertStr(Attr(Name("a"), Name("b")), "a.b")
        self.assertStr(Attr(call, Name("b")), "foo().b")
 
    def test_returns(self):
        attr = Attr(Name("a"), Name("b"))