#2464 - Linting changes to see if the python 3.12 pipeline will pass

This commit is contained in:
Charlie Crane
2024-05-01 16:20:01 +01:00
parent 57cff8d4e3
commit c2cc5228ae
7 changed files with 10 additions and 10 deletions

View File

@@ -231,7 +231,7 @@ class WebpageUnavailablePenalty(AbstractReward):
# If the last request did actually go through, then check if the webpage also loaded # If the last request did actually go through, then check if the webpage also loaded
web_browser_state = access_from_nested_dict(state, self.location_in_state) web_browser_state = access_from_nested_dict(state, self.location_in_state)
if web_browser_state is NOT_PRESENT_IN_STATE or "history" not in web_browser_state: if web_browser_state is NOT_PRESENT_IN_STATE or "history" not in web_browser_state: # noqa
_LOGGER.debug( _LOGGER.debug(
"Web browser reward could not be calculated because the web browser history on node", "Web browser reward could not be calculated because the web browser history on node",
f"{self._node} was not reported in the simulation state. Returning 0.0", f"{self._node} was not reported in the simulation state. Returning 0.0",

View File

@@ -56,7 +56,7 @@ def generate_mac_address(oui: Optional[str] = None) -> str:
if oui: if oui:
oui_pattern = re.compile(r"^([0-9A-Fa-f]{2}[:-]){2}[0-9A-Fa-f]{2}$") oui_pattern = re.compile(r"^([0-9A-Fa-f]{2}[:-]){2}[0-9A-Fa-f]{2}$")
if not oui_pattern.match(oui): if not oui_pattern.match(oui):
msg = f"Invalid oui. The oui should be in the format xx:xx:xx, where x is a hexadecimal digit, got '{oui}'" msg = f"Invalid oui. The oui should be in the format xx:xx:xx, where x is a hexadecimal digit, got '{oui}'" # noqa
_LOGGER.error(msg) _LOGGER.error(msg)
raise ValueError(msg) raise ValueError(msg)
oui_bytes = [int(chunk, 16) for chunk in oui.split(":")] oui_bytes = [int(chunk, 16) for chunk in oui.split(":")]
@@ -64,7 +64,7 @@ def generate_mac_address(oui: Optional[str] = None) -> str:
else: else:
mac = random_bytes mac = random_bytes
return ":".join(f"{b:02x}" for b in mac) return ":".join(f"{b:02x}" for b in mac) # noqa
class NetworkInterface(SimComponent, ABC): class NetworkInterface(SimComponent, ABC):
@@ -599,7 +599,7 @@ class Link(SimComponent):
@property @property
def current_load_percent(self) -> str: def current_load_percent(self) -> str:
"""Get the current load formatted as a percentage string.""" """Get the current load formatted as a percentage string."""
return f"{self.current_load / self.bandwidth:.5f}%" return f"{self.current_load / self.bandwidth:.5f}%" # noqa
def endpoint_up(self): def endpoint_up(self):
"""Let the Link know and endpoint has been brought up.""" """Let the Link know and endpoint has been brought up."""

View File

@@ -147,7 +147,7 @@ class FTPServiceABC(Service, ABC):
retrieved_file: File = self.file_system.get_file(folder_name=folder_name, file_name=file_name) retrieved_file: File = self.file_system.get_file(folder_name=folder_name, file_name=file_name)
# if file does not exist, return an error # if file does not exist, return an error
if not retrieved_file: if not retrieved_file: # noqa
self.sys_log.error( self.sys_log.error(
f"File {payload.ftp_command_args['dest_folder_name']}/" f"File {payload.ftp_command_args['dest_folder_name']}/"
f"{payload.ftp_command_args['dest_file_name']} does not exist in {self.sys_log.hostname}" f"{payload.ftp_command_args['dest_file_name']} does not exist in {self.sys_log.hostname}"