Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
f9792872
"tests/pipelines/vscode:/vscode.git/clone" did not exist on "ca783a0f1f4ce8b0a16e6b96a8890edc47489e3a"
Unverified
Commit
f9792872
authored
Sep 10, 2024
by
Jakob Görgen
Browse files
fixed remaining patterns unreachable
parent
0a32b755
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
experiments/simbricks/orchestration/utils/base.py
experiments/simbricks/orchestration/utils/base.py
+6
-6
No files found.
experiments/simbricks/orchestration/utils/base.py
View file @
f9792872
...
...
@@ -30,18 +30,18 @@ class IdObj(abc.ABC):
def
__init__
(
self
):
self
.
_id
=
next
(
self
.
__id_iter
)
def
check_type
(
obj
,
expected_type
)
->
bool
:
"""
Checks if obj has type or is a subtype of expected_type
obj: an class object
expected_type: a type object
"""
match
obj
:
case
expected_type
:
return
True
case
_
:
return
False
return
isinstance
(
obj
,
expected_type
)
def
has_expected_type
(
obj
,
expected_type
)
->
None
:
if
not
check_type
(
obj
=
obj
,
expected_type
=
expected_type
):
raise
Exception
(
f
"obj of type
{
type
(
obj
)
}
has not the type or is not a subtype of
{
type
(
expected_type
)
}
"
)
\ No newline at end of file
raise
Exception
(
f
"obj of type
{
type
(
obj
)
}
has not the type or is not a subtype of
{
type
(
expected_type
)
}
"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment