replace List with Sequence in matching/responses.py

This commit is contained in:
jesopo 2020-06-12 14:22:39 +01:00
parent ab3cf63135
commit c4df2e2175
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
from typing import List, Optional, Union from typing import List, Optional, Sequence, Union
from irctokens import Line from irctokens import Line
from ..interface import (IServer, IMatchResponse, IMatchResponseParam, from ..interface import (IServer, IMatchResponse, IMatchResponseParam,
IMatchResponseHostmask) IMatchResponseHostmask)
@ -7,13 +7,13 @@ from .params import *
TYPE_PARAM = Union[str, IMatchResponseParam] TYPE_PARAM = Union[str, IMatchResponseParam]
class Responses(IMatchResponse): class Responses(IMatchResponse):
def __init__(self, def __init__(self,
commands: List[str], commands: Sequence[str],
params: List[TYPE_PARAM]=[], params: Sequence[TYPE_PARAM]=[],
source: Optional[IMatchResponseHostmask]=None): source: Optional[IMatchResponseHostmask]=None):
self._commands = commands self._commands = commands
self._source = source self._source = source
self._params: List[IMatchResponseParam] = [] self._params: Sequence[IMatchResponseParam] = []
for param in params: for param in params:
if isinstance(param, str): if isinstance(param, str):
self._params.append(Literal(param)) self._params.append(Literal(param))
@ -43,7 +43,7 @@ class Responses(IMatchResponse):
class Response(Responses): class Response(Responses):
def __init__(self, def __init__(self,
command: str, command: str,
params: List[TYPE_PARAM]=[], params: Sequence[TYPE_PARAM]=[],
source: Optional[IMatchResponseHostmask]=None): source: Optional[IMatchResponseHostmask]=None):
super().__init__([command], params, source=source) super().__init__([command], params, source=source)