Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
eb2e6c9c
Verified
Commit
eb2e6c9c
authored
2 weeks ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Remove redundant str-cast method
parent
aa57f283
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!439
Add new attributes to R&E subscriptions
Pipeline
#95096
passed
2 weeks ago
Stage: tox
Stage: documentation
Stage: sonarqube
Stage: trigger_jenkins_build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/utils/types/multi_exit_discriminator.py
+2
-8
2 additions, 8 deletions
gso/utils/types/multi_exit_discriminator.py
with
2 additions
and
8 deletions
gso/utils/types/multi_exit_discriminator.py
+
2
−
8
View file @
eb2e6c9c
"""
Type definition for a BGP Multi Exit Discriminator.
"""
import
contextlib
from
typing
import
Annotated
,
Any
from
typing
import
Annotated
from
pydantic
import
AfterValidator
,
BeforeValidator
def
_ensure_str
(
value
:
Any
)
->
Any
:
if
not
isinstance
(
value
,
str
):
return
str
(
value
)
return
value
def
_multi_exit_discriminator_valid
(
value
:
str
)
->
str
:
with
contextlib
.
suppress
(
ValueError
):
int_value
=
int
(
value
)
...
...
@@ -25,4 +19,4 @@ def _multi_exit_discriminator_valid(value: str) -> str:
raise
ValueError
(
msg
)
MultiExitDiscriminator
=
Annotated
[
str
,
BeforeValidator
(
_ensure_
str
),
AfterValidator
(
_multi_exit_discriminator_valid
)]
MultiExitDiscriminator
=
Annotated
[
str
,
BeforeValidator
(
str
),
AfterValidator
(
_multi_exit_discriminator_valid
)]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment