Skip to content

Commit

Permalink
style: pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebits committed Jun 25, 2024
1 parent 9430c86 commit 6b3b248
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
LogcollectorStatisticsVisualizer,
)


supported_targets = ['binary', 'analysis', 'remote', 'wazuhdb', 'logcollector',
'cluster', 'indexer-alerts',
'indexer-vulnerabilities']
Expand All @@ -26,6 +25,7 @@
'indexer-vulnerabilities': IndexerVulnerabilities
}


def create_destination_directory(destination_directory):
if not exists(destination_directory):
makedirs(destination_directory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class DataVisualizer(ABC):
store_path (str): path to store the CSV images. Defaults to the temp directory.
base_name (str, optional): base name used to store the images.
"""

def __init__(self, dataframes_paths, store_path=gettempdir(), base_name=None):
"""Initializes the DataVisualizer.
Expand Down Expand Up @@ -202,9 +203,9 @@ class BinaryDatavisualizer(DataVisualizer):
binary_metrics_fields (list): Combined list of binary metrics fields.
"""
binary_metrics_fields_to_plot = ["CPU", "VMS", "RSS", "USS",
"PSS", "SWAP", "FD", "Read_Ops",
"Write_Ops", "Disk_Read", "Disk_Written",
"Disk_Read_Speed", "Disk_Write_Speed"]
"PSS", "SWAP", "FD", "Read_Ops",
"Write_Ops", "Disk_Read", "Disk_Written",
"Disk_Read_Speed", "Disk_Write_Speed"]
binary_metrics_extra_fields = ["Daemon", "Version", "PID"]
binary_metrics_fields = binary_metrics_fields_to_plot + binary_metrics_extra_fields

Expand Down Expand Up @@ -308,7 +309,7 @@ def plot(self):
colors = self._color_palette(len(daemons))
for daemon, color in zip(daemons, colors):
self._basic_plot(ax, self.dataframe[self.dataframe.Daemon == daemon][element],
label=daemon, color=color)
label=daemon, color=color)

self._save_custom_plot(ax, element, element)

Expand Down Expand Up @@ -392,6 +393,7 @@ def plot(self):
self._basic_plot(ax, self.dataframe[column], label=column, color=color)
self._save_custom_plot(ax, title, title)


class LogcollectorStatisticsVisualizer(DaemonStatisticsVisualizer):
"""A class for visualizing logcollector statistics data.
Expand Down Expand Up @@ -441,10 +443,11 @@ def plot(self):
colors = self._color_palette(len(targets))
for target, color in zip(targets, colors):
self._basic_plot(ax, self.dataframe[self.dataframe.Location == target][element['columns']],
label=target, color=color)
label=target, color=color)

self._save_custom_plot(ax, element['title'], element['title'])


class ClusterStatisticsVisualizer(DataVisualizer):
"""A class for visualizing cluster statistics data.
Expand All @@ -455,7 +458,7 @@ class ClusterStatisticsVisualizer(DataVisualizer):
base_name (str, optional): base name used to store the images.
expected_cluster_fields (list): List of expected fields for cluster statistics.
"""
expected_cluster_fields= ['node_name', 'activity', 'time_spent(s)']
expected_cluster_fields = ['node_name', 'activity', 'time_spent(s)']

def __init__(self, dataframes_paths, store_path=gettempdir(), base_name=None):
"""Initialize the ClusterStatisticsVisualizer.
Expand Down Expand Up @@ -490,9 +493,9 @@ def plot(self):
current_df.reset_index(drop=True, inplace=True)
for node, color in zip(nodes, self._color_palette(len(nodes))):
self._basic_plot(ax=ax, dataframe=current_df[current_df.node_name == node]['time_spent(s)'],
label=node, color=color)
label=node, color=color)
self._save_custom_plot(ax, 'time_spent(s)', element.replace(' ', '_').lower(), disable_x_labels=True,
statistics=DataVisualizer._get_statistics(
statistics=DataVisualizer._get_statistics(
current_df['time_spent(s)'], calculate_mean=True, calculate_median=True))


Expand Down Expand Up @@ -597,7 +600,6 @@ def _get_expected_fields(self):
"""
return self.expected_fields


def plot(self):
"""Plot the indexer vulnerabilities data.
Expand Down

0 comments on commit 6b3b248

Please sign in to comment.