Skip to content

Commit

Permalink
Merge pull request #6611 from rdimaio/feature-6588-policy
Browse files Browse the repository at this point in the history
Testing: Add type annotations to policy.py
  • Loading branch information
bari12 committed Apr 17, 2024
2 parents 3482306 + 2de7c6f commit a308c8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rucio/common/policy.py
Expand Up @@ -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
Expand All @@ -27,7 +28,7 @@
expiration_time=900)


def get_policy():
def get_policy() -> str:
policy = REGION.get('policy')
if isinstance(policy, NoValue):
try:
Expand All @@ -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:
Expand All @@ -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': []}
Expand Down

0 comments on commit a308c8e

Please sign in to comment.