本文整理汇总了Python中logilab.astng.MANAGER.project_from_files方法的典型用法代码示例。如果您正苦于以下问题:Python MANAGER.project_from_files方法的具体用法?Python MANAGER.project_from_files怎么用?Python MANAGER.project_from_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logilab.astng.MANAGER
的用法示例。
在下文中一共展示了MANAGER.project_from_files方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_functional_relation_extraction
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import project_from_files [as 别名]
def test_functional_relation_extraction(self):
"""functional test of relations extraction;
different classes possibly in different modules"""
# XXX should be catching pyreverse environnement problem but doesn't
# pyreverse doesn't extracts the relations but this test ok
project = MANAGER.project_from_files(["data"], astng_wrapper)
handler = DiadefsHandler(Config())
diadefs = handler.get_diadefs(project, Linker(project, tag=True))
cd = diadefs[1]
relations = _process_relations(cd.relationships)
self.assertEquals(relations, self._should_rels)
示例2: test_known_values2
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import project_from_files [as 别名]
def test_known_values2(self):
project = MANAGER.project_from_files(['data.clientmodule_test'], astng_wrapper)
dd = DefaultDiadefGenerator(Linker(project), HANDLER).visit(project)
self.assertEqual(len(dd), 1)
keys = [d.TYPE for d in dd]
self.assertEqual(keys, ['class'])
cd = dd[0]
self.assertEqual(cd.title, 'classes No Name')
classes = _process_classes(cd.objects)
self.assertEqual(classes, [(True, 'Ancestor'),
(True, 'DoNothing'),
(True, 'Specialization')]
)
示例3: test_known_values2
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import project_from_files [as 别名]
def test_known_values2(self):
project = MANAGER.project_from_files(["data.clientmodule_test"], astng_wrapper)
dd = DefaultDiadefGenerator(Linker(project), HANDLER).visit(project)
self.assertEquals(len(dd), 1)
keys = [d.TYPE for d in dd]
self.assertEquals(keys, ["class"])
cd = dd[0]
self.assertEquals(cd.title, "classes No Name")
classes = _process_classes(cd.objects)
self.assertEquals(
classes,
[
{"node": True, "name": "Ancestor"},
{"node": True, "name": "DoNothing"},
{"node": True, "name": "Specialization"},
],
)
示例4: astng_wrapper
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import project_from_files [as 别名]
import sys
from logilab import astng
from logilab.astng import MANAGER
from logilab.astng.inspector import Linker
from pylint.pyreverse.diadefslib import *
from utils import Config
def astng_wrapper(func, modname):
return func(modname)
PROJECT = MANAGER.project_from_files(["data"], astng_wrapper)
CONFIG = Config()
HANDLER = DiadefsHandler(CONFIG)
def _process_classes(classes):
"""extract class names of a list"""
result = []
for classe in classes:
result.append({"node": isinstance(classe.node, astng.Class), "name": classe.title})
result.sort()
return result
def _process_modules(modules):
示例5: setUp
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import project_from_files [as 别名]
def setUp(self):
self.project = MANAGER.project_from_files(['data2'], astng_wrapper)
self.linker = inspector.Linker(self.project)
self.linker.visit(self.project)