Skip to content

Commit

Permalink
Don't derive from object
Browse files Browse the repository at this point in the history
Python 3 doesn't needd that anymore.
  • Loading branch information
heinrich5991 committed Feb 11, 2025
1 parent 8d39bd1 commit 972d208
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ the format (ARC or WARC), record type, the record headers, http headers

.. code:: python
class ArcWarcRecord(object):
class ArcWarcRecord:
def __init__(self, *args):
(self.format, self.rec_type, self.rec_headers, self.raw_stream,
self.http_headers, self.content_type, self.length) = args
Expand Down
2 changes: 1 addition & 1 deletion test/test_archiveiterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


#==============================================================================
class TestArchiveIterator(object):
class TestArchiveIterator:
def _load_archive(self, filename, offset=0, cls=ArchiveIterator,
errs_expected=0, **kwargs):

Expand Down
2 changes: 1 addition & 1 deletion test/test_capture_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


# ==================================================================
class TestCaptureHttpBin(object):
class TestCaptureHttpBin:
@classmethod
def setup_class(cls):
from httpbin import app as httpbin_app
Expand Down
2 changes: 1 addition & 1 deletion test/test_check_digest_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def pytest_generate_tests(metafunc):
metafunc.parametrize('test_filename', files)


class TestExamplesDigest(object):
class TestExamplesDigest:
def check_helper(self, args, expected_exit_value, capsys):
exit_value = None
try:
Expand Down
2 changes: 1 addition & 1 deletion test/test_limitreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from io import BytesIO

class TestLimitReader(object):
class TestLimitReader:
def test_limit_reader_1(self):
assert b'abcdefghji' == LimitReader(BytesIO(b'abcdefghjiklmnopqrstuvwxyz'), 10).read(26)

Expand Down
2 changes: 1 addition & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
pass


class TestUtils(object):
class TestUtils:
def test_headers_to_str_headers(self):
result = [('foo', 'bar'), ('baz', 'barf')]

Expand Down
2 changes: 1 addition & 1 deletion test/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def record_sampler(request):


# ============================================================================
class TestWarcWriter(object):
class TestWarcWriter:
@classmethod
def _validate_record_content_len(cls, stream):
for record in ArchiveIterator(stream, no_record_parse=True):
Expand Down
2 changes: 1 addition & 1 deletion warcio/bufferedreaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def brotli_decompressor():


#=================================================================
class BufferedReader(object):
class BufferedReader:
"""
A wrapping line reader which wraps an existing reader.
Read operations operate on underlying buffer, which is filled to
Expand Down
4 changes: 2 additions & 2 deletions warcio/capture_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


# ============================================================================
class RecordingStream(object):
class RecordingStream:
def __init__(self, fp, recorder):
self.fp = fp
self.recorder = recorder
Expand Down Expand Up @@ -130,7 +130,7 @@ def putrequest(self, *args, **kwargs):


# ============================================================================
class RequestRecorder(object):
class RequestRecorder:
def __init__(self, writer, filter_func=None, record_ip=True):
self.writer = writer
self.filter_func = filter_func
Expand Down
2 changes: 1 addition & 1 deletion warcio/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _read_entire_stream(stream):
break


class Checker(object):
class Checker:
def __init__(self, cmd):
self.inputs = cmd.inputs
self.verbose = cmd.verbose
Expand Down
2 changes: 1 addition & 1 deletion warcio/digestverifyingreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# ============================================================================
class DigestChecker(object):
class DigestChecker:
def __init__(self, kind=None):
self._problem = []
self._passed = None
Expand Down
2 changes: 1 addition & 1 deletion warcio/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


# ============================================================================
class Extractor(object):
class Extractor:
READ_SIZE = BUFF_SIZE * 4

def __init__(self, filename, offset):
Expand Down
2 changes: 1 addition & 1 deletion warcio/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


# ============================================================================
class Indexer(object):
class Indexer:
field_names = {}

def __init__(self, fields, inputs, output, verify_http=False):
Expand Down
2 changes: 1 addition & 1 deletion warcio/limitreader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ============================================================================
class LimitReader(object):
class LimitReader:
"""
A reader which will not read more than specified limit
"""
Expand Down
2 changes: 1 addition & 1 deletion warcio/recompressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


# ============================================================================
class Recompressor(object):
class Recompressor:
def __init__(self, filename, output, verbose=False):
self.filename = filename
self.output = output
Expand Down
2 changes: 1 addition & 1 deletion warcio/recordbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from warcio.utils import to_native_str, BUFF_SIZE, Digester

#=================================================================
class RecordBuilder(object):
class RecordBuilder:
REVISIT_PROFILE = 'http://netpreserve.org/warc/1.0/revisit/identical-payload-digest'
REVISIT_PROFILE_1_1 = 'http://netpreserve.org/warc/1.1/revisit/identical-payload-digest'

Expand Down
6 changes: 3 additions & 3 deletions warcio/recordloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


#=================================================================
class ArcWarcRecord(object):
class ArcWarcRecord:
def __init__(self, *args, **kwargs):
(self.format, self.rec_type, self.rec_headers, self.raw_stream,
self.http_headers, self.content_type, self.length) = args
Expand Down Expand Up @@ -43,7 +43,7 @@ def content_stream(self):


#=================================================================
class ArcWarcRecordLoader(object):
class ArcWarcRecordLoader:
WARC_TYPES = ['WARC/1.1', 'WARC/1.0', 'WARC/0.17', 'WARC/0.18']

HTTP_TYPES = ['HTTP/1.0', 'HTTP/1.1']
Expand Down Expand Up @@ -267,7 +267,7 @@ def _ensure_target_uri_format(self, rec_headers):


#=================================================================
class ARCHeadersParser(object):
class ARCHeadersParser:
# ARC 1.0 headers
ARC_HEADERS = ["uri", "ip-address", "archive-date",
"content-type", "length"]
Expand Down
4 changes: 2 additions & 2 deletions warcio/statusandheaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


#=================================================================
class StatusAndHeaders(object):
class StatusAndHeaders:
ENCODE_HEADER_RX = re.compile(r'[=]["\']?([^;"]+)["\']?(?=[;]?)')
"""
Representation of parsed http-style status line and headers
Expand Down Expand Up @@ -222,7 +222,7 @@ def _strip_count(string, total_read):


#=================================================================
class StatusAndHeadersParser(object):
class StatusAndHeadersParser:
"""
Parser which consumes a stream support readline() to read
status and headers and return a StatusAndHeaders object
Expand Down
2 changes: 1 addition & 1 deletion warcio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def headers_to_str_headers(headers):


# ============================================================================
class Digester(object):
class Digester:
def __init__(self, type_='sha1'):
self.type_ = type_
self.digester = hashlib.new(type_)
Expand Down
2 changes: 1 addition & 1 deletion warcio/warcwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _write_warc_record(self, out, record):


# ============================================================================
class GzippingWrapper(object):
class GzippingWrapper:
def __init__(self, out):
self.compressor = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS + 16)
self.out = out
Expand Down

0 comments on commit 972d208

Please sign in to comment.