Skip to content

Commit

Permalink
Typing: Add type annotations to vo.py; #6454
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio authored and bari12 committed Apr 8, 2024
1 parent 19ad8f0 commit ecf37f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/rucio/core/vo.py
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import re
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

from sqlalchemy.exc import DatabaseError, IntegrityError
from sqlalchemy.orm.exc import NoResultFound
Expand All @@ -33,7 +33,7 @@


@read_session
def vo_exists(vo, *, session: "Session"):
def vo_exists(vo: str, *, session: "Session") -> bool:
"""
Verify that the vo exists.
Expand All @@ -46,7 +46,7 @@ def vo_exists(vo, *, session: "Session"):


@transactional_session
def add_vo(vo, description, email, *, session: "Session"):
def add_vo(vo: str, description: str, email: str, *, session: "Session") -> None:
"""
Add a VO and setup a new root user.
New root user will have account name 'root' and a userpass identity with username: 'root@<vo>' and password: 'password'
Expand Down Expand Up @@ -88,7 +88,7 @@ def add_vo(vo, description, email, *, session: "Session"):


@read_session
def list_vos(*, session: "Session"):
def list_vos(*, session: "Session") -> list[dict[str, Any]]:
"""
List all the VOs in the db.
Expand All @@ -113,7 +113,7 @@ def list_vos(*, session: "Session"):


@transactional_session
def update_vo(vo, parameters, *, session: "Session"):
def update_vo(vo: str, parameters: dict[str, Any], *, session: "Session") -> None:
"""
Update VO properties (email, description).
Expand All @@ -135,7 +135,7 @@ def update_vo(vo, parameters, *, session: "Session"):
query.update(param)


def map_vo(vo):
def map_vo(vo: str) -> str:
"""
Converts a long VO name into the internal short (three letter)
tag mapping.
Expand Down
2 changes: 1 addition & 1 deletion lib/rucio/daemons/automatix/automatix.py
Expand Up @@ -165,7 +165,7 @@ def run_once(heartbeat_handler: "HeartbeatHandler", inputfile: str, **_kwargs) -
account = config_get("automatix", "account", raise_exception=False, default="root")
scope = config_get("automatix", "scope", raise_exception=False, default="test")
client = Client(account=account)
vo = map_vo(client.vo)
vo = map_vo(client.vo) # type: ignore
filters = {"scope": InternalScope("*", vo=vo)}
scopes = list_scopes(filter_=filters)
if InternalScope(scope, vo=vo) not in scopes:
Expand Down

0 comments on commit ecf37f7

Please sign in to comment.