Skip to content

Commit

Permalink
Make export function preserve types (#666)
Browse files Browse the repository at this point in the history
#665

Co-authored-by: Mike Lin <[email protected]>
  • Loading branch information
adamnovak and mlin authored Dec 16, 2023
1 parent 3f684ea commit b82e9da
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions WDL/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
from types import FrameType
from pythonjsonlogger import jsonlogger

T = TypeVar("T")

__all__: List[str] = []


def export(obj) -> str: # pyre-ignore
__all__.append(obj.__name__)
def export(obj: T) -> T:
__all__.append(obj.__name__) # pyre-ignore
return obj


Expand Down Expand Up @@ -67,9 +69,6 @@ def strip_leading_whitespace(txt: str) -> Tuple[int, str]:
return (to_strip, "\n".join(lines))


T = TypeVar("T")


@export
class AdjM(Generic[T]):
# A sparse adjacency matrix for topological sorting
Expand Down

0 comments on commit b82e9da

Please sign in to comment.