Skip to content

Commit

Permalink
Cleanup pylintrc.
Browse files Browse the repository at this point in the history
  • Loading branch information
wRAR committed Jan 30, 2025
1 parent 536c3c0 commit cf7b3bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
7 changes: 3 additions & 4 deletions parsel/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def _get_root_and_type_from_text(


def _get_root_type(root: Any, *, input_type: str | None) -> str:
if isinstance(root, etree._Element): # pylint: disable=protected-access
if isinstance(root, etree._Element):
if input_type in {"json", "text"}:
raise ValueError(
f"Selector got an lxml.etree._Element object as root, "
Expand All @@ -354,8 +354,7 @@ def _is_valid_json(text: str) -> bool:
json.loads(text)
except (TypeError, ValueError):
return False
else:
return True
return True


def _load_json_or_none(text: str) -> Any:
Expand Down Expand Up @@ -602,7 +601,7 @@ def xpath(
except etree.XPathError as exc:
raise ValueError(f"XPath error: {exc} in {query}")

if type(result) is not list:
if not isinstance(result, list):
result = [result]

result = [
Expand Down
10 changes: 3 additions & 7 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[MASTER]
ignore=typing
persistent=no
extension-pkg-allow-list=lxml

[MESSAGES CONTROL]
disable=c-extension-no-member,
fixme,
enable=useless-suppression
disable=fixme,
import-error,
import-outside-toplevel,
invalid-name,
line-too-long,
missing-class-docstring,
missing-function-docstring,
missing-module-docstring,
no-else-return,
no-member,
not-callable,
parse-error,
protected-access,
raise-missing-from,
redefined-builtin,
Expand All @@ -24,8 +23,5 @@ disable=c-extension-no-member,
too-many-lines,
too-many-positional-arguments,
too-many-public-methods,
unidiomatic-typecheck,
unused-argument,
use-a-generator,
wrong-import-order,
wrong-import-position,
4 changes: 2 additions & 2 deletions tests/test_selector_jmespath.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ def test_json_types(self) -> None:
):
selector = Selector(text=text, root=_NOT_SET)
self.assertEqual(selector.type, "json")
self.assertEqual(selector._text, text) # pylint: disable=protected-access
self.assertEqual(selector._text, text)
self.assertEqual(selector.root, root)

selector = Selector(text=None, root=root)
self.assertEqual(selector.type, "json")
self.assertEqual(selector._text, None) # pylint: disable=protected-access
self.assertEqual(selector._text, None)
self.assertEqual(selector.root, root)

0 comments on commit cf7b3bb

Please sign in to comment.