Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
scriptconfig
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Utils
scriptconfig
Commits
7f2bf326
Commit
7f2bf326
authored
1 year ago
by
Jon Crall
Browse files
Options
Downloads
Patches
Plain Diff
format changes
parent
116e423a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!24
Start branch for dev/0.7.7
Pipeline
#327743
failed
1 year ago
Stage: build
Stage: test
Stage: external
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
requirements/optional.txt
+1
-0
1 addition, 0 deletions
requirements/optional.txt
scriptconfig/argparse_ext.py
+11
-0
11 additions, 0 deletions
scriptconfig/argparse_ext.py
with
12 additions
and
0 deletions
requirements/optional.txt
+
1
−
0
View file @
7f2bf326
...
...
@@ -13,3 +13,4 @@ numpy>=1.11.1 ; python_version < '3.4' and python_version >= '2.7' # Python
omegaconf>=2.2.2 ; python_version >= '3.6' # Python 3.6+
rich_argparse>=1.1.0; python_version >= '3.7'
argcomplete>=3.0.5
This diff is collapsed.
Click to expand it.
scriptconfig/argparse_ext.py
+
11
−
0
View file @
7f2bf326
...
...
@@ -222,6 +222,10 @@ class RawDescriptionDefaultsHelpFormatter(
for
option_string
in
display_option_strings
:
if
SCFG_MODIFICATIONS
:
if
option_string
.
startswith
(
'
--no-
'
):
if
isinstance
(
action
.
default
,
int
)
and
action
.
default
==
0
:
# Dont bother telling the user they can turn
# something off when that is the default.
continue
parts
.
append
(
'
%s
'
%
(
option_string
,))
else
:
parts
.
append
(
'
%s %s
'
%
(
option_string
,
args_string
))
...
...
@@ -230,6 +234,9 @@ class RawDescriptionDefaultsHelpFormatter(
return
'
,
'
.
join
(
parts
)
def
_rich_format_action_invocation
(
self
,
action
):
"""
Mirrors _format_action_invocation but for rich-argparse
"""
from
rich.text
import
Text
if
not
action
.
option_strings
:
...
...
@@ -254,6 +261,10 @@ class RawDescriptionDefaultsHelpFormatter(
args_string
=
self
.
_format_args
(
action
,
default
)
for
option_string
in
display_option_strings
:
if
option_string
.
startswith
(
'
--no-
'
):
if
isinstance
(
action
.
default
,
int
)
and
action
.
default
==
0
:
# Dont bother telling the user they can turn
# something off when that is the default.
continue
part
=
Text
(
option_string
,
'
argparse.args
'
)
else
:
part
=
Text
(
"
"
).
join
([
Text
(
option_string
,
'
argparse.args
'
),
Text
(
args_string
,
'
argparse.metavar
'
)])
...
...
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