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 list literal?

        def is_list(node):
    """Does the node represent a list literal?"""
    return (isinstance(node, Node)
            and len(node.children) > 1
            and isinstance(node.children[0], Leaf)
            and isinstance(node.children[-1], Leaf)
            and node.children[0].value == u"["
            and node.children[-1].value == u"]")
        


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