raise ValueError(
"The '@<port>' syntax must be used either for all or none of the IP addresses in the list."
)
- port_set = True if addr.port else False
+ port_set = bool(addr.port)
elif isinstance(origin.ip_address, IPAddressOptionalPort) and origin.ip_address.port and origin.port:
raise ValueError("The port number is defined in two places ('port' option and '@<port>' syntax).")
return origin.ip_address
raise ValueError(
"The '@<port>' syntax must be used either for all or none of the interface in the list."
)
- port_set = True if intrfc.port else False
+ port_set = bool(intrfc.port)
elif isinstance(origin.interface, InterfaceOptionalPort) and origin.interface.port and origin.port:
raise ValueError("The port number is defined in two places ('port' option and '@<port>' syntax).")
return origin.interface
_value: str
+ def __int__(self) -> int:
+ raise ValueError("Can't convert string to an integer.")
+
def __str__(self) -> str:
return self._value
_max: int
def __init__(self, source_value: Any, object_path: str = "/") -> None:
+ super().__init__(source_value)
if isinstance(source_value, int):
if not self._min <= source_value <= self._max:
raise SchemaException(
port: Optional[PortNumber] = None
def __init__(self, source_value: Any, object_path: str = "/") -> None:
+ super().__init__(source_value)
if isinstance(source_value, str):
parts = source_value.split("@")
if 0 < len(parts) < 3:
nsite = web.TCPSite(self.runner, str(mgn.ip_address.addr), int(mgn.ip_address.port))
logger.info(f"Starting API HTTP server on http://{mgn.ip_address.addr}:{mgn.ip_address.port}")
else:
- raise KresManagerException(f"Requested API on unsupported configuration format.")
+ raise KresManagerException("Requested API on unsupported configuration format.")
await nsite.start()
# stop the old listen