diff mbox series

[bitbake-devel,1/1] lib: Remove double imports

Message ID 20250225183425.232815-1-michaelestner@web.de
State New
Headers show
Series [bitbake-devel,1/1] lib: Remove double imports | expand

Commit Message

Michael Estner Feb. 25, 2025, 6:34 p.m. UTC
* Remove double imports mentioned by pylint

Signed-off-by: Michael Estner <michaelestner@web.de>
---
 lib/bb/__init__.py                                 | 1 -
 lib/bb/acl.py                                      | 2 --
 lib/bb/fetch2/git.py                               | 1 -
 lib/bb/fetch2/gitsm.py                             | 2 +-
 lib/bb/runqueue.py                                 | 1 -
 lib/bs4/__init__.py                                | 1 -
 lib/bs4/diagnose.py                                | 1 -
 lib/ply/yacc.py                                    | 1 -
 lib/toaster/orm/models.py                          | 3 +--
 lib/toaster/toastergui/templatetags/projecttags.py | 1 -
 lib/toaster/toastergui/views.py                    | 2 --
 lib/toaster/toastermain/settings.py                | 1 -
 12 files changed, 2 insertions(+), 15 deletions(-)

--
2.25.1
diff mbox series

Patch

diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index 574e0de5b..876f7e397 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -194,7 +194,6 @@  def deprecated(func, name=None, advice=""):
 # For compatibility
 def deprecate_import(current, modulename, fromlist, renames = None):
     """Import objects from one module into another, wrapping them with a DeprecationWarning"""
-    import sys

     module = __import__(modulename, fromlist = fromlist)
     for position, objname in enumerate(fromlist):
diff --git a/lib/bb/acl.py b/lib/bb/acl.py
index 0f41b275c..e9dbdb617 100755
--- a/lib/bb/acl.py
+++ b/lib/bb/acl.py
@@ -195,8 +195,6 @@  class ACL(object):

 def main():
     import argparse
-    import pwd
-    import grp
     from pathlib import Path

     parser = argparse.ArgumentParser()
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 6badda597..168f14d0c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -817,7 +817,6 @@  class Git(FetchMethod):
         """
         Return True if git-lfs can be found, False otherwise.
         """
-        import shutil
         return shutil.which("git-lfs", path=d.getVar('PATH')) is not None

     def _get_repo_url(self, ud):
diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index ba62517f0..bab1bf258 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -264,7 +264,7 @@  class GitSM(Git):
         Git.clean(self, ud, d)

     def implicit_urldata(self, ud, d):
-        import shutil, subprocess, tempfile
+        import subprocess

         urldata = []
         def add_submodule(ud, url, module, modpath, workdir, d):
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index ffb2d2849..ad4ce0b0e 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -477,7 +477,6 @@  class RunQueueData:
         self.runtaskentries = {}

     def runq_depends_names(self, ids):
-        import re
         ret = []
         for id in ids:
             nam = os.path.basename(id)
diff --git a/lib/bs4/__init__.py b/lib/bs4/__init__.py
index d8ad5e1dc..725203d94 100644
--- a/lib/bs4/__init__.py
+++ b/lib/bs4/__init__.py
@@ -835,6 +835,5 @@  class FeatureNotFound(ValueError):

 #If this file is run as a script, act as an HTML pretty-printer.
 if __name__ == '__main__':
-    import sys
     soup = BeautifulSoup(sys.stdin)
     print((soup.prettify()))
diff --git a/lib/bs4/diagnose.py b/lib/bs4/diagnose.py
index e079772e6..469279534 100644
--- a/lib/bs4/diagnose.py
+++ b/lib/bs4/diagnose.py
@@ -17,7 +17,6 @@  import tempfile
 import time
 import traceback
 import sys
-import cProfile

 def diagnose(data):
     """Diagnostic suite for isolating common problems.
diff --git a/lib/ply/yacc.py b/lib/ply/yacc.py
index 381b50cf0..529f85b08 100644
--- a/lib/ply/yacc.py
+++ b/lib/ply/yacc.py
@@ -1122,7 +1122,6 @@  class LRParser:
 # manipulate the rules that make up a grammar.
 # -----------------------------------------------------------------------------

-import re

 # regex matching identifiers
 _is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$')
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 19c968620..e2f488ed8 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -79,7 +79,6 @@  if 'sqlite' in settings.DATABASES['default']['ENGINE']:
     # end of HACK

 class GitURLValidator(validators.URLValidator):
-    import re
     regex = re.compile(
         r'^(?:ssh|git|http|ftp)s?://'  # http:// or https://
         r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # domain...
@@ -1500,7 +1499,7 @@  class Layer_Version(models.Model):
     # code lifted, with adaptations, from the layerindex-web application
     # https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/
     def _handle_url_path(self, base_url, path):
-        import re, posixpath
+        import posixpath
         if base_url:
             if self.dirpath:
                 if path:
diff --git a/lib/toaster/toastergui/templatetags/projecttags.py b/lib/toaster/toastergui/templatetags/projecttags.py
index bd398f001..aee9bbcd1 100644
--- a/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/lib/toaster/toastergui/templatetags/projecttags.py
@@ -233,7 +233,6 @@  def filter_sizeovertotal(package_object, total_size):

     return '{:.1%}'.format(float(size)/float(total_size))

-from django.utils.safestring import mark_safe
 @register.filter
 def format_vpackage_rowclass(size):
     if size == -1:
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 40aed265d..061e6436c 100644
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -372,7 +372,6 @@  def _get_parameters_values(request, default_count, default_order):
 # set cookies for parameters. this is usefull in case parameters are set
 # manually from the GET values of the link
 def _set_parameters_values(pagesize, orderby, request):
-    from django.urls import resolve
     current_url = resolve(request.path_info).url_name
     request.session['%s_count' % current_url] = pagesize
     request.session['%s_orderby' % current_url] =orderby
@@ -699,7 +698,6 @@  class LazyEncoder(json.JSONEncoder):
         return super(LazyEncoder, self).default(obj)

 from toastergui.templatetags.projecttags import filtered_filesizeformat
-import os
 def _get_dir_entries(build_id, target_id, start):
     node_str = {
         Target_File.ITYPE_REGULAR   : '-',
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index e06adc5a9..d2a449627 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -298,7 +298,6 @@  SOUTH_TESTS_MIGRATE = False

 # We automatically detect and install applications here if
 # they have a 'models.py' or 'views.py' file
-import os
 currentdir = os.path.dirname(__file__)
 for t in os.walk(os.path.dirname(currentdir)):
     modulename = os.path.basename(t[0])