Skip to content

Commit e76fda4

Browse files
committed
Keep the typing import grouped
by moving them at the end. This way, the typing import are grouped even when if TYPE_CHECKING: import … is used Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent 65b97db commit e76fda4

File tree

19 files changed

+37
-37
lines changed

19 files changed

+37
-37
lines changed

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Dict
2-
31
import pytest
42

53
import itertools
@@ -33,6 +31,8 @@
3331
# need to import them in the global conftest.py so that they are recognized as fixtures.
3432
from pkgfixtures import formatted_and_mounted_ext4_disk, sr_disk_wiped
3533

34+
from typing import Dict
35+
3636
# Do we cache VMs?
3737
try:
3838
from data import CACHE_IMPORTED_VM

lib/basevm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from typing import TYPE_CHECKING, Any, Literal, Optional, overload
2-
31
import logging
42

3+
from typing import TYPE_CHECKING, Any, Literal, Optional, overload
4+
55
if TYPE_CHECKING:
66
import lib.host
77

lib/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List, Literal, Union, overload
2-
31
import base64
42
import logging
53
import shlex
@@ -8,6 +6,8 @@
86
import lib.config as config
97
from lib.netutil import wrap_ip
108

9+
from typing import List, Literal, Union, overload
10+
1111
class BaseCommandFailed(Exception):
1212
__slots__ = 'returncode', 'stdout', 'cmd'
1313

lib/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import TYPE_CHECKING, Callable, Dict, Literal, Optional, TypeVar, Union, cast, overload
2-
31
import pytest
42

53
import getpass
@@ -17,6 +15,8 @@
1715

1816
import lib.commands as commands
1917

18+
from typing import TYPE_CHECKING, Callable, Dict, Literal, Optional, TypeVar, Union, cast, overload
19+
2020
if TYPE_CHECKING:
2121
import lib.host
2222

lib/host.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Union, overload
4-
53
import logging
64
import os
75
import shlex
@@ -13,6 +11,8 @@
1311
import lib.commands as commands
1412
import lib.pif as pif
1513

14+
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Union, overload
15+
1616
if TYPE_CHECKING:
1717
import lib.pool
1818

lib/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any, Dict, Optional
2-
31
import logging
42
import os
53
import traceback
@@ -11,6 +9,8 @@
119
from lib.host import Host
1210
from lib.sr import SR
1311

12+
from typing import Any, Dict, Optional
13+
1414
class Pool:
1515
xe_prefix = "pool"
1616

lib/typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from typing import TypedDict
2-
31
import sys
42

3+
from typing import TypedDict
4+
55
if sys.version_info >= (3, 11):
66
from typing import NotRequired
77
else:

lib/vdi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import TYPE_CHECKING, Literal, Optional, overload
2-
31
import logging
42

53
from lib.common import _param_add, _param_clear, _param_get, _param_remove, _param_set, strtobool
64

5+
from typing import TYPE_CHECKING, Literal, Optional, overload
6+
77
if TYPE_CHECKING:
88
from lib.host import Host
99
from lib.sr import SR

lib/vm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, List, Literal, Optional, Union, overload
4-
53
import logging
64
import os
75
import tempfile
@@ -23,6 +21,8 @@
2321
from lib.vbd import VBD
2422
from lib.vif import VIF
2523

24+
from typing import TYPE_CHECKING, List, Literal, Optional, Union, overload
25+
2626
if TYPE_CHECKING:
2727
from lib.host import Host
2828

lib/xo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from typing import Any, Dict, Literal, Union, overload
2-
31
import json
42
import subprocess
53

4+
from typing import Any, Dict, Literal, Union, overload
5+
66
@overload
77
def xo_cli(action: str, args: Dict[str, str] = {}, *, check: bool = True, simple_output: Literal[True] = True,
88
use_json: Literal[False] = False) -> str:

0 commit comments

Comments
 (0)