Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] Use python3 new style classes #3290

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/analyzer_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def available_guidelines(self):


# -----------------------------------------------------------------------------
class Context(object, metaclass=Singleton):
class Context(metaclass=Singleton):
""" Generic package specific context. """

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/analyzers/analyzer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
LOG = get_logger('analyzer')


class SourceAnalyzer(object, metaclass=ABCMeta):
class SourceAnalyzer(metaclass=ABCMeta):
"""
Base class for different source analyzers.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def invoke_binary_checked(binary_path, args=None, environ=None):
return output


class CTUAutodetection(object):
class CTUAutodetection:
"""
CTUAutodetection is responsible for providing the availability information
of CTU feature, the the relevant mapping tool path and the mapping file
Expand Down
4 changes: 2 additions & 2 deletions analyzer/codechecker_analyzer/analyzers/clangsa/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import subprocess


class ClangVersionInfo(object):
class ClangVersionInfo:
"""ClangVersionInfo holds the version information of the used Clang."""

def __init__(self,
Expand All @@ -29,7 +29,7 @@ def __init__(self,
self.vendor = str(vendor)


class ClangVersionInfoParser(object):
class ClangVersionInfoParser:
"""
ClangVersionInfoParser is responsible for creating ClangVersionInfo
instances from the version output of Clang.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
LOG = get_logger('analyzer.tidy')


class Note(object):
class Note:
"""
Represents a note and also this is the base class of Message.
"""
Expand Down Expand Up @@ -70,7 +70,7 @@ def __str__(self):
[str(note) for note in self.notes])


class OutputParser(object):
class OutputParser:
"""
Parser for clang-tidy console output.
"""
Expand Down Expand Up @@ -215,7 +215,7 @@ def _parse_notes(self, message, titer, line):
return line


class PListConverter(object):
class PListConverter:
"""
Clang-tidy messages to plist converter.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CheckerState(Enum):
enabled = 2


class AnalyzerConfigHandler(object, metaclass=ABCMeta):
class AnalyzerConfigHandler(metaclass=ABCMeta):
"""
Handle the checker configurations and enabled disabled checkers lists.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
LOG = get_logger('analyzer')


class ResultHandler(object, metaclass=ABCMeta):
class ResultHandler(metaclass=ABCMeta):
"""
Handle and store the results at runtime for the analyzer:
stdout, stderr, temporarily generated files.
Expand Down
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/buildlog/build_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
""""""


class BuildAction(object):
class BuildAction:
"""
The objects of this class hold information which is the input of the
analyzer engines.
Expand Down
4 changes: 2 additions & 2 deletions analyzer/codechecker_analyzer/buildlog/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def filter_compiler_includes_extra_args(compiler_flags):
return extra_opts


class ImplicitCompilerInfo(object):
class ImplicitCompilerInfo:
"""
This class helps to fetch and set some additional compiler flags which are
implicitly added when using GCC.
Expand Down Expand Up @@ -602,7 +602,7 @@ def get():
return ImplicitCompilerInfo.compiler_info


class OptionIterator(object):
class OptionIterator:

def __init__(self, args):
self._item = None
Expand Down
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/cmd/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"""


class PlistToPlaintextFormatter(object):
class PlistToPlaintextFormatter:
"""
Parse and format plist reports to a more human readable format.
"""
Expand Down
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
LOG = get_logger('analyzer')


class MakeFileCreator(object):
class MakeFileCreator:
""" Creates a Makefile from analyzer actions. """

def __init__(self, analyzers, output_path, config_map, context,
Expand Down
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/suppress_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
LOG = get_logger('system')


class GenericSuppressHandler(object):
class GenericSuppressHandler:

def __init__(self, suppress_file, allow_write, src_comment_status_filter):
"""
Expand Down
10 changes: 5 additions & 5 deletions analyzer/tests/unit/test_checker_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from codechecker_analyzer.buildlog import log_parser


class MockContextSA(object):
class ProfileMap(object):
class MockContextSA:
class ProfileMap:
def __getitem__(self, key):
return 'profile1'

Expand All @@ -34,7 +34,7 @@ def by_profile(self, profile):
def available_profiles(self):
return {'default': 'description', 'security': 'description'}

class GuidelineMap(object):
class GuidelineMap:
def __getitem__(self, key):
return {'sei-cert': ['rule1', 'rule2']}

Expand Down Expand Up @@ -228,8 +228,8 @@ def f(checks, checkers):
(cfg_handler.checks(), cert_guideline))


class MockContextTidy(object):
class ProfileMap(object):
class MockContextTidy:
class ProfileMap:
def __getitem__(self, key):
return 'profile1'

Expand Down
4 changes: 2 additions & 2 deletions analyzer/tests/unit/test_option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def test_preprocess_and_compile_with_extra_file_clang(self):
'command': 'clang++ -c -MF deps.txt main.cpp',
'directory': ''}

class FakeClangVersion(object):
class FakeClangVersion:
installed_dir = "/tmp/clang/install"
major_version = "9"

Expand Down Expand Up @@ -400,7 +400,7 @@ def test_keep_clang_flags(self):
'command': "clang++ {} main.cpp".format(' '.join(keep)),
'directory': ''}

class FakeClangVersion(object):
class FakeClangVersion:
installed_dir = "/tmp/clang/install"
major_version = "9"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import re


class ReturnValueCollector(object):
class ReturnValueCollector:
""" Collect return value statistics.

This script lists functions of which the return value is mostly checked.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re


class SpecialReturnValueCollector(object):
class SpecialReturnValueCollector:
""" Collect special return value statistics.

This script lists functions of which the return value is checked for
Expand Down
2 changes: 1 addition & 1 deletion codechecker_common/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def validate_loglvl(log_level):
return log_level


class LOG_CFG_SERVER(object):
class LOG_CFG_SERVER:
"""
Initialize a log configuration server for dynamic log configuration.
The log config server will only be started if the
Expand Down
2 changes: 1 addition & 1 deletion codechecker_common/plist_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
LOG = get_logger('report')


class LXMLPlistEventHandler(object):
class LXMLPlistEventHandler:
"""
Basic lxml event handler.
"""
Expand Down
2 changes: 1 addition & 1 deletion codechecker_common/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
LOG = get_logger('report')


class Report(object):
class Report:
"""Represents an analyzer report.

The main section is where the analyzer reported the issue.
Expand Down
2 changes: 1 addition & 1 deletion codechecker_common/skiplist_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
LOG = get_logger('system')


class SkipListHandler(object):
class SkipListHandler:
"""
Skiplist file format:

Expand Down
2 changes: 1 addition & 1 deletion codechecker_common/source_code_comment_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SpellException(Exception):
pass


class SourceCodeCommentHandler(object):
class SourceCodeCommentHandler:
"""
Handle source code comments.
"""
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug_tools/failure_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def change_paths(string, pathModifierFun):
return ''.join(result)


class IncludePathModifier(object):
class IncludePathModifier:
def __init__(self, sources_root):
self.sources_root = sources_root

Expand Down
4 changes: 2 additions & 2 deletions scripts/debug_tools/prepare_analyzer_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_first_line_of_file(fname):
return f.readline()


class AnalyzerCommandPathModifier(object):
class AnalyzerCommandPathModifier:
def __init__(self, opts):
self.opts = opts

Expand Down Expand Up @@ -63,7 +63,7 @@ def __call__(self, path):
os.path.sep)))


class PathOptions(object):
class PathOptions:
def __init__(
self,
sources_root,
Expand Down
4 changes: 2 additions & 2 deletions scripts/test/run_server_performance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def parse_arguments():
return parser.parse_args()


class StatManager(object):
class StatManager:
"""
This class stores the statistics of the single user events and prints them
in CSV format. To produce a nice output the users should do the same tasks
Expand Down Expand Up @@ -157,7 +157,7 @@ def print_stats(self, file_name):
writer.writerow([user_id] + [x[1] for x in durations])


class UserSimulator(object):
class UserSimulator:
"""
This class simulates a user who performs actions one after the other. The
durations of the single actions are stored in the statistics.
Expand Down
2 changes: 1 addition & 1 deletion tools/plist_to_html/plist_to_html/PlistToHtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def twodim_to_table(
return '\n'.join(str_parts)


class HtmlBuilder(object):
class HtmlBuilder:
"""
Helper class to create html file from a report data.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
LOG = logging.getLogger('ReportConverter')


class AnalyzerResult(object, metaclass=ABCMeta):
class AnalyzerResult(metaclass=ABCMeta):
""" Base class to transform analyzer result. """

# Short name of the analyzer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_next(it):
return ''


class Event(object):
class Event:
""" Represents an event message. """

def __init__(self, path, line, column, message):
Expand Down Expand Up @@ -67,7 +67,7 @@ def __str__(self):
[str(fixit) for fixit in self.fixits])


class BaseParser(object, metaclass=ABCMeta):
class BaseParser(metaclass=ABCMeta):
""" Warning message parser. """

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import json


class PlistConverter(object, metaclass=ABCMeta):
class PlistConverter(metaclass=ABCMeta):
""" Warning messages to plist converter. """

def __init__(self, tool_name):
Expand Down
2 changes: 1 addition & 1 deletion web/client/codechecker_client/credential_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def simplify_credentials(credentials):
return ret


class UserCredentials(object):
class UserCredentials:

def __init__(self):
LOG.debug("Loading clientside session config.")
Expand Down
2 changes: 1 addition & 1 deletion web/client/codechecker_client/helpers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
LOG = get_logger('system')


class BaseClientHelper(object):
class BaseClientHelper:

def __init__(self, protocol, host, port, uri, session_token=None,
get_new_token=None):
Expand Down
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/webserver_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __len__(self):


# -----------------------------------------------------------------------------
class Context(object, metaclass=Singleton):
class Context(metaclass=Singleton):
""" Generic package specific context. """

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion web/server/codechecker_server/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
LOG = get_logger('server')


class ThriftAuthHandler(object):
class ThriftAuthHandler:
"""
Handle Thrift authentication requests.
"""
Expand Down
2 changes: 1 addition & 1 deletion web/server/codechecker_server/api/config_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
LOG = get_logger('server')


class ThriftConfigHandler(object):
class ThriftConfigHandler:
"""
Manages Thrift requests regarding configuration.
"""
Expand Down
2 changes: 1 addition & 1 deletion web/server/codechecker_server/api/product_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
LOG = get_logger('server')


class ThriftProductHandler(object):
class ThriftProductHandler:
"""
Connect to database and handle thrift client requests.
"""
Expand Down
Loading