Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
erivlis committed Jan 28, 2025

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent ab2bdad commit c7b6513
Showing 10 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/code/python_ast.py
Original file line number Diff line number Diff line change
@@ -101,5 +101,5 @@ def ast_edge(**kwargs):
graphinate.materialize(
ast_model,
builder=graphinate.builders.GraphQLBuilder,
actualizer=graphinate.graphql
builder_output_handler=graphinate.graphql
)
4 changes: 1 addition & 3 deletions examples/code/python_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pipdeptree._cli import get_options
from pipdeptree._discovery import get_installed_distributions
from pipdeptree._models import PackageDAG
from pipdeptree._non_host import handle_non_host_target

import graphinate

@@ -15,7 +14,6 @@ def dependency_graph_model():
"""

options = get_options(args=None)
handle_non_host_target(options)

pkgs = get_installed_distributions(local_only=options.local_only, user_only=options.user_only)
tree = PackageDAG.from_pkgs(pkgs)
@@ -36,5 +34,5 @@ def dependency():
graphinate.materialize(
dependency_model,
builder=graphinate.builders.GraphQLBuilder,
actualizer=graphinate.graphql
builder_output_handler=graphinate.graphql
)
4 changes: 4 additions & 0 deletions examples/github/followers.py
Original file line number Diff line number Diff line change
@@ -50,9 +50,13 @@ def followed_by(user_id: Optional[str] = None, **kwargs):
# 'user_id' "strawberry-graphql"
}

builder, handler = graphinate.materializers.Materializers.GraphQL.value

graphinate.materialize(
model=followers_model,
graph_type=graphinate.GraphType.DiGraph,
builder=graphinate.builders.GraphQLBuilder,
builder_output_handler=graphinate.graphql,
default_node_attributes={'type': 'user'},
**params
)
3 changes: 2 additions & 1 deletion examples/github/repositories.py
Original file line number Diff line number Diff line change
@@ -122,4 +122,5 @@ def file(user_id: Optional[str] = None,
# 'user_id' "strawberry-graphql"
}

graphinate.materialize(repo_model, **params)
builder, handler = graphinate.materializers.Materializers.GraphQL.value
graphinate.materialize(repo_model, builder=builder, builder_output_handler=handler, **params)
1 change: 0 additions & 1 deletion examples/math/graph_atlas.py
Original file line number Diff line number Diff line change
@@ -49,5 +49,4 @@ def edge():
options={m.name: m.value for m in Materializers},
default=(None, None))
builder, handler = result[1]

graphinate.materialize(model, builder=builder, builder_output_handler=handler)
2 changes: 1 addition & 1 deletion examples/system/processes.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ def edge():
graphinate.materialize(
model,
builder=graphinate.builders.GraphQLBuilder,
actualizer=graphinate.graphql
builder_output_handler=graphinate.graphql
)

else:
2 changes: 2 additions & 0 deletions examples/web/page_links.py
Original file line number Diff line number Diff line change
@@ -62,5 +62,7 @@ def link(url, **kwargs):
model=model,
graph_type=graphinate.GraphType.DiGraph,
default_node_attributes={'type': 'url'},
builder=graphinate.builders.NetworkxBuilder,
builder_output_handler=graphinate.materializers.matplotlib.plot,
**params
)
4 changes: 2 additions & 2 deletions src/graphinate/cli.py
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ def save(ctx, model):
with open(f"{model.name}.json", mode='w') as fp:
materialize(model=model,
builder=builders.D3Builder,
actualizer=functools.partial(json.dump, fp=fp, default=str),
builder_output_handler=functools.partial(json.dump, fp=fp, default=str),
**_get_kwargs(ctx))


@@ -102,5 +102,5 @@ def server(ctx, model, port):
click.echo(message)
materialize(model=model,
builder=builders.GraphQLBuilder,
actualizer=functools.partial(graphql, port=port),
builder_output_handler=functools.partial(graphql, port=port),
**_get_kwargs(ctx))
2 changes: 1 addition & 1 deletion src/graphinate/materializers/__init__.py
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ def materialize(model: modeling.GraphModel,
None
"""
if builder is None and builder_output_handler is None:
raise ValueError("Missing: builder, actualizer")
raise ValueError("Missing: builder, builder_output_handler")

if builder:
graph = builders.build(builder,
2 changes: 1 addition & 1 deletion tests/graphinate/test_materializers.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ def test_materialize_d3graph(map_graph_model, monkeypatch, capsys):

# Assert
assert expected_snippet in captured.out
assert captured.err
assert captured.err == ""


def valid_materialization(*args, **kwargs) -> bool:

0 comments on commit c7b6513

Please sign in to comment.