From 5731f85fea0b2aaade24ac8bad13ef21e591586c Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Thu, 14 Dec 2023 13:23:14 -0500 Subject: [PATCH 1/3] Make export function preserve types --- WDL/_util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WDL/_util.py b/WDL/_util.py index 1affe49a..ef3bd0a2 100644 --- a/WDL/_util.py +++ b/WDL/_util.py @@ -32,10 +32,12 @@ from types import FrameType from pythonjsonlogger import jsonlogger +T = TypeVar("T") + __all__: List[str] = [] -def export(obj) -> str: # pyre-ignore +def export(obj: T) -> T: # pyre-ignore __all__.append(obj.__name__) return obj @@ -67,7 +69,6 @@ def strip_leading_whitespace(txt: str) -> Tuple[int, str]: return (to_strip, "\n".join(lines)) -T = TypeVar("T") @export From a7e2b5e835e9830178dfc52ee21b1ae0226103c8 Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Thu, 14 Dec 2023 17:08:20 -1000 Subject: [PATCH 2/3] reformat --- WDL/_util.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/WDL/_util.py b/WDL/_util.py index ef3bd0a2..f0b87711 100644 --- a/WDL/_util.py +++ b/WDL/_util.py @@ -69,8 +69,6 @@ def strip_leading_whitespace(txt: str) -> Tuple[int, str]: return (to_strip, "\n".join(lines)) - - @export class AdjM(Generic[T]): # A sparse adjacency matrix for topological sorting From ff1ce9256001df844239ff37822d1c5adf31878f Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Fri, 15 Dec 2023 21:55:42 -1000 Subject: [PATCH 3/3] fix pyre --- WDL/_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WDL/_util.py b/WDL/_util.py index f0b87711..c7be2ffb 100644 --- a/WDL/_util.py +++ b/WDL/_util.py @@ -37,8 +37,8 @@ __all__: List[str] = [] -def export(obj: T) -> T: # pyre-ignore - __all__.append(obj.__name__) +def export(obj: T) -> T: + __all__.append(obj.__name__) # pyre-ignore return obj