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

callgraph: make pre-push target pass with newer pandas versions #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: GPL-2.0-only

Expand All @@ -25,6 +26,7 @@ matrix:
before_install:
- cd development-process/stable-maintenance/regression-analysis/
install:
- pip install --upgrade importlib_metadata
- make install-requirements
script:
- make pre-push
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: GPL-2.0-only

Expand Down Expand Up @@ -741,7 +742,7 @@ def getargs():
nomerges = args.no_merge_datapoints

repo = repo if repo.endswith(".git") else os.path.join(repo, ".git")
if(not (os.path.isdir(repo))):
if (not (os.path.isdir(repo))):
sys.stderr.write("Error: not a git repository: %s\n" % repo)
sys.exit(1)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: GPL-2.0-only

Expand Down Expand Up @@ -296,7 +297,7 @@ def getargs():
gitdir = args.git_dir

gitdir = gitdir if gitdir.endswith(".git") else os.path.join(gitdir, ".git")
if(not (os.path.isdir(gitdir))):
if (not (os.path.isdir(gitdir))):
sys.stderr.write("Error: not a git repository: %s\n" % gitdir)
sys.exit(1)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

# SPDX-FileCopyrightText: 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: Apache-2.0
import argparse
Expand Down Expand Up @@ -36,8 +37,8 @@ def __init__(
self.callee_line = callee_line

def get_query_str(self):
return ' & '.join(
["{}=='{}'".format(key, value)
return ' and '.join(
["{} == '{}'".format(key, value)
for key, value in self.__dict__.items() if value is not None])

def __eq__(self, other):
Expand Down Expand Up @@ -137,7 +138,7 @@ def graph(self, args):

def _load_callgraph_data(self, filename):
utils.exit_unless_accessible(filename)
self.df = pd.read_csv(filename, na_values=[''], keep_default_na=False)
self.df = pd.read_csv(filename, dtype=str, keep_default_na=False)
self.df.reset_index(drop=True, inplace=True)
self.df.columns = self.df.columns.str.lower()
require_cols = [
Expand Down Expand Up @@ -466,7 +467,7 @@ def node_id(filename, function, line):
return ("%s_%s_%s" % (
filename,
html.escape(str(function)),
float(line)
str(line)
)).replace(":", "")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

# SPDX-FileCopyrightText: 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -53,9 +54,9 @@ def set_up_session_test_data(request):
# Run once at the start of test session, before any tests have been run
print("session setup")
clang_path = get_clang_bin_path()
assert(Path(clang_path).exists())
assert Path(clang_path).exists()
clang_version = get_clang_version()
assert(clang_version)
assert clang_version
request.addfinalizer(clean_up_session_test_data)
assert Path(CG_BIN).exists()
# Generate target bitcode files
Expand Down
2 changes: 2 additions & 0 deletions safety-architecture/tools/callgraph-tool/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

# SPDX-FileCopyrightText: 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# SPDX-FileCopyrightText: 2022 Henri Rosten
#
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -28,6 +29,7 @@ def df_to_string(df):


def df_difference(df_left, df_right):
df_right = df_right.astype(df_left.dtypes.to_dict())
df = df_left.merge(
df_right,
how='outer',
Expand Down