All of lore.kernel.org
 help / color / mirror / Atom feed
* [bitbake-devel][PATCH 1/1] utils: pylint: clean up imports
@ 2025-02-17 15:29 Michael Estner
  2025-02-18 23:10 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Estner @ 2025-02-17 15:29 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Michael Estner

As mentioned in the TODO file I run pylint
and start clean code including:
Remove double imports
Order the imports as mentioned by pylint.
First small patch to see if what I do
fits the expectations.

Signed-off-by: Michael Estner <michaelestner@web.de>
---
 lib/bb/utils.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 135c71c00..3cb59d807 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -11,11 +11,8 @@ import re, fcntl, os, string, stat, shutil, time
 import sys
 import errno
 import logging
-import bb
-import bb.msg
 import locale
 import multiprocessing
-import fcntl
 import importlib
 import importlib.machinery
 import importlib.util
@@ -24,7 +21,6 @@ import subprocess
 import glob
 import fnmatch
 import traceback
-import errno
 import signal
 import collections
 import copy
@@ -36,6 +32,8 @@ import tempfile
 from subprocess import getstatusoutput
 from contextlib import contextmanager
 from ctypes import cdll
+import bb
+import bb.msg

 logger = logging.getLogger("BitBake.Util")
 python_extensions = importlib.machinery.all_suffixes()
@@ -1457,8 +1455,6 @@ def edit_bblayers_conf(bblayers_conf, add, remove, edit_cb=None):
             but weren't (because they weren't in the list)
     """

-    import fnmatch
-
     def remove_trailing_sep(pth):
         if pth and pth[-1] == os.sep:
             pth = pth[:-1]
@@ -1649,7 +1645,7 @@ def ioprio_set(who, cls, value):
         bb.warn("Unable to set IO Prio for arch %s" % _unamearch)

 def set_process_name(name):
-    from ctypes import cdll, byref, create_string_buffer
+    from ctypes import byref, create_string_buffer
     # This is nice to have for debugging, not essential
     try:
         libc = cdll.LoadLibrary('libc.so.6')
--
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [bitbake-devel][PATCH 1/1] utils: pylint: clean up imports
  2025-02-17 15:29 [bitbake-devel][PATCH 1/1] utils: pylint: clean up imports Michael Estner
@ 2025-02-18 23:10 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2025-02-18 23:10 UTC (permalink / raw)
  To: michaelestner, bitbake-devel

On Mon, 2025-02-17 at 16:29 +0100, Michael Estner via
lists.openembedded.org wrote:
> As mentioned in the TODO file I run pylint
> and start clean code including:
> Remove double imports
> Order the imports as mentioned by pylint.
> First small patch to see if what I do
> fits the expectations.
> 
> Signed-off-by: Michael Estner <michaelestner@web.de>
> ---
>  lib/bb/utils.py | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

Thanks for this. The patch itself was fine and I've merged it. I did
need to tweak the commit message itself a little bit to be more focused
on the patch and have correct line wrapping.

I was initially a bit worried as the TODO file hasn't been touched in a
long time but you did pick a sensible improvement so well done for
filtering it to something useful.

I would warn that we wouldn't necessarily act on everything suggested
by the linter, we'd prefer to focus on "real" issues. Unneeded imports
definitely fit into that category.

I'll try and find some time to clean up that TODO file a bit.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-18 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 15:29 [bitbake-devel][PATCH 1/1] utils: pylint: clean up imports Michael Estner
2025-02-18 23:10 ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.