diff --git a/build_ext/build_ext/lint.py b/build_ext/build_ext/lint.py index b9e577c200..b9a33fcee2 100644 --- a/build_ext/build_ext/lint.py +++ b/build_ext/build_ext/lint.py @@ -69,7 +69,7 @@ def run(self): spawn(["flake8"]) -class AstVisitor(object): +class AstVisitor: """Visitor pattern for looking at specific nodes in an AST. Basically a copy of ast.NodeVisitor, but with the additional feature of appending return values onto a result list that is ultimately returned. @@ -163,7 +163,7 @@ def visit_Call(self, node): ) -class AstChecker(object): +class AstChecker: name = "SubscriptionManagerAstChecker" version = "1.0" diff --git a/build_ext/build_ext/utils.py b/build_ext/build_ext/utils.py index 3c3dd07a31..386fcd4c6c 100644 --- a/build_ext/build_ext/utils.py +++ b/build_ext/build_ext/utils.py @@ -68,7 +68,7 @@ def finalize_options(self): pass -class Utils(object): +class Utils: @staticmethod def run_if_new(src, dest, callback): src_mtime = os.stat(src)[8] diff --git a/scripts/gen_test_en_po.py b/scripts/gen_test_en_po.py index 4e489bed23..7654c7d5cd 100755 --- a/scripts/gen_test_en_po.py +++ b/scripts/gen_test_en_po.py @@ -4,7 +4,7 @@ import sys -class PotFile(object): +class PotFile: def __init__(self): self.msgids = [] diff --git a/src/cloud_what/_base_provider.py b/src/cloud_what/_base_provider.py index e9daf3c534..e869130c9a 100644 --- a/src/cloud_what/_base_provider.py +++ b/src/cloud_what/_base_provider.py @@ -28,7 +28,7 @@ log = logging.getLogger(__name__) -class BaseCloudProvider(object): +class BaseCloudProvider: """ Base class of cloud provider. This class is used for cloud detecting and collecting metadata/signature. diff --git a/src/cloud_what/fact_collector.py b/src/cloud_what/fact_collector.py index cc31f16f5d..711e37cbe4 100644 --- a/src/cloud_what/fact_collector.py +++ b/src/cloud_what/fact_collector.py @@ -27,7 +27,7 @@ log = logging.getLogger(__name__) -class MiniHostCollector(object): +class MiniHostCollector: """ Minimalistic collector of host facts """ @@ -124,7 +124,7 @@ def get_all(self) -> dict: # We do not need this collector for cloud-what, so it is really dummy -class MiniCustomFactsCollector(object): +class MiniCustomFactsCollector: @staticmethod def get_all() -> dict: return {} diff --git a/src/plugins/zypper/services/rhsm b/src/plugins/zypper/services/rhsm index 15be5b9494..6b43660fe8 100755 --- a/src/plugins/zypper/services/rhsm +++ b/src/plugins/zypper/services/rhsm @@ -72,7 +72,7 @@ class RepoLocker(Locker): self.lock.release() -class ZypperService(object): +class ZypperService: ZYPP_RHSM_PLUGIN_CONFIG_FILE = '/etc/rhsm/zypper.conf' diff --git a/src/rct/printing.py b/src/rct/printing.py index d24211e816..352004edba 100644 --- a/src/rct/printing.py +++ b/src/rct/printing.py @@ -32,7 +32,7 @@ def xstr(value): return str(value) -class ProductPrinter(object): +class ProductPrinter: def as_str(self, product): s = [] s.append("%s:" % _("Product")) @@ -56,7 +56,7 @@ def as_str(self, product): return "%s\n" % "\n".join(s) -class OrderPrinter(object): +class OrderPrinter: def as_str(self, order): if order is None: @@ -90,7 +90,7 @@ def as_str(self, order): return "%s\n" % "\n".join(s) -class ContentPrinter(object): +class ContentPrinter: def as_str(self, content): s = [] s.append("%s:" % _("Content")) @@ -109,7 +109,7 @@ def as_str(self, content): return "\n".join(s) -class CertificatePrinter(object): +class CertificatePrinter: def cert_to_str(self, cert): s = [] s.append("\n+-------------------------------------------+") @@ -228,7 +228,7 @@ def _get_paths(self, cert): return "%s" % "\n".join(s) -class CertificatePrinterFactory(object): +class CertificatePrinterFactory: def get_printer(self, cert, **kwargs): if isinstance(cert, EntitlementCertificate): return EntitlementCertificatePrinter(**kwargs) diff --git a/src/rhsm/certificate.py b/src/rhsm/certificate.py index 80218569c9..c165b8c000 100644 --- a/src/rhsm/certificate.py +++ b/src/rhsm/certificate.py @@ -116,7 +116,7 @@ def new_func(*args, **kwargs): return new_func -class Certificate(object): +class Certificate: """ Represents and x.509 certificate. @@ -505,7 +505,7 @@ def __str__(self) -> str: return "\n".join(s) -class Key(object): +class Key: """ The (private|public) key. @@ -572,7 +572,7 @@ def __str__(self) -> str: return self.content -class DateRange(object): +class DateRange: """ Date range object. @@ -906,7 +906,7 @@ def __str__(self) -> str: return self._str -class Order(object): +class Order: @deprecated def __init__(self, ext): self.ext = ext @@ -996,7 +996,7 @@ def __str__(self): return "\n".join(s) -class Product(object): +class Product: @deprecated def __init__(self, p_hash: str, ext: Extensions) -> None: self.hash = p_hash diff --git a/src/rhsm/certificate2.py b/src/rhsm/certificate2.py index 5881237bbc..810a564087 100644 --- a/src/rhsm/certificate2.py +++ b/src/rhsm/certificate2.py @@ -872,7 +872,7 @@ def __str__(self): return "" % (self.name, self.number, self.sku) -class Content(object): +class Content: def __init__( self, content_type=None, @@ -929,7 +929,7 @@ def __hash__(self): return hash(self.label) -class Pool(object): +class Pool: """ Represents the pool an entitlement originates from. """ diff --git a/src/rhsm/pathtree.py b/src/rhsm/pathtree.py index 5b5886798d..bfb43d617b 100644 --- a/src/rhsm/pathtree.py +++ b/src/rhsm/pathtree.py @@ -24,7 +24,7 @@ LISTING = "listing" -class PathTree(object): +class PathTree: """ This builds and makes available a tree that represents matchable paths. A path must be matched starting from its root and the root of the tree, diff --git a/src/rhsm/profile.py b/src/rhsm/profile.py index f54ae11d5a..de570c115f 100644 --- a/src/rhsm/profile.py +++ b/src/rhsm/profile.py @@ -55,7 +55,7 @@ class InvalidProfileType(Exception): pass -class ModulesProfile(object): +class ModulesProfile: def __init__(self) -> None: self.content: List[dict] = self.__generate() @@ -191,7 +191,7 @@ def collect(self) -> List[dict]: return self.content -class EnabledRepos(object): +class EnabledRepos: def __generate(self) -> List[dict]: if not os.path.exists(self.repofile): return [] @@ -279,7 +279,7 @@ def _obtain_mappings_yum(self) -> dict: return {"releasever": self.yb.conf.yumvar["releasever"], "basearch": self.yb.conf.yumvar["basearch"]} -class EnabledReposProfile(object): +class EnabledReposProfile: """ Collect information about enabled repositories """ @@ -298,7 +298,7 @@ def collect(self) -> List[dict]: return self._enabled_repos.content -class Package(object): +class Package: """ Represents a package installed on the system. """ @@ -354,7 +354,7 @@ def _normalize_string(value: Union[str, bytes]) -> str: return value -class RPMProfile(object): +class RPMProfile: def __init__(self, from_file: _io.TextIOWrapper = None) -> None: """ Load the RPM package profile from a given file, or from rpm itself. diff --git a/src/rhsm_debug/debug_commands.py b/src/rhsm_debug/debug_commands.py index 088cc54ae2..abfcd7de94 100644 --- a/src/rhsm_debug/debug_commands.py +++ b/src/rhsm_debug/debug_commands.py @@ -263,7 +263,7 @@ def _makedir(self, dest_dir_name): os.makedirs(dest_dir_name, ROOT_READ_ONLY_DIR) -class SaferFileMove(object): +class SaferFileMove: """Try to copy a file avoiding race conditions. Opens the dest file os.O_RDWR | os.O_CREAT | os.O_EXCL, which diff --git a/src/rhsmlib/candlepin/api.py b/src/rhsmlib/candlepin/api.py index a2ed42d14e..531f55a428 100644 --- a/src/rhsmlib/candlepin/api.py +++ b/src/rhsmlib/candlepin/api.py @@ -45,7 +45,7 @@ class CandlepinApiNetworkError(CandlepinApiError): pass -class Candlepin(object): +class Candlepin: def __init__(self, uep): self.uep = uep self._default_args = () diff --git a/src/rhsmlib/dbus/facts/client.py b/src/rhsmlib/dbus/facts/client.py index 9dbd590124..4e955652c8 100755 --- a/src/rhsmlib/dbus/facts/client.py +++ b/src/rhsmlib/dbus/facts/client.py @@ -28,7 +28,7 @@ def __init__(self, *args, **kwargs): self.action_id = action_id -class FactsClient(object): +class FactsClient: bus_name = facts_constants.FACTS_DBUS_NAME object_path = facts_constants.FACTS_DBUS_PATH interface_name = facts_constants.FACTS_DBUS_INTERFACE diff --git a/src/rhsmlib/dbus/server.py b/src/rhsmlib/dbus/server.py index ca15f0ba2d..d8d29be67d 100644 --- a/src/rhsmlib/dbus/server.py +++ b/src/rhsmlib/dbus/server.py @@ -43,7 +43,7 @@ conf = config.Config(parser) -class Server(object): +class Server: """ Class used for rhsm.service providing D-Bus API """ @@ -246,7 +246,7 @@ def enable_dir_watchers(cls, watcher_set: set = None) -> None: dir_watcher.enable() -class DomainSocketServer(object): +class DomainSocketServer: """This class sets up a DBus server on a domain socket. That server can then be used to perform registration. The issue is that we can't send registration credentials over the regular system or session bus since those aren't really locked down. The work-around is the client asks our service diff --git a/src/rhsmlib/facts/collection.py b/src/rhsmlib/facts/collection.py index defc8b4455..7badd093ea 100644 --- a/src/rhsmlib/facts/collection.py +++ b/src/rhsmlib/facts/collection.py @@ -69,7 +69,7 @@ def compare_with_graylist(dict_a: dict, dict_b: dict, graylist: Set[str]) -> boo return ka == kb and all(dict_a[k] == dict_b[k] for k in ka) -class FactsCollection(object): +class FactsCollection: def __init__(self, facts_dict: FactsDict = None): self.data: FactsDict = facts_dict or FactsDict() self.collection_datetime = datetime.now() diff --git a/src/rhsmlib/facts/collector.py b/src/rhsmlib/facts/collector.py index 398c637f27..d2f04064e3 100644 --- a/src/rhsmlib/facts/collector.py +++ b/src/rhsmlib/facts/collector.py @@ -58,7 +58,7 @@ def get_arch(prefix: str = None) -> str: # An empty FactsCollector should just return an empty dict on get_all() -class FactsCollector(object): +class FactsCollector: def __init__( self, arch: str = None, diff --git a/src/rhsmlib/facts/cpuinfo.py b/src/rhsmlib/facts/cpuinfo.py index 7771d5cde5..8106bc818b 100644 --- a/src/rhsmlib/facts/cpuinfo.py +++ b/src/rhsmlib/facts/cpuinfo.py @@ -107,7 +107,7 @@ log = logging.getLogger("rhsm-app." + __name__) -class DefaultCpuFields(object): +class DefaultCpuFields: """Maps generic cpuinfo fields to the corresponding field from ProcessorModel. For, a cpu MODEL (a number or string that the cpu vendor assigns to that model of @@ -121,23 +121,23 @@ class DefaultCpuFields(object): MODEL: str = "model" -class X86_64Fields(object): +class X86_64Fields: MODEL_NAME: str = "model_name" MODEL: str = "model" -class Aarch64Fields(object): +class Aarch64Fields: MODEL: str = "cpu_part" MODEL_NAME: str = "model_name" -class Ppc64Fields(object): +class Ppc64Fields: MODEL: str = "model" MODEL_NAME: str = "machine" # represent the data in /proc/cpuinfo, which may include multiple processors -class CpuinfoModel(object): +class CpuinfoModel: fields_class: type = DefaultCpuFields def __init__(self, cpuinfo_data: str = None): @@ -347,7 +347,7 @@ def split_kv_list_by_field( """ -class BaseCpuInfo(object): +class BaseCpuInfo: cpu_info: CpuinfoModel @classmethod @@ -473,7 +473,7 @@ def _not_timebase_key(self, item: str) -> bool: return item[0] != "timebase" -class SystemCpuInfoFactory(object): +class SystemCpuInfoFactory: uname_to_cpuinfo: Dict[str, type(BaseCpuInfo)] = { "x86_64": X86_64CpuInfo, "aarch64": Aarch64CpuInfo, diff --git a/src/rhsmlib/facts/custom.py b/src/rhsmlib/facts/custom.py index cdc97cfc6e..cb41f99205 100644 --- a/src/rhsmlib/facts/custom.py +++ b/src/rhsmlib/facts/custom.py @@ -24,7 +24,7 @@ log = logging.getLogger(__name__) -class CustomFacts(object): +class CustomFacts: def __init__(self, data: Dict[str, Any] = None): self.data: Dict[str, Any] = data @@ -52,7 +52,7 @@ class CustomFactsFileError(Exception): pass -class CustomFactsFile(object): +class CustomFactsFile: def __init__(self, path: str = None): self.path: str = path self.buf = None @@ -73,7 +73,7 @@ def close(self) -> None: pass -class CustomFactsDirectory(object): +class CustomFactsDirectory: def __init__(self, path: str = None, glob_pattern: str = None): self.path: str = path self.glob_pattern: str = glob_pattern @@ -94,7 +94,7 @@ def __iter__(self) -> Generator[CustomFacts, None, None]: yield CustomFacts.from_json(fact_file.read()) -class CustomFactsDirectories(object): +class CustomFactsDirectories: def __init__(self, path_and_globs: Dict[str, str]): self.path_and_globs: Dict[str, str] = path_and_globs diff --git a/src/rhsmlib/facts/firmware_info.py b/src/rhsmlib/facts/firmware_info.py index 3b0d5dbb21..6d576b71b4 100644 --- a/src/rhsmlib/facts/firmware_info.py +++ b/src/rhsmlib/facts/firmware_info.py @@ -26,7 +26,7 @@ # This doesn't really do anything other than provide a null/noop provider for # non-DMI platforms. -class NullFirmwareInfoCollector(object): +class NullFirmwareInfoCollector: """Default provider for platform without a specific platform info provider. ie, all platforms except those with DMI (ie, intel platforms)""" diff --git a/src/rhsmlib/facts/hwprobe.py b/src/rhsmlib/facts/hwprobe.py index e9a655d480..0ea16f7720 100644 --- a/src/rhsmlib/facts/hwprobe.py +++ b/src/rhsmlib/facts/hwprobe.py @@ -41,7 +41,7 @@ ethtool = None -class ClassicCheck(object): +class ClassicCheck: def is_registered_with_classic(self) -> bool: try: sys.path.append("/usr/share/rhn") @@ -82,7 +82,7 @@ def gather_entries(entries_string: str) -> List[int]: # FIXME This class does not seem to be used anywhere -class GenericPlatformSpecificInfoProvider(object): +class GenericPlatformSpecificInfoProvider: """Default provider for platform without a specific platform info provider. ie, all platforms except those with DMI (ie, intel platforms)""" diff --git a/src/rhsmlib/file_monitor.py b/src/rhsmlib/file_monitor.py index 90a3b8138c..120891acb7 100644 --- a/src/rhsmlib/file_monitor.py +++ b/src/rhsmlib/file_monitor.py @@ -43,7 +43,7 @@ SYSPURPOSE_WATCHER = "SYSPURPOSE_WATCHER" -class FilesystemWatcher(object): +class FilesystemWatcher: """ Watches a set of directories and notifies when there are changes @@ -233,7 +233,7 @@ def remove_watches(self): self.watch_manager.rm_watch(dir_watch.path, rec=True) -class DirectoryWatch(object): +class DirectoryWatch: """ Directory to be watched diff --git a/src/rhsmlib/services/attach.py b/src/rhsmlib/services/attach.py index 76555676f5..c141da1400 100644 --- a/src/rhsmlib/services/attach.py +++ b/src/rhsmlib/services/attach.py @@ -18,7 +18,7 @@ log = logging.getLogger(__name__) -class AttachService(object): +class AttachService: """ Service using for attach pools by ID or auto-attaching """ diff --git a/src/rhsmlib/services/consumer.py b/src/rhsmlib/services/consumer.py index 71d9fb16af..8d120c43f2 100644 --- a/src/rhsmlib/services/consumer.py +++ b/src/rhsmlib/services/consumer.py @@ -19,7 +19,7 @@ from subscription_manager import injection as inj -class Consumer(object): +class Consumer: def __init__(self) -> None: """ Initialization of Consumer instance. diff --git a/src/rhsmlib/services/entitlement.py b/src/rhsmlib/services/entitlement.py index 98747fc079..5f0d8e1900 100644 --- a/src/rhsmlib/services/entitlement.py +++ b/src/rhsmlib/services/entitlement.py @@ -29,7 +29,7 @@ log = logging.getLogger(__name__) -class EntitlementService(object): +class EntitlementService: def __init__(self, cp: connection.UEPConnection = None) -> None: self.cp = cp self.identity = inj.require(inj.IDENTITY) diff --git a/src/rhsmlib/services/products.py b/src/rhsmlib/services/products.py index b70cf1e950..2b14897b19 100644 --- a/src/rhsmlib/services/products.py +++ b/src/rhsmlib/services/products.py @@ -19,7 +19,7 @@ from subscription_manager import managerlib -class InstalledProducts(object): +class InstalledProducts: """ Class for listing installed products """ diff --git a/src/rhsmlib/services/refresh.py b/src/rhsmlib/services/refresh.py index 190f2d7ba7..6ddc2d57d3 100644 --- a/src/rhsmlib/services/refresh.py +++ b/src/rhsmlib/services/refresh.py @@ -26,7 +26,7 @@ log = logging.getLogger(__name__) -class Refresh(object): +class Refresh: """ Class used for refreshing entitlement certificates """ diff --git a/src/rhsmlib/services/register.py b/src/rhsmlib/services/register.py index 95084738b6..ebc1e1bfb8 100644 --- a/src/rhsmlib/services/register.py +++ b/src/rhsmlib/services/register.py @@ -27,7 +27,7 @@ log = logging.getLogger(__name__) -class RegisterService(object): +class RegisterService: def __init__(self, cp: UEPConnection) -> None: self.plugin_manager = inj.require(inj.PLUGIN_MANAGER) self.installed_mgr = inj.require(inj.INSTALLED_PRODUCTS_MANAGER) diff --git a/src/rhsmlib/services/syspurpose.py b/src/rhsmlib/services/syspurpose.py index f96050c16a..a1697c9245 100644 --- a/src/rhsmlib/services/syspurpose.py +++ b/src/rhsmlib/services/syspurpose.py @@ -34,7 +34,7 @@ log = logging.getLogger(__name__) -class Syspurpose(object): +class Syspurpose: def __init__(self, cp: UEPConnection) -> None: self.cp = cp self.identity = inj.require(inj.IDENTITY) diff --git a/src/rhsmlib/services/unregister.py b/src/rhsmlib/services/unregister.py index 446c3ff0a5..bf46efe9aa 100644 --- a/src/rhsmlib/services/unregister.py +++ b/src/rhsmlib/services/unregister.py @@ -29,7 +29,7 @@ log = logging.getLogger(__name__) -class UnregisterService(object): +class UnregisterService: """ Class providing functionality of unregistering the system from Candlepin server. diff --git a/src/subscription_manager/base_action_client.py b/src/subscription_manager/base_action_client.py index 692a3222d7..7dc2358f15 100644 --- a/src/subscription_manager/base_action_client.py +++ b/src/subscription_manager/base_action_client.py @@ -26,7 +26,7 @@ log = logging.getLogger(__name__) -class BaseActionClient(object): +class BaseActionClient: """ An object used to update the certificates, DNF repos, and facts for the system. """ diff --git a/src/subscription_manager/base_plugin.py b/src/subscription_manager/base_plugin.py index ab27375ce0..473335444d 100644 --- a/src/subscription_manager/base_plugin.py +++ b/src/subscription_manager/base_plugin.py @@ -17,7 +17,7 @@ from subscription_manager.plugins import PluginConfig -class SubManPlugin(object): +class SubManPlugin: """Base class for all subscription-manager "rhsm-plugins" Plugins need to subclass SubManPlugin() to be found diff --git a/src/subscription_manager/branding/__init__.py b/src/subscription_manager/branding/__init__.py index be73a9e010..f435976ced 100644 --- a/src/subscription_manager/branding/__init__.py +++ b/src/subscription_manager/branding/__init__.py @@ -52,7 +52,7 @@ def get_branding(): return _branding -class Branding(object): +class Branding: def __init__(self, custom_branding=None): self._default = DefaultBranding() if custom_branding is None: @@ -66,7 +66,7 @@ def __getattr__(self, x): return getattr(self._default, x) -class DefaultBranding(object): +class DefaultBranding: """ Default branding. values are defined in init to help with i18n/l10n @@ -88,7 +88,7 @@ def __init__(self): self.REGISTERED_TO_SUBSCRIPTION_MANAGEMENT_SUMMARY = _("Red Hat Subscription Management") -class EmptyBranding(object): +class EmptyBranding: """ Empty branding object to use in place of a custom branding (so we always fall back to the defaults. diff --git a/src/subscription_manager/branding/redhat_branding.py b/src/subscription_manager/branding/redhat_branding.py index 5927f6b11d..3d3e314752 100644 --- a/src/subscription_manager/branding/redhat_branding.py +++ b/src/subscription_manager/branding/redhat_branding.py @@ -1,7 +1,7 @@ from subscription_manager.i18n import ugettext as _ -class Branding(object): +class Branding: def __init__(self): self.CLI_REGISTER = _( "Register this system to the Customer Portal or another subscription management service" diff --git a/src/subscription_manager/cache.py b/src/subscription_manager/cache.py index 7b55758b66..ab01ffe371 100644 --- a/src/subscription_manager/cache.py +++ b/src/subscription_manager/cache.py @@ -54,7 +54,7 @@ conf = config.Config(get_config_parser()) -class CacheManager(object): +class CacheManager: """ Parent class used for common logic in a number of collections where we need to push some consumer JSON up to the server, @@ -668,7 +668,7 @@ def _sync_with_server(self, uep: connection.UEPConnection, uuid: str, *args, **k self.server_status = uep.getEntitlementList(uuid) -class PoolTypeCache(object): +class PoolTypeCache: """ Cache type of pool """ @@ -718,7 +718,7 @@ def clear(self) -> None: self.pooltype_map = {} -class ContentAccessCache(object): +class ContentAccessCache: CACHE_FILE = "/var/lib/rhsm/cache/content_access.json" def __init__(self): diff --git a/src/subscription_manager/cert_sorter.py b/src/subscription_manager/cert_sorter.py index bdb885369d..e7009daa1d 100644 --- a/src/subscription_manager/cert_sorter.py +++ b/src/subscription_manager/cert_sorter.py @@ -64,7 +64,7 @@ RHSM_REGISTRATION_REQUIRED = 5 -class ComplianceManager(object): +class ComplianceManager: def __init__(self, on_date: Optional[datetime] = None): self.cp_provider: CPProvider = inj.require(inj.CP_PROVIDER) self.product_dir: ProductDirectory = inj.require(inj.PROD_DIR) @@ -454,7 +454,7 @@ def has_entitlements(self) -> bool: return len(self.entitlement_dir.list()) > 0 -class StackingGroupSorter(object): +class StackingGroupSorter: def __init__(self, entitlements: List["EntitlementCertificate"]): self.groups: List[EntitlementGroup] = [] stacking_groups: Dict[str, EntitlementGroup] = {} @@ -480,7 +480,7 @@ def _get_identity_name(self, entitlement: "EntitlementCertificate"): raise NotImplementedError("Subclasses must implement: _get_identity_name") -class EntitlementGroup(object): +class EntitlementGroup: def __init__(self, entitlement: "EntitlementCertificate", name: str = ""): self.name = name self.entitlements: List[EntitlementCertificate] = [] diff --git a/src/subscription_manager/certdirectory.py b/src/subscription_manager/certdirectory.py index 07c9094dbb..167a057cfd 100644 --- a/src/subscription_manager/certdirectory.py +++ b/src/subscription_manager/certdirectory.py @@ -35,7 +35,7 @@ DEFAULT_PRODUCT_CERT_DIR = "/etc/pki/product-default" -class Directory(object): +class Directory: def __init__(self, path): self.path = Path.abs(path) @@ -352,7 +352,7 @@ def list_serials_for_pool_ids(self, pool_ids: List[str]) -> Dict[str, List[str]] return pool_id_to_serials -class Path(object): +class Path: # Used during Anaconda install by the yum pidplugin to ensure we operate # beneath /mnt/sysimage/ instead of /. @@ -376,7 +376,7 @@ def isdir(cls, path: str) -> bool: return os.path.isdir(path) -class Writer(object): +class Writer: def __init__(self): self.ent_dir: EntitlementDirectory = require(ENT_DIR) diff --git a/src/subscription_manager/certlib.py b/src/subscription_manager/certlib.py index a559877f0b..f2c2837390 100644 --- a/src/subscription_manager/certlib.py +++ b/src/subscription_manager/certlib.py @@ -9,7 +9,7 @@ log = logging.getLogger(__name__) -class Locker(object): +class Locker: def __init__(self): self.lock: ActionLock = self._get_lock() @@ -24,7 +24,7 @@ def _get_lock(self) -> "ActionLock": return inj.require(inj.ACTION_LOCK) -class BaseActionInvoker(object): +class BaseActionInvoker: def __init__(self, locker: Optional[Locker] = None): self.locker = locker or Locker() self.report: Any = None @@ -39,7 +39,7 @@ def _do_update(self): return -class ActionReport(object): +class ActionReport: """Base class for cert lib and action reports""" name: str = "Report" diff --git a/src/subscription_manager/cli.py b/src/subscription_manager/cli.py index 10bd7c8330..da81a65864 100644 --- a/src/subscription_manager/cli.py +++ b/src/subscription_manager/cli.py @@ -45,7 +45,7 @@ def flush_stdout_stderr() -> None: log.error("Error: Unable to print data to stdout/stderr output during exit process: %s" % io_err) -class AbstractCLICommand(object): +class AbstractCLICommand: """ Base class for rt commands. This class provides a templated run strategy. @@ -102,7 +102,7 @@ def _create_argparser(self) -> ArgumentParser: # taken wholseale from rho... -class CLI(object): +class CLI: def __init__(self, command_classes: List[Type[AbstractCLICommand]] = None): command_classes = command_classes or [] self.cli_commands: Dict[str, AbstractCLICommand] = {} diff --git a/src/subscription_manager/content_action_client.py b/src/subscription_manager/content_action_client.py index 50165a0b2b..f7a4e4cc29 100644 --- a/src/subscription_manager/content_action_client.py +++ b/src/subscription_manager/content_action_client.py @@ -47,7 +47,7 @@ def add(self, report: "ActionReport"): self.reports.add(report) -class ContentPluginActionCommand(object): +class ContentPluginActionCommand: """An ActionCommand used to wrap 'content_update' plugin invocations. args: diff --git a/src/subscription_manager/cpuinfo.py b/src/subscription_manager/cpuinfo.py index 70abc4c078..95e7e6c782 100644 --- a/src/subscription_manager/cpuinfo.py +++ b/src/subscription_manager/cpuinfo.py @@ -107,7 +107,7 @@ log = logging.getLogger(__name__) -class DefaultCpuFields(object): +class DefaultCpuFields: """Maps generic cpuinfo fields to the corresponding field from ProcessorModel. For, a cpu MODEL (a number or string that the cpu vendor assigns to that model of @@ -121,23 +121,23 @@ class DefaultCpuFields(object): MODEL = "model" -class X86_64Fields(object): +class X86_64Fields: MODEL_NAME = "model_name" MODEL = "model" -class Aarch64Fields(object): +class Aarch64Fields: MODEL = "cpu_part" MODEL_NAME = "model_name" -class Ppc64Fields(object): +class Ppc64Fields: MODEL = "model" MODEL_NAME = "machine" # represent the data in /proc/cpuinfo, which may include multiple processors -class CpuinfoModel(object): +class CpuinfoModel: fields_class = DefaultCpuFields def __init__(self, cpuinfo_data: Optional[Dict] = None): @@ -348,7 +348,7 @@ def split_kv_list_by_field(kv_list: Sequence[Tuple[str, Any]], field: str) -> It """ -class BaseCpuInfo(object): +class BaseCpuInfo: @classmethod def from_proc_cpuinfo_string(cls: type, proc_cpuinfo_string: str): """Return a BaseCpuInfo subclass based on proc_cpuinfo_string. @@ -470,7 +470,7 @@ def _not_timebase_key(self, item: str) -> bool: return item[0] != "timebase" -class SystemCpuInfoFactory(object): +class SystemCpuInfoFactory: uname_to_cpuinfo = { "x86_64": X86_64CpuInfo, "aarch64": Aarch64CpuInfo, diff --git a/src/subscription_manager/entbranding.py b/src/subscription_manager/entbranding.py index 9bc3d5a0f9..8c0988b953 100644 --- a/src/subscription_manager/entbranding.py +++ b/src/subscription_manager/entbranding.py @@ -25,7 +25,7 @@ log = logging.getLogger(__name__) -class BrandsInstaller(object): +class BrandsInstaller: def __init__(self, ent_certs: Optional[List["EntitlementCertificate"]] = None): self.ent_certs: Optional[List[EntitlementCertificate]] = ent_certs @@ -41,7 +41,7 @@ def install(self) -> None: brand_installer.install() -class BrandInstaller(object): +class BrandInstaller: """Install branding info for a set of entitlement certs.""" def __init__(self, ent_certs: Optional[List["EntitlementCertificate"]] = None): @@ -79,7 +79,7 @@ def _install(self, brand: "Brand") -> None: raise NotImplementedError -class BrandPicker(object): +class BrandPicker: """Returns the branded name to install. Check installed product certs, and the list of entitlement certs @@ -92,7 +92,7 @@ def get_brand(self) -> "Brand": raise NotImplementedError -class Brand(object): +class Brand: """Base class for Brand objects.""" name: Optional[str] = None @@ -166,7 +166,7 @@ def unformat_brand(brand: str) -> Optional[str]: return None -class BrandFile(object): +class BrandFile: """The file used for storing product branding info. Default is "/var/lib/rhsm/branded_name diff --git a/src/subscription_manager/entcertlib.py b/src/subscription_manager/entcertlib.py index c64c1ef2a0..b826bea224 100644 --- a/src/subscription_manager/entcertlib.py +++ b/src/subscription_manager/entcertlib.py @@ -57,7 +57,7 @@ def _do_update(self) -> "EntCertUpdateReport": # NOTE: this lib and EntCertDeleteAction are currently # unused. Intention is to replace managerlib.clean_all_data # with a CertActionClient.delete invocation -class EntCertDeleteLib(object): +class EntCertDeleteLib: """Invoker for entitlement certificate delete actions.""" def __init__(self, serial_numbers=None, ent_dir=None): @@ -73,7 +73,7 @@ def _do_delete(self): # FIXME: currently unused -class EntCertDeleteAction(object): +class EntCertDeleteAction: """Action for deleting all entitlement certs.""" def __init__(self, ent_dir=None): @@ -88,7 +88,7 @@ def perform(self, serial_numbers): return self -class EntCertUpdateAction(object): +class EntCertUpdateAction: """Action for syncing entitlement certificates. EntCertUpdateAction is used to sync entitlement certs based on @@ -338,7 +338,7 @@ def delete(self, rogue: List["EntitlementCertificate"]): self.ent_dir.refresh() -class EntitlementCertBundlesInstaller(object): +class EntitlementCertBundlesInstaller: """Install a list of entitlement cert bundles. pre_install() is triggered before any of the ent cert @@ -381,7 +381,7 @@ def _get_installed(self) -> List["EntitlementCertificate"]: return self.report.added -class EntitlementCertBundleInstaller(object): +class EntitlementCertBundleInstaller: """Install an entitlement cert bundle (cert/key). Split a bundle into an certificate.EntitlementCertificate and a diff --git a/src/subscription_manager/exceptions.py b/src/subscription_manager/exceptions.py index ffd06d971f..79f7bbe2ef 100644 --- a/src/subscription_manager/exceptions.py +++ b/src/subscription_manager/exceptions.py @@ -70,7 +70,7 @@ RESTLIB_MESSAGE = _("{message} (HTTP error code {code}: {title})") -class ExceptionMapper(object): +class ExceptionMapper: def __init__(self): self.message_map: Dict[str, Callable] = { diff --git a/src/subscription_manager/factlib.py b/src/subscription_manager/factlib.py index 7d77b26fae..c496766b86 100644 --- a/src/subscription_manager/factlib.py +++ b/src/subscription_manager/factlib.py @@ -29,7 +29,7 @@ # FactsActionInvoker has a Facts # Facts is a CacheManager -class FactsActionInvoker(object): +class FactsActionInvoker: """Used by CertActionClient to update a system's facts with the server, used primarily by the cron job but in a couple other places as well. @@ -67,7 +67,7 @@ def updates(self) -> int: return len(self.fact_updates) -class FactsActionCommand(object): +class FactsActionCommand: """UpdateAction for facts. Update facts if calculated local facts are different than diff --git a/src/subscription_manager/healinglib.py b/src/subscription_manager/healinglib.py index 42f8ed0cab..baec6fd4d7 100644 --- a/src/subscription_manager/healinglib.py +++ b/src/subscription_manager/healinglib.py @@ -48,7 +48,7 @@ def _do_update(self) -> int: return action.perform() -class HealingUpdateAction(object): +class HealingUpdateAction: """UpdateAction for ent cert healing. Core if entitlement certificate healing. diff --git a/src/subscription_manager/i18n.py b/src/subscription_manager/i18n.py index 255aeeb79d..e0f6a07b98 100644 --- a/src/subscription_manager/i18n.py +++ b/src/subscription_manager/i18n.py @@ -95,7 +95,7 @@ def ungettext(*args, **kwargs) -> str: return TRANSLATION.ngettext(*args, **kwargs) -class Locale(object): +class Locale: """ Class used for changing languages on the fly """ diff --git a/src/subscription_manager/identity.py b/src/subscription_manager/identity.py index 16f3b2bb8c..e6234eee5d 100644 --- a/src/subscription_manager/identity.py +++ b/src/subscription_manager/identity.py @@ -33,7 +33,7 @@ log = logging.getLogger(__name__) -class ConsumerIdentity(object): +class ConsumerIdentity: """Consumer info and certificate information. Includes helpers for reading/writing consumer identity certificates @@ -126,7 +126,7 @@ def __str__(self) -> str: return 'consumer: name="%s", uuid=%s' % (self.getConsumerName(), self.getConsumerId()) -class Identity(object): +class Identity: """Wrapper for sharing consumer identity without constant reloading.""" def __init__(self): diff --git a/src/subscription_manager/identitycertlib.py b/src/subscription_manager/identitycertlib.py index c2daf609bf..8140d4ef90 100644 --- a/src/subscription_manager/identitycertlib.py +++ b/src/subscription_manager/identitycertlib.py @@ -39,7 +39,7 @@ def _do_update(self) -> certlib.ActionReport: return action.perform() -class IdentityUpdateAction(object): +class IdentityUpdateAction: """UpdateAction for consumer identity certificates. Returns a certlib.ActionReport. report.status of diff --git a/src/subscription_manager/injection.py b/src/subscription_manager/injection.py index 9436e29b88..1c4487bde3 100644 --- a/src/subscription_manager/injection.py +++ b/src/subscription_manager/injection.py @@ -40,7 +40,7 @@ SYSTEMPURPOSE_COMPLIANCE_STATUS_CACHE = "SYSTEMPURPOSE_COMPLIANCE_STATUS_CACHE" -class FeatureBroker(object): +class FeatureBroker: """ Tracks all configured features. diff --git a/src/subscription_manager/installedproductslib.py b/src/subscription_manager/installedproductslib.py index 743d64aa99..6cb47fb67e 100644 --- a/src/subscription_manager/installedproductslib.py +++ b/src/subscription_manager/installedproductslib.py @@ -31,7 +31,7 @@ def _do_update(self) -> "InstalledProductsActionReport": return action.perform() -class InstalledProductsActionCommand(object): +class InstalledProductsActionCommand: """Update the consumers installed product list to RHSM API. Returns a InstalledProductsActionReport. diff --git a/src/subscription_manager/jsonwrapper.py b/src/subscription_manager/jsonwrapper.py index c90c351858..91006ccf72 100644 --- a/src/subscription_manager/jsonwrapper.py +++ b/src/subscription_manager/jsonwrapper.py @@ -18,7 +18,7 @@ from subscription_manager.utils import is_true_value -class PoolWrapper(object): +class PoolWrapper: def __init__(self, pool_json: dict): self.data: dict = pool_json diff --git a/src/subscription_manager/listing.py b/src/subscription_manager/listing.py index c630327343..bc90c55461 100644 --- a/src/subscription_manager/listing.py +++ b/src/subscription_manager/listing.py @@ -14,7 +14,7 @@ from typing import List, Optional -class ListingFile(object): +class ListingFile: def __init__(self, data: Optional[str] = None): self.data: Optional[str] = data self.releases: List[str] = [] diff --git a/src/subscription_manager/lock.py b/src/subscription_manager/lock.py index 99be0ff585..738315f60f 100644 --- a/src/subscription_manager/lock.py +++ b/src/subscription_manager/lock.py @@ -28,7 +28,7 @@ LOCK_WAIT_DURATION: float = 0.5 -class LockFile(object): +class LockFile: def __init__(self, path: str): self.path: str = path self.pid: Optional[int] = None @@ -90,7 +90,7 @@ def __del__(self) -> None: self.close() -class Lock(object): +class Lock: mutex = Mutex() diff --git a/src/subscription_manager/managerlib.py b/src/subscription_manager/managerlib.py index 39764d7a15..714ae5b286 100644 --- a/src/subscription_manager/managerlib.py +++ b/src/subscription_manager/managerlib.py @@ -128,7 +128,7 @@ def fetch_certificates(certlib) -> Literal[True]: return True -class PoolFilter(object): +class PoolFilter: """ Helper to filter a list of pools. """ @@ -451,7 +451,7 @@ def get_available_entitlements( return data -class MergedPools(object): +class MergedPools: """ Class to track the view of merged pools for the same product. Used to view total entitlement information across all pools for a @@ -545,7 +545,7 @@ def _get_identity_name(self, merged_pool): return merged_pool.pools[0]["productName"] -class PoolStash(object): +class PoolStash: """ Object used to fetch pools from the server, sort them into compatible, incompatible, and installed lists. Also does filtering based on name. @@ -759,7 +759,7 @@ def lookup_provided_products(self, pool_id: str) -> Optional[List[Tuple[str, str return provided_products -class ImportFileExtractor(object): +class ImportFileExtractor: """ Responsible for checking an import file and pulling cert and key from it. An import file may include only the certificate, but may also include its diff --git a/src/subscription_manager/model/__init__.py b/src/subscription_manager/model/__init__.py index b0ca06ed1d..a7bfbd6925 100644 --- a/src/subscription_manager/model/__init__.py +++ b/src/subscription_manager/model/__init__.py @@ -23,7 +23,7 @@ # be based on containers.abc.Iterable -class Content(object): +class Content: """ A generic representation of entitled content. """ @@ -54,7 +54,7 @@ def __init__( self.arches = arches -class Entitlement(object): +class Entitlement: """Represent an entitlement. Has a 'contents' attribute that is an @@ -69,7 +69,7 @@ def __init__(self, contents=None, entitlement_type=None): self.entitlement_type = entitlement_type -class EntitlementSource(object): +class EntitlementSource: """Populate with info needed for plugins to find content. Acts as a iterable over entitlements. diff --git a/src/subscription_manager/overrides.py b/src/subscription_manager/overrides.py index c0c32c9c44..d6a505e682 100644 --- a/src/subscription_manager/overrides.py +++ b/src/subscription_manager/overrides.py @@ -29,7 +29,7 @@ # Module for manipulating content overrides -class Overrides(object): +class Overrides: def __init__(self): self.cp_provider: CPProvider = inj.require(inj.CP_PROVIDER) @@ -75,7 +75,7 @@ def _getuep(self) -> "UEPConnection": return self.cp_provider.get_consumer_auth_cp() -class Override(object): +class Override: def __init__(self, repo_id: str, name: str, value: Optional[object] = None): self.repo_id: str = repo_id self.name: str = name diff --git a/src/subscription_manager/packageprofilelib.py b/src/subscription_manager/packageprofilelib.py index 21129ef968..faca09920e 100644 --- a/src/subscription_manager/packageprofilelib.py +++ b/src/subscription_manager/packageprofilelib.py @@ -31,7 +31,7 @@ def _do_update(self) -> "PackageProfileActionReport": return action.perform() -class PackageProfileActionCommand(object): +class PackageProfileActionCommand: """Action for updating the list of installed packages to RHSM API, Returns a PackageProfileActionReport. diff --git a/src/subscription_manager/plugin/container/__init__.py b/src/subscription_manager/plugin/container/__init__.py index 359ccd10cc..98217bd1b2 100644 --- a/src/subscription_manager/plugin/container/__init__.py +++ b/src/subscription_manager/plugin/container/__init__.py @@ -31,7 +31,7 @@ RH_CDN_CA = "/etc/rhsm/ca/redhat-entitlement-authority.pem" -class ContainerContentUpdateActionCommand(object): +class ContainerContentUpdateActionCommand: """ UpdateActionCommand for Docker configuration. @@ -74,7 +74,7 @@ def _get_unique_paths(self, content_sets): return unique_cert_paths -class KeyPair(object): +class KeyPair: """Simple object to hold paths to an entitlement cert and key.""" def __init__(self, cert_path, key_path): @@ -108,7 +108,7 @@ def __hash__(self): return hash(self.__repr__()) -class ContainerCertDir(object): +class ContainerCertDir: """ An object to manage the docker certificate directory at /etc/docker/certs.d/. diff --git a/src/subscription_manager/plugin/ostree/action_invoker.py b/src/subscription_manager/plugin/ostree/action_invoker.py index ff154d676d..10ea0e0416 100644 --- a/src/subscription_manager/plugin/ostree/action_invoker.py +++ b/src/subscription_manager/plugin/ostree/action_invoker.py @@ -28,7 +28,7 @@ OSTREE_CONTENT_TYPE = "ostree" -class OstreeContentUpdateActionCommand(object): +class OstreeContentUpdateActionCommand: """UpdateActionCommand for ostree repos. Update the repo configuration for rpm-ostree when triggered. diff --git a/src/subscription_manager/plugin/ostree/config.py b/src/subscription_manager/plugin/ostree/config.py index ae379ebc71..19192a7678 100644 --- a/src/subscription_manager/plugin/ostree/config.py +++ b/src/subscription_manager/plugin/ostree/config.py @@ -118,7 +118,7 @@ def save(self, config_file=None): super(KeyFileConfigParser, self).save() -class BaseOstreeConfigFile(object): +class BaseOstreeConfigFile: config_parser_class = KeyFileConfigParser def __init__(self, filename=None): diff --git a/src/subscription_manager/plugin/ostree/model.py b/src/subscription_manager/plugin/ostree/model.py index 2c6ec69b4d..9063225801 100644 --- a/src/subscription_manager/plugin/ostree/model.py +++ b/src/subscription_manager/plugin/ostree/model.py @@ -42,7 +42,7 @@ def __init__(self, msg=None, section=None): self.section = section -class OstreeRemote(object): +class OstreeRemote: """Represent a ostree repo remote. A repo remote is one of the the '[remote "ostree-awesomeos-8"]' section in @@ -238,7 +238,7 @@ def report(self): return self.report_template.format(self=self) -class OstreeRemotes(object): +class OstreeRemotes: """A container/set of OstreeRemote objects. Representing OstreeRemote's as found in the repo configs, or @@ -281,7 +281,7 @@ def __str__(self): return s -class OstreeConfigFileStore(object): +class OstreeConfigFileStore: """For loading/saving a ostree remotes repo config file.""" default_repo_file_path = OSTREE_REPO_CONFIG_PATH @@ -303,7 +303,7 @@ def save(self, ostree_config): # persist OstreeConfig object to a config file -class OstreeConfigFileWriter(object): +class OstreeConfigFileWriter: """Populate config file parser with infrom from OstreeConfig and save.""" def __init__(self, repo_file): @@ -336,7 +336,7 @@ def update_core(self, ostree_config): self.repo_file.set_core(ostree_config.core) -class OstreeConfigUpdatesBuilder(object): +class OstreeConfigUpdatesBuilder: def __init__(self, ostree_config, contents): self.orig_ostree_config = ostree_config self.contents = contents @@ -382,7 +382,7 @@ class OstreeCore(dict): pass -class OstreeConfig(object): +class OstreeConfig: """Represents the config state of the systems ostree tool. Config file loading and parsing will create one of these and populate it @@ -448,7 +448,7 @@ class OstreeRepoConfig(OstreeConfig): default_repo_file_path = OSTREE_REPO_CONFIG_PATH -class OstreeConfigUpdates(object): +class OstreeConfigUpdates: """The info a ostree update action needs to update OstreeConfig. remote sets, branches, etc. diff --git a/src/subscription_manager/plugins.py b/src/subscription_manager/plugins.py index 5b941ab20f..d5477b8896 100644 --- a/src/subscription_manager/plugins.py +++ b/src/subscription_manager/plugins.py @@ -133,7 +133,7 @@ def __str__(self): return "slot name %s does not have a conduit to handle it" % self.slot_name -class BaseConduit(object): +class BaseConduit: """An API entry point for rhsm plugins. Conduit()'s are used to provide access to the data a SubManPlugin may need. @@ -429,7 +429,7 @@ def __init__(self, clazz: Type[SubManPlugin], consumer_uuid: str, entitlement_da super(PostAutoAttachConduit, self).__init__(clazz, consumer_uuid, entitlement_data) -class PluginConfig(object): +class PluginConfig: """Represents configuation for each rhsm plugin. Attributes: @@ -493,7 +493,7 @@ def __str__(self) -> str: return buf -class PluginHookRunner(object): +class PluginHookRunner: """Encapsulates a Conduit() instance and a bound plugin method. PluginManager.runiter() returns an iterable that will yield @@ -514,7 +514,7 @@ def run(self) -> None: # NOTE: need to be super paranoid here about existing of cfg variables # BasePluginManager with our default config info -class BasePluginManager(object): +class BasePluginManager: """Finds, load, and provides access to subscription-manager plugins.""" def __init__(self, search_path: Optional[str] = None, plugin_conf_path: Optional[str] = None): diff --git a/src/subscription_manager/productid.py b/src/subscription_manager/productid.py index 1da5da3ef1..0a564f7c4a 100644 --- a/src/subscription_manager/productid.py +++ b/src/subscription_manager/productid.py @@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs): # FIXME Missing super() call -class ProductDatabase(object): +class ProductDatabase: def __init__(self): self.dir = DatabaseDirectory() self.content = ProductIdRepoMap() @@ -108,7 +108,7 @@ def __fn(self) -> str: return self.dir.abspath("productid.js") -class ComparableMixin(object): +class ComparableMixin: """Needs compare_keys to be implemented.""" # FIXME self.compare_keys should be defined here, raising NotImplementedError @@ -135,7 +135,7 @@ def __ge__(self, other): return self._compare(self.compare_keys(other), lambda s, o: s >= o) -class RpmVersion(object): +class RpmVersion: """Represent the epoch, version, release of a rpm style version. This includes the rich comparison methods to support >,<,==,!- @@ -273,7 +273,7 @@ def compare_keys(self, other): return self.comp_product.compare_keys(other.comp_product) -class ProductId(object): +class ProductId: def __init__(self, product_cert): self.product_cert = product_cert @@ -293,7 +293,7 @@ def remove(self): # def compare(self, other): # version check? -class ProductManager(object): +class ProductManager: """Manager product certs, detecting when they need to be installed, or deleted. Note that this class has no knowledge of when it runs, and no nothing of the diff --git a/src/subscription_manager/reasons.py b/src/subscription_manager/reasons.py index 8080eb02c8..a89d376b20 100644 --- a/src/subscription_manager/reasons.py +++ b/src/subscription_manager/reasons.py @@ -16,7 +16,7 @@ from subscription_manager.i18n import ugettext as _ -class Reasons(object): +class Reasons: """ Holds reasons and parses them for the client. diff --git a/src/subscription_manager/release.py b/src/subscription_manager/release.py index 3b90da59bf..1d81abf3af 100644 --- a/src/subscription_manager/release.py +++ b/src/subscription_manager/release.py @@ -61,12 +61,12 @@ def translated_message(self) -> str: ) % ", ".join([certificate.path for certificate in self.certificates]) -class ContentConnectionProvider(object): +class ContentConnectionProvider: def __init__(self): pass -class ReleaseBackend(object): +class ReleaseBackend: def get_releases(self): provider: CdnReleaseVersionProvider = self._get_release_version_provider() return provider.get_releases() @@ -78,7 +78,7 @@ def _get_release_version_provider(self): return CdnReleaseVersionProvider() -class ApiReleaseVersionProvider(object): +class ApiReleaseVersionProvider: def __init__(self): self.cp_provider = inj.require(inj.CP_PROVIDER) self.identity = inj.require(inj.IDENTITY) @@ -93,7 +93,7 @@ def _conn(self): return self.cp_provider.get_consumer_auth_cp() -class CdnReleaseVersionProvider(object): +class CdnReleaseVersionProvider: def __init__(self): self.entitlement_dir: EntitlementDirectory = inj.require(inj.ENT_DIR) self.product_dir: ProductDirectory = inj.require(inj.PROD_DIR) diff --git a/src/subscription_manager/repofile.py b/src/subscription_manager/repofile.py index 82ae663b00..9bc0a35f17 100644 --- a/src/subscription_manager/repofile.py +++ b/src/subscription_manager/repofile.py @@ -285,7 +285,7 @@ def manage_repos_enabled() -> bool: return bool(manage_repos) -class TidyWriter(object): +class TidyWriter: """ ini file reader that removes successive newlines, @@ -329,7 +329,7 @@ def close(self) -> None: self.backing_file.write("\n") -class RepoFileBase(object): +class RepoFileBase: """ Base class for managing repository. """ diff --git a/src/subscription_manager/repolib.py b/src/subscription_manager/repolib.py index 91c7f70537..75e7bb3ba8 100644 --- a/src/subscription_manager/repolib.py +++ b/src/subscription_manager/repolib.py @@ -53,7 +53,7 @@ ALLOWED_CONTENT_TYPES = ["yum", "deb"] -class YumPluginManager(object): +class YumPluginManager: """ Instance of this class is used for automatic enabling of dnf plugins (formerly for yum plugins, hence the name). @@ -258,7 +258,7 @@ def delete_repo_file(cls) -> None: # just the marker, and get_expansion would change # # For example, for full craziness, we could expand facts in urls... -class YumReleaseverSource(object): +class YumReleaseverSource: """ Contains a ReleaseStatusCache and releasever helpers. @@ -332,7 +332,7 @@ def get_expansion(self) -> str: return self._expansion -class RepoUpdateActionCommand(object): +class RepoUpdateActionCommand: """UpdateAction for yum repos. Update yum repos when triggered. Generates yum repo config diff --git a/src/subscription_manager/rhelproduct.py b/src/subscription_manager/rhelproduct.py index b39a17ece8..260fcf1eb4 100644 --- a/src/subscription_manager/rhelproduct.py +++ b/src/subscription_manager/rhelproduct.py @@ -30,7 +30,7 @@ from rhsm.certificate2 import Product -class RHELProductMatcher(object): +class RHELProductMatcher: """Check a Product object to see if it is a RHEL product. Compares the provided tags to see if any provide 'rhel-VERSION'. diff --git a/src/subscription_manager/syspurposelib.py b/src/subscription_manager/syspurposelib.py index 91c09952f1..d26482fc05 100644 --- a/src/subscription_manager/syspurposelib.py +++ b/src/subscription_manager/syspurposelib.py @@ -242,7 +242,7 @@ def format_exceptions(self) -> str: return buf -class SyspurposeSyncActionCommand(object): +class SyspurposeSyncActionCommand: """ Sync the system purpose values, by performing a three-way merge between: - The last known shared state (SyspurposeCache) diff --git a/src/subscription_manager/utils.py b/src/subscription_manager/utils.py index 640fce0b3e..724f1a3aad 100644 --- a/src/subscription_manager/utils.py +++ b/src/subscription_manager/utils.py @@ -403,7 +403,7 @@ def chroot(dirname: str) -> None: Path.ROOT = dirname -class CertificateFilter(object): +class CertificateFilter: def match(self, cert: "EntitlementCertificate"): """ Checks if the specified certificate matches this filter's restrictions. diff --git a/src/subscription_manager/validity.py b/src/subscription_manager/validity.py index bd2dd7a367..88a20f87ed 100644 --- a/src/subscription_manager/validity.py +++ b/src/subscription_manager/validity.py @@ -28,7 +28,7 @@ log = logging.getLogger(__name__) -class ValidProductDateRangeCalculator(object): +class ValidProductDateRangeCalculator: def __init__(self, uep: Optional["UEPConnection"] = None): uep = uep or inj.require(inj.CP_PROVIDER).get_consumer_auth_cp() self.identity: Identity = inj.require(inj.IDENTITY) diff --git a/src/syspurpose/files.py b/src/syspurpose/files.py index 34399f51ba..b7d7e47c07 100644 --- a/src/syspurpose/files.py +++ b/src/syspurpose/files.py @@ -73,7 +73,7 @@ def post_process_received_data(data: dict) -> dict: return data -class SyspurposeStore(object): +class SyspurposeStore: """ Represents and maintains a json syspurpose file """ @@ -222,7 +222,7 @@ def read(cls, path: str, raise_on_error: bool = False) -> "SyspurposeStore": return new_store -class SyncResult(object): +class SyncResult: """ A container class for the results of a sync operation performed by a SyncedStore class. """ @@ -234,7 +234,7 @@ def __init__(self, result, remote_changed, local_changed, cached_changed): self.cached_changed = cached_changed -class SyncedStore(object): +class SyncedStore: """ Stores values in a local file backed by a cache which is then synced with another source of the same values. diff --git a/test/fixture.py b/test/fixture.py index 80e37018f4..a93bc7dbd2 100644 --- a/test/fixture.py +++ b/test/fixture.py @@ -91,7 +91,7 @@ def locale_context(new_locale, category=None): locale.setlocale(category, old_locale) -class FakeLogger(object): +class FakeLogger: def __init__(self): self.expected_msg = "" self.msg = None @@ -124,7 +124,7 @@ def __str__(self): return repr(self.msg) -class Matcher(object): +class Matcher: @staticmethod def set_eq(first, second): """Useful for dealing with sets that have been cast to or instantiated as lists.""" @@ -330,8 +330,8 @@ def assert_items_equals(self, a, b): return True -class Capture(object): - class Tee(object): +class Capture: + class Tee: def __init__(self, stream, silent): self.buf = io.StringIO() self.stream = stream diff --git a/test/plugins/dummy_plugin.py b/test/plugins/dummy_plugin.py index 6e8c09909e..ad64b9462b 100644 --- a/test/plugins/dummy_plugin.py +++ b/test/plugins/dummy_plugin.py @@ -12,5 +12,5 @@ def post_product_id_install_hook(self, conduit): conduit.log.error("Hello World") -class DontImportMe(object): +class DontImportMe: pass diff --git a/test/rhsmlib/base.py b/test/rhsmlib/base.py index 3eec4b79ff..295990863c 100644 --- a/test/rhsmlib/base.py +++ b/test/rhsmlib/base.py @@ -37,7 +37,7 @@ log = logging.getLogger(__name__) -class TestUtilsMixin(object): +class TestUtilsMixin: def assert_items_equals(self, a, b): """Assert that two lists contain the same items regardless of order.""" if sorted(a) != sorted(b): diff --git a/test/stubs.py b/test/stubs.py index 3879199fa3..f4431680ba 100644 --- a/test/stubs.py +++ b/test/stubs.py @@ -428,7 +428,7 @@ def refresh(self): pass -class StubConsumerIdentity(object): +class StubConsumerIdentity: CONSUMER_NAME = "John Q Consumer" CONSUMER_ID = "211211381984" SERIAL = "23234523452345234523453453434534534" @@ -467,7 +467,7 @@ def keypath(cls): return "" -class StubUEP(object): +class StubUEP: def __init__( self, host=None, @@ -601,7 +601,7 @@ def getOwnerSyspurposeValidFields(self, owner_key): } -class StubBackend(object): +class StubBackend: def __init__(self, uep=None): self.cp_provider = StubCPProvider() self.entitlement_dir = None @@ -618,7 +618,7 @@ def update(self): pass -class StubContentConnection(object): +class StubContentConnection: proxy_hostname = None proxy_port = None @@ -652,7 +652,7 @@ def delete_cache(self): self.server_status = None -class StubConsumer(object): +class StubConsumer: def __init__(self): self.uuid = None @@ -666,7 +666,7 @@ def getConsumerId(self): return "12341234234" -class StubEntActionInvoker(object): +class StubEntActionInvoker: def __init__(self, uep=None): self.uep = uep or StubUEP() @@ -687,7 +687,7 @@ def _parse_server_status(self): pass -class StubCPProvider(object): +class StubCPProvider: def __init__(self): self.cert_file = StubConsumerIdentity.certpath() self.key_file = StubConsumerIdentity.keypath() @@ -818,7 +818,7 @@ def delete_cache(self): self.server_status = None -class StubPool(object): +class StubPool: def __init__(self, poolid): self.id = poolid diff --git a/test/test_branding.py b/test/test_branding.py index a6c1f7ffde..92f0df1f58 100644 --- a/test/test_branding.py +++ b/test/test_branding.py @@ -16,7 +16,7 @@ from subscription_manager.branding import Branding -class TestBranding(object): +class TestBranding: def __init__(self): self.CLI_REGISTER = "register with awesomeness" diff --git a/test/test_cache.py b/test/test_cache.py index bbbc979e10..9b284ed1ee 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -60,7 +60,7 @@ log = logging.getLogger(__name__) -class _FACT_MATCHER(object): +class _FACT_MATCHER: def __eq__(self, other): return True diff --git a/test/test_managerlib.py b/test/test_managerlib.py index 6000bea715..f7ec64a526 100644 --- a/test/test_managerlib.py +++ b/test/test_managerlib.py @@ -695,7 +695,7 @@ def _create_pool( return pool -class MockLog(object): +class MockLog: def info(self): pass diff --git a/test/test_model.py b/test/test_model.py index d76f3139b0..672cc6f279 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -59,7 +59,7 @@ def test_contents(self): self.assertTrue(isinstance(e.contents[0], mock.Mock)) -class EntitlementSourceBuilder(object): +class EntitlementSourceBuilder: def contents_list(self, name): return [self.mock_content(name), self.mock_content(name)] diff --git a/test/test_ostree_content_plugin.py b/test/test_ostree_content_plugin.py index 94a9aa9078..700507278b 100644 --- a/test/test_ostree_content_plugin.py +++ b/test/test_ostree_content_plugin.py @@ -23,7 +23,7 @@ from rhsm import certificate2 -class StubPluginManager(object): +class StubPluginManager: pass diff --git a/test/test_plugins.py b/test/test_plugins.py index b5b3974829..e58c0827df 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -247,7 +247,7 @@ def test_unrelated_classes(self): mock_module = mock.Mock() mock_module.__name__ = "mock_module" - class NotAPluginClass(object): + class NotAPluginClass: pass mock_module.NotAPluginClass = NotAPluginClass @@ -830,7 +830,7 @@ def test_dummy_runiter(self): runner.run() def test_iter_wrapper(self): - class Wrapper(object): + class Wrapper: def __init__(self, runner): self.runner = runner self.runner_func = self.runner.func