Resolve lint errors from Ruff 0.0.259

This commit is contained in:
Adam Turner 2023-03-23 21:58:38 +00:00
parent 54f531e978
commit 9df3b59e00
6 changed files with 7 additions and 5 deletions

View File

@ -247,6 +247,7 @@ ignore = [
"S105", # possible hardcoded password
"S110", # try/except/pass detected
"S113", # probable use of requests call without timeout
"S301", # 'pickle' unsafe when loading untrusted data
"S324", # probable use of insecure hash functions
"S701", # use autoescape=True for Jinja
# flake8-simplify

View File

@ -82,7 +82,7 @@ def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) ->
def etree_parse(path: str) -> Any:
with warnings.catch_warnings(record=False):
warnings.filterwarnings("ignore", category=DeprecationWarning)
return ElementTree.parse(path)
return ElementTree.parse(path) # NoQA: S314 # using known data in tests
class Struct:

View File

@ -36,7 +36,8 @@ class EPUBElementTree:
@classmethod
def fromstring(cls, string):
return cls(ElementTree.fromstring(string))
tree = ElementTree.fromstring(string) # NoQA: S314 # using known data in tests
return cls(tree)
def find(self, match):
ret = self.tree.find(match, namespaces=self.namespaces)

View File

@ -862,7 +862,7 @@ def test_latex_show_urls_is_inline(app, status, warning):
'(http://sphinx\\sphinxhyphen{}doc.org/)}\n'
'\\sphinxAtStartPar\nDescription' in result)
assert ('\\sphinxlineitem{Footnote in term \\sphinxfootnotemark[7]}%\n'
'\\begin{footnotetext}[7]\\sphinxAtStartFootnote\n')
'\\begin{footnotetext}[7]\\sphinxAtStartFootnote\n' in result)
assert ('\\sphinxlineitem{\\sphinxhref{http://sphinx-doc.org/}{URL in term} '
'(http://sphinx\\sphinxhyphen{}doc.org/)}\n'
'\\sphinxAtStartPar\nDescription' in result)

View File

@ -630,7 +630,7 @@ def extract_role_links(app, filename):
lis = [l for l in t.split('\n') if l.startswith("<li")]
entries = []
for l in lis:
li = ElementTree.fromstring(l)
li = ElementTree.fromstring(l) # NoQA: S314 # using known data in tests
aList = list(li.iter('a'))
assert len(aList) == 1
a = aList[0]

View File

@ -18,7 +18,7 @@ def test_build(app, status, warning):
assert ' * function\n' not in py_undoc # these two are documented
assert ' * Class\n' not in py_undoc # in autodoc.txt
assert ' * mod -- No module named mod' # in the "failed import" section
assert " * mod -- No module named 'mod'" in py_undoc # in the "failed import" section
assert "undocumented py" not in status.getvalue()