From 2de7c6f0e404bb669ebf504c39ff0821d65b1f41 Mon Sep 17 00:00:00 2001 From: rdimaio Date: Wed, 27 Mar 2024 12:39:11 +0100 Subject: [PATCH] Testing: Add type annotations to policy.py; #6588 --- lib/rucio/common/policy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rucio/common/policy.py b/lib/rucio/common/policy.py index e84e05834f..06610fc7b3 100644 --- a/lib/rucio/common/policy.py +++ b/lib/rucio/common/policy.py @@ -16,6 +16,7 @@ import os from configparser import NoOptionError, NoSectionError from functools import wraps +from typing import Any from dogpile.cache import make_region from dogpile.cache.api import NoValue @@ -27,7 +28,7 @@ expiration_time=900) -def get_policy(): +def get_policy() -> str: policy = REGION.get('policy') if isinstance(policy, NoValue): try: @@ -38,7 +39,7 @@ def get_policy(): return policy -def get_scratchdisk_lifetime(): +def get_scratchdisk_lifetime() -> int: scratchdisk_lifetime = REGION.get('scratchdisk_lifetime') if isinstance(scratchdisk_lifetime, NoValue): try: @@ -50,7 +51,7 @@ def get_scratchdisk_lifetime(): return scratchdisk_lifetime -def get_lifetime_policy(): +def get_lifetime_policy() -> dict[str, list[dict[str, Any]]]: lifetime_dict = REGION.get('lifetime_dict') if isinstance(lifetime_dict, NoValue): lifetime_dict = {'data': [], 'mc': [], 'valid': [], 'other': []}