tdf#132293 remove unused imports and variables

I used pyflakes to check for any unused imports and variables in python scripts under sc, sw, uitest directories, and then removed the unused imports and variables

Change-Id: I0690c9366087dc602ee8ea169bc1c9063033fef6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141421
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Rakielle 2022-10-15 20:19:33 +01:00 committed by Xisco Fauli
parent 61f660daef
commit 09ba0057e3
28 changed files with 19 additions and 67 deletions

View file

@ -26,7 +26,7 @@ class autofilter(UITestCase):
self.assertEqual(calc_doc.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
def test_tdf123095(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
with self.ui_test.create_doc_in_start_center("calc"):
calcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = calcDoc.getChild("grid_window")
enter_text_to_cell(xGridWindow, "A1", "乙二醇(进口料件)")
@ -46,7 +46,7 @@ class autofilter(UITestCase):
self.assertEqual(get_state_as_dict(xTreeList.getChild("1"))["Text"], "乙二醇(进口料件)")
def test_tdf125363(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
with self.ui_test.create_doc_in_start_center("calc"):
calcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = calcDoc.getChild("grid_window")
enter_text_to_cell(xGridWindow, "A1", "guet")

View file

@ -12,7 +12,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class goToSheet(UITestCase):
def test_go_to_sheet(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = xCalcDoc.getChild("grid_window")

View file

@ -8,8 +8,6 @@
#
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from org.libreoffice.unotest import systemPathToFileUrl
from uitest.uihelper.common import select_by_text
from tempfile import TemporaryDirectory
import os.path

View file

@ -9,7 +9,6 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
from uitest.uihelper.common import select_by_text
from libreoffice.uno.propertyvalue import mkPropertyValues
from libreoffice.calc.document import get_cell_by_position

View file

@ -17,7 +17,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
# test all dialog items - trend Line dialog
class tdf93506(UITestCase):
def test_tdf93506_chart_trendline_dialog(self):
with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) as calc_doc:
with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")):
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")

View file

@ -13,7 +13,7 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf98690(UITestCase):
def test_tdf98690(self):
with self.ui_test.load_file(get_url_for_data_file("tdf98690.xlsx")) as calc_doc:
with self.ui_test.load_file(get_url_for_data_file("tdf98690.xlsx")):
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")

View file

@ -7,7 +7,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position

View file

@ -44,7 +44,6 @@ class tdf150307(UITestCase):
with self.ui_test.create_doc_in_start_center("calc"):
xCalcDoc = self.xUITest.getTopFocusWindow()
xGridWin = xCalcDoc.getChild("grid_window")
xPosWindow = xCalcDoc.getChild('pos_window')
self.xUITest.executeCommand(".uno:Sidebar")

View file

@ -103,21 +103,21 @@ class CheckStyle(unittest.TestCase):
xFamily.removeByName(xRightStyle2.Name)
with self.assertRaises(NoSuchElementException):
nope = xFamily.getByName("RightStyleOld")
xFamily.getByName("RightStyleOld")
with self.assertRaises(NoSuchElementException):
nope = xFamily.getByName("RightStyle")
xFamily.getByName("RightStyle")
with self.assertRaises(NoSuchElementException):
nope = xFamily.getByName("RightStyle2Old")
xFamily.getByName("RightStyle2Old")
with self.assertRaises(NoSuchElementException):
nope = xFamily.getByName("RightStyle2")
xFamily.getByName("RightStyle2")
with self.assertRaises(IllegalArgumentException):
xFamily.insertByName("WrongStyle", xWrongStyle)
with self.assertRaises(NoSuchElementException):
nope = xFamily.getByName("WrongStyle")
xFamily.getByName("WrongStyle")
def test_CharacterFamily(self):
xDoc = CheckStyle._uno.openEmptyWriterDoc()

View file

@ -3271,7 +3271,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
try:
if i_comp:
i_comp.close(True)
except Exception as e:
except Exception:
pass
def test_load_store(self):

View file

@ -9,13 +9,11 @@
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
class tdf149718( UITestCase ):
def test_chart_from_table_with_merged_cells( self ):
with self.ui_test.create_doc_in_start_center("writer") as document:
with self.ui_test.create_doc_in_start_center("writer"):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
@ -35,6 +33,6 @@ class tdf149718( UITestCase ):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
self.xUITest.executeCommand(".uno:CharRightSel")
with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xDialog:
xWizard = xDialog.getChild('Wizard')
xDialog.getChild('Wizard')
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -122,7 +122,7 @@ class bookmarkDialog(UITestCase):
self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tBookmark 1\tfubar\tNo\t")
def test_bookmark_dialog_hidden_from_DOCX_import(self):
with self.ui_test.load_file(get_url_for_data_file("tdf95495.docx")) as XDoc:
with self.ui_test.load_file(get_url_for_data_file("tdf95495.docx")):
# check Hidden field of the imported hidden bookmarks
with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:

View file

@ -10,8 +10,6 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import type_text
from libreoffice.uno.propertyvalue import mkPropertyValues
import time
class tdf150457(UITestCase):

View file

@ -14,7 +14,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf150443(UITestCase):
def test_tdf150443(self):
with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")) as document:
with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')

View file

@ -7,8 +7,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
class CheckBoxTest(UITestCase):

View file

@ -7,8 +7,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos

View file

@ -12,8 +12,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import type_text, get_state_as_dict, select_text
import time
class EditTest(UITestCase):
def test_type_text(self):

View file

@ -7,8 +7,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from libreoffice.uno.eventlistener import EventListener
from uitest.framework import UITestCase
from uitest.uihelper.common import get_url_for_data_file
import time
@ -17,7 +15,7 @@ class HandleFiles(UITestCase):
def test_load_file(self):
with self.ui_test.load_file(get_url_for_data_file("test.ods")) as calc_file:
with self.ui_test.load_file(get_url_for_data_file("test.ods")):
with self.ui_test.load_file(get_url_for_data_file("test2.ods")):
@ -34,7 +32,7 @@ class HandleFiles(UITestCase):
time.sleep(1)
def test_select_frame(self):
with self.ui_test.load_file(get_url_for_data_file("test.ods")) as calc_file:
with self.ui_test.load_file(get_url_for_data_file("test.ods")):
with self.ui_test.load_file(get_url_for_data_file("test2.ods")):
frames = self.ui_test.get_frames()

View file

@ -7,8 +7,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
import json

View file

@ -7,10 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
class ListBoxTest(UITestCase):

View file

@ -7,22 +7,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
import time
try:
import pyuno
import uno
import unohelper
except ImportError:
print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
print("PYTHONPATH=/installation/opt/program")
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
raise
class RadioButtonTest(UITestCase):
def test_toggle_radiobutton(self):

View file

@ -7,10 +7,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, type_text, select_pos
from uitest.uihelper.common import get_state_as_dict, type_text
class SpinFieldTest(UITestCase):

View file

@ -7,10 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
class TabDialogTest(UITestCase):

View file

@ -10,7 +10,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell
from uitest.uihelper.common import get_state_as_dict, select_pos
from uitest.uihelper.common import select_pos
from uitest.framework import UITestCase

View file

@ -14,7 +14,6 @@ import os
try:
import pyuno
import uno
import unohelper
except ImportError:
print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
print("PYTHONPATH=/installation/opt/program")

View file

@ -6,7 +6,6 @@
#
try:
import pyuno
import unohelper
from com.sun.star.document import XDocumentEventListener
except ImportError:

View file

@ -6,7 +6,6 @@
#
try:
import pyuno
import uno
except ImportError:
print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")

View file

@ -14,9 +14,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import type_text, select_pos
import unittest
import platform
class SimpleMathTest(UITestCase):
def test_math_unoCommand(self):
@ -39,7 +36,6 @@ class SimpleMathTest(UITestCase):
xEditView = xMathDoc.getChild("editview")
type_text(xEditView, "E=mc^2")
xMathEdit = xMathDoc.getChild("editview")
self.assertEqual("E=mc^2", get_state_as_dict(xEditView)["Text"])