Skip to content

Commit efc565b

Browse files
committed
Update syntax to match what ruff recommends for Python 3.10
1 parent 0a43546 commit efc565b

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

Diff for: examples/grpc/grpc_user.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from locust.exception import LocustError
33

44
import time
5-
from typing import Any, Callable
5+
from collections.abc import Callable
6+
from typing import Any
67

78
import grpc
89
import grpc.experimental.gevent as grpc_gevent

Diff for: locust/clients.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,10 @@ def __exit__(self, exc, value, traceback): # type: ignore[override]
373373
while (
374374
isinstance(
375375
e,
376-
(
377-
requests.exceptions.ConnectionError,
378-
requests.packages.urllib3.exceptions.ProtocolError,
379-
requests.packages.urllib3.exceptions.MaxRetryError,
380-
requests.packages.urllib3.exceptions.NewConnectionError,
381-
),
376+
requests.exceptions.ConnectionError
377+
| requests.packages.urllib3.exceptions.ProtocolError
378+
| requests.packages.urllib3.exceptions.MaxRetryError
379+
| requests.packages.urllib3.exceptions.NewConnectionError,
382380
)
383381
and e.__context__ # Not sure if the above exceptions can ever be the lowest level, but it is good to be sure
384382
):

Diff for: locust/env.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable
34
from operator import methodcaller
4-
from typing import Callable, TypeVar
5+
from typing import TypeVar
56

67
from configargparse import Namespace
78

Diff for: locust/input_events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
import os
66
import sys
7-
from typing import Callable
7+
from collections.abc import Callable
88

99
import gevent
1010

Diff for: locust/runners.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import traceback
1515
from abc import abstractmethod
1616
from collections import defaultdict
17-
from collections.abc import Iterator, MutableMapping, ValuesView
17+
from collections.abc import Callable, Iterator, MutableMapping, ValuesView
1818
from operator import itemgetter, methodcaller
1919
from types import TracebackType
20-
from typing import TYPE_CHECKING, Any, Callable, NoReturn, TypedDict, cast
20+
from typing import TYPE_CHECKING, Any, NoReturn, TypedDict, cast
2121
from uuid import uuid4
2222

2323
import gevent

Diff for: locust/stats.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import time
1010
from abc import abstractmethod
1111
from collections import OrderedDict, defaultdict, namedtuple
12-
from collections.abc import Iterable
12+
from collections.abc import Callable, Iterable
1313
from copy import copy
1414
from html import escape
1515
from itertools import chain
1616
from types import FrameType
17-
from typing import TYPE_CHECKING, Any, Callable, NoReturn, Protocol, TypedDict, TypeVar, cast
17+
from typing import TYPE_CHECKING, Any, NoReturn, Protocol, TypedDict, TypeVar, cast
1818

1919
import gevent
2020

Diff for: locust/user/task.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import random
77
import traceback
88
from collections import deque
9+
from collections.abc import Callable
910
from time import time
1011
from typing import (
1112
TYPE_CHECKING,
12-
Callable,
1313
Protocol,
1414
TypeVar,
1515
final,

Diff for: locust/user/users.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import logging
1717
import time
1818
import traceback
19-
from typing import Callable, final
19+
from collections.abc import Callable
20+
from typing import final
2021

2122
from gevent import GreenletExit, greenlet
2223
from gevent.pool import Group

0 commit comments

Comments
 (0)