summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorChenxiong Qi <qcxhome@gmail.com>2023-12-17 22:14:09 +0800
committerHossein <hossein@libreoffice.org>2023-12-27 13:48:47 +0100
commit8b6e0dd9e47c20a79fd194f6d530d1c868911bda (patch)
tree9ebad0a155cf126fe6fde2b892bb164aaf914000 /pyuno
parent7ad6ae594fd92b736b4217268eea47c71c04c34a (diff)
tdf#158803 Fix issues detected by pyflakes
Change-Id: Iaa329dff61db894e7d5fecd840e785a53a48b26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160889 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/demo/ooextract.py1
-rw-r--r--pyuno/qa/pytests/testcollections_XCellRange.py4
-rw-r--r--pyuno/qa/pytests/testcollections_XEnumerationAccess.py4
-rw-r--r--pyuno/qa/pytests/testcollections_XIndexAccess.py2
-rw-r--r--pyuno/qa/pytests/testcollections_XIndexReplace.py2
-rw-r--r--pyuno/qa/pytests/testcollections_XNameAccess.py12
-rw-r--r--pyuno/qa/pytests/testcollections_XNameReplace.py4
-rw-r--r--pyuno/qa/pytests/testcollections_misc.py2
-rw-r--r--pyuno/qa/pytests/testssl.py5
9 files changed, 19 insertions, 17 deletions
diff --git a/pyuno/demo/ooextract.py b/pyuno/demo/ooextract.py
index a5699548ce22..0aec00f43a47 100644
--- a/pyuno/demo/ooextract.py
+++ b/pyuno/demo/ooextract.py
@@ -45,7 +45,6 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hc:", ["help", "connection-string=", "html"])
- format = None
url = "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
filterName = "Text (Encoded)"
for o, a in opts:
diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py b/pyuno/qa/pytests/testcollections_XCellRange.py
index 6ab827ab3346..6ace0b11cba0 100644
--- a/pyuno/qa/pytests/testcollections_XCellRange.py
+++ b/pyuno/qa/pytests/testcollections_XCellRange.py
@@ -230,9 +230,9 @@ class TestXCellRange(CollectionsTestBase):
# When / Then
with self.assertRaises(KeyError):
- rng = sht[1:1, 3:5]
+ _ = sht[1:1, 3:5]
with self.assertRaises(KeyError):
- rng = sht[1:3, 3:3]
+ _ = sht[1:3, 3:3]
spr.close(True)
diff --git a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py
index 385514ae77c5..eecb81c05021 100644
--- a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py
+++ b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py
@@ -127,13 +127,13 @@ class TestXEnumerationAccess(CollectionsTestBase):
# if val in obj: ... # Test value presence
# For:
# Invalid value (dict)
- def test_XEnumerationAccess_IfIn_String(self):
+ def test_XEnumerationAccess_IfIn_String_TypeError(self):
# Given
doc = self.createBlankTextDocument()
# When / Then
with self.assertRaises(TypeError):
- result = {} in doc.Text
+ _ = {} in doc.Text
doc.close(True)
diff --git a/pyuno/qa/pytests/testcollections_XIndexAccess.py b/pyuno/qa/pytests/testcollections_XIndexAccess.py
index ee668b7bfb4c..07c14c1b0942 100644
--- a/pyuno/qa/pytests/testcollections_XIndexAccess.py
+++ b/pyuno/qa/pytests/testcollections_XIndexAccess.py
@@ -223,7 +223,7 @@ class TestXIndexAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- present = {} in doc.Footnotes
+ _ = {} in doc.Footnotes
doc.close(True);
diff --git a/pyuno/qa/pytests/testcollections_XIndexReplace.py b/pyuno/qa/pytests/testcollections_XIndexReplace.py
index b2b2d2245750..0075883543d3 100644
--- a/pyuno/qa/pytests/testcollections_XIndexReplace.py
+++ b/pyuno/qa/pytests/testcollections_XIndexReplace.py
@@ -177,7 +177,6 @@ class TestXIndexReplace(CollectionsTestBase):
def test_XIndexReplace_ReplaceSlice(self):
assign_max = 12
doc = self.createBlankTextDocument()
- t = tuple(range(10))
for j in [x for x in range(-12, 13)] + [None]:
for k in [x for x in range(-12, 13)] + [None]:
key = slice(j, k)
@@ -218,7 +217,6 @@ class TestXIndexReplace(CollectionsTestBase):
def test_XIndexReplace_ReplaceExtendedSlice(self):
assign_max = 12
doc = self.createBlankTextDocument()
- t = tuple(range(10))
for j in [x for x in range(-12, 13)] + [None]:
for k in [x for x in range(-12, 13)] + [None]:
for l in [-2, -1, 2]:
diff --git a/pyuno/qa/pytests/testcollections_XNameAccess.py b/pyuno/qa/pytests/testcollections_XNameAccess.py
index 5c5ad6890be2..155029b9fadf 100644
--- a/pyuno/qa/pytests/testcollections_XNameAccess.py
+++ b/pyuno/qa/pytests/testcollections_XNameAccess.py
@@ -66,7 +66,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(KeyError):
- link = drw.Links['Slide'].Links['foo']
+ _ = drw.Links['Slide'].Links['foo']
drw.close(True)
@@ -80,7 +80,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- link = drw.Links[None]
+ _ = drw.Links[None]
drw.close(True)
@@ -94,7 +94,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- link = drw.Links[12.34]
+ _ = drw.Links[12.34]
drw.close(True)
@@ -108,7 +108,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- link = drw.Links[(1, 2)]
+ _ = drw.Links[(1, 2)]
drw.close(True)
@@ -122,7 +122,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- link = drw.Links[[1, 2]]
+ _ = drw.Links[[1, 2]]
drw.close(True)
@@ -136,7 +136,7 @@ class TestXNameAccess(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- link = drw.Links[{'a': 'b'}]
+ _ = drw.Links[{'a': 'b'}]
drw.close(True)
diff --git a/pyuno/qa/pytests/testcollections_XNameReplace.py b/pyuno/qa/pytests/testcollections_XNameReplace.py
index a0be04404f09..e93ca590e51d 100644
--- a/pyuno/qa/pytests/testcollections_XNameReplace.py
+++ b/pyuno/qa/pytests/testcollections_XNameReplace.py
@@ -45,7 +45,7 @@ class TestXNameReplace(CollectionsTestBase):
# obj[key] = val # Replace by key
# For:
# Invalid key
- def test_XNameReplace_ReplaceName_Invalid(self):
+ def test_XNameReplace_ReplaceName_Invalid_Key(self):
# Given
doc = self.createBlankTextDocument()
event_properties = (PropertyValue(Name='Script', Value=getScriptName()),)
@@ -60,7 +60,7 @@ class TestXNameReplace(CollectionsTestBase):
# obj[key] = val # Replace by key
# For:
# Invalid key type
- def test_XNameReplace_ReplaceName_Invalid(self):
+ def test_XNameReplace_ReplaceName_Invalid_Key_Type(self):
# Given
doc = self.createBlankTextDocument()
event_properties = (PropertyValue(Name='Script', Value=getScriptName()),)
diff --git a/pyuno/qa/pytests/testcollections_misc.py b/pyuno/qa/pytests/testcollections_misc.py
index 7ca40de1f7ad..e32815840749 100644
--- a/pyuno/qa/pytests/testcollections_misc.py
+++ b/pyuno/qa/pytests/testcollections_misc.py
@@ -42,7 +42,7 @@ class TestMisc(CollectionsTestBase):
# When / Then
with self.assertRaises(TypeError):
- foo = "bar" in doc.UIConfigurationManager
+ _ = "bar" in doc.UIConfigurationManager
doc.close(True)
diff --git a/pyuno/qa/pytests/testssl.py b/pyuno/qa/pytests/testssl.py
index 6ec9875fb84f..d29066ffe39e 100644
--- a/pyuno/qa/pytests/testssl.py
+++ b/pyuno/qa/pytests/testssl.py
@@ -1,3 +1,4 @@
+import os
import unittest
@@ -6,5 +7,9 @@ class SSLTest(unittest.TestCase):
def test_ssl_import(self):
import ssl
+ # use imported ssl module for pyflakes
+ with open(os.devnull, "w") as devnull:
+ print(str(ssl), file=devnull)
+
if __name__ == '__main__':
unittest.main()