def __init__(self, resource_resolver=None, file_length_calculator=None, *args, **kwargs): ModuleListSupply.__init__(self, *args, **kwargs) self.__module_size_map = dict() self.__logger = logging.getLogger(self.__class__.__module__) # self.__min_module_size = None # self.__max_module_size = None if resource_resolver: self.__resource_resolver = resource_resolver else: warnings.warn( "Parameter resource_resolver should be set in BaseModuleListSupply constructor", DeprecationWarning) self.__resource_resolver = config_basic( ).get_local_source_resolver() if file_length_calculator: assert isinstance(file_length_calculator, AbsoluteFileMetricProcessor) self.__metric = file_length_calculator else: warnings.warn( "Parameter file_length_calculator should be set in BaseModuleListSupply constructor", DeprecationWarning) self.__metric = PlainLinesOfCodeMetric()
def __init__(self, module_list_supply=ModuleListSupply()): # TODO actually, this does not require an arbitrary ModuleListSupply, but a VCXProjModuleListSupply, but # currently the autowire mechanism does not support analyzing the type hierarchy! self.__logger = logging.getLogger(self.__class__.__module__) self.__dependencies = dict() self.__modules = dict() self.__analysis_base_dirs = config_basic.get_local_source_base_dir_subset( ) self.__project_dir_resolver = config_basic.get_local_source_resolver() self.__module_checker_parameter = dict() self.__vcxproj_checker_class = None if not hasattr(module_list_supply, "get_module_spec_files") or not hasattr(module_list_supply, "get_source_files") \ or not hasattr(module_list_supply, "set_results") or not hasattr(module_list_supply, "set_checked_rules"): raise TypeError("VCXProjReferenceDependencyParser requires a %s" % (VCXProjModuleListSupply, )) self.__module_list_supply = module_list_supply
self.write_attributes(self.node_attributes(k, self.__types.get(k))) self.file().write(';\n') def _output_head(self): logging.info("_output_head, %i nodes, %i edges" % (len(tuple(self._graph().node_names())), len(tuple(self._graph().edges())))) self.file().write('digraph G {\n') #f.write('concentrate = true;\n') #f.write('ordering = out;\n') self.file().write('ranksep=1.0;\n') self.file().write('node [style=filled,fontname=Calibri,fontsize=24];\n') def _output_tail(self): self.file().write('}\n') config_module_grouper = ModuleGrouper config_module_list = ModuleListSupply() class PydepRunner(object): def run(self, paths, dep_filter=None): if dep_filter is None: dep_filter = DefaultDependencyFilter(config=NullDependencyFilterConfiguration(), module_list=config_module_list.get_module_list()) processor = PydepProcessor() processor.process(paths) processor.output(dep_filter) PydepGraphOutputter(colored=True, types=processor.types(), output_groups=True, graph=dep_filter.graph(), outfile=sys.stdout).output_all() if __name__ == '__main__':
def skip_module_as_target(self, target): return False def skip_edge(self, source, target): if self.__focus_on: group_skip = self.get_module_grouper().get_node_group_prefix(source) not in self.__focus_on \ and self.get_module_grouper().get_node_group_prefix(target) not in self.__focus_on else: group_skip = False return group_skip def get_edge_color(self, source, target): #if self.__ return Colors.BLACK config_module_list_supply = ModuleListSupply() class EPMDependencyFilterConfiguration(EPMDependencyFilterConfigurationInternal): def __init__(self, focus_on=None, module_grouper_class=None, physical_module_describer=None, modules=None, *args, **kwargs): if module_grouper_class==None: module_grouper_class = config_module_grouper if physical_module_describer==None: physical_module_describer = config_physical_module_describer if modules==None: modules = config_module_list_supply.get_module_list() EPMDependencyFilterConfigurationInternal.__init__(self, focus_on=focus_on, modules=modules, module_grouper_class=module_grouper_class, physical_module_describer=physical_module_describer, *args, **kwargs)