1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 16:50:34 +03:00

Merge branch 'fix/1723/flake8-everything' into develop

This commit is contained in:
Athanasius 2022-12-05 16:09:33 +00:00
commit 21c1f07db4
No known key found for this signature in database
GPG Key ID: 772697E181BB2767
2 changed files with 9 additions and 9 deletions

View File

@ -319,17 +319,17 @@ class AbstractConfig(abc.ABC):
warnings.warn(DeprecationWarning('get is Deprecated. use the specific getter for your type'))
logger.debug('Attempt to use Deprecated get() method\n' + ''.join(traceback.format_stack()))
if (l := self._suppress_call(self.get_list, ValueError, key, default=None)) is not None:
return l
if (a_list := self._suppress_call(self.get_list, ValueError, key, default=None)) is not None:
return a_list
elif (s := self._suppress_call(self.get_str, ValueError, key, default=None)) is not None:
return s
elif (a_str := self._suppress_call(self.get_str, ValueError, key, default=None)) is not None:
return a_str
elif (b := self._suppress_call(self.get_bool, ValueError, key, default=None)) is not None:
return b
elif (a_bool := self._suppress_call(self.get_bool, ValueError, key, default=None)) is not None:
return a_bool
elif (i := self._suppress_call(self.get_int, ValueError, key, default=None)) is not None:
return i
elif (an_int := self._suppress_call(self.get_int, ValueError, key, default=None)) is not None:
return an_int
return default # type: ignore

View File

@ -41,7 +41,7 @@ def _fuzz_list(length: int) -> List[str]:
_fuzz_generators = { # Type annotating this would be a nightmare.
int: lambda i: random.randint(min(0, i), max(0, i)),
# This doesn't cover unicode, or random bytes. Use them at your own peril
str: lambda l: "".join(random.choice(string.ascii_letters + string.digits + '\r\n') for _ in range(l)),
str: lambda s: "".join(random.choice(string.ascii_letters + string.digits + '\r\n') for _ in range(s)),
bool: lambda _: bool(random.choice((True, False))),
list: _fuzz_list,
}