Skip to content

Commit

Permalink
update snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemia committed Apr 9, 2024
1 parent bfe2b2c commit 97d006a
Show file tree
Hide file tree
Showing 55 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/ffmpeg/dag/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def _repr_png_(self) -> bytes: # pragma: no cover
with open(self.view(format="png"), "rb") as f:
return f.read()

def _repr_svg_(self) -> bytes: # pragma: no cover
with open(self.view(format="svg"), "rb") as f:
return f.read()


@dataclass(frozen=True, kw_only=True)
class Node(HashableBaseModel, ABC):
Expand Down Expand Up @@ -182,3 +186,25 @@ def upstream_nodes(self) -> set[Node]:
output |= input.node.upstream_nodes

return output

def view(self, format: Literal["png", "svg", "dot"] = "png") -> str:
"""
Visualize the Node.
Args:
format: The format of the view.
Returns:
The file path of the visualization.
"""
from ..utils.view import view

Check warning on line 200 in src/ffmpeg/dag/schema.py

View check run for this annotation

Codecov / codecov/patch

src/ffmpeg/dag/schema.py#L200

Added line #L200 was not covered by tests

return view(self, format=format)

Check warning on line 202 in src/ffmpeg/dag/schema.py

View check run for this annotation

Codecov / codecov/patch

src/ffmpeg/dag/schema.py#L202

Added line #L202 was not covered by tests

def _repr_png_(self) -> bytes: # pragma: no cover
with open(self.view(format="png"), "rb") as f:
return f.read()

def _repr_svg_(self) -> bytes: # pragma: no cover
with open(self.view(format="svg"), "rb") as f:
return f.read()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/ffmpeg/dag/tests/__snapshots__/test_schema/test_dag[org].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/ffmpeg/utils/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ def view(node: Node, format: Literal["png", "svg", "dot"]) -> str:

for node in context.all_nodes:
for idx, stream in enumerate(node.inputs):
graph.edge(stream.node.hex, node.hex, label=f"{stream.index or '*'} => {idx}")
graph.edge(stream.node.hex, node.hex, label=f"{'*' if stream.index is None else stream.index} => {idx}")

return graph.render(engine="dot")

0 comments on commit 97d006a

Please sign in to comment.