Skip to content

Commit

Permalink
Testing: Add type annotations to common/types; rucio#6588
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio committed Apr 26, 2024
1 parent 3e0edd7 commit 5232980
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/rucio/common/types.py
Expand Up @@ -23,7 +23,7 @@ class InternalType:
'''
Base for Internal representations of string types
'''
def __init__(self, value, vo='def', fromExternal=True):
def __init__(self, value: Optional[str], vo: str = 'def', fromExternal: bool = True):
if value is None:
self.external = None
self.internal = None
Expand Down Expand Up @@ -72,7 +72,7 @@ def __lt__(self, other):
def __hash__(self):
return hash(self.internal)

def _calc_external(self):
def _calc_external(self) -> tuple[str, str]:
''' Utility to convert between internal and external representations'''
if isinstance(self.internal, str):
split = self.internal.split('@', 1)
Expand All @@ -85,7 +85,7 @@ def _calc_external(self):
return vo, external
return '', ''

def _calc_internal(self):
def _calc_internal(self) -> str:
''' Utility to convert between internal and external representations'''
if self.vo == 'def' and self.external is not None:
return self.external
Expand All @@ -97,15 +97,15 @@ class InternalAccount(InternalType):
'''
Internal representation of an account
'''
def __init__(self, account, vo='def', fromExternal=True):
def __init__(self, account: Optional[str], vo: str = 'def', fromExternal: bool = True):
super(InternalAccount, self).__init__(value=account, vo=vo, fromExternal=fromExternal)


class InternalScope(InternalType):
'''
Internal representation of a scope
'''
def __init__(self, scope, vo='def', fromExternal=True):
def __init__(self, scope: Optional[str], vo: str = 'def', fromExternal: bool = True):
super(InternalScope, self).__init__(value=scope, vo=vo, fromExternal=fromExternal)


Expand Down

0 comments on commit 5232980

Please sign in to comment.