forked from GrammaTech/gtirb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
155 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[mypy] | ||
mypy_path = @CMAKE_CURRENT_SOURCE_DIR@/stubs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Stubs for packages that do not include type annotations recognized by mypy. | ||
|
||
Generic type stubs were handwritten to enable more precise type checking. | ||
They are deliberately incomplete, only including the operations used in the | ||
GTIRB implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .interval import Interval as Interval | ||
from .intervaltree import IntervalTree as IntervalTree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from typing import Generic, TypeVar | ||
|
||
PointT = TypeVar("PointT") | ||
DataT = TypeVar("DataT") | ||
|
||
class Interval(Generic[PointT, DataT]): | ||
begin: PointT | ||
end: PointT | ||
data: DataT | ||
def __init__(self, begin: PointT, end: PointT, data: DataT): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Iterator, MutableSet, Set, TypeVar, overload | ||
|
||
from .interval import Interval | ||
|
||
PointT = TypeVar("PointT") | ||
DataT = TypeVar("DataT") | ||
|
||
class IntervalTree(MutableSet[Interval[PointT, DataT]]): | ||
def __contains__(self, item: object) -> bool: ... | ||
def __iter__(self) -> Iterator[Interval[PointT, DataT]]: ... | ||
def __len__(self) -> int: ... | ||
def add(self, interval: Interval[PointT, DataT]) -> None: ... | ||
def discard(self, interval: Interval[PointT, DataT]) -> None: ... | ||
def begin(self) -> PointT: ... | ||
def span(self) -> PointT: ... | ||
@overload | ||
def overlap( | ||
self, begin: Interval[PointT, DataT] | ||
) -> Set[Interval[PointT, DataT]]: ... | ||
@overload | ||
def overlap( | ||
self, begin: PointT, end: PointT | ||
) -> Set[Interval[PointT, DataT]]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from networkx.classes import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .multidigraph import MultiDiGraph as MultiDiGraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from typing import ( | ||
Collection, | ||
Dict, | ||
Generic, | ||
Iterable, | ||
Tuple, | ||
TypeVar, | ||
overload, | ||
) | ||
from typing_extensions import Literal | ||
|
||
NodeT = TypeVar("NodeT") | ||
KeyT = TypeVar("KeyT") | ||
DataT = TypeVar("DataT") | ||
|
||
class MultiDiGraph(Generic[NodeT, KeyT, DataT]): | ||
def __contains__(self, n: object) -> bool: ... | ||
def __getitem__( | ||
self, n: NodeT | ||
) -> Dict[NodeT, Dict[KeyT, Dict[str, DataT]]]: ... | ||
def add_edge( | ||
self, u: NodeT, v: NodeT, key: KeyT | None = ..., **attr: DataT | ||
) -> KeyT: ... | ||
def remove_edge( | ||
self, u: NodeT, v: NodeT, key: KeyT | None = ... | ||
) -> None: ... | ||
def number_of_edges( | ||
self, u: NodeT | None = ..., v: NodeT | None = ... | ||
) -> int: ... | ||
def clear(self) -> None: ... | ||
# The actual types of edges(), out_edges(), and in_edges() are remarkably | ||
# complicated. Depending on various combinations of arguments, they can | ||
# retrieve a collection of tuples of two, three, or four elements. These | ||
# overloads are specifically just the cases currently used by CFG, and do | ||
# not remotely cover all valid combinations of arguments. | ||
@overload | ||
def edges( | ||
self, | ||
nbunch: Iterable[NodeT] | NodeT | None = ..., | ||
data: Literal[False] = ..., | ||
) -> Collection[Tuple[NodeT, NodeT]]: ... | ||
@overload | ||
def edges( | ||
self, | ||
nbunch: Iterable[NodeT] | NodeT | None = ..., | ||
*, | ||
data: str, | ||
default: DataT | None = ..., | ||
) -> Collection[Tuple[NodeT, NodeT, DataT | None]]: ... | ||
def out_edges( | ||
self, | ||
nbunch: Iterable[NodeT] | NodeT | None = ..., | ||
*, | ||
data: str = ..., | ||
default: DataT | None = ..., | ||
) -> Collection[Tuple[NodeT, NodeT, DataT | None]]: ... | ||
def in_edges( | ||
self, | ||
nbunch: Iterable[NodeT] | NodeT | None = ..., | ||
*, | ||
data: str = ..., | ||
default: DataT | None = ..., | ||
) -> Collection[Tuple[NodeT, NodeT, DataT | None]]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .sorteddict import SortedDict as SortedDict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from typing import MutableMapping, Iterator, TypeVar | ||
|
||
K = TypeVar("K") | ||
V = TypeVar("V") | ||
|
||
class SortedDict(MutableMapping[K, V]): | ||
def __delitem__(self, key: K) -> None: ... | ||
def __getitem__(self, key: K) -> V: ... | ||
def __iter__(self) -> Iterator[K]: ... | ||
def __len__(self) -> int: ... | ||
def __setitem__(self, key: K, value: V) -> None: ... |