Do not subclass object

This commit is contained in:
Dennis Camera 2020-06-20 21:16:23 +02:00
parent 955243a93b
commit ce07021580
18 changed files with 19 additions and 22 deletions

View file

@ -70,7 +70,7 @@ def _graph_dfs_cycle(graph, node, path):
return False
class Config(object):
class Config:
"""Cdist main class to hold arbitrary data"""
# list of paths (files and/or directories) that will be removed on finish

View file

@ -47,7 +47,7 @@ class MissingObjectIdError(cdist.Error):
return '%s' % (self.message)
class CdistObject(object):
class CdistObject:
"""Represents a cdist object.
All interaction with objects in cdist should be done through this class.

View file

@ -38,7 +38,7 @@ class InvalidTypeError(cdist.Error):
self.type_path, self.type_absolute_path, self.source_path)
class CdistType(object):
class CdistType:
"""Represents a cdist type.
All interaction with types in cdist should be done through this class.

View file

@ -92,7 +92,7 @@ code-remote
'''
class Code(object):
class Code:
"""Generates and executes cdist code scripts.
"""

View file

@ -63,7 +63,7 @@ type explorer is:
'''
class Explorer(object):
class Explorer:
"""Executes cdist explorers.
"""

View file

@ -92,7 +92,7 @@ class NoInitialManifestError(cdist.Error):
return repr(self.message)
class Manifest(object):
class Manifest:
"""Executes cdist manifests.
"""

View file

@ -56,7 +56,7 @@ class DefaultList(list):
return cls(initial.split('\n'))
class Emulator(object):
class Emulator:
def __init__(self, argv, stdin=sys.stdin.buffer, env=os.environ):
self.argv = argv
self.stdin = stdin

View file

@ -39,7 +39,7 @@ import cdist.exec.util as util
CONF_SUBDIRS_LINKED = ["explorer", "files", "manifest", "type", ]
class Local(object):
class Local:
"""Execute commands locally.
All interaction with the local side should be done through this class.

View file

@ -49,7 +49,7 @@ class DecodeError(cdist.Error):
return "Cannot decode output of " + " ".join(self.command)
class Remote(object):
class Remote:
"""Execute commands remotely.
All interaction with the remote side should be done through this class.

View file

@ -41,7 +41,7 @@ def hostfile_process_line(line, strip_func=str.strip):
return None
class HostSource(object):
class HostSource:
"""
Host source object.
Source can be a sequence or filename (stdin if \'-\').

View file

@ -29,8 +29,7 @@ import glob
import fnmatch
class Info(object):
class Info:
def __init__(self, conf_dirs, args):
self.conf_dirs = conf_dirs
self.all = args.all

View file

@ -80,7 +80,7 @@ def rstrip_nl(s):
return str.rstrip(s, "\n")
class Inventory(object):
class Inventory:
"""Inventory main class"""
def __init__(self, db_basedir=dist_inventory_db, configuration=None):

View file

@ -27,7 +27,7 @@ import tempfile
log = logging.getLogger(__name__)
class Message(object):
class Message:
"""Support messaging between types
"""

View file

@ -78,7 +78,7 @@ def get_available_preoses_string(cls):
return "Available PreOS-es:\n{}".format("\n".join(preoses))
class PreOS(object):
class PreOS:
preoses = None
@classmethod

View file

@ -31,7 +31,7 @@ import os
import subprocess
class Debian(object):
class Debian:
_preos_name = 'debian'
_cdist_preos = True

View file

@ -32,10 +32,8 @@ import cdist.config
log = logging.getLogger(__name__)
class Shell(object):
class Shell:
def __init__(self, shell=None):
self.shell = shell
self.target_host = (

View file

@ -44,7 +44,7 @@ expected_object_names = sorted([
'__third/moon'])
class CdistObjectErrorContext(object):
class CdistObjectErrorContext:
def __init__(self, original_error):
self.original_error = original_error

View file

@ -177,7 +177,7 @@ class DirectoryDict(collections.MutableMapping):
raise cdist.Error(str(e))
class FileBasedProperty(object):
class FileBasedProperty:
attribute_class = None
def __init__(self, path):
@ -189,7 +189,7 @@ class FileBasedProperty(object):
Usage with a sublcass:
class Foo(object):
class Foo:
# note that the actual DirectoryDict is stored as __parameters
# on the instance
parameters = DirectoryDictProperty(