Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mkexp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esmenv
mkexp
Commits
908d3b29
Commit
908d3b29
authored
3 weeks ago
by
Karl-Hermann Wieners
Browse files
Options
Downloads
Patches
Plain Diff
setconfig: make deletion of missing keys non-fatal
parent
eeb79f2d
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES.rst
+5
-0
5 additions, 0 deletions
CHANGES.rst
setconfig
+7
-4
7 additions, 4 deletions
setconfig
with
12 additions
and
4 deletions
CHANGES.rst
+
5
−
0
View file @
908d3b29
...
...
@@ -20,6 +20,11 @@ Config
* Setting to skip reading of the default config file (``.NO_DEFAULT = true``)
* Add function to convert ISO periods to seconds (period2sec)
Tools
-----
* Make deletion of missing keys non-fatal for setconfig
Release 1.4.1
=============
...
...
This diff is collapsed.
Click to expand it.
setconfig
+
7
−
4
View file @
908d3b29
...
...
@@ -15,7 +15,7 @@ import sys
from
expconfig
import
ConfigObj
from
expargparse
import
assigns_to_dicts
,
get_key_chain
from
feedback
import
die
from
feedback
import
die
,
warn
import
package_info
#
...
...
@@ -70,9 +70,12 @@ for current in args.delete:
chain
=
get_key_chain
(
current
)
chain
.
reverse
()
key
=
chain
.
pop
()
for
section
in
chain
:
config
=
config
[
section
]
del
config
[
key
]
try
:
for
section
in
chain
:
config
=
config
[
section
]
del
config
[
key
]
except
KeyError
:
warn
(
f
"
key to be deleted (
{
current
}
) does not exist
"
)
# Merge key=value assignments from command line
...
...
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