Skip to content

Commit

Permalink
Core & Internals: No longer ignoring return typechecking in core/rule.py
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingstaff committed Mar 14, 2024
2 parents 45e497e + b814e6a commit 8b77972
Show file tree
Hide file tree
Showing 10 changed files with 512 additions and 184 deletions.
8 changes: 4 additions & 4 deletions lib/rucio/common/types.py
Expand Up @@ -166,11 +166,11 @@ class RuleDict(TypedDict):
copies: int
rse_expression: str
grouping: Literal['ALL', 'DATASET', 'NONE']
weight: str
lifetime: int
weight: Optional[str]
lifetime: Optional[int]
locked: bool
subscription_id: str
subscription_id: Optional[str]
source_replica_expression: Optional[str]
activity: str
notify: Optional[Literal['Y', 'N', 'C']]
notify: Optional[Literal['Y', 'N', 'C', 'P']]
purge_replicas: bool
34 changes: 17 additions & 17 deletions lib/rucio/common/utils.py
Expand Up @@ -796,6 +796,22 @@ def __strip_dsn(dsn: str) -> str:
stripped_dsn = '.'.join(fields)
return stripped_dsn

@staticmethod
def __strip_tag(tag: str) -> str:
"""
Drop the _sub and _dis suffixes for panda datasets from the lfc path
they will be registered in
Method imported from DQ2.
"""
suffixes_to_drop = ['_dis', '_sub', '_tid']
stripped_tag = tag
try:
for suffix in suffixes_to_drop:
stripped_tag = re.sub('%s.*$' % suffix, '', stripped_tag)
except IndexError:
return stripped_tag
return stripped_tag

@staticmethod
def construct_surl_DQ2(dsn: str, scope: str, filename: str) -> str:
"""
Expand Down Expand Up @@ -831,7 +847,7 @@ def construct_surl_DQ2(dsn: str, scope: str, filename: str) -> str:
if nfields == 5:
tag = 'other'
else:
tag = __strip_tag(fields[-1])
tag = SurlAlgorithms.__strip_tag(fields[-1])
stripped_dsn = SurlAlgorithms.__strip_dsn(dsn)
return '/%s/%s/%s/%s/%s' % (project, dataset_type, tag, stripped_dsn, filename)

Expand Down Expand Up @@ -890,22 +906,6 @@ def construct_surl(dsn: str, scope: str, filename: str, naming_convention: str =
return surl_algorithms.construct_surl(dsn, scope, filename, naming_convention)


def __strip_tag(tag):
"""
Drop the _sub and _dis suffixes for panda datasets from the lfc path
they will be registered in
Method imported from DQ2.
"""
suffixes_to_drop = ['_dis', '_sub', '_tid']
stripped_tag = tag
try:
for suffix in suffixes_to_drop:
stripped_tag = re.sub('%s.*$' % suffix, '', stripped_tag)
except IndexError:
return stripped_tag
return stripped_tag


def clean_surls(surls):
res = []
for surl in surls:
Expand Down

0 comments on commit 8b77972

Please sign in to comment.