The following issues were found

pipenv/vendor/jinja2/optimizer.py
7 issues
Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              """
import typing as t

from . import nodes
from .visitor import NodeTransformer

if t.TYPE_CHECKING:
    from .environment import Environment


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              import typing as t

from . import nodes
from .visitor import NodeTransformer

if t.TYPE_CHECKING:
    from .environment import Environment



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 16 Column: 5

              from .visitor import NodeTransformer

if t.TYPE_CHECKING:
    from .environment import Environment


def optimize(node: nodes.Node, environment: "Environment") -> nodes.Node:
    """The context hint can be used to perform an static optimization
    based on the context given."""

            

Reported by Pylint.

Unused Environment imported from environment
Error

Line: 16 Column: 5

              from .visitor import NodeTransformer

if t.TYPE_CHECKING:
    from .environment import Environment


def optimize(node: nodes.Node, environment: "Environment") -> nodes.Node:
    """The context hint can be used to perform an static optimization
    based on the context given."""

            

Reported by Pylint.

Missing class docstring
Error

Line: 26 Column: 1

                  return t.cast(nodes.Node, optimizer.visit(node))


class Optimizer(NodeTransformer):
    def __init__(self, environment: "t.Optional[Environment]") -> None:
        self.environment = environment

    def generic_visit(
        self, node: nodes.Node, *args: t.Any, **kwargs: t.Any

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 26 Column: 1

                  return t.cast(nodes.Node, optimizer.visit(node))


class Optimizer(NodeTransformer):
    def __init__(self, environment: "t.Optional[Environment]") -> None:
        self.environment = environment

    def generic_visit(
        self, node: nodes.Node, *args: t.Any, **kwargs: t.Any

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 5

                  def __init__(self, environment: "t.Optional[Environment]") -> None:
        self.environment = environment

    def generic_visit(
        self, node: nodes.Node, *args: t.Any, **kwargs: t.Any
    ) -> nodes.Node:
        node = super().generic_visit(node, *args, **kwargs)

        # Do constant folding. Some other nodes besides Expr have

            

Reported by Pylint.

pipenv/patched/notpip/_internal/pyproject.py
7 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 167 Column: 13

                      try:
            Requirement(requirement)
        except InvalidRequirement:
            raise InstallationError(
                error_template.format(
                    package=req_name,
                    reason=(
                        "'build-system.requires' contains an invalid "
                        "requirement: {!r}".format(requirement)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import absolute_import

import io
import os
import sys
from collections import namedtuple

from pipenv.patched.notpip._vendor import pytoml, six
from pipenv.patched.notpip._vendor.packaging.requirements import InvalidRequirement, Requirement

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 1

                  )


def make_pyproject_path(unpacked_source_directory):
    # type: (str) -> str
    path = os.path.join(unpacked_source_directory, 'pyproject.toml')

    # Python2 __file__ should not be unicode
    if six.PY2 and isinstance(path, six.text_type):

            

Reported by Pylint.

Too many branches (14/12)
Error

Line: 42 Column: 1

              ])


def load_pyproject_toml(
    use_pep517,  # type: Optional[bool]
    pyproject_toml,  # type: str
    setup_py,  # type: str
    req_name  # type: str
):

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 74 Column: 59

                  has_setup = os.path.isfile(setup_py)

    if has_pyproject:
        with io.open(pyproject_toml, encoding="utf-8") as f:
            pp_toml = pytoml.load(f)
        build_system = pp_toml.get("build-system")
    else:
        build_system = None


            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 111
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      use_pep517 = has_pyproject

    # At this point, we know whether we're going to use PEP 517.
    assert use_pep517 is not None

    # If we're using the legacy code path, there is nothing further
    # for us to do here.
    if not use_pep517:
        return None

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 136
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  # from pyproject.toml, or defaulted by the code above).
    # Note that at this point, we do not know if the user has actually
    # specified a backend, though.
    assert build_system is not None

    # Ensure that the build-system section in pyproject.toml conforms
    # to PEP 518.
    error_template = (
        "{package} has a pyproject.toml file that does not comply "

            

Reported by Bandit.

pipenv/patched/notpip/_internal/commands/search.py
7 issues
Unable to import 'pipenv.patched.notpip._vendor.six.moves'
Error

Line: 15 Column: 1

              from pipenv.patched.notpip._vendor.packaging.version import parse as parse_version
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
#       why we ignore the type on this import
from pipenv.patched.notpip._vendor.six.moves import xmlrpc_client  # type: ignore

from pipenv.patched.notpip._internal.cli.base_command import Command
from pipenv.patched.notpip._internal.cli.req_command import SessionCommandMixin
from pipenv.patched.notpip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS
from pipenv.patched.notpip._internal.exceptions import CommandError

            

Reported by Pylint.

Non-iterable value pkg_resources.working_set is used in an iterating context
Error

Line: 112 Column: 51

                          for hit in hits
        ]) + 4

    installed_packages = [p.project_name for p in pkg_resources.working_set]
    for hit in hits:
        name = hit['name']
        summary = hit['summary'] or ''
        latest = highest_version(hit.get('versions', ['-']))
        if terminal_width is not None:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
import sys
import textwrap
from collections import OrderedDict

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 38 Column: 9

                  ignore_require_venv = True

    def __init__(self, *args, **kw):
        super(SearchCommand, self).__init__(*args, **kw)
        self.cmd_opts.add_option(
            '-i', '--index',
            dest='index',
            metavar='URL',
            default=PyPI.pypi_url,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 64 Column: 5

                          return SUCCESS
        return NO_MATCHES_FOUND

    def search(self, query, options):
        index_url = options.index

        session = self.get_default_session(options)

        transport = PipXmlrpcTransport(index_url, session)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 103 Column: 1

                  return list(packages.values())


def print_results(hits, name_column_width=None, terminal_width=None):
    if not hits:
        return
    if name_column_width is None:
        name_column_width = max([
            len(hit['name']) + len(highest_version(hit.get('versions', ['-'])))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 144 Column: 1

                          pass


def highest_version(versions):
    return max(versions, key=parse_version)

            

Reported by Pylint.

pipenv/patched/notpip/_internal/operations/install/legacy.py
7 issues
FIXME: put the record somewhere
Error

Line: 115 Column: 3

                          gone_in="20.2",
            issue=6998,
        )
        # FIXME: put the record somewhere
        return
    new_lines = []
    for line in record_lines:
        filename = line.strip()
        if os.path.isdir(filename):

            

Reported by Pylint.

Too many local variables (23/15)
Error

Line: 26 Column: 1

              logger = logging.getLogger(__name__)


def install(
    install_req,  # type: InstallRequirement
    install_options,  # type: List[str]
    global_options,  # type: Sequence[str]
    root,  # type: Optional[str]
    home,  # type: Optional[str]

            

Reported by Pylint.

Too many arguments (9/5)
Error

Line: 26 Column: 1

              logger = logging.getLogger(__name__)


def install(
    install_req,  # type: InstallRequirement
    install_options,  # type: List[str]
    global_options,  # type: Sequence[str]
    root,  # type: Optional[str]
    home,  # type: Optional[str]

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 1

              logger = logging.getLogger(__name__)


def install(
    install_req,  # type: InstallRequirement
    install_options,  # type: List[str]
    global_options,  # type: Sequence[str]
    root,  # type: Optional[str]
    home,  # type: Optional[str]

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 83 Column: 39

                      # We intentionally do not use any encoding to read the file because
        # setuptools writes the file using distutils.file_util.write_file,
        # which does not specify an encoding.
        with open(record_filename) as f:
            record_lines = f.read().splitlines()

    def prepend_root(path):
        # type: (str) -> str
        if root is None or not os.path.isabs(path):

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 88 Column: 9

              
    def prepend_root(path):
        # type: (str) -> str
        if root is None or not os.path.isabs(path):
            return path
        else:
            return change_root(root, path)

    for line in record_lines:

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 128 Column: 40

                  new_lines.sort()
    ensure_dir(egg_info_dir)
    inst_files_path = os.path.join(egg_info_dir, 'installed-files.txt')
    with open(inst_files_path, 'w') as f:
        f.write('\n'.join(new_lines) + '\n')

            

Reported by Pylint.

pipenv/patched/notpip/_internal/network/download.py
7 issues
Class 'Download' inherits from object, can be safely removed from bases in python3
Error

Line: 163 Column: 1

                  return resp


class Download(object):
    def __init__(
        self,
        response,  # type: Response
        filename,  # type: str
        chunks,  # type: Iterable[bytes]

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 163 Column: 1

                  return resp


class Download(object):
    def __init__(
        self,
        response,  # type: Response
        filename,  # type: str
        chunks,  # type: Iterable[bytes]

            

Reported by Pylint.

Missing class docstring
Error

Line: 163 Column: 1

                  return resp


class Download(object):
    def __init__(
        self,
        response,  # type: Response
        filename,  # type: str
        chunks,  # type: Iterable[bytes]

            

Reported by Pylint.

Missing class docstring
Error

Line: 176 Column: 1

                      self.chunks = chunks


class Downloader(object):
    def __init__(
        self,
        session,  # type: PipSession
        progress_bar,  # type: str
    ):

            

Reported by Pylint.

Class 'Downloader' inherits from object, can be safely removed from bases in python3
Error

Line: 176 Column: 1

                      self.chunks = chunks


class Downloader(object):
    def __init__(
        self,
        session,  # type: PipSession
        progress_bar,  # type: str
    ):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 176 Column: 1

                      self.chunks = chunks


class Downloader(object):
    def __init__(
        self,
        session,  # type: PipSession
        progress_bar,  # type: str
    ):

            

Reported by Pylint.

Variable name "e" doesn't conform to snake_case naming style
Error

Line: 190 Column: 9

                      # type: (Link) -> Download
        try:
            resp = _http_get_download(self._session, link)
        except requests.HTTPError as e:
            logger.critical(
                "HTTP error %s while getting %s", e.response.status_code, link
            )
            raise


            

Reported by Pylint.

pipenv/vendor/dparse/filetypes.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

requirements_txt = "requirements.txt"
conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "requirements_txt" doesn't conform to UPPER_CASE naming style
Error

Line: 4 Column: 1

              # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

requirements_txt = "requirements.txt"
conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "conda_yml" doesn't conform to UPPER_CASE naming style
Error

Line: 5 Column: 1

              from __future__ import unicode_literals, absolute_import

requirements_txt = "requirements.txt"
conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "setup_cfg" doesn't conform to UPPER_CASE naming style
Error

Line: 6 Column: 1

              
requirements_txt = "requirements.txt"
conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "tox_ini" doesn't conform to UPPER_CASE naming style
Error

Line: 7 Column: 1

              requirements_txt = "requirements.txt"
conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "pipfile" doesn't conform to UPPER_CASE naming style
Error

Line: 8 Column: 1

              conda_yml = "conda.yml"
setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

Constant name "pipfile_lock" doesn't conform to UPPER_CASE naming style
Error

Line: 9 Column: 1

              setup_cfg = "setup.cfg"
tox_ini = "tox.ini"
pipfile = "Pipfile"
pipfile_lock = "Pipfile.lock"

            

Reported by Pylint.

pipenv/vendor/dotenv/ipython.py
7 issues
Unable to import 'IPython.core.magic'
Error

Line: 1 Column: 1

              from IPython.core.magic import Magics, line_magic, magics_class  # type: ignore
from IPython.core.magic_arguments import (argument, magic_arguments,  # type: ignore
                                          parse_argstring)  # type: ignore

from .main import find_dotenv, load_dotenv


@magics_class
class IPythonDotEnv(Magics):

            

Reported by Pylint.

Unable to import 'IPython.core.magic_arguments'
Error

Line: 2 Column: 1

              from IPython.core.magic import Magics, line_magic, magics_class  # type: ignore
from IPython.core.magic_arguments import (argument, magic_arguments,  # type: ignore
                                          parse_argstring)  # type: ignore

from .main import find_dotenv, load_dotenv


@magics_class
class IPythonDotEnv(Magics):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              from IPython.core.magic_arguments import (argument, magic_arguments,  # type: ignore
                                          parse_argstring)  # type: ignore

from .main import find_dotenv, load_dotenv


@magics_class
class IPythonDotEnv(Magics):


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from IPython.core.magic import Magics, line_magic, magics_class  # type: ignore
from IPython.core.magic_arguments import (argument, magic_arguments,  # type: ignore
                                          parse_argstring)  # type: ignore

from .main import find_dotenv, load_dotenv


@magics_class
class IPythonDotEnv(Magics):

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 9 Column: 1

              

@magics_class
class IPythonDotEnv(Magics):

    @magic_arguments()
    @argument(
        '-o', '--override', action='store_true',
        help="Indicate to override existing variables"

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              

@magics_class
class IPythonDotEnv(Magics):

    @magic_arguments()
    @argument(
        '-o', '--override', action='store_true',
        help="Indicate to override existing variables"

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 5

                      help="Indicate function calls to be verbose"
    )
    @argument('dotenv_path', nargs='?', type=str, default='.env',
              help='Search in increasingly higher folders for the `dotenv_path`')
    @line_magic
    def dotenv(self, line):
        args = parse_argstring(self.dotenv, line)
        # Locate the .env file
        dotenv_path = args.dotenv_path

            

Reported by Pylint.

pipenv/vendor/wheel/pkginfo.py
7 issues
Statement seems to have no effect
Error

Line: 7 Column: 5

              from email.parser import Parser

try:
    unicode
    _PY3 = False
except NameError:
    _PY3 = True

if not _PY3:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 5

              if not _PY3:
    from email.generator import Generator

    def read_pkg_info_bytes(bytestr):
        return Parser().parsestr(bytestr)

    def read_pkg_info(path):
        with open(path, "r") as headers:
            message = Parser().parse(headers)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 5

                  def read_pkg_info_bytes(bytestr):
        return Parser().parsestr(bytestr)

    def read_pkg_info(path):
        with open(path, "r") as headers:
            message = Parser().parse(headers)
        return message

    def write_pkg_info(path, message):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 23 Column: 5

                          message = Parser().parse(headers)
        return message

    def write_pkg_info(path, message):
        with open(path, 'w') as metadata:
            Generator(metadata, mangle_from_=False, maxheaderlen=0).flatten(message)
else:
    from email.generator import BytesGenerator


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 5

              else:
    from email.generator import BytesGenerator

    def read_pkg_info_bytes(bytestr):
        headers = bytestr.decode(encoding="ascii", errors="surrogateescape")
        message = Parser().parsestr(headers)
        return message

    def read_pkg_info(path):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 5

                      message = Parser().parsestr(headers)
        return message

    def read_pkg_info(path):
        with open(path, "r",
                  encoding="ascii",
                  errors="surrogateescape") as headers:
            message = Parser().parse(headers)
        return message

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

                          message = Parser().parse(headers)
        return message

    def write_pkg_info(path, message):
        with open(path, "wb") as out:
            BytesGenerator(out, mangle_from_=False, maxheaderlen=0).flatten(message)

            

Reported by Pylint.

pipenv/patched/notpip/_vendor/cachecontrol/cache.py
7 issues
Missing class docstring
Error

Line: 8 Column: 1

              from threading import Lock


class BaseCache(object):

    def get(self, key):
        raise NotImplementedError()

    def set(self, key, value):

            

Reported by Pylint.

Class 'BaseCache' inherits from object, can be safely removed from bases in python3
Error

Line: 8 Column: 1

              from threading import Lock


class BaseCache(object):

    def get(self, key):
        raise NotImplementedError()

    def set(self, key, value):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 5

              
class BaseCache(object):

    def get(self, key):
        raise NotImplementedError()

    def set(self, key, value):
        raise NotImplementedError()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 5

                  def get(self, key):
        raise NotImplementedError()

    def set(self, key, value):
        raise NotImplementedError()

    def delete(self, key):
        raise NotImplementedError()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

                  def set(self, key, value):
        raise NotImplementedError()

    def delete(self, key):
        raise NotImplementedError()

    def close(self):
        pass


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                  def delete(self, key):
        raise NotImplementedError()

    def close(self):
        pass


class DictCache(BaseCache):


            

Reported by Pylint.

Missing class docstring
Error

Line: 23 Column: 1

                      pass


class DictCache(BaseCache):

    def __init__(self, init_dict=None):
        self.lock = Lock()
        self.data = init_dict or {}


            

Reported by Pylint.

pipenv/vendor/vistir/__init__.py
7 issues
Unable to import '__init__.compat'
Error

Line: 4 Column: 1

              # -*- coding=utf-8 -*-
from __future__ import absolute_import, unicode_literals

from .compat import (
    NamedTemporaryFile,
    StringIO,
    TemporaryDirectory,
    partialmethod,
    to_native_string,

            

Reported by Pylint.

Unable to import '__init__.contextmanagers'
Error

Line: 11 Column: 1

                  partialmethod,
    to_native_string,
)
from .contextmanagers import (
    atomic_open_for_write,
    cd,
    open_file,
    replaced_stream,
    replaced_streams,

            

Reported by Pylint.

Unable to import '__init__.cursor'
Error

Line: 21 Column: 1

                  temp_environ,
    temp_path,
)
from .cursor import hide_cursor, show_cursor
from .misc import (
    StreamWrapper,
    chunked,
    decode_for_output,
    divide,

            

Reported by Pylint.

Unable to import '__init__.misc'
Error

Line: 22 Column: 1

                  temp_path,
)
from .cursor import hide_cursor, show_cursor
from .misc import (
    StreamWrapper,
    chunked,
    decode_for_output,
    divide,
    get_wrapped_stream,

            

Reported by Pylint.

Unable to import '__init__.path'
Error

Line: 36 Column: 1

                  to_bytes,
    to_text,
)
from .path import create_tracked_tempdir, create_tracked_tempfile, mkdir_p, rmtree
from .spin import create_spinner

__version__ = "0.5.2"



            

Reported by Pylint.

Unable to import '__init__.spin'
Error

Line: 37 Column: 1

                  to_text,
)
from .path import create_tracked_tempdir, create_tracked_tempfile, mkdir_p, rmtree
from .spin import create_spinner

__version__ = "0.5.2"


__all__ = [

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding=utf-8 -*-
from __future__ import absolute_import, unicode_literals

from .compat import (
    NamedTemporaryFile,
    StringIO,
    TemporaryDirectory,
    partialmethod,
    to_native_string,

            

Reported by Pylint.