Skip to content

Commit fb1ac5f

Browse files
committed
Python lints.
1 parent cc293e9 commit fb1ac5f

File tree

10 files changed

+427
-335
lines changed

10 files changed

+427
-335
lines changed

hugr-py/src/hugr/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
representation.
33
"""
44

5+
from . import model
56
from .hugr.base import Hugr
67
from .hugr.node_port import Direction, InPort, Node, OutPort, Wire
7-
from . import model
88

99
__all__ = [
1010
"Hugr",

hugr-py/src/hugr/_hugr/__init__.pyi

+14-54
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,16 @@
11
import hugr.model
22

3-
def term_to_string(term: "hugr.model.Term") -> str:
4-
"""Convert a term into a string in the hugr text syntax."""
5-
...
6-
7-
def string_to_term(string: str) -> "hugr.model.Term":
8-
"""Parse a term from a string in the hugr text syntax."""
9-
10-
def node_to_string(node: "hugr.model.Node") -> str:
11-
"""Convert a node into a string in the hugr text syntax."""
12-
...
13-
14-
def string_to_node(string: str) -> "hugr.model.Node":
15-
"""Parse a node from a string in the hugr text syntax."""
16-
...
17-
18-
def region_to_string(region: "hugr.model.Region") -> str:
19-
"""Convert a node into a string in the hugr text syntax."""
20-
...
21-
22-
def string_to_region(string: str) -> "hugr.model.Region":
23-
"""Parse a region from a string in the hugr text syntax."""
24-
...
25-
26-
def param_to_string(region: "hugr.model.Param") -> str:
27-
"""Convert a parameter into a string in the hugr text syntax."""
28-
...
29-
30-
def string_to_param(string: str) -> "hugr.model.Param":
31-
"""Parse a parameter from a string in the hugr text syntax."""
32-
...
33-
34-
def symbol_to_string(region: "hugr.model.Symbol") -> str:
35-
"""Convert a symbol into a string in the hugr text syntax."""
36-
...
37-
38-
def string_to_symbol(string: str) -> "hugr.model.Symbol":
39-
"""Parse a symbol from a string in the hugr text syntax."""
40-
...
41-
42-
def module_to_string(module: "hugr.model.Module") -> str:
43-
"""Convert a module into a string in the hugr text syntax."""
44-
...
45-
46-
def string_to_module(string: str) -> "hugr.model.Module":
47-
"""Parse a module from a string in the hugr text syntax."""
48-
...
49-
50-
def module_to_bytes(module: "hugr.model.Module") -> bytes:
51-
"""Convert a module into the hugr binary format."""
52-
...
53-
54-
def bytes_to_module(binary: bytes) -> "hugr.model.Module":
55-
"""Read a module from the hugr binary format."""
56-
...
3+
def term_to_string(term: hugr.model.Term) -> str: ...
4+
def string_to_term(string: str) -> hugr.model.Term: ...
5+
def node_to_string(node: hugr.model.Node) -> str: ...
6+
def string_to_node(string: str) -> hugr.model.Node: ...
7+
def region_to_string(region: hugr.model.Region) -> str: ...
8+
def string_to_region(string: str) -> hugr.model.Region: ...
9+
def param_to_string(region: hugr.model.Param) -> str: ...
10+
def string_to_param(string: str) -> hugr.model.Param: ...
11+
def symbol_to_string(region: hugr.model.Symbol) -> str: ...
12+
def string_to_symbol(string: str) -> hugr.model.Symbol: ...
13+
def module_to_string(module: hugr.model.Module) -> str: ...
14+
def string_to_module(string: str) -> hugr.model.Module: ...
15+
def module_to_bytes(module: hugr.model.Module) -> bytes: ...
16+
def bytes_to_module(binary: bytes) -> hugr.model.Module: ...

hugr-py/src/hugr/hugr/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
overload,
1515
)
1616

17+
import hugr.model as model
1718
from hugr._serialization.ops import OpType as SerialOp
1819
from hugr._serialization.serial_hugr import SerialHugr
1920
from hugr.exceptions import ParentBeforeChild
2021
from hugr.ops import Call, Const, Custom, DataflowOp, Module, Op
2122
from hugr.tys import Kind, Type, ValueKind
2223
from hugr.utils import BiMap
2324
from hugr.val import Value
24-
import hugr.model as model
2525

2626
from .node_port import (
2727
Direction,
@@ -736,6 +736,7 @@ def to_model(self) -> model.Module:
736736

737737
def to_model_region(self) -> model.Region:
738738
from hugr.model.export import ModelExport
739+
739740
export = ModelExport(self)
740741
return export.export_region_module(self.root)
741742

0 commit comments

Comments
 (0)