summaryrefslogtreecommitdiff
path: root/examples/python/gi/checkpoint.py
Commit message (Collapse)AuthorAgeFilesLines
* examples: fix handling "--last" argument in "examples/python/gi/checkpoint.py"Thomas Haller2022-12-091-3/+3
| | | | Fixes: 3ce3ed4c92fb ('examples: improve finding last checkpoint in "checkpoint.py"')
* examples: improve finding last checkpoint in "checkpoint.py"Thomas Haller2022-05-021-5/+5
| | | | | This is a python example. We should do nice things, like using max() for finding the maximum, instead of sorting.
* examples: add "--last" argument to "examples/python/gi/checkpoint.py"Thomas Haller2022-02-231-44/+73
| | | | | | | | | | | | | "examples/python/gi/checkpoint.py" is not only an example. It's also a useful script for testing checkpoints. Support a "--last" argument to specify the last checkpoint created. Otherwise, when you are using this example from a test script, it can be cumbersome to find the right checkpoint point. Also, rename "client" and "nm_client" variables to "nmc". The purpose of using the same variable name for the same thing is readability, but also it works better when copy+paste snippets into the Python REPL.
* all: update deprecated SPDX license identifiersThomas Haller2021-01-051-1/+1
| | | | | | | | | | | | | | | | These SPDX license identifiers are deprecated ([1]). Update them. [1] https://spdx.org/licenses/ sed \ -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \ -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \ -i \ $(git grep -l SPDX-License-Identifier -- \ ':(exclude)shared/c-*/' \ ':(exclude)shared/n-*/' \ ':(exclude)shared/systemd/src' \ ':(exclude)src/systemd/src')
* all: reformat python files with python blackSayed Shah2020-06-151-19/+48
| | | | | | Part of !537. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/537
* examples: avoid "except" for BaseException in examplesThomas Haller2020-05-071-1/+1
| | | | lgtm.com flags this as "Except block directly handles BaseException".
* examples: remove unused imports from python examplesThomas Haller2020-05-071-2/+0
|
* all: unify format of our Copyright source code commentsThomas Haller2019-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```bash readarray -d '' FILES < <( git ls-files -z \ ':(exclude)po' \ ':(exclude)shared/c-rbtree' \ ':(exclude)shared/c-list' \ ':(exclude)shared/c-siphash' \ ':(exclude)shared/c-stdaux' \ ':(exclude)shared/n-acd' \ ':(exclude)shared/n-dhcp4' \ ':(exclude)src/systemd/src' \ ':(exclude)shared/systemd/src' \ ':(exclude)m4' \ ':(exclude)COPYING*' ) sed \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \ -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \ -i \ "${FILES[@]}" echo ">>> untouched Copyright lines" git grep Copyright "${FILES[@]}" echo ">>> Copyright lines with unusual extra" git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved sed \ -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \ -i \ "${FILES[@]}" ``` https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
* all: manually drop code comments with file descriptionThomas Haller2019-10-011-1/+2
|
* all: SPDX header conversionLubomir Rintel2019-09-101-8/+1
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* all: drop vim file variables from source filesThomas Haller2019-06-111-1/+0
| | | | sed '1,3 { /^\(#\|--\) *vim:/d }; 1 { /^\/\* *vim:.*\*\/$/ d}' -i $(git grep -l 'vim:')
* all: drop emacs file variables from source filesThomas Haller2019-06-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | We no longer add these. If you use Emacs, configure it yourself. Also, due to our "smart-tab" usage the editor anyway does a subpar job handling our tabs. However, on the upside every user can choose whatever tab-width he/she prefers. If "smart-tabs" are used properly (like we do), every tab-width will work. No manual changes, just ran commands: F=($(git grep -l -e '-\*-')) sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}" sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}" Check remaining lines with: git grep -e '-\*-' The ultimate purpose of this is to cleanup our files and eventually use SPDX license identifiers. For that, first get rid of the boilerplate lines.
* examples/python: utilize nm_utils_get_timestamp_msec()Lubomir Rintel2018-06-151-3/+1
|
* libnm: rework checkpoint APIThomas Haller2018-04-041-25/+30
| | | | | | | | | | | | | | | | | | | | | | The libnm API fir checkpoints was only introduced with 1.11. It is not yet stable, so there is still time to adjust it. Note that this changes API/ABI of the development branch. Changes: - we only add async variants of the checkpoint functions. I believe that synchronous D-Bus methods are fundamentally flawed, because they mess up the ordering of events. Rename the async functions by removing the "_async" suffix. This matches glib style, for which the async form is also not specially marked. - for function that refere to a particular checkpoint (rollback and destroy), accept the D-Bus path as string, instead of an NMCheckpoint instance. This form is more flexible, because it allows to use the function without having a NMCheckpoint instance at hand. On the other hand, if one has a NMCheckpoint instance, he can trivially obtain the path to make the call.
* examples: improve checkpoint.py for python/giThomas Haller2018-04-041-49/+100
| | | | | | | | - make python2 and python3 compatible - support Checkpoint create flags (requires recent libnm for GI of flags) - support adjust-rollback-timeout command - print elapsed time in show output
* checkpoint: generate GIR information for NMCheckpointCreateFlagsThomas Haller2018-04-041-0/+1
| | | | | | | Note that this changes API for checkpoint_create_async() in Python via GIR. Previously it would require an integer argument, now a flags argument. But this API is still unstable, it will be introduced with 1.12.
* examples: add checkpoint example using python gobject-introspectionBeniamino Galvani2017-11-091-0/+130