Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
aliby-mirror
Commits
2665bf22
Commit
2665bf22
authored
2 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
change(bin.run): move casting fn to agora
parent
92fb44cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aliby/bin/run.py
+3
-12
3 additions, 12 deletions
src/aliby/bin/run.py
with
3 additions
and
12 deletions
src/aliby/bin/run.py
+
3
−
12
View file @
2665bf22
#!/usr/bin/env jupyter
import
argparse
from
agora.utils.cast
import
_str_to_int
from
aliby.pipeline
import
Pipeline
,
PipelineParameters
...
...
@@ -19,7 +21,6 @@ def run():
Examples
--------
FIXME: Add docs.
FIXME: GTP-generated. Confirm manually.
"""
parser
=
argparse
.
ArgumentParser
(
prog
=
"
aliby-run
"
,
...
...
@@ -37,23 +38,13 @@ def run():
"
password
"
:
None
,
}
def
_cast_str
(
x
:
str
or
None
):
"""
Cast string as int if possible. If Nonetype return None.
"""
if
x
:
try
:
return
int
(
x
)
except
:
return
x
for
k
in
param_values
:
parser
.
add_argument
(
f
"
--
{
k
}
"
,
action
=
"
store
"
)
args
=
parser
.
parse_args
()
for
k
in
param_values
:
if
passed_value
:
=
_
cast_str
(
getattr
(
args
,
k
)):
if
passed_value
:
=
_
str_to_int
(
getattr
(
args
,
k
)):
param_values
[
k
]
=
passed_value
...
...
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