|
23 | 23 |
|
24 | 24 | def _normalize_address(inp: Union[str, tuple, int]): |
25 | 25 | if isinstance(inp, str): |
26 | | - if '://' in inp: |
27 | | - protocol, _, rest_str = inp.partition('://') |
| 26 | + if "://" in inp: |
| 27 | + protocol, _, rest_str = inp.partition("://") |
28 | 28 | else: |
29 | | - protocol = 'tcp' |
| 29 | + protocol = "tcp" |
30 | 30 | rest_str = inp |
31 | 31 | elif isinstance(inp, tuple): |
32 | | - if inp[0] in ['tcp', 'ipc']: |
| 32 | + if inp[0] in ["tcp", "ipc"]: |
33 | 33 | protocol, *rest = inp |
34 | 34 | else: |
35 | | - protocol = 'tcp' |
| 35 | + protocol = "tcp" |
36 | 36 | rest = list(inp) |
37 | | - if protocol == 'tcp': |
| 37 | + if protocol == "tcp": |
38 | 38 | if len(rest) == 2: |
39 | | - rest_str = ':'.join(str(r) for r in rest) |
| 39 | + rest_str = ":".join(str(r) for r in rest) |
40 | 40 | else: |
41 | | - rest_str, = rest |
| 41 | + (rest_str,) = rest |
42 | 42 | else: |
43 | | - rest_str, = rest |
| 43 | + (rest_str,) = rest |
44 | 44 | elif isinstance(inp, int): |
45 | | - protocol = 'tcp' |
46 | | - rest_str = f'localhost:{inp}' |
| 45 | + protocol = "tcp" |
| 46 | + rest_str = f"localhost:{inp}" |
47 | 47 |
|
48 | 48 | else: |
49 | 49 | raise TypeError(f"Input expected to be str or tuple, not {type(inp)}") |
50 | 50 |
|
51 | | - return f'{protocol}://{rest_str}' |
| 51 | + return f"{protocol}://{rest_str}" |
52 | 52 |
|
53 | 53 |
|
54 | 54 | class Bluesky0MQDecodeError(Exception): |
@@ -145,6 +145,7 @@ class Proxy: |
145 | 145 | - ``6657`` (implicitly binds to ``'tcp://localhost:6657'`` |
146 | 146 | - ``('tcp', 'localhost', 6657)`` |
147 | 147 | - ``('localhost', 6657)`` |
| 148 | +
|
148 | 149 | Parameters |
149 | 150 | ---------- |
150 | 151 | in_address : str or tuple or int, optional |
|
0 commit comments