Skip to content

Commit

Permalink
Pylint-induced maintenance (#70)
Browse files Browse the repository at this point in the history
- Remove the explicit `object` superclass definition from classes.
  In Python3, object is the implicit superclass. There is no need
  to explicitly define it.
- Remove unnecessary pass.
  • Loading branch information
akosthekiss authored Nov 11, 2023
1 parent db3f24b commit d3b1a39
Show file tree
Hide file tree
Showing 27 changed files with 39 additions and 57 deletions.
2 changes: 0 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ disable=
too-many-locals,
too-many-return-statements,
too-many-statements,
unnecessary-pass,
unspecified-encoding,
unused-argument,
useless-object-inheritance,
useless-option-value, # disables warning in recent pylint that does not check for no-self-use anymore

[TYPECHECK]
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/call/adaptive_timeout_decorator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
Expand All @@ -10,7 +10,7 @@
from multiprocessing import Value


class AdaptiveTimeoutDecorator(object):
class AdaptiveTimeoutDecorator:
"""
Decorator for SUT calls used in validate or reduce jobs. It helps
dynamically optimizing the timeout of SUT calls. It works with SUTs
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/call/call.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class Call(object):
class Call:
"""
Abstract base class to represent how a software-under-test (SUT) can be
called/executed.
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/call/call_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from inspect import signature


class CallDecorator(object):
class CallDecorator:
"""
Base class for SUT call (i.e., :class:`Call`) decorators.
"""
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/call/regex_automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re


class RegexAutomaton(object):
class RegexAutomaton:
"""
Auxiliary class to recognize patterns in textual data and process them with
user-defined automaton-like instructions.
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .mongo_driver import MongoDriver


class Controller(object):
class Controller:
"""
Fuzzinator's main controller that orchestrates a fuzz session by scheduling
all related activities (e.g., keeps SUTs up-to-date, runs fuzzers and feeds
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/exporter/exporter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class Exporter(object):
class Exporter:
"""
Abstract base class to represent issue exporters.
"""
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/formatter/formatter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2021-2022 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class Formatter(object):
class Formatter:
"""
Abstract base class to represent issue formatters.
"""
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/formatter/formatter_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from inspect import signature


class FormatterDecorator(object):
class FormatterDecorator:
"""
Base class for :class:`Formatter` decorators.
"""
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/fuzzer/fuzzer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class Fuzzer(object):
class Fuzzer:
"""
Abstract base class to represent a (random) test case generator, a.k.a.
fuzzer.
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/fuzzer/fuzzer_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from inspect import signature


class FuzzerDecorator(object):
class FuzzerDecorator:
"""
Base class for :class:`Fuzzer` decorators.
"""
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/job/call_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import hashlib


class CallJob(object):
class CallJob:
"""
Base class for jobs that call SUTs and can find new issues.
"""
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/job/update_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ..config import config_get_object


class UpdateJob(object):
class UpdateJob:
"""
Class for running SUT update jobs.
"""
Expand Down
18 changes: 2 additions & 16 deletions fuzzinator/listener/event_listener.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2016-2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2016-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class EventListener(object):
class EventListener:
"""
A no-op base class for listeners that can get notified by
:class:`fuzzinator.Controller` on various events of a fuzz sessions.
Expand All @@ -29,7 +29,6 @@ def on_load_updated(self, load):
:param int load: number between 0 and controller's capacity.
"""
pass

def on_fuzz_job_added(self, job_id, cost, sut, fuzzer, batch):
"""
Expand All @@ -45,7 +44,6 @@ def on_fuzz_job_added(self, job_id, cost, sut, fuzzer, batch):
requested from the fuzzer (may be ``inf``).
:type batch: int, float
"""
pass

def on_reduce_job_added(self, job_id, cost, sut, issue_oid, issue_id, size):
"""
Expand All @@ -60,7 +58,6 @@ def on_reduce_job_added(self, job_id, cost, sut, issue_oid, issue_id, size):
:param int size: size of the test case associated with the issue to be
reduced.
"""
pass

def on_update_job_added(self, job_id, cost, sut):
"""
Expand All @@ -71,7 +68,6 @@ def on_update_job_added(self, job_id, cost, sut):
:param str sut: short name of the SUT to be updated (name of the
corresponding config section without the "sut." prefix).
"""
pass

def on_validate_job_added(self, job_id, cost, sut, issue_oid, issue_id):
"""
Expand All @@ -84,15 +80,13 @@ def on_validate_job_added(self, job_id, cost, sut, issue_oid, issue_id):
:param str issue_oid: ``'_id'`` property of the issue to be validated.
:param Any issue_id: ``'id'`` property of the issue to be validated.
"""
pass

def on_job_activated(self, job_id):
"""
Invoked when a previously instantiated job is activated (started).
:param int job_id: unique identifier of the activated job.
"""
pass

def on_job_progressed(self, job_id, progress):
"""
Expand All @@ -104,15 +98,13 @@ def on_job_progressed(self, job_id, progress):
reduce jobs, this is the current size of the test case being reduced
(number between the original test size and 0).
"""
pass

def on_job_removed(self, job_id):
"""
Invoked when an active job has finished.
:param int job_id: unique identifier of the finished job.
"""
pass

def on_issue_added(self, job_id, issue):
"""
Expand All @@ -124,7 +116,6 @@ def on_issue_added(self, job_id, issue):
the issue, the fuzzer that generated the test case, the ID of the
issue - is stored in appropriate properties of the issue).
"""
pass

def on_issue_invalidated(self, job_id, issue):
"""
Expand All @@ -135,7 +126,6 @@ def on_issue_invalidated(self, job_id, issue):
(listener is free to decide how to react, an option is to remove the
issue from the database).
"""
pass

def on_issue_updated(self, job_id, issue):
"""
Expand All @@ -144,7 +134,6 @@ def on_issue_updated(self, job_id, issue):
:param int job_id: identifier of the job that has updated the issue.
:param dict issue: the issue object that has changed.
"""
pass

def on_issue_reduced(self, job_id, issue):
"""
Expand All @@ -153,7 +142,6 @@ def on_issue_reduced(self, job_id, issue):
:param int job_id: identifier of the job that has reduced the issue.
:param dict issue: the issue object that got reduced.
"""
pass

def warning(self, job_id, msg):
"""
Expand All @@ -164,12 +152,10 @@ def warning(self, job_id, msg):
the core).
:param str msg: description of the problem.
"""
pass

def on_stats_updated(self):
"""
Invoked when statistics about fuzzers, SUTs, and issues (e.g., execution
counts, issue counts, unique issue counts) are updated in the
framework's database.
"""
pass
4 changes: 2 additions & 2 deletions fuzzinator/listener/listener_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
logger = logging.getLogger(__name__)


class Trampoline(object):
class Trampoline:

def __init__(self, manager, name):
self.manager = manager
Expand All @@ -27,7 +27,7 @@ def __call__(self, **kwargs):
logger.warning('Unhandled exception in listener %r.', self.name, exc_info=e)


class ListenerManager(object):
class ListenerManager:
"""
Class that registers listeners to various events and executes all of them
when the event has triggered.
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/mongo_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = logging.getLogger(__name__)


class MongoDriver(object):
class MongoDriver:

def __init__(self, uri, server_selection_timeout):
self.uri = uri
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/reduce/picire_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .reducer import Reducer


class PicireTester(object):
class PicireTester:

def __init__(self, *, test_builder, sut_call, issue, on_job_progressed, filename, encoding, new_issues):
self._test_builder = test_builder
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/reduce/reducer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2021-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.


class Reducer(object):
class Reducer:
"""
Abstract base class to represent test case reducers.
"""
Expand Down
1 change: 0 additions & 1 deletion fuzzinator/tracker/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ class TrackerError(Exception):
"""
Raised when a :class:`Tracker` operation cannot be performed.
"""
pass
1 change: 0 additions & 1 deletion fuzzinator/ui/tui/reporter_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def init(self):
collect input from the user, usually based on ``settings`` (empty by
default).
"""
pass

def set_duplicate(self, btn, state):
if state:
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/ui/tui/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def selection(self):
return None


class TableColumn(object):
class TableColumn:
align = 'left'
wrap = 'space'
padding = None
Expand Down
4 changes: 2 additions & 2 deletions fuzzinator/ui/tui/tui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2021 Renata Hodovan, Akos Kiss.
# Copyright (c) 2016-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
Expand All @@ -24,7 +24,7 @@
logger = logging.getLogger(__name__)


class Tui(object):
class Tui:
signals = ['close']

def __init__(self, controller, style):
Expand Down
6 changes: 3 additions & 3 deletions fuzzinator/ui/tui/tui_listener.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2019 Renata Hodovan, Akos Kiss.
# Copyright (c) 2016-2023 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
Expand All @@ -11,13 +11,13 @@
from ...listener import EventListener


class TuiListener(object):
class TuiListener:

def __init__(self, pipe, events, lock):
for fn, _ in inspect.getmembers(EventListener, predicate=inspect.isfunction):
setattr(self, fn, self.Trampoline(name=fn, pipe=pipe, events=events, lock=lock))

class Trampoline(object):
class Trampoline:
def __init__(self, name, pipe, events, lock):
self.name = name
self.pipe = pipe
Expand Down
2 changes: 1 addition & 1 deletion fuzzinator/ui/wui/wui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
root_logger = logging.getLogger()


class Wui(object):
class Wui:

def __init__(self, controller, port, address, cert, key, debug):
self.events = Queue()
Expand Down
Loading

0 comments on commit d3b1a39

Please sign in to comment.