未验证 提交 5103a965 编写于 作者: A Ansgar

do not explicitly inherit from `object` in class definitions

Expliclty inheriting from `object` was needed in Python 2 for
new-style classes, but is no longer needed in Python 3 where all
classes implicitly inherit from `object`.
上级 b7efeb1f
......@@ -68,7 +68,7 @@ arguments = [('s', 'simulate', 'BtsCategorize::Options::Simulate'),
('h', 'help', 'BtsCategorize::Options::Help')]
class BugClassifier(object):
class BugClassifier:
"""
classify bugs using usertags based on the bug subject lines
......
......@@ -53,7 +53,7 @@ should be given as lines of the form 'PACKAGE KEY VALUE'.
#############################################################################
class ExternalOverrideReader(object):
class ExternalOverrideReader:
"""
Parses an external override file
"""
......
......@@ -106,7 +106,7 @@ def sign_release_dir(suite, dirname):
daklib.gpg.sign(stdin, stdout, inline=True, **args)
class XzFile(object):
class XzFile:
def __init__(self, filename, mode='r'):
self.filename = filename
......@@ -115,7 +115,7 @@ class XzFile(object):
return subprocess.check_output(['xz', '-d'], stdin=stdin)
class HashFunc(object):
class HashFunc:
def __init__(self, release_field, func, db_name):
self.release_field = release_field
self.func = func
......@@ -129,7 +129,7 @@ RELEASE_HASHES = [
]
class ReleaseWriter(object):
class ReleaseWriter:
def __init__(self, suite):
self.suite = suite
......
......@@ -56,7 +56,7 @@ def usage():
sys.exit(0)
class SuiteUpdater(object):
class SuiteUpdater:
def __init__(self, transaction, origin, target,
new_packages=True, also_from_policy_queue=False,
obey_policy_queue=True, obey_build_queues=True,
......
......@@ -26,7 +26,7 @@ from daklib.textutils import fix_maintainer
from daklib.utils import mail_addresses_for_upload, TemplateSubst, send_mail
class ProcessedUpload(object):
class ProcessedUpload:
"""Contains data of a processed upload.
"""
# people
......
......@@ -17,7 +17,7 @@
import apt_pkg
class AptVersion(object):
class AptVersion:
def __init__(self, version):
self.version = version
......
......@@ -46,7 +46,7 @@ class HashMismatchException(ArchiveException):
pass
class ArchiveTransaction(object):
class ArchiveTransaction:
"""manipulate the archive in a transaction
"""
......@@ -585,7 +585,7 @@ def source_component_from_package_list(package_list, suite):
return query.first()
class ArchiveUpload(object):
class ArchiveUpload:
"""handle an upload
This class can be used in a with-statement::
......
......@@ -78,7 +78,7 @@ class RejectACL(Reject):
return "ACL {0}: {1}".format(self.acl.name, self.reason)
class Check(object):
class Check:
"""base class for checks
checks are called by L{daklib.archive.ArchiveUpload}. Failing tests should
......@@ -472,7 +472,7 @@ class BinaryTimestampCheck(Check):
future_cutoff = time.time() + cnf.find_i('Dinstall::FutureTimeTravelGrace', 24 * 3600)
past_cutoff = time.mktime(time.strptime(cnf.find('Dinstall::PastCutoffYear', '1975'), '%Y'))
class TarTime(object):
class TarTime:
def __init__(self):
self.future_files = dict()
self.past_files = dict()
......
......@@ -37,7 +37,7 @@ class CommandError(Exception):
pass
class CommandFile(object):
class CommandFile:
def __init__(self, filename: str, data: bytes, log=None):
if log is None:
from daklib.daklog import Logger
......
......@@ -47,7 +47,7 @@ def which_conf_file():
return os.getenv("DAK_CONFIG", default_config)
class Config(object):
class Config:
"""
A Config object is a singleton containing
information about the DAK configuration
......
......@@ -37,7 +37,7 @@ import os.path
import sqlalchemy.sql as sql
class BinaryContentsWriter(object):
class BinaryContentsWriter:
'''
BinaryContentsWriter writes the Contents-$arch.gz files.
'''
......@@ -148,7 +148,7 @@ select bc.file, string_agg(o.section || '/' || b.package, ',' order by b.package
writer.close()
class SourceContentsWriter(object):
class SourceContentsWriter:
'''
SourceContentsWriter writes the Contents-source.gz files.
'''
......@@ -266,7 +266,7 @@ def source_helper(suite_id, component_id):
return log_message
class ContentsWriter(object):
class ContentsWriter:
'''
Loop over all suites, architectures, overridetypes, and components to write
all contents files.
......@@ -330,7 +330,7 @@ class ContentsWriter(object):
session.close()
class BinaryContentsScanner(object):
class BinaryContentsScanner:
'''
BinaryContentsScanner provides a threadsafe method scan() to scan the
contents of a DBBinary object.
......@@ -394,7 +394,7 @@ def binary_scan_helper(binary_id):
print("binary_scan_helper raised an exception: %s" % (e))
class UnpackedSource(object):
class UnpackedSource:
'''
UnpackedSource extracts a source package into a temporary location and
gives you some convinient function for accessing it.
......@@ -445,7 +445,7 @@ class UnpackedSource(object):
self.cleanup()
class SourceContentsScanner(object):
class SourceContentsScanner:
'''
SourceContentsScanner provides a method scan() to scan the contents of a
DBSource object.
......
......@@ -143,7 +143,7 @@ def get_package_names(suite):
group_by(DBBinary.package).order_by(DBBinary.package)
class NamedSource(object):
class NamedSource:
'''
A source package identified by its name with all of its versions in a
suite.
......@@ -159,7 +159,7 @@ class NamedSource(object):
return "%s(%s)" % (self.source, ", ".join(self.versions))
class DejavuBinary(object):
class DejavuBinary:
'''
A binary package identified by its name which gets built by multiple source
packages in a suite. The architecture is ignored which leads to the
......
......@@ -23,7 +23,7 @@ interfaces around python-apt
import apt_pkg
class DakHashes(object):
class DakHashes:
"""
wrapper around `apt_pkg.Hashes`
"""
......
......@@ -32,7 +32,7 @@ from . import utils
################################################################################
class Logger(object):
class Logger:
"Logger object"
__shared_state = {}
......
......@@ -149,7 +149,7 @@ __all__.append('session_wrapper')
################################################################################
class ORMObject(object):
class ORMObject:
"""
ORMObject is a base class for all ORM classes mapped by SQLalchemy. All
derived classes must implement the properties() method.
......@@ -301,7 +301,7 @@ __all__.append('get_architecture')
################################################################################
class Archive(object):
class Archive:
def __init__(self, *args, **kwargs):
pass
......@@ -339,7 +339,7 @@ __all__.append('get_archive')
################################################################################
class ArchiveFile(object):
class ArchiveFile:
def __init__(self, archive=None, component=None, file=None):
self.archive = archive
self.component = component
......@@ -508,7 +508,7 @@ __all__.append('get_component_by_package_suite')
################################################################################
class BuildQueue(object):
class BuildQueue:
def __init__(self, *args, **kwargs):
pass
......@@ -626,7 +626,7 @@ __all__.append('get_component_names')
################################################################################
class DBConfig(object):
class DBConfig:
def __init__(self, *args, **kwargs):
pass
......@@ -639,7 +639,7 @@ __all__.append('DBConfig')
################################################################################
class DSCFile(object):
class DSCFile:
def __init__(self, *args, **kwargs):
pass
......@@ -826,7 +826,7 @@ def get_ldap_name(entry):
################################################################################
class Keyring(object):
class Keyring:
keys = {}
fpr_lookup = {}
......@@ -989,7 +989,7 @@ __all__.append('get_active_keyring_paths')
################################################################################
class DBChange(object):
class DBChange:
def __init__(self, *args, **kwargs):
pass
......@@ -1099,7 +1099,7 @@ __all__.append('get_maintainer')
################################################################################
class NewComment(object):
class NewComment:
def __init__(self, *args, **kwargs):
pass
......@@ -1286,7 +1286,7 @@ __all__.append('get_override_type')
################################################################################
class PolicyQueue(object):
class PolicyQueue:
def __init__(self, *args, **kwargs):
pass
......@@ -1323,7 +1323,7 @@ __all__.append('get_policy_queue')
@functools.total_ordering
class PolicyQueueUpload(object):
class PolicyQueueUpload:
def _key(self):
return (
self.changes.source,
......@@ -1344,7 +1344,7 @@ __all__.append('PolicyQueueUpload')
################################################################################
class PolicyQueueByhandFile(object):
class PolicyQueueByhandFile:
pass
......@@ -1668,7 +1668,7 @@ __all__.append('import_metadata_into_db')
################################################################################
class SrcFormat(object):
class SrcFormat:
def __init__(self, *args, **kwargs):
pass
......@@ -2030,7 +2030,7 @@ __all__.append('SourceMetadata')
################################################################################
class MetadataProxy(object):
class MetadataProxy:
def __init__(self, session, query):
self.session = session
self.query = query
......@@ -2091,7 +2091,7 @@ __all__.append('get_version_checks')
################################################################################
class DBConn(object):
class DBConn:
"""
database module init.
"""
......
......@@ -30,7 +30,7 @@ import os.path
import subprocess
class CompressionMethod(object):
class CompressionMethod:
def __init__(self, keyword, extension, command):
self.keyword = keyword
self.extension = extension
......@@ -47,7 +47,7 @@ _compression_methods = (
)
class BaseFileWriter(object):
class BaseFileWriter:
'''
Base class for compressed and uncompressed file writing.
'''
......
......@@ -22,7 +22,7 @@ import shutil
import six
class _FilesystemAction(object):
class _FilesystemAction:
@property
def temporary_name(self):
raise NotImplementedError()
......@@ -122,7 +122,7 @@ class _FilesystemCreateAction(_FilesystemAction):
self.need_cleanup = False
class FilesystemTransaction(object):
class FilesystemTransaction:
"""transactions for filesystem actions"""
def __init__(self):
......
......@@ -36,7 +36,7 @@ class GpgException(Exception):
pass
class _Pipe(object):
class _Pipe:
"""context manager for pipes
Note: When the pipe is closed by other means than the close_r and close_w
......@@ -65,7 +65,7 @@ class _Pipe(object):
self.w = None
class SignedFile(object):
class SignedFile:
"""handle files signed with PGP
The following attributes are available:
......
......@@ -38,7 +38,7 @@ from sqlalchemy.orm import object_session
_release_hashes_fields = ('MD5Sum', 'SHA1', 'SHA256')
class Release(object):
class Release:
def __init__(self, base, suite_name, data):
self._base = base
self._suite_name = suite_name
......@@ -70,7 +70,7 @@ class Release(object):
# a newer version than before
class File(object):
class File:
def __init__(self):
config = daklib.config.Config()
self._tmp = tempfile.NamedTemporaryFile(dir=config['Dir::TempPath'])
......
......@@ -26,7 +26,7 @@ class InvalidSource(Exception):
pass
class PackageListEntry(object):
class PackageListEntry:
def __init__(self, name, package_type, section, component, priority, **other):
self.name = name
self.type = package_type
......@@ -75,7 +75,7 @@ class PackageListEntry(object):
)
class PackageList(object):
class PackageList:
def __init__(self, source):
if 'Package-List' in source:
self._parse(source)
......
......@@ -177,7 +177,7 @@ def _read_hashes(history, history_order, ind, hashind, lines):
return current_order[-patches_from_the_end:]
class PDiffIndex(object):
class PDiffIndex:
def __init__(self, patches_dir, max=56, merge_pdiffs=False):
self.can_path = None
self._history = {}
......
......@@ -28,7 +28,7 @@ import os
import shutil
class UploadCopy(object):
class UploadCopy:
"""export a policy queue upload
This class can be used in a with-statement::
......@@ -120,7 +120,7 @@ class UploadCopy(object):
return None
class PolicyQueueUploadHandler(object):
class PolicyQueueUploadHandler:
"""process uploads to policy queues
This class allows to accept or reject uploads and to get a list of missing
......
......@@ -56,7 +56,7 @@ import debianbts as bts
################################################################################
class ReverseDependencyChecker(object):
class ReverseDependencyChecker:
"""A bulk tester for reverse dependency checks
This class is similar to the check_reverse_depends method from "utils". However,
......
......@@ -26,7 +26,7 @@ Simple summary class for dak
###############################################################################
class SummaryStats(object):
class SummaryStats:
__shared_state = {}
def __init__(self, *args, **kwargs):
......
......@@ -83,7 +83,7 @@ class FileDoesNotExist(UploadException):
return "Refers to non-existing file '{0}'".format(self.filename)
class HashedFile(object):
class HashedFile:
"""file with checksums
"""
......@@ -267,7 +267,7 @@ def parse_file_list(control, has_priority_and_section, safe_file_regexp=re_file_
@functools.total_ordering
class Changes(object):
class Changes:
"""Representation of a .changes file
"""
......@@ -480,7 +480,7 @@ class Changes(object):
return self._key() < other._key()
class Binary(object):
class Binary:
"""Representation of a binary package
"""
......@@ -544,7 +544,7 @@ class Binary(object):
return "main"
class Source(object):
class Source:
"""Representation of a source package
"""
......
......@@ -34,7 +34,7 @@ from .utils import warn, move
###############################################################################
class UrgencyLog(object):
class UrgencyLog:
"Urgency Logger object"
__shared_state = {}
......
......@@ -655,7 +655,7 @@ def parse_args(Options):
@functools.total_ordering
class ArchKey(object):
class ArchKey:
"""
Key object for use in sorting lists of architectures.
......
......@@ -5,7 +5,7 @@
"""
class QueryRegister(object):
class QueryRegister:
__shared_state = {}
def __init__(self, *args, **kwargs):
......
......@@ -9,7 +9,7 @@ from sqlalchemy.orm import mapper
import unittest
class Version(object):
class Version:
def __init__(self, version):
self.version = version
......
......@@ -22,7 +22,7 @@ import unittest
import daklib.dbconn
class DummyChanges(object):
class DummyChanges:
def __init__(self, source, version, changesname):
self.source = source
self.version = version
......
......@@ -21,12 +21,12 @@ import unittest
from daklib.packagelist import PackageList
class FakeArchitecture(object):
class FakeArchitecture:
def __init__(self, name):
self.arch_string = name
class FakeSuite(object):
class FakeSuite:
def __init__(self, *architectures):
self.architectures = [FakeArchitecture(a) for a in architectures]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册