scripting/source/pyprov/pythonscript.py                 |   32 +++++++---------
 wizards/com/sun/star/wizards/ui/event/CommonListener.py |   15 ++++---
 wizards/source/access2base/access2base.py               |    4 +-
 3 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit a2569900d7be8bf94a83da2a6de8e7a67c23ff49
Author:     Bogdan Buzea <[email protected]>
AuthorDate: Sun Jun 1 20:36:29 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Jun 10 09:00:16 2025 +0200

    tdf#158803 E402 Module level import not at top of file
    
    Change-Id: Id2a1d7715ba7c7094c39949afc6fe7b03a445cba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186114
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index ad72e4722a21..c6cf8efbb7e0 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -28,6 +28,21 @@ import platform
 from com.sun.star.uri.RelativeUriExcessParentSegments import RETAIN
 from urllib.parse import unquote
 
+from com.sun.star.uno import RuntimeException
+from com.sun.star.lang import IllegalArgumentException
+from com.sun.star.container import NoSuchElementException
+from com.sun.star.ucb import XCommandEnvironment, XProgressHandler, Command
+from com.sun.star.task import XInteractionHandler
+from com.sun.star.beans import XPropertySet, Property
+from com.sun.star.container import XNameContainer
+from com.sun.star.xml.sax import XDocumentHandler, InputSource
+from com.sun.star.uno import Exception as UnoException
+from com.sun.star.script import XInvocation
+from com.sun.star.awt import XActionListener
+
+from com.sun.star.script.provider import XScriptProvider, XScript, 
ScriptFrameworkErrorException
+from com.sun.star.script.browse import XBrowseNode
+from com.sun.star.script.browse.BrowseNodeTypes import SCRIPT, CONTAINER
 
 class LogLevel:
     NONE = 0  # production level
@@ -121,23 +136,6 @@ log = Logger(getLogTarget())
 
 log.debug("pythonscript loading")
 
-# from com.sun.star.lang import typeOfXServiceInfo, typeOfXTypeProvider
-from com.sun.star.uno import RuntimeException
-from com.sun.star.lang import IllegalArgumentException
-from com.sun.star.container import NoSuchElementException
-from com.sun.star.ucb import XCommandEnvironment, XProgressHandler, Command
-from com.sun.star.task import XInteractionHandler
-from com.sun.star.beans import XPropertySet, Property
-from com.sun.star.container import XNameContainer
-from com.sun.star.xml.sax import XDocumentHandler, InputSource
-from com.sun.star.uno import Exception as UnoException
-from com.sun.star.script import XInvocation
-from com.sun.star.awt import XActionListener
-
-from com.sun.star.script.provider import XScriptProvider, XScript, 
ScriptFrameworkErrorException
-from com.sun.star.script.browse import XBrowseNode
-from com.sun.star.script.browse.BrowseNodeTypes import SCRIPT, CONTAINER
-
 LANGUAGENAME = "Python"
 GLOBAL_SCRIPTCONTEXT_NAME = "XSCRIPTCONTEXT"
 CALLABLE_CONTAINER_NAME = "g_exportedScripts"
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py 
b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
index dad035ddf2c6..63bdb2024405 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
@@ -18,6 +18,14 @@
 import unohelper
 
 from com.sun.star.awt import XActionListener
+from com.sun.star.awt import XItemListener
+from com.sun.star.awt import XTextListener
+from com.sun.star.frame import XTerminateListener
+from com.sun.star.awt import XWindowListener
+from com.sun.star.awt import XAdjustmentListener
+from com.sun.star.awt import XFocusListener
+from com.sun.star.awt import XKeyListener
+
 class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -30,7 +38,6 @@ class ActionListenerProcAdapter( unohelper.Base, 
XActionListener ):
         # TODO: Implement ?
         pass
 
-from com.sun.star.awt import XItemListener
 class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -46,7 +53,6 @@ class ItemListenerProcAdapter( unohelper.Base, XItemListener 
):
         # TODO: Implement ?
         pass
 
-from com.sun.star.awt import XTextListener
 class TextListenerProcAdapter( unohelper.Base, XTextListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -59,7 +65,6 @@ class TextListenerProcAdapter( unohelper.Base, XTextListener 
):
         # TODO: Implement ?
         pass
 
-from com.sun.star.frame import XTerminateListener
 class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -68,7 +73,6 @@ class TerminateListenerProcAdapter( unohelper.Base, 
XTerminateListener ):
         if callable( self.oProcToCall ):
             self.oProcToCall()
 
-from com.sun.star.awt import XWindowListener
 class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -93,7 +97,6 @@ class WindowListenerProcAdapter( unohelper.Base, 
XWindowListener ):
         # TODO: Implement ?
         pass
 
-from com.sun.star.awt import XAdjustmentListener
 class AdjustmentListenerProcAdapter( unohelper.Base, XAdjustmentListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -102,7 +105,6 @@ class AdjustmentListenerProcAdapter( unohelper.Base, 
XAdjustmentListener ):
         if callable( self.oProcToCall ):
             self.oProcToCall()
 
-from com.sun.star.awt import XFocusListener
 class FocusListenerProcAdapter( unohelper.Base, XFocusListener ):
     def __init__( self, oProcToCall):
         self.oProcToCall = oProcToCall
@@ -111,7 +113,6 @@ class FocusListenerProcAdapter( unohelper.Base, 
XFocusListener ):
         if callable( self.oProcToCall ):
             self.oProcToCall(FocusEvent)
 
-from com.sun.star.awt import XKeyListener
 class KeyListenerProcAdapter( unohelper.Base, XKeyListener ):
     def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
diff --git a/wizards/source/access2base/access2base.py 
b/wizards/source/access2base/access2base.py
index e54dca0bbcf3..ab2c183ce32f 100644
--- a/wizards/source/access2base/access2base.py
+++ b/wizards/source/access2base/access2base.py
@@ -37,14 +37,14 @@ Specific documentation about Access2Base and Python:
 """
 
 import uno
-XSCRIPTCONTEXT = uno
-
 from platform import system as _opsys
 import datetime
 import os
 import sys
 import traceback
 
+XSCRIPTCONTEXT = uno
+
 _LIBRARY = ''               # Should be 'Access2Base' or 'Access2BaseDev'
 _VERSION = '7.4'            # Actual version number
 _WRAPPERMODULE = 'Python'   # Module name in the Access2Base library 
containing Python interfaces

Reply via email to