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

All Samples(15)  |  Call(15)  |  Derive(0)  |  Import(0)
build astroid from a source code file (i.e. from an ast)

path is expected to be a python source file

src/a/s/astroid-1.1.1/test/unittest_lookup.py   astroid(Download)
builder = builder.AstroidBuilder()
DATA = join(dirname(abspath(__file__)), 'data')
MODULE = builder.file_build(join(DATA, 'module.py'), 'data.module')
MODULE2 = builder.file_build(join(DATA, 'module2.py'), 'data.module2')
NONREGR = builder.file_build(join(DATA, 'nonregr.py'), 'data.nonregr')

src/a/s/astroid-1.1.1/test/unittest_scoped_nodes.py   astroid(Download)
DATA = join(dirname(abspath(__file__)), 'data')
REGRTEST_DATA = join(dirname(abspath(__file__)), 'regrtest_data')
MODULE = abuilder.file_build(join(DATA, 'module.py'), 'data.module')
MODULE2 = abuilder.file_build(join(DATA, 'module2.py'), 'data.module2')
NONREGR = abuilder.file_build(join(DATA, 'nonregr.py'), 'data.nonregr')
 
PACK = abuilder.file_build(join(DATA, '__init__.py'), 'data')
        # resolve packageredirection
        sys.path.insert(1, DATA)
        mod = abuilder.file_build(join(DATA, 'appl/myConnection.py'),
                                  'appl.myConnection')
        try:

src/a/s/astroid-1.1.1/test/unittest_inference.py   astroid(Download)
    def test_python25_no_relative_import(self):
        fname = join(abspath(dirname(__file__)), 'regrtest_data', 'package', 'absimport.py')
        astroid = builder.file_build(fname, 'absimport')
        self.assertTrue(astroid.absolute_import_activated(), True)
        infered = get_name_node(astroid, 'import_package_subpackage_module').infer().next()
    def test_nonregr_absolute_import(self):
        fname = join(abspath(dirname(__file__)), 'regrtest_data', 'absimp', 'string.py')
        astroid = builder.file_build(fname, 'absimp.string')
        self.assertTrue(astroid.absolute_import_activated(), True)
        infered = get_name_node(astroid, 'string').infer().next()

src/a/s/astroid-1.1.1/test/unittest_nodes.py   astroid(Download)
 
MODULE = abuilder.module_build(test_module)
MODULE2 = abuilder.file_build(join(DATA, 'module2.py'), 'data.module2')
 
 
    def test_absolute_import(self):
        astroid = abuilder.file_build(self.datapath('absimport.py'))
        ctx = InferenceContext()
        ctx.lookupname = 'message'
        # will fail if absolute import failed