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

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Does the node represent a tuple literal?

        def is_tuple(node):
    """Does the node represent a tuple literal?"""
    if isinstance(node, Node) and node.children == [LParen(), RParen()]:
        return True
    return (isinstance(node, Node)
            and len(node.children) == 3
            and isinstance(node.children[0], Leaf)
            and isinstance(node.children[1], Node)
            and isinstance(node.children[2], Leaf)
            and node.children[0].value == u"("
            and node.children[2].value == u")")

src/p/y/py3kwarn-HEAD/py3kwarn2to3/tests/test_util.py   py3kwarn(Download)
    def is_tuple(self, string):
        return fixer_util.is_tuple(parse(string, strip_levels=2))
    def test_valid(self):
        self.assertTrue(self.is_tuple("(a, b)"))