6
6
import shutil
7
7
from datetime import datetime
8
8
from tempfile import mkdtemp
9
- from typing import Dict , Iterable , List , Optional , Tuple
9
+ from typing import Dict , Iterable , List , Optional , Tuple , Union
10
10
11
11
from dateutil .parser import parse as parse_date
12
12
from distro import distro
@@ -280,7 +280,7 @@ def replace_octal(s: str) -> str:
280
280
return devices
281
281
282
282
283
- class Port (FactBase [Tuple [str , int ] | Tuple [None , None ]]):
283
+ class Port (FactBase [Union [ Tuple [str , int ], Tuple [None , None ] ]]):
284
284
"""
285
285
Returns the process occuping a port and its PID
286
286
"""
@@ -290,7 +290,7 @@ def command(self, port: int) -> str:
290
290
return f"ss -lptnH 'src :{ port } '"
291
291
292
292
@override
293
- def process (self , output : Iterable [str ]) -> Tuple [str , int ] | Tuple [None , None ]:
293
+ def process (self , output : Iterable [str ]) -> Union [ Tuple [str , int ], Tuple [None , None ] ]:
294
294
for line in output :
295
295
proc , pid = line .split ('"' )[1 ], int (line .split ("pid=" )[1 ].split ("," )[0 ])
296
296
return (proc , pid )
0 commit comments