Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cyber-sandbox-creator
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
MUNI-KYPO-CSC
cyber-sandbox-creator
Commits
5f9d8257
Commit
5f9d8257
authored
3 years ago
by
Attila Farkas
Browse files
Options
Downloads
Patches
Plain Diff
Remove type check warnings
parent
afb3259a
No related branches found
No related tags found
1 merge request
!32
Version 2.0.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cyber_sandbox_creator/creator.py
+9
-9
9 additions, 9 deletions
cyber_sandbox_creator/creator.py
with
9 additions
and
9 deletions
cyber_sandbox_creator/creator.py
+
9
−
9
View file @
5f9d8257
...
...
@@ -30,12 +30,12 @@ def create(topology: Union[str, Path], output_dir: Union[str, Path],
"""
try
:
if
typ
e
(
topology
)
==
str
:
if
isinstanc
e
(
topology
,
str
)
:
topology_path
:
Path
=
Path
(
topology
).
resolve
()
elif
typ
e
(
topology
)
==
Path
:
elif
isinstanc
e
(
topology
,
Path
)
:
topology_path
:
Path
=
topology
.
resolve
()
else
:
raise
TypeError
(
"
Topology definition file path has invalid type
"
raise
TypeError
(
"
Topology definition file path has invalid type
"
f
"
\"
{
type
(
topology
)
}
\"
"
)
if
not
topology_path
.
is_file
():
raise
IOError
(
f
"
File
\"
{
topology_path
}
\"
does not exist
"
)
...
...
@@ -43,9 +43,9 @@ def create(topology: Union[str, Path], output_dir: Union[str, Path],
raise
ValueError
(
f
"
Invalid path to topology file
\"
{
topology
}
\"
"
)
try
:
if
typ
e
(
output_dir
)
==
str
:
if
isinstanc
e
(
output_dir
,
str
)
:
sandbox_path
:
Path
=
Path
(
output_dir
).
resolve
()
elif
typ
e
(
output_dir
)
==
Path
:
elif
isinstanc
e
(
output_dir
,
Path
)
:
sandbox_path
:
Path
=
output_dir
.
resolve
()
else
:
raise
TypeError
(
"
Output directory path has invalid type
"
...
...
@@ -56,9 +56,9 @@ def create(topology: Union[str, Path], output_dir: Union[str, Path],
try
:
user_provisioning_path
:
Optional
[
Path
]
=
None
if
provisioning_dir
:
if
typ
e
(
provisioning_dir
)
==
str
:
if
isinstanc
e
(
provisioning_dir
,
str
)
:
user_provisioning_path
=
Path
(
provisioning_dir
).
resolve
()
elif
typ
e
(
provisioning_dir
)
==
Path
:
elif
isinstanc
e
(
provisioning_dir
,
Path
)
:
user_provisioning_path
=
provisioning_dir
.
resolve
()
else
:
raise
TypeError
(
"
Provisioning directory path has invalid type
"
...
...
@@ -77,9 +77,9 @@ def create(topology: Union[str, Path], output_dir: Union[str, Path],
try
:
extra_vars_path
:
Optional
[
Path
]
=
None
if
extra_vars
:
if
typ
e
(
extra_vars
)
==
str
:
if
isinstanc
e
(
extra_vars
,
str
)
:
extra_vars_path
=
Path
(
extra_vars
).
resolve
()
elif
typ
e
(
extra_vars
)
==
Path
:
elif
isinstanc
e
(
extra_vars
,
Path
)
:
extra_vars_path
=
extra_vars
.
resolve
()
else
:
raise
TypeError
(
"
Extra vars file path has invalid type
"
...
...
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