Skip to content
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
3 changes: 1 addition & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ select = [

ignore = [
"E501", # line too long

"UP007", # non-pep604-annotation-union

"UP015", # redundant-open-modes
"UP031", # printf-string-formatting
"UP035", # deprecated-import
Expand Down
4 changes: 1 addition & 3 deletions src/powerapi/dispatch_rule/dispatch_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from typing import Optional


class DispatchRule:
"""
Group by rule
"""
def __init__(self, primary: bool = False, fields: Optional[list[str]] = None):
def __init__(self, primary: bool = False, fields: list[str] | None = None):
self.is_primary = primary
self.fields = fields

Expand Down
3 changes: 1 addition & 2 deletions src/powerapi/processor/pre/k8s/metadata_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

from dataclasses import dataclass
from multiprocessing import Manager
from typing import Optional

ADDED_EVENT = 'ADDED'
DELETED_EVENT = 'DELETED'
Expand Down Expand Up @@ -70,7 +69,7 @@ def update_container_metadata(self, event: str, container_metadata: K8sContainer
if event == DELETED_EVENT:
self.metadata_cache.pop(container_metadata.container_id, None)

def get_container_metadata(self, container_id: str) -> Optional[K8sContainerMetadata]:
def get_container_metadata(self, container_id: str) -> K8sContainerMetadata | None:
"""
Get metadata for a specific container from the cache.
:param container_id: Container ID (hexadecimal string of 64 characters, short format is not supported)
Expand Down
3 changes: 1 addition & 2 deletions src/powerapi/processor/pre/k8s/monitor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import sys
from multiprocessing import Process
from signal import signal, SIGTERM, SIGINT
from typing import Optional

from kubernetes import client, config, watch
from kubernetes.client import V1Pod, V1PodList, V1ContainerStatus
Expand Down Expand Up @@ -185,7 +184,7 @@ def build_metadata_cache_entries_from_pod(self, pod: V1Pod) -> list[K8sContainer
for container_id, container_name in self.get_containers_id_name_from_statuses(container_statuses).items()
]

def fetch_list_all_pod_for_all_namespaces(self) -> Optional[int]:
def fetch_list_all_pod_for_all_namespaces(self) -> int | None:
"""
Fetch all pod for all namespaces and populate the metadata cache.
:return: Resource version of the last fetched entry
Expand Down
Loading