The following issues were found
pipenv/vendor/importlib_resources/_common.py
5 issues
Line: 10
Column: 1
import importlib
from typing import Union, Any, Optional
from .abc import ResourceReader, Traversable
from ._compat import wrap_spec
Package = Union[types.ModuleType, str]
Resource = Union[str, os.PathLike]
Reported by Pylint.
Line: 12
Column: 1
from typing import Union, Any, Optional
from .abc import ResourceReader, Traversable
from ._compat import wrap_spec
Package = Union[types.ModuleType, str]
Resource = Union[str, os.PathLike]
Reported by Pylint.
Line: 1
Column: 1
import os
import pathlib
import tempfile
import functools
import contextlib
import types
import importlib
from typing import Union, Any, Optional
Reported by Pylint.
Line: 56
Column: 1
return reader(spec.name) # type: ignore
def resolve(cand):
# type: (Package) -> types.ModuleType
return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand)
def get_package(package):
Reported by Pylint.
Line: 88
Column: 5
# Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
# blocks due to the need to close the temporary file to work on Windows
# properly.
fd, raw_path = tempfile.mkstemp(suffix=suffix)
try:
os.write(fd, reader())
os.close(fd)
del reader
yield pathlib.Path(raw_path)
Reported by Pylint.
pipenv/vendor/importlib_metadata/_text.py
5 issues
Line: 3
Column: 1
import re
from ._functools import method_cache
# from jaraco.text 3.5
class FoldedCase(str):
"""
A case insensitive string class; behaves just like str
Reported by Pylint.
Line: 94
Column: 5
def lower(self):
return super(FoldedCase, self).lower()
def index(self, sub):
return self.lower().index(sub.lower())
def split(self, splitter=' ', maxsplit=0):
pattern = re.compile(re.escape(splitter), re.I)
return pattern.split(self, maxsplit)
Reported by Pylint.
Line: 1
Column: 1
import re
from ._functools import method_cache
# from jaraco.text 3.5
class FoldedCase(str):
"""
A case insensitive string class; behaves just like str
Reported by Pylint.
Line: 83
Column: 16
return hash(self.lower())
def __contains__(self, other):
return super(FoldedCase, self).lower().__contains__(other.lower())
def in_(self, other):
"Does self appear in other?"
return self in FoldedCase(other)
Reported by Pylint.
Line: 92
Column: 16
# cache lower since it's likely to be called frequently.
@method_cache
def lower(self):
return super(FoldedCase, self).lower()
def index(self, sub):
return self.lower().index(sub.lower())
def split(self, splitter=' ', maxsplit=0):
Reported by Pylint.
pipenv/patched/notpip/_vendor/requests/exceptions.py
5 issues
Line: 32
Column: 1
"""An HTTP error occurred."""
class ConnectionError(RequestException):
"""A Connection error occurred."""
class ProxyError(ConnectionError):
"""A proxy error occurred."""
Reported by Pylint.
Line: 116
Column: 5
class RequestsWarning(Warning):
"""Base warning for Requests."""
pass
class FileModeWarning(RequestsWarning, DeprecationWarning):
"""A file was opened in text mode, but Requests determined its binary length."""
pass
Reported by Pylint.
Line: 121
Column: 5
class FileModeWarning(RequestsWarning, DeprecationWarning):
"""A file was opened in text mode, but Requests determined its binary length."""
pass
class RequestsDependencyWarning(RequestsWarning):
"""An imported dependency doesn't match the expected version range."""
pass
Reported by Pylint.
Line: 126
Column: 5
class RequestsDependencyWarning(RequestsWarning):
"""An imported dependency doesn't match the expected version range."""
pass
Reported by Pylint.
Line: 25
Column: 9
if (response is not None and not self.request and
hasattr(response, 'request')):
self.request = self.response.request
super(RequestException, self).__init__(*args, **kwargs)
class HTTPError(RequestException):
"""An HTTP error occurred."""
Reported by Pylint.
pipenv/vendor/pip_shims/shims.py
5 issues
Line: 10
Column: 1
import sys
import types
from packaging.version import parse as parse_version
from .models import (
ShimmedPathCollection,
get_package_finder,
import_pip,
Reported by Pylint.
Line: 12
Column: 1
from packaging.version import parse as parse_version
from .models import (
ShimmedPathCollection,
get_package_finder,
import_pip,
lookup_current_pip_version,
)
Reported by Pylint.
Line: 24
Column: 5
CURRENT_PIP_VERSION = str(lookup_current_pip_version())
@classmethod
def parse_version(cls, version):
return parse_version(version)
def __dir__(self):
result = list(self._locations.keys()) + list(self.__dict__.keys())
result.extend(
Reported by Pylint.
Line: 59
Column: 21
self.parsed_pip_version = lookup_current_pip_version()
def __getattr__(self, *args, **kwargs):
locations = super(_shims, self).__getattribute__("_locations")
if args[0] in locations:
return locations[args[0]].shim()
return super(_shims, self).__getattribute__(*args, **kwargs)
Reported by Pylint.
Line: 62
Column: 16
locations = super(_shims, self).__getattribute__("_locations")
if args[0] in locations:
return locations[args[0]].shim()
return super(_shims, self).__getattribute__(*args, **kwargs)
old_module = sys.modules[__name__] if __name__ in sys.modules else None
module = sys.modules[__name__] = _shims()
module.__dict__.update(
Reported by Pylint.
pipenv/patched/notpip/_vendor/chardet/__init__.py
5 issues
Line: 19
Column: 1
######################### END LICENSE BLOCK #########################
from .compat import PY2, PY3
from .universaldetector import UniversalDetector
from .version import __version__, VERSION
def detect(byte_str):
Reported by Pylint.
Line: 20
Column: 1
from .compat import PY2, PY3
from .universaldetector import UniversalDetector
from .version import __version__, VERSION
def detect(byte_str):
"""
Reported by Pylint.
Line: 21
Column: 1
from .compat import PY2, PY3
from .universaldetector import UniversalDetector
from .version import __version__, VERSION
def detect(byte_str):
"""
Detect the encoding of the given byte string.
Reported by Pylint.
Line: 1
Column: 1
######################## BEGIN LICENSE BLOCK ########################
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Reported by Pylint.
Line: 32
Column: 9
:type byte_str: ``bytes`` or ``bytearray``
"""
if not isinstance(byte_str, bytearray):
if not isinstance(byte_str, bytes):
raise TypeError('Expected object of type bytes or bytearray, got: '
'{0}'.format(type(byte_str)))
else:
byte_str = bytearray(byte_str)
detector = UniversalDetector()
Reported by Pylint.
pipenv/patched/notpip/_internal/network/cache.py
5 issues
Line: 22
Column: 1
from typing import Optional
def is_from_cache(response):
# type: (Response) -> bool
return getattr(response, "from_cache", False)
@contextmanager
Reported by Pylint.
Line: 46
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def __init__(self, directory):
# type: (str) -> None
assert directory is not None, "Cache directory must not be None."
super(SafeFileCache, self).__init__()
self.directory = directory
def _get_cache_path(self, name):
# type: (str) -> str
Reported by Bandit.
Line: 47
Column: 9
def __init__(self, directory):
# type: (str) -> None
assert directory is not None, "Cache directory must not be None."
super(SafeFileCache, self).__init__()
self.directory = directory
def _get_cache_path(self, name):
# type: (str) -> str
# From cachecontrol.caches.file_cache.FileCache._fn, brought into our
Reported by Pylint.
Line: 63
Column: 38
# type: (str) -> Optional[bytes]
path = self._get_cache_path(key)
with suppressed_cache_errors():
with open(path, 'rb') as f:
return f.read()
def set(self, key, value):
# type: (str, bytes) -> None
path = self._get_cache_path(key)
Reported by Pylint.
Line: 72
Column: 45
with suppressed_cache_errors():
ensure_dir(os.path.dirname(path))
with adjacent_tmp_file(path) as f:
f.write(value)
replace(f.name, path)
def delete(self, key):
Reported by Pylint.
pipenv/patched/notpip/_internal/models/search_scope.py
5 issues
Line: 7
Column: 1
import posixpath
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.notpip._vendor.six.moves.urllib import parse as urllib_parse
from pipenv.patched.notpip._internal.models.index import PyPI
from pipenv.patched.notpip._internal.utils.compat import has_tls
from pipenv.patched.notpip._internal.utils.misc import normalize_path, redact_auth_from_url
from pipenv.patched.notpip._internal.utils.typing import MYPY_CHECK_RUNNING
Reported by Pylint.
Line: 7
Column: 1
import posixpath
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.notpip._vendor.six.moves.urllib import parse as urllib_parse
from pipenv.patched.notpip._internal.models.index import PyPI
from pipenv.patched.notpip._internal.utils.compat import has_tls
from pipenv.patched.notpip._internal.utils.misc import normalize_path, redact_auth_from_url
from pipenv.patched.notpip._internal.utils.typing import MYPY_CHECK_RUNNING
Reported by Pylint.
Line: 1
Column: 1
import itertools
import logging
import os
import posixpath
from pipenv.patched.notpip._vendor.packaging.utils import canonicalize_name
from pipenv.patched.notpip._vendor.six.moves.urllib import parse as urllib_parse
from pipenv.patched.notpip._internal.models.index import PyPI
Reported by Pylint.
Line: 21
Column: 1
logger = logging.getLogger(__name__)
class SearchScope(object):
"""
Encapsulates the locations that pip is configured to search.
"""
Reported by Pylint.
Line: 77
Column: 5
self.find_links = find_links
self.index_urls = index_urls
def get_formatted_locations(self):
# type: () -> str
lines = []
if self.index_urls and self.index_urls != [PyPI.simple_url]:
lines.append(
'Looking in indexes: {}'.format(', '.join(
Reported by Pylint.
pipenv/patched/notpip/_vendor/packaging/_structures.py
5 issues
Line: 1
Column: 1
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
class InfinityType(object):
def __repr__(self):
# type: () -> str
Reported by Pylint.
Line: 7
Column: 1
from __future__ import absolute_import, division, print_function
class InfinityType(object):
def __repr__(self):
# type: () -> str
return "Infinity"
def __hash__(self):
Reported by Pylint.
Line: 7
Column: 1
from __future__ import absolute_import, division, print_function
class InfinityType(object):
def __repr__(self):
# type: () -> str
return "Infinity"
def __hash__(self):
Reported by Pylint.
Line: 48
Column: 1
Infinity = InfinityType()
class NegativeInfinityType(object):
def __repr__(self):
# type: () -> str
return "-Infinity"
def __hash__(self):
Reported by Pylint.
Line: 48
Column: 1
Infinity = InfinityType()
class NegativeInfinityType(object):
def __repr__(self):
# type: () -> str
return "-Infinity"
def __hash__(self):
Reported by Pylint.
pipenv/vendor/colorama/__init__.py
4 issues
Line: 2
Column: 1
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.4'
Reported by Pylint.
Line: 3
Column: 1
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.4'
Reported by Pylint.
Line: 4
Column: 1
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.4'
Reported by Pylint.
Line: 1
Column: 1
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.4'
Reported by Pylint.
pipenv/patched/notpip/_vendor/msgpack/exceptions.py
4 issues
Line: 37
Column: 5
unpack.
"""
def __init__(self, unpacked, extra):
self.unpacked = unpacked
self.extra = extra
def __str__(self):
return "unpack(b) received extra data."
Reported by Pylint.
Line: 1
Column: 1
class UnpackException(Exception):
"""Base class for some exceptions raised while unpacking.
NOTE: unpack may raise exception other than subclass of
UnpackException. If you want to catch all error, catch
Exception instead.
"""
Reported by Pylint.
Line: 10
Column: 1
"""
class BufferFull(UnpackException):
pass
class OutOfData(UnpackException):
pass
Reported by Pylint.
Line: 14
Column: 1
pass
class OutOfData(UnpackException):
pass
class FormatError(ValueError, UnpackException):
"""Invalid msgpack format"""
Reported by Pylint.