Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cosmetics #112

Merged
merged 5 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions stubs/pytest_httpserver.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import abc
from _typeshed import Incomplete
from enum import Enum
from ssl import SSLContext
from typing import Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Pattern, Tuple, Union
from werkzeug.datastructures import MultiDict
from typing import Any, Callable, Iterable, Mapping, MutableMapping, Optional, Pattern, Tuple, Union

# pylint: disable=import-error, no-name-in-module, super-init-not-called, multiple-statements, too-few-public-methods, invalid-name, line-too-long
from _typeshed import Incomplete

from werkzeug.wrappers import Request, Response

URI_DEFAULT: str
METHOD_ALL: str
HEADERS_T = Union[Mapping[str, Union[str, Iterable[str]]], Iterable[Tuple[str, str]]]
HVMATCHER_T = Callable[[str, Optional[str], str], bool]

class Undefined: ...

UNDEFINED: Incomplete

class Error(Exception): ...
class NoHandlerError(Error): ...
class HTTPServerError(Error): ...
Expand Down
6 changes: 3 additions & 3 deletions xcp/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ def __init__(self, addr):
self.segment = 0

self.bus = int(groups["bus"], 16)
if not ( 0 <= self.bus < 2**8 ):
if not 0 <= self.bus < 2**8:
raise ValueError("Bus '%d' out of range 0 <= bus < 256"
% (self.bus,))

self.device = int(groups["device"], 16)
if not ( 0 <= self.device < 2**5):
if not 0 <= self.device < 2**5:
raise ValueError("Device '%d' out of range 0 <= device < 32"
% (self.device,))

self.function = int(groups["function"], 16)
if not ( 0 <= self.function < 2**3):
if not 0 <= self.function < 2**3:
raise ValueError("Function '%d' out of range 0 <= device "
"< 8" % (self.function,))

Expand Down
5 changes: 3 additions & 2 deletions xcp/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ def __str__(self):

@classmethod
def arc_cmp(cls, l, r):
# type:(int, int) -> int
return l - r

@classmethod
def ver_cmp(cls, l, r):
assert type(l) is list
assert type(r) is list
# type:(list[int], list[int]) -> int
assert isinstance(l, list) and isinstance(r, list)

# iterate over arcs in turn, zip() returns min(len(l), len(r)) tuples
for la, ra in zip(l, r):
Expand Down
2 changes: 1 addition & 1 deletion xcp/xmlunwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def getBoolAttribute(el, attrs, default = None):
return default
return val in ['yes', 'true']

def getIntAttribute(el, attrs, default = None):
def getIntAttribute(el, attrs, default = None): # pylint: disable=inconsistent-return-statements
# type:(Element, list[str], Optional[int]) -> int | None
mandatory = default is None
val = getStrAttribute(el, attrs, '', mandatory)
Expand Down
Loading