Пример #1
0
 def _make_dep_triple_dict(self):
     dg = DependencyGraph(self._sentence, self.logger, self._parser_server)
     triples = dg.dep_triples
     dg.print_dep_triples()
     for triple in triples:
         dep = triple[1]
         if dep in self._dependencies.values():
             if dep not in self._dep_triple_dict:
                 self._dep_triple_dict[dep] = []
             self._dep_triple_dict[dep].append({
                 'head': triple[0],
                 'dependent': triple[2]
             })
Пример #2
0
def main():
    args = parser.parse_args()
    dep_graph = DependencyGraph(args.module,
                                db=args.db,
                                server=args.server,
                                user=args.user,
                                password=args.password)
    print dep_graph.hierarchy.show()
Пример #3
0
from dependency_graph import DependencyGraph

dependencyGraph = DependencyGraph()

dependencyGraph.addVertex("A")
dependencyGraph.addVertex("B")
dependencyGraph.addVertex("C")
dependencyGraph.addVertex("D")

print "\n"
print dependencyGraph.es
print dependencyGraph.vs["A"]["depList"]
print dependencyGraph.vs["B"]["depList"]
print dependencyGraph.vs["C"]["depList"]
print dependencyGraph.vs["D"]["depList"]

dependencyGraph.addEdge("B", 2, "A")
dependencyGraph.addEdge("C", 5, "B")
dependencyGraph.addEdge("D", 1, "B")

print "\n"
print dependencyGraph.es
print dependencyGraph.vs["A"]["depList"]
print dependencyGraph.vs["B"]["depList"]
print dependencyGraph.vs["C"]["depList"]
print dependencyGraph.vs["D"]["depList"]

# dependencyGraph.setPrice("C", 2)
# print "-" * 40
# print "(A)", dependencyGraph.vs["A"]["directPrice"], "-", dependencyGraph.vs["A"]["craftPrice"]
# print "(B)", dependencyGraph.vs["B"]["directPrice"], "-", dependencyGraph.vs["B"]["craftPrice"]
Пример #4
0
# configuration
serverName = "garona"

relationsGraph = RelationsGraph()
relationsGraph.importRelations("/ABSOULTE_PATH_TO/data/item-relations.tsv")

# get server auction house summary file
req = requests.get("http://eu.battle.net/api/wow/auction/data/garona")
res = req.json()

# get server auction house items
req = requests.get(res["files"][0]["url"])
res = req.json()

dependencyGraph = DependencyGraph()

auctions = res["auctions"]["auctions"]
total = len(auctions)
count = 0

# loop through auctions and create dependency graph
for auction in auctions:
	count += 1

	if count % 1000 == 0:
		print count, "/", total, "(", (count / (total / 100)), "%)"

	auctionItem = str(auction["item"])
	auctionPrice = auction["buyout"]
	auctionQuant = auction["quantity"]
Пример #5
0
    def create_dependency_graph(self, implementation_dependencies=False):
        """
        Create a DependencyGraph object of the HDL code project
        """

        def add_dependency(start, end):
            """
            Utility to add dependency
            """
            if start.name == end.name:
                return

            is_new = dependency_graph.add_dependency(start, end)

            if is_new:
                LOGGER.debug(
                    "Adding dependency: %s depends on %s", end.name, start.name
                )

        def add_dependencies(dependency_function, files):
            """
            Utility to add all dependencies returned by a dependency_function
            returning an iterator of dependencies
            """
            for source_file in files:
                for dependency in dependency_function(source_file):
                    add_dependency(dependency, source_file)

        dependency_graph = DependencyGraph()
        for source_file in self._source_files_in_order:
            dependency_graph.add_node(source_file)

        vhdl_files = [
            source_file
            for source_file in self._source_files_in_order
            if source_file.file_type == "vhdl"
        ]

        depend_on_package_bodies = (
            self._depend_on_package_body or implementation_dependencies
        )
        add_dependencies(
            lambda source_file: self._find_other_vhdl_design_unit_dependencies(
                source_file, depend_on_package_bodies, implementation_dependencies
            ),
            vhdl_files,
        )
        add_dependencies(
            self._find_primary_secondary_design_unit_dependencies, vhdl_files
        )

        verilog_files = [
            source_file
            for source_file in self._source_files_in_order
            if source_file.file_type in VERILOG_FILE_TYPES
        ]

        add_dependencies(self._find_verilog_package_dependencies, verilog_files)
        add_dependencies(self._find_verilog_module_dependencies, verilog_files)

        if implementation_dependencies:
            add_dependencies(self._find_component_design_unit_dependencies, vhdl_files)

        for source_file, depends_on in self._manual_dependencies:
            add_dependency(depends_on, source_file)

        return dependency_graph