Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyroute2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
safeedge
pyroute2
Commits
d000d3d1
Commit
d000d3d1
authored
Apr 15, 2020
by
Peter V. Saveliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb.objects: update `set()` syntax
Valid variants:: br0.set('mtu', 1500) br0.set(mtu=1500)
parent
d5d2ad58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
pyroute2/ndb/objects/__init__.py
pyroute2/ndb/objects/__init__.py
+7
-1
No files found.
pyroute2/ndb/objects/__init__.py
View file @
d000d3d1
...
...
@@ -376,7 +376,7 @@ class RTNL_Object(dict):
out
[
key
]
=
self
[
key
]
return
'%s
\n
'
%
json
.
dumps
(
out
,
indent
=
4
,
separators
=
(
','
,
': '
))
def
set
(
self
,
key
,
value
):
def
set
(
self
,
*
argv
,
**
kwarg
):
'''
Set a field specified by `key` to `value`, and return self. The
method is useful to write call chains like that::
...
...
@@ -388,6 +388,12 @@ class RTNL_Object(dict):
.set('address', '00:11:22:33:44:55')
.commit())
'''
key
,
value
=
None
,
None
if
argv
:
key
,
value
=
argv
elif
kwarg
:
for
key
,
value
in
kwarg
.
items
():
break
self
[
key
]
=
value
return
self
...
...
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