Skip to content

Commit

Permalink
Fixes pylint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vulder committed Jan 30, 2024
1 parent e40070e commit 194b228
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions varats/varats/tables/feature_perf_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@
from varats.table.tables import TableFormat, TableGenerator
from varats.utils.git_util import calc_repo_loc, ChurnConfig

group_synthetic_categories = True
GROUP_SYNTHETIC_CATEGORIES = True

synth_categories = [
SYNTH_CATEGORIES = [
"Static Analysis", "Dynamic Analysis", "Configurability",
"Implementation Pattern"
]


def compute_cs_category_grouping(case_study_name: str) -> str:
"""Mapping function to transform individual project names to their synthtic
categories."""
if case_study_name.startswith("SynthSA"):
return "Static Analysis"

Expand Down Expand Up @@ -329,7 +331,7 @@ def tabulate(self, table_format: TableFormat, wrap_table: bool) -> str:
precision_df, overhead_df, on=["CaseStudy", "Profiler"]
)

if group_synthetic_categories:
if GROUP_SYNTHETIC_CATEGORIES:

merged_df["CaseStudy"] = merged_df["CaseStudy"].apply(
compute_cs_category_grouping
Expand Down Expand Up @@ -366,11 +368,11 @@ def tabulate(self, table_format: TableFormat, wrap_table: bool) -> str:

# All means need to be computed before they are added as rows
overall_mean = pivot_df.mean()
if group_synthetic_categories:
synth_mean = pivot_df.loc[pivot_df.index.isin(synth_categories)
if GROUP_SYNTHETIC_CATEGORIES:
synth_mean = pivot_df.loc[pivot_df.index.isin(SYNTH_CATEGORIES)
].mean()
real_world_mean = pivot_df.loc[~pivot_df.index.
isin(synth_categories)].mean()
isin(SYNTH_CATEGORIES)].mean()

pivot_df.loc["SynthMean"] = synth_mean
pivot_df.loc["RealWorldMean"] = real_world_mean
Expand Down Expand Up @@ -569,7 +571,7 @@ def tabulate(self, table_format: TableFormat, wrap_table: bool) -> str:
df = pd.concat(cs_data).sort_index()
df.index.name = 'CaseStudy'

if group_synthetic_categories:
if GROUP_SYNTHETIC_CATEGORIES:
df.index = df.index.map(compute_cs_category_grouping)

df = df.groupby(df.index.name, as_index=True).agg({
Expand Down

0 comments on commit 194b228

Please sign in to comment.