From 82745b470053499505bf91b216c28ce4610650da Mon Sep 17 00:00:00 2001 From: Bertrand <bneron@pasteur.fr> Date: Wed, 4 Sep 2019 10:54:30 +0200 Subject: [PATCH] :pencil2: improve hint typing --- Graph/graph/graph_2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Graph/graph/graph_2.py b/Graph/graph/graph_2.py index 5f5acb0..2d55b71 100644 --- a/Graph/graph/graph_2.py +++ b/Graph/graph/graph_2.py @@ -13,7 +13,7 @@ class NDGraph: below I implemented the 2nd version. """ - def __init__(self, nodes): + def __init__(self, nodes: Sequence['Node']) -> None: self.nodes: Set['Node'] = {n for n in nodes} self.vertices: Dict['Node': Set['Node']] = {n: set() for n in self.nodes} @@ -80,10 +80,10 @@ class Node: _id = itertools.count(0) - def __init__(self): + def __init__(self) -> None: self.id: int = next(self._id) - def __hash__(self): + def __hash__(self) -> int: # to be usable in set an object must be hashable # so we need to implement __hash__ # which must returm an int uniq per object -- GitLab