From 7fcf03ff9e70297b53556adaadbd47d7c7b0ee0d Mon Sep 17 00:00:00 2001 From: Renan Rodrigo Date: Fri, 28 Jun 2024 00:36:40 -0300 Subject: [PATCH] chore: get rid of some unneeded noqas in the code Signed-off-by: Renan Rodrigo --- features/environment.py | 1 - uaclient/actions.py | 3 +-- uaclient/api/u/pro/security/fix/_common/__init__.py | 2 +- uaclient/cli/tests/test_cli_fix.py | 12 ++++++------ uaclient/entitlements/__init__.py | 4 ++-- uaclient/entitlements/fips.py | 2 +- uaclient/entitlements/realtime.py | 2 +- uaclient/entitlements/ros.py | 2 +- uaclient/files/files.py | 2 +- uaclient/files/machine_token.py | 2 +- uaclient/messages/__init__.py | 2 +- uaclient/system.py | 3 ++- uaclient/util.py | 2 +- 13 files changed, 19 insertions(+), 20 deletions(-) diff --git a/features/environment.py b/features/environment.py index 9fc3a6df98..345c7d9245 100644 --- a/features/environment.py +++ b/features/environment.py @@ -9,7 +9,6 @@ from typing import Dict, List, Optional, Tuple, Union # noqa: F401 import paramiko -import pycloudlib # type: ignore # noqa: F401 import yaml from behave.model import Feature, Scenario from behave.model_core import Status diff --git a/uaclient/actions.py b/uaclient/actions.py index a591123cc0..8f9b31408b 100644 --- a/uaclient/actions.py +++ b/uaclient/actions.py @@ -5,7 +5,7 @@ import os import re import shutil -from typing import List, Optional # noqa: F401 +from typing import List, Optional from uaclient import ( api, @@ -21,7 +21,6 @@ from uaclient import messages, secret_manager from uaclient import status as ua_status from uaclient import system, timer, util -from uaclient.clouds import AutoAttachCloudInstance # noqa: F401 from uaclient.defaults import ( APPARMOR_PROFILES, CLOUD_BUILD_INFO, diff --git a/uaclient/api/u/pro/security/fix/_common/__init__.py b/uaclient/api/u/pro/security/fix/_common/__init__.py index f8af63e0e9..2cf130c1b2 100644 --- a/uaclient/api/u/pro/security/fix/_common/__init__.py +++ b/uaclient/api/u/pro/security/fix/_common/__init__.py @@ -2,7 +2,7 @@ import enum import socket from collections import defaultdict -from typing import Any, Dict, List, NamedTuple, Optional, Tuple # noqa: F401 +from typing import Any, Dict, List, NamedTuple, Optional, Tuple from uaclient import apt, exceptions, livepatch, messages, system, util from uaclient.http import serviceclient diff --git a/uaclient/cli/tests/test_cli_fix.py b/uaclient/cli/tests/test_cli_fix.py index 37d09339e5..4e566a8f05 100644 --- a/uaclient/cli/tests/test_cli_fix.py +++ b/uaclient/cli/tests/test_cli_fix.py @@ -264,8 +264,8 @@ class TestExecuteFixPlan: {check} USN-### does not affect your system. """.format( - check=messages.OKGREEN_CHECK # noqa: E126 - ) # noqa: E126 + check=messages.OKGREEN_CHECK + ) ), FixStatus.SYSTEM_NOT_AFFECTED, [], @@ -331,8 +331,8 @@ class TestExecuteFixPlan: {check} USN-### is resolved. """.format( - check=messages.OKGREEN_CHECK # noqa: E126 - ) # noqa: E126 + check=messages.OKGREEN_CHECK + ) ), FixStatus.SYSTEM_NON_VULNERABLE, [], @@ -1727,8 +1727,8 @@ def test_execute_fix_plan_when_subscription_is_expired( {check} USN-### does not affect your system. """.format( - check=messages.OKGREEN_CHECK # noqa: E126 - ) # noqa: E126 + check=messages.OKGREEN_CHECK + ) ), FixStatus.SYSTEM_NOT_AFFECTED, [], diff --git a/uaclient/entitlements/__init__.py b/uaclient/entitlements/__init__.py index 27dec82386..4f718acff2 100644 --- a/uaclient/entitlements/__init__.py +++ b/uaclient/entitlements/__init__.py @@ -1,13 +1,13 @@ import enum import textwrap from collections import defaultdict -from typing import Dict, List, NamedTuple, Optional, Tuple, Type # noqa: F401 +from typing import Dict, List, Optional, Type from uaclient import exceptions from uaclient.config import UAConfig from uaclient.entitlements import fips from uaclient.entitlements.anbox import AnboxEntitlement -from uaclient.entitlements.base import UAEntitlement # noqa: F401 +from uaclient.entitlements.base import UAEntitlement from uaclient.entitlements.cc import CommonCriteriaEntitlement from uaclient.entitlements.cis import CISEntitlement from uaclient.entitlements.entitlement_status import ApplicabilityStatus diff --git a/uaclient/entitlements/fips.py b/uaclient/entitlements/fips.py index 3c103b3c3a..6a83366e4a 100644 --- a/uaclient/entitlements/fips.py +++ b/uaclient/entitlements/fips.py @@ -2,7 +2,7 @@ import os import re from itertools import groupby -from typing import Callable, List, Optional, Tuple, Union # noqa: F401 +from typing import List, Optional, Tuple from uaclient import api, apt, event_logger, exceptions, messages, system, util from uaclient.clouds.identity import NoCloudTypeReason, get_cloud_type diff --git a/uaclient/entitlements/realtime.py b/uaclient/entitlements/realtime.py index da1bba3274..ac8c136182 100644 --- a/uaclient/entitlements/realtime.py +++ b/uaclient/entitlements/realtime.py @@ -1,5 +1,5 @@ import logging -from typing import Any, Dict, Optional, Tuple, Type # noqa: F401 +from typing import Any, Dict, Optional, Tuple, Type from uaclient import apt, event_logger, messages, system, util from uaclient.entitlements import repo diff --git a/uaclient/entitlements/ros.py b/uaclient/entitlements/ros.py index 9082cb595f..091a07a79d 100644 --- a/uaclient/entitlements/ros.py +++ b/uaclient/entitlements/ros.py @@ -1,4 +1,4 @@ -from typing import Tuple, Type # noqa: F401 +from typing import Tuple, Type from uaclient import messages from uaclient.entitlements import repo diff --git a/uaclient/files/files.py b/uaclient/files/files.py index 2a445eb8a8..b627e7c4c6 100644 --- a/uaclient/files/files.py +++ b/uaclient/files/files.py @@ -1,7 +1,7 @@ import json import logging import os -from typing import Any, Dict, Optional # noqa: F401 +from typing import Any, Dict, Optional from uaclient import defaults, event_logger, exceptions, system, util diff --git a/uaclient/files/machine_token.py b/uaclient/files/machine_token.py index 568a3e268c..d276456e7a 100644 --- a/uaclient/files/machine_token.py +++ b/uaclient/files/machine_token.py @@ -1,6 +1,6 @@ import json from datetime import datetime -from typing import Any, Dict, Optional # noqa: F401 +from typing import Any, Dict, Optional from uaclient import defaults, exceptions, system, util from uaclient.contract_data_types import PublicMachineTokenData diff --git a/uaclient/messages/__init__.py b/uaclient/messages/__init__.py index 329143cba2..97cbfc7567 100644 --- a/uaclient/messages/__init__.py +++ b/uaclient/messages/__init__.py @@ -1,6 +1,6 @@ import sys from gettext import NullTranslations, translation -from typing import Callable, Dict, Optional # noqa: F401 +from typing import Callable, Dict, Optional from uaclient.messages import urls diff --git a/uaclient/system.py b/uaclient/system.py index 6cefa2766b..2b2bb082c7 100644 --- a/uaclient/system.py +++ b/uaclient/system.py @@ -105,7 +105,8 @@ def _get_kernel_changelog_timestamp( ) -> Optional[datetime.datetime]: if is_container(): LOG.warning( - "Not attempting to use timestamp of kernel changelog because we're in a container" # noqa: E501 + "Not attempting to use timestamp of kernel " + "changelog because we're in a container" ) return None diff --git a/uaclient/util.py b/uaclient/util.py index 8118b8c770..ee5c4f88b8 100644 --- a/uaclient/util.py +++ b/uaclient/util.py @@ -7,7 +7,7 @@ import textwrap import time from functools import wraps -from typing import Any, Callable, Dict, List, Optional, Union # noqa: F401 +from typing import Any, Dict, List, Optional, Union # noqa: F401 from uaclient import exceptions, messages from uaclient.defaults import CONFIG_FIELD_ENVVAR_ALLOWLIST