Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Add type annotations to policy.py #6611

Merged
merged 1 commit into from Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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