Skip to content

Commit

Permalink
Merge pull request Ericsson#3290 from csordasmarton/use_python_new_st…
Browse files Browse the repository at this point in the history
…yle_classes

[refactor] Use python3 new style classes
csordasmarton authored May 17, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 09c1fec + f7804dc commit 9c3a36c
Showing 44 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/analyzer_context.py
Original file line number Diff line number Diff line change
@@ -248,7 +248,7 @@ def available_guidelines(self):


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

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


class SourceAnalyzer(object, metaclass=ABCMeta):
class SourceAnalyzer(metaclass=ABCMeta):
"""
Base class for different source analyzers.
"""
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions analyzer/codechecker_analyzer/analyzers/clangsa/version.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
import subprocess


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

def __init__(self,
@@ -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.
Original file line number Diff line number Diff line change
@@ -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.
"""
@@ -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.
"""
@@ -215,7 +215,7 @@ def _parse_notes(self, message, titer, line):
return line


class PListConverter(object):
class PListConverter:
"""
Clang-tidy messages to plist converter.
"""
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/analyzers/config_handler.py
Original file line number Diff line number Diff line change
@@ -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.
"""
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/buildlog/build_action.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
""""""


class BuildAction(object):
class BuildAction:
"""
The objects of this class hold information which is the input of the
analyzer engines.
4 changes: 2 additions & 2 deletions analyzer/codechecker_analyzer/buildlog/log_parser.py
Original file line number Diff line number Diff line change
@@ -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.
@@ -602,7 +602,7 @@ def get():
return ImplicitCompilerInfo.compiler_info


class OptionIterator(object):
class OptionIterator:

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


class PlistToPlaintextFormatter(object):
class PlistToPlaintextFormatter:
"""
Parse and format plist reports to a more human readable format.
"""
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/makefile.py
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/suppress_handler.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
LOG = get_logger('system')


class GenericSuppressHandler(object):
class GenericSuppressHandler:

def __init__(self, suppress_file, allow_write, src_comment_status_filter):
"""
10 changes: 5 additions & 5 deletions analyzer/tests/unit/test_checker_handling.py
Original file line number Diff line number Diff line change
@@ -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'

@@ -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']}

@@ -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'

4 changes: 2 additions & 2 deletions analyzer/tests/unit/test_option_parser.py
Original file line number Diff line number Diff line change
@@ -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"

@@ -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"

Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion codechecker_common/logger.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion codechecker_common/plist_parser.py
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@
LOG = get_logger('report')


class LXMLPlistEventHandler(object):
class LXMLPlistEventHandler:
"""
Basic lxml event handler.
"""
2 changes: 1 addition & 1 deletion codechecker_common/report.py
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion codechecker_common/skiplist_handler.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
LOG = get_logger('system')


class SkipListHandler(object):
class SkipListHandler:
"""
Skiplist file format:
2 changes: 1 addition & 1 deletion codechecker_common/source_code_comment_handler.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ class SpellException(Exception):
pass


class SourceCodeCommentHandler(object):
class SourceCodeCommentHandler:
"""
Handle source code comments.
"""
2 changes: 1 addition & 1 deletion scripts/debug_tools/failure_lib.py
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions scripts/debug_tools/prepare_analyzer_cmd.py
Original file line number Diff line number Diff line change
@@ -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

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


class PathOptions(object):
class PathOptions:
def __init__(
self,
sources_root,
4 changes: 2 additions & 2 deletions scripts/test/run_server_performance_test.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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.
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
@@ -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.
"""
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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):
@@ -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):
Original file line number Diff line number Diff line change
@@ -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):
2 changes: 1 addition & 1 deletion web/client/codechecker_client/credential_manager.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ def simplify_credentials(credentials):
return ret


class UserCredentials(object):
class UserCredentials:

def __init__(self):
LOG.debug("Loading clientside session config.")
2 changes: 1 addition & 1 deletion web/client/codechecker_client/helpers/base.py
Original file line number Diff line number Diff line change
@@ -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):
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/webserver_context.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ def __len__(self):


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

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


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


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


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

0 comments on commit 9c3a36c

Please sign in to comment.