The following issues were found
pipenv/patched/notpip/_vendor/html5lib/treeadapters/genshi.py
8 issues
Line: 3
Column: 1
from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
Reported by Pylint.
Line: 3
Column: 1
from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
Reported by Pylint.
Line: 4
Column: 1
from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
Reported by Pylint.
Line: 4
Column: 1
from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
Reported by Pylint.
Line: 17
Column: 9
"""
text = []
for token in walker:
type = token["type"]
if type in ("Characters", "SpaceCharacters"):
text.append(token["data"])
elif text:
yield TEXT, "".join(text), (None, -1, -1)
text = []
Reported by Pylint.
Line: 51
Column: 3
token["systemId"]), (None, -1, -1)
else:
pass # FIXME: What to do?
if text:
yield TEXT, "".join(text), (None, -1, -1)
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
Reported by Pylint.
Line: 7
Column: 1
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
:arg walker: the treewalker to use to walk the tree to convert it
:returns: generator of genshi nodes
Reported by Pylint.
pipenv/vendor/certifi/core.py
8 issues
Line: 37
Column: 32
# it will do the cleanup whenever it gets garbage collected, so
# we will also store that at the global level as well.
_CACERT_CTX = get_path("certifi", "cacert.pem")
_CACERT_PATH = str(_CACERT_CTX.__enter__())
return _CACERT_PATH
except ImportError:
Reported by Pylint.
Line: 23
Column: 9
# actually calls where(), but we don't want to re-extract the file
# on every call of where(), so we'll do it once then store it in a
# global variable.
global _CACERT_CTX
global _CACERT_PATH
if _CACERT_PATH is None:
# This is slightly janky, the importlib.resources API wants you to
# manage the cleanup of this file, so it doesn't actually return a
# path, it returns a context manager that will give you the path
Reported by Pylint.
Line: 24
Column: 9
# on every call of where(), so we'll do it once then store it in a
# global variable.
global _CACERT_CTX
global _CACERT_PATH
if _CACERT_PATH is None:
# This is slightly janky, the importlib.resources API wants you to
# manage the cleanup of this file, so it doesn't actually return a
# path, it returns a context manager that will give you the path
# when you enter it and will do any cleanup when you leave it. In
Reported by Pylint.
Line: 17
Column: 5
_CACERT_CTX = None
_CACERT_PATH = None
def where():
# This is slightly terrible, but we want to delay extracting the file
# in cases where we're inside of a zipimport situation until someone
# actually calls where(), but we don't want to re-extract the file
# on every call of where(), so we'll do it once then store it in a
# global variable.
Reported by Pylint.
Line: 47
Column: 5
# importlib.resources module but relies on the existing `where` function
# so won't address issues with environments like PyOxidizer that don't set
# __file__ on modules.
def read_text(_module, _path, encoding="ascii"):
with open(where(), "r", encoding=encoding) as data:
return data.read()
# If we don't have importlib.resources, then we will just do the old logic
# of assuming we're on the filesystem and munge the path directly.
Reported by Pylint.
Line: 53
Column: 5
# If we don't have importlib.resources, then we will just do the old logic
# of assuming we're on the filesystem and munge the path directly.
def where():
f = os.path.dirname(__file__)
return os.path.join(f, "cacert.pem")
Reported by Pylint.
Line: 54
Column: 9
# If we don't have importlib.resources, then we will just do the old logic
# of assuming we're on the filesystem and munge the path directly.
def where():
f = os.path.dirname(__file__)
return os.path.join(f, "cacert.pem")
def contents():
Reported by Pylint.
Line: 59
Column: 1
return os.path.join(f, "cacert.pem")
def contents():
return read_text("certifi", "cacert.pem", encoding="ascii")
Reported by Pylint.
pipenv/patched/notpip/_vendor/html5lib/_trie/_base.py
8 issues
Line: 9
Column: 1
from collections import Mapping
class Trie(Mapping):
"""Abstract base class for tries"""
def keys(self, prefix=None):
# pylint:disable=arguments-differ
keys = super(Trie, self).keys()
Reported by Pylint.
Line: 9
Column: 1
from collections import Mapping
class Trie(Mapping):
"""Abstract base class for tries"""
def keys(self, prefix=None):
# pylint:disable=arguments-differ
keys = super(Trie, self).keys()
Reported by Pylint.
Line: 9
Column: 1
from collections import Mapping
class Trie(Mapping):
"""Abstract base class for tries"""
def keys(self, prefix=None):
# pylint:disable=arguments-differ
keys = super(Trie, self).keys()
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import, division, unicode_literals
try:
from collections.abc import Mapping
except ImportError: # Python 2.7
from collections import Mapping
class Trie(Mapping):
Reported by Pylint.
Line: 14
Column: 16
def keys(self, prefix=None):
# pylint:disable=arguments-differ
keys = super(Trie, self).keys()
if prefix is None:
return set(keys)
return {x for x in keys if x.startswith(prefix)}
Reported by Pylint.
Line: 21
Column: 5
return {x for x in keys if x.startswith(prefix)}
def has_keys_with_prefix(self, prefix):
for key in self.keys():
if key.startswith(prefix):
return True
return False
Reported by Pylint.
Line: 28
Column: 5
return False
def longest_prefix(self, prefix):
if prefix in self:
return prefix
for i in range(1, len(prefix) + 1):
if prefix[:-i] in self:
Reported by Pylint.
Line: 38
Column: 5
raise KeyError(prefix)
def longest_prefix_item(self, prefix):
lprefix = self.longest_prefix(prefix)
return (lprefix, self[lprefix])
Reported by Pylint.
pipenv/patched/notpip/_internal/cli/command_context.py
8 issues
Line: 1
Column: 1
from contextlib import contextmanager
from pipenv.patched.notpip._vendor.contextlib2 import ExitStack
from pipenv.patched.notpip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Iterator, ContextManager, TypeVar
Reported by Pylint.
Line: 13
Column: 1
_T = TypeVar('_T', covariant=True)
class CommandContextMixIn(object):
def __init__(self):
# type: () -> None
super(CommandContextMixIn, self).__init__()
self._in_main_context = False
self._main_context = ExitStack()
Reported by Pylint.
Line: 13
Column: 1
_T = TypeVar('_T', covariant=True)
class CommandContextMixIn(object):
def __init__(self):
# type: () -> None
super(CommandContextMixIn, self).__init__()
self._in_main_context = False
self._main_context = ExitStack()
Reported by Pylint.
Line: 16
Column: 9
class CommandContextMixIn(object):
def __init__(self):
# type: () -> None
super(CommandContextMixIn, self).__init__()
self._in_main_context = False
self._main_context = ExitStack()
@contextmanager
def main_context(self):
Reported by Pylint.
Line: 21
Column: 5
self._main_context = ExitStack()
@contextmanager
def main_context(self):
# type: () -> Iterator[None]
assert not self._in_main_context
self._in_main_context = True
try:
Reported by Pylint.
Line: 23
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
@contextmanager
def main_context(self):
# type: () -> Iterator[None]
assert not self._in_main_context
self._in_main_context = True
try:
with self._main_context:
yield
Reported by Bandit.
Line: 32
Column: 5
finally:
self._in_main_context = False
def enter_context(self, context_provider):
# type: (ContextManager[_T]) -> _T
assert self._in_main_context
return self._main_context.enter_context(context_provider)
Reported by Pylint.
Line: 34
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def enter_context(self, context_provider):
# type: (ContextManager[_T]) -> _T
assert self._in_main_context
return self._main_context.enter_context(context_provider)
Reported by Bandit.
pipenv/vendor/attr/setters.py
8 issues
Line: 7
Column: 1
from __future__ import absolute_import, division, print_function
from . import _config
from .exceptions import FrozenAttributeError
def pipe(*setters):
"""
Reported by Pylint.
Line: 8
Column: 1
from __future__ import absolute_import, division, print_function
from . import _config
from .exceptions import FrozenAttributeError
def pipe(*setters):
"""
Run all *setters* and return the return value of the last one.
Reported by Pylint.
Line: 44
Column: 8
.. versionadded:: 20.1.0
"""
if _config._run_validators is False:
return new_value
v = attrib.validator
if not v:
return new_value
Reported by Pylint.
Line: 56
Column: 13
return new_value
def convert(instance, attrib, new_value):
"""
Run *attrib*'s converter -- if it has one -- on *new_value* and return the
result.
.. versionadded:: 20.1.0
Reported by Pylint.
Line: 19
Column: 9
"""
def wrapped_pipe(instance, attrib, new_value):
rv = new_value
for setter in setters:
rv = setter(instance, attrib, rv)
return rv
Reported by Pylint.
Line: 22
Column: 13
rv = new_value
for setter in setters:
rv = setter(instance, attrib, rv)
return rv
return wrapped_pipe
Reported by Pylint.
Line: 47
Column: 5
if _config._run_validators is False:
return new_value
v = attrib.validator
if not v:
return new_value
v(instance, attrib, new_value)
Reported by Pylint.
Line: 63
Column: 5
.. versionadded:: 20.1.0
"""
c = attrib.converter
if c:
return c(new_value)
return new_value
Reported by Pylint.
pipenv/vendor/importlib_resources/tests/_compat.py
8 issues
Line: 5
Column: 5
try:
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
Reported by Pylint.
Line: 14
Column: 5
try:
# Python 3.10
from test.support.os_helper import unlink
except ImportError:
from test.support import unlink as _unlink
def unlink(target):
return _unlink(os.fspath(target))
Reported by Pylint.
Line: 1
Column: 1
import os
try:
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
Reported by Pylint.
Line: 8
Column: 5
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
try:
# Python 3.10
Reported by Pylint.
Line: 8
Column: 5
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
try:
# Python 3.10
Reported by Pylint.
Line: 8
Column: 5
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
try:
# Python 3.10
Reported by Pylint.
Line: 9
Column: 9
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import modules_setup, modules_cleanup
try:
# Python 3.10
from test.support.os_helper import unlink
Reported by Pylint.
Line: 18
Column: 5
except ImportError:
from test.support import unlink as _unlink
def unlink(target):
return _unlink(os.fspath(target))
Reported by Pylint.
pipenv/patched/notpip/_vendor/distlib/_backport/misc.py
8 issues
Line: 25
Column: 5
try:
callable = callable
except NameError:
from collections import Callable
def callable(obj):
return isinstance(obj, Callable)
Reported by Pylint.
Line: 23
Column: 5
try:
callable = callable
except NameError:
from collections import Callable
def callable(obj):
return isinstance(obj, Callable)
Reported by Pylint.
Line: 23
Column: 5
try:
callable = callable
except NameError:
from collections import Callable
def callable(obj):
return isinstance(obj, Callable)
Reported by Pylint.
Line: 17
Column: 5
try:
from imp import cache_from_source
except ImportError:
def cache_from_source(py_file, debug=__debug__):
ext = debug and 'c' or 'o'
return py_file + ext
try:
Reported by Pylint.
Line: 18
Column: 9
from imp import cache_from_source
except ImportError:
def cache_from_source(py_file, debug=__debug__):
ext = debug and 'c' or 'o'
return py_file + ext
try:
callable = callable
Reported by Pylint.
Line: 27
Column: 5
except NameError:
from collections import Callable
def callable(obj):
return isinstance(obj, Callable)
try:
fsencode = os.fsencode
Reported by Pylint.
Line: 34
Column: 5
try:
fsencode = os.fsencode
except AttributeError:
def fsencode(filename):
if isinstance(filename, bytes):
return filename
elif isinstance(filename, str):
return filename.encode(sys.getfilesystemencoding())
else:
Reported by Pylint.
Line: 35
Column: 9
fsencode = os.fsencode
except AttributeError:
def fsencode(filename):
if isinstance(filename, bytes):
return filename
elif isinstance(filename, str):
return filename.encode(sys.getfilesystemencoding())
else:
raise TypeError("expect bytes or str, not %s" %
Reported by Pylint.
pipenv/vendor/markupsafe/_native.py
8 issues
Line: 3
Column: 1
import typing as t
from . import Markup
def escape(s: t.Any) -> Markup:
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
the string with HTML-safe sequences. Use this if you need to display
text that might contain such characters in HTML.
Reported by Pylint.
Line: 1
Column: 1
import typing as t
from . import Markup
def escape(s: t.Any) -> Markup:
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
the string with HTML-safe sequences. Use this if you need to display
text that might contain such characters in HTML.
Reported by Pylint.
Line: 6
Column: 1
from . import Markup
def escape(s: t.Any) -> Markup:
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
the string with HTML-safe sequences. Use this if you need to display
text that might contain such characters in HTML.
If the object has an ``__html__`` method, it is called and the
Reported by Pylint.
Line: 30
Column: 1
)
def escape_silent(s: t.Optional[t.Any]) -> Markup:
"""Like :func:`escape` but treats ``None`` as the empty string.
Useful with optional values, as otherwise you get the string
``'None'`` when the value is ``None``.
>>> escape(None)
Reported by Pylint.
Line: 46
Column: 1
return escape(s)
def soft_str(s: t.Any) -> str:
"""Convert an object to a string if it isn't already. This preserves
a :class:`Markup` string rather than converting it back to a basic
string, so it will still be marked as safe and won't be escaped
again.
Reported by Pylint.
Line: 66
Column: 1
return s
def soft_unicode(s: t.Any) -> str:
import warnings
warnings.warn(
"'soft_unicode' has been renamed to 'soft_str'. The old name"
" will be removed in MarkupSafe 2.1.",
Reported by Pylint.
Line: 66
Column: 1
return s
def soft_unicode(s: t.Any) -> str:
import warnings
warnings.warn(
"'soft_unicode' has been renamed to 'soft_str'. The old name"
" will be removed in MarkupSafe 2.1.",
Reported by Pylint.
Line: 67
Column: 5
def soft_unicode(s: t.Any) -> str:
import warnings
warnings.warn(
"'soft_unicode' has been renamed to 'soft_str'. The old name"
" will be removed in MarkupSafe 2.1.",
DeprecationWarning,
Reported by Pylint.
pipenv/vendor/yarg/exceptions.py
8 issues
Line: 48
Column: 36
for key, val in kwargs.items():
setattr(self, key, val)
if hasattr(self, 'status_code'):
setattr(self, 'errno', self.status_code)
if hasattr(self, 'reason'):
setattr(self, 'message', self.reason)
def __str__(self):
return self.__repr__()
Reported by Pylint.
Line: 50
Column: 38
if hasattr(self, 'status_code'):
setattr(self, 'errno', self.status_code)
if hasattr(self, 'reason'):
setattr(self, 'message', self.reason)
def __str__(self):
return self.__repr__()
def __repr__(self):
Reported by Pylint.
Line: 57
Column: 49
def __repr__(self):
if hasattr(self, 'status_code') and hasattr(self, 'reason'):
return "<HTTPError {0} {1}>".format(self.status_code, self.reason)
return "<HTTPError>"
Reported by Pylint.
Line: 57
Column: 67
def __repr__(self):
if hasattr(self, 'status_code') and hasattr(self, 'reason'):
return "<HTTPError {0} {1}>".format(self.status_code, self.reason)
return "<HTTPError>"
Reported by Pylint.
Line: 44
Column: 5
:member: status_code
"""
def __init__(self, *args, **kwargs):
for key, val in kwargs.items():
setattr(self, key, val)
if hasattr(self, 'status_code'):
setattr(self, 'errno', self.status_code)
if hasattr(self, 'reason'):
Reported by Pylint.
Line: 44
Column: 5
:member: status_code
"""
def __init__(self, *args, **kwargs):
for key, val in kwargs.items():
setattr(self, key, val)
if hasattr(self, 'status_code'):
setattr(self, 'errno', self.status_code)
if hasattr(self, 'reason'):
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright (c) 2014 Kura
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
Reported by Pylint.
Line: 29
Column: 1
from requests.exceptions import HTTPError as RHTTPError
class YargException(Exception):
pass
class HTTPError(YargException, RHTTPError):
"""
Reported by Pylint.
pipenv/vendor/jinja2/visitor.py
8 issues
Line: 6
Column: 1
"""
import typing as t
from .nodes import Node
if t.TYPE_CHECKING:
import typing_extensions as te
class VisitCallable(te.Protocol):
Reported by Pylint.
Line: 9
Column: 5
from .nodes import Node
if t.TYPE_CHECKING:
import typing_extensions as te
class VisitCallable(te.Protocol):
def __call__(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
...
Reported by Pylint.
Line: 11
Column: 5
if t.TYPE_CHECKING:
import typing_extensions as te
class VisitCallable(te.Protocol):
def __call__(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
...
class NodeVisitor:
Reported by Pylint.
Line: 11
Column: 5
if t.TYPE_CHECKING:
import typing_extensions as te
class VisitCallable(te.Protocol):
def __call__(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
...
class NodeVisitor:
Reported by Pylint.
Line: 37
Column: 9
def visit(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
"""Visit a node."""
f = self.get_visitor(node)
if f is not None:
return f(node, *args, **kwargs)
return self.generic_visit(node, *args, **kwargs)
Reported by Pylint.
Line: 46
Column: 13
def generic_visit(self, node: Node, *args: t.Any, **kwargs: t.Any) -> t.Any:
"""Called if no explicit visitor function exists for a node."""
for node in node.iter_child_nodes():
self.visit(node, *args, **kwargs)
class NodeTransformer(NodeVisitor):
"""Walks the abstract syntax tree and allows modifications of nodes.
Reported by Pylint.
Line: 68
Column: 25
for value in old_value:
if isinstance(value, Node):
value = self.visit(value, *args, **kwargs)
if value is None:
continue
elif not isinstance(value, Node):
new_values.extend(value)
continue
new_values.append(value)
Reported by Pylint.
Line: 87
Column: 9
"""As transformers may return lists in some places this method
can be used to enforce a list as return value.
"""
rv = self.visit(node, *args, **kwargs)
if not isinstance(rv, list):
return [rv]
return rv
Reported by Pylint.