[elbe-devel] [PATCH 37/40] pylint: directories - annotate usage of global
Torben Hohn
torben.hohn at linutronix.de
Fri Sep 21 11:19:32 CEST 2018
On Fri, Sep 14, 2018 at 01:56:49PM +0200, Manuel Traut wrote:
> global is really what should be used there. Because
> the values should be accessible by other modules.
>
> It would be feasable to rewrite the code to be a class
> and use class variables for this. But i don't really
> see a reason for this.
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/directories.py | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/elbepack/directories.py b/elbepack/directories.py
> index d81cb72f..3909dbaa 100644
> --- a/elbepack/directories.py
> +++ b/elbepack/directories.py
> @@ -17,9 +17,11 @@ examples_dir = None
>
>
> def init_directories(elbe_relpath):
> - global elbe_exe
> - global elbe_dir
> - global examples_dir
> + # set global variables that are used in other modules via imports
> + # this is the very first function that is called by 'elbe'
> + global elbe_exe #pylint: disable=global-statement
> + global elbe_dir #pylint: disable=global-statement
> + global examples_dir #pylint: disable=global-statement
>
> elbe_exe = os.path.abspath(elbe_relpath)
> elbe_dir = os.path.dirname(elbe_exe)
> --
> 2.19.0.rc2
>
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20180921/591d8e7b/attachment.sig>
More information about the elbe-devel
mailing list