|
73 | 73 | import re |
74 | 74 | import sys |
75 | 75 | import warnings |
76 | | -from collections.abc import Callable, Iterable, Iterator, Sequence |
| 76 | +from collections.abc import Callable, Iterable, Iterator |
77 | 77 | from pathlib import Path |
78 | 78 | from typing import IO, Any |
79 | 79 |
|
@@ -164,27 +164,19 @@ def parse(cls, line: str) -> HBARecord: |
164 | 164 | # Remove extra outer double quotes for auth options values if any |
165 | 165 | auth_options = [(o[0], re.sub(r"^\"|\"$", "", o[1])) for o in auth_options] |
166 | 166 | options = base_options + auth_options |
167 | | - return cls(options, comment=comment) |
| 167 | + return cls(**{k: v for k, v in options}, comment=comment) |
168 | 168 |
|
169 | 169 | conntype: str | None |
170 | 170 | database: str |
171 | 171 | user: str |
172 | 172 |
|
173 | | - def __init__( |
174 | | - self, |
175 | | - values: Iterable[tuple[str, str]] | dict[str, Any] | None = None, |
176 | | - comment: str | None = None, |
177 | | - **kw_values: str | Sequence[str], |
178 | | - ) -> None: |
| 173 | + def __init__(self, *, comment: str | None = None, **values: Any) -> None: |
179 | 174 | """ |
180 | | - :param values: A dict of fields. |
181 | | - :param kw_values: Fields passed as keyword. |
182 | | - :param comment: Comment at the end of the line. |
| 175 | + :param values: Fields passed as keyword. |
183 | 176 | """ |
184 | | - dict_values: dict[str, Any] = dict(values or {}, **kw_values) |
185 | | - self.__dict__.update(dict_values) |
186 | | - self.fields = [k for k, _ in dict_values.items()] |
187 | 177 | self.comment = comment |
| 178 | + self.__dict__.update(values) |
| 179 | + self.fields = list(values) |
188 | 180 |
|
189 | 181 | def __repr__(self) -> str: |
190 | 182 | return "<{} {}{}>".format( |
|
0 commit comments