The following issues were found

pipenv/vendor/click_completion/__init__.py
14 issues
Unable to import 'click_completion.core'
Error

Line: 11 Column: 1

              from click import ParamType
from enum import Enum

from click_completion.core import completion_configuration, get_code, install, shells, resolve_ctx, get_choices, \
    startswith, Shell
from click_completion.lib import get_auto_shell
from click_completion.patch import patch as _patch

__version__ = '0.5.2'

            

Reported by Pylint.

Unable to import 'click_completion.lib'
Error

Line: 13 Column: 1

              
from click_completion.core import completion_configuration, get_code, install, shells, resolve_ctx, get_choices, \
    startswith, Shell
from click_completion.lib import get_auto_shell
from click_completion.patch import patch as _patch

__version__ = '0.5.2'

_initialized = False

            

Reported by Pylint.

Unable to import 'click_completion.patch'
Error

Line: 14 Column: 1

              from click_completion.core import completion_configuration, get_code, install, shells, resolve_ctx, get_choices, \
    startswith, Shell
from click_completion.lib import get_auto_shell
from click_completion.patch import patch as _patch

__version__ = '0.5.2'

_initialized = False


            

Reported by Pylint.

Using the global statement
Error

Line: 32 Column: 5

                      a function with two parameters choice and incomplete. Must return True
        if incomplete is a correct match for choice, False otherwise.
    """
    global _initialized
    if not _initialized:
        _patch()
        completion_configuration.complete_options = complete_options
        if match_incomplete is not None:
            completion_configuration.match_incomplete = match_incomplete

            

Reported by Pylint.

Unused argument 'ctx'
Error

Line: 86 Column: 24

                  def __repr__(self):
        return 'DocumentedChoice(%r)' % list(self.choices.keys())

    def complete(self, ctx, incomplete):
        match = completion_configuration.match_incomplete
        return [(c, v) for c, v in six.iteritems(self.choices) if match(c, incomplete)]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import print_function, absolute_import

import six

from click import ParamType
from enum import Enum

            

Reported by Pylint.

standard import "from enum import Enum" should be placed before "import six"
Error

Line: 9 Column: 1

              import six

from click import ParamType
from enum import Enum

from click_completion.core import completion_configuration, get_code, install, shells, resolve_ctx, get_choices, \
    startswith, Shell
from click_completion.lib import get_auto_shell
from click_completion.patch import patch as _patch

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 11 Column: 1

              from click import ParamType
from enum import Enum

from click_completion.core import completion_configuration, get_code, install, shells, resolve_ctx, get_choices, \
    startswith, Shell
from click_completion.lib import get_auto_shell
from click_completion.patch import patch as _patch

__version__ = '0.5.2'

            

Reported by Pylint.

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

Line: 18 Column: 1

              
__version__ = '0.5.2'

_initialized = False


def init(complete_options=False, match_incomplete=None):
    """Initialize the enhanced click completion


            

Reported by Pylint.

Line too long (105/100)
Error

Line: 27 Column: 1

                  Parameters
    ----------
    complete_options : bool
        always complete the options, even when the user hasn't typed a first dash (Default value = False)
    match_incomplete : func
        a function with two parameters choice and incomplete. Must return True
        if incomplete is a correct match for choice, False otherwise.
    """
    global _initialized

            

Reported by Pylint.

pipenv/vendor/ptyprocess/util.py
14 issues
Unused which imported from shutil
Error

Line: 2 Column: 5

              try:
    from shutil import which  # Python >= 3.3
except ImportError:
    import os, sys
    
    # This is copied from Python 3.4.1
    def which(cmd, mode=os.F_OK | os.X_OK, path=None):
        """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 59 Column: 13

                          files = [cmd]
    
        seen = set()
        for dir in path:
            normdir = os.path.normcase(dir)
            if not normdir in seen:
                seen.add(normdir)
                for thefile in files:
                    name = os.path.join(dir, thefile)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    from shutil import which  # Python >= 3.3
except ImportError:
    import os, sys
    
    # This is copied from Python 3.4.1
    def which(cmd, mode=os.F_OK | os.X_OK, path=None):
        """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such

            

Reported by Pylint.

Multiple imports on one line (os, sys)
Error

Line: 4 Column: 5

              try:
    from shutil import which  # Python >= 3.3
except ImportError:
    import os, sys
    
    # This is copied from Python 3.4.1
    def which(cmd, mode=os.F_OK | os.X_OK, path=None):
        """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such

            

Reported by Pylint.

Trailing whitespace
Error

Line: 5 Column: 1

                  from shutil import which  # Python >= 3.3
except ImportError:
    import os, sys
    
    # This is copied from Python 3.4.1
    def which(cmd, mode=os.F_OK | os.X_OK, path=None):
        """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such
        file.

            

Reported by Pylint.

Too many branches (13/12)
Error

Line: 7 Column: 5

                  import os, sys
    
    # This is copied from Python 3.4.1
    def which(cmd, mode=os.F_OK | os.X_OK, path=None):
        """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such
        file.
    
        `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result

            

Reported by Pylint.

Trailing whitespace
Error

Line: 11 Column: 1

                      """Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such
        file.
    
        `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
        of os.environ.get("PATH"), or can be overridden with a custom search
        path.
    
        """

            

Reported by Pylint.

Trailing whitespace
Error

Line: 15 Column: 1

                      `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
        of os.environ.get("PATH"), or can be overridden with a custom search
        path.
    
        """
        # Check that a given file can be accessed with the correct mode.
        # Additionally check that `file` is not a directory, as on Windows
        # directories pass the os.access check.
        def _access_check(fn, mode):

            

Reported by Pylint.

Argument name "fn" doesn't conform to snake_case naming style
Error

Line: 20 Column: 9

                      # Check that a given file can be accessed with the correct mode.
        # Additionally check that `file` is not a directory, as on Windows
        # directories pass the os.access check.
        def _access_check(fn, mode):
            return (os.path.exists(fn) and os.access(fn, mode)
                    and not os.path.isdir(fn))
    
        # If we're given a path with a directory part, look it up directly rather
        # than referring to PATH directories. This includes checking relative to the

            

Reported by Pylint.

Trailing whitespace
Error

Line: 23 Column: 1

                      def _access_check(fn, mode):
            return (os.path.exists(fn) and os.access(fn, mode)
                    and not os.path.isdir(fn))
    
        # If we're given a path with a directory part, look it up directly rather
        # than referring to PATH directories. This includes checking relative to the
        # current directory, e.g. ./script
        if os.path.dirname(cmd):
            if _access_check(cmd, mode):

            

Reported by Pylint.

pipenv/patched/notpip/_vendor/chardet/escprober.py
14 issues
Attempted relative import beyond top-level package
Error

Line: 28 Column: 1

              # 02110-1301  USA
######################### END LICENSE BLOCK #########################

from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .enums import LanguageFilter, ProbingState, MachineState
from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL,
                    ISO2022KR_SM_MODEL)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              ######################### END LICENSE BLOCK #########################

from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .enums import LanguageFilter, ProbingState, MachineState
from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL,
                    ISO2022KR_SM_MODEL)



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 30 Column: 1

              
from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .enums import LanguageFilter, ProbingState, MachineState
from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL,
                    ISO2022KR_SM_MODEL)


class EscCharSetProber(CharSetProber):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 31 Column: 1

              from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .enums import LanguageFilter, ProbingState, MachineState
from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL,
                    ISO2022KR_SM_MODEL)


class EscCharSetProber(CharSetProber):
    """

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 43 Column: 9

                  """

    def __init__(self, lang_filter=None):
        super(EscCharSetProber, self).__init__(lang_filter=lang_filter)
        self.coding_sm = []
        if self.lang_filter & LanguageFilter.CHINESE_SIMPLIFIED:
            self.coding_sm.append(CodingStateMachine(HZ_SM_MODEL))
            self.coding_sm.append(CodingStateMachine(ISO2022CN_SM_MODEL))
        if self.lang_filter & LanguageFilter.JAPANESE:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 58 Column: 5

                      self._state = None
        self.reset()

    def reset(self):
        super(EscCharSetProber, self).reset()
        for coding_sm in self.coding_sm:
            if not coding_sm:
                continue
            coding_sm.active = True

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 59 Column: 9

                      self.reset()

    def reset(self):
        super(EscCharSetProber, self).reset()
        for coding_sm in self.coding_sm:
            if not coding_sm:
                continue
            coding_sm.active = True
            coding_sm.reset()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 70 Column: 5

                      self._detected_language = None

    @property
    def charset_name(self):
        return self._detected_charset

    @property
    def language(self):
        return self._detected_language

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 74 Column: 5

                      return self._detected_charset

    @property
    def language(self):
        return self._detected_language

    def get_confidence(self):
        if self._detected_charset:
            return 0.99

            

Reported by Pylint.

pipenv/installers.py
14 issues
Unnecessary pass statement
Error

Line: 129 Column: 9

                  def iter_installable_versions(self):
        """Iterate through CPython versions available for Pipenv to install.
        """
        pass

    def find_version_to_install(self, name):
        """Find a version in the installer from the version supplied.

        A ValueError is raised if a matching version cannot be found.

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 146 Column: 13

                              if inst_version.matches_minor(version)
            ), key=operator.attrgetter('cmpkey'))
        except ValueError:
            raise ValueError(
                f'no installable version found for {name!r}',
            )
        return best_match

    @abstractmethod

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 161 Column: 9

                      A ValueError is raised if the given version does not have a match in
        the runner. A InstallerError is raised if the runner command fails.
        """
        pass


class Pyenv(Installer):

    def _find_installer(self):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import operator
import re
from abc import ABCMeta, abstractmethod

from pipenv.vendor import attr
from pipenv.utils import find_windows_executable, subprocess_run



            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              

@attr.s
class Version:

    major = attr.ib()
    minor = attr.ib()
    patch = attr.ib()


            

Reported by Pylint.

Missing class docstring
Error

Line: 53 Column: 1

                      return (self.major, self.minor) == (other.major, other.minor)


class InstallerNotFound(RuntimeError):
    pass


class InstallerError(RuntimeError):
    def __init__(self, desc, c):

            

Reported by Pylint.

Missing class docstring
Error

Line: 57 Column: 1

                  pass


class InstallerError(RuntimeError):
    def __init__(self, desc, c):
        super().__init__(desc)
        self.out = c.stdout
        self.err = c.stderr


            

Reported by Pylint.

Missing class docstring
Error

Line: 64 Column: 1

                      self.err = c.stderr


class Installer(metaclass=ABCMeta):

    def __init__(self, project):
        self.cmd = self._find_installer()
        self.project = project


            

Reported by Pylint.

Line too long (101/100)
Error

Line: 110 Column: 1

                          # Check the pyenv/asdf-recommended from-source install locations
            os.path.join(os.path.expanduser(f'~/.{name}'), 'bin', name),
        ):
            if candidate is not None and os.path.isfile(candidate) and os.access(candidate, os.X_OK):
                return candidate
        raise InstallerNotFound()

    def _run(self, *args, **kwargs):
        timeout = kwargs.pop('timeout', 30)

            

Reported by Pylint.

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

Line: 120 Column: 9

                          k = list(kwargs.keys())[0]
            raise TypeError(f'unexpected keyword argument {k!r}')
        args = (self.cmd,) + tuple(args)
        c = subprocess_run(args, timeout=timeout)
        if c.returncode != 0:
            raise InstallerError(f'failed to run {args}', c)
        return c

    @abstractmethod

            

Reported by Pylint.

pipenv/patched/notpip/_vendor/chardet/charsetgroupprober.py
14 issues
Attempted relative import beyond top-level package
Error

Line: 28 Column: 1

              # 02110-1301  USA
######################### END LICENSE BLOCK #########################

from .enums import ProbingState
from .charsetprober import CharSetProber


class CharSetGroupProber(CharSetProber):
    def __init__(self, lang_filter=None):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              ######################### END LICENSE BLOCK #########################

from .enums import ProbingState
from .charsetprober import CharSetProber


class CharSetGroupProber(CharSetProber):
    def __init__(self, lang_filter=None):
        super(CharSetGroupProber, self).__init__(lang_filter=lang_filter)

            

Reported by Pylint.

Attribute '_state' defined outside __init__
Error

Line: 81 Column: 21

                              prober.active = False
                self._active_num -= 1
                if self._active_num <= 0:
                    self._state = ProbingState.NOT_ME
                    return self.state
        return self.state

    def get_confidence(self):
        state = self.state

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):

            

Reported by Pylint.

Missing class docstring
Error

Line: 32 Column: 1

              from .charsetprober import CharSetProber


class CharSetGroupProber(CharSetProber):
    def __init__(self, lang_filter=None):
        super(CharSetGroupProber, self).__init__(lang_filter=lang_filter)
        self._active_num = 0
        self.probers = []
        self._best_guess_prober = None

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 34 Column: 9

              
class CharSetGroupProber(CharSetProber):
    def __init__(self, lang_filter=None):
        super(CharSetGroupProber, self).__init__(lang_filter=lang_filter)
        self._active_num = 0
        self.probers = []
        self._best_guess_prober = None

    def reset(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 5

                      self.probers = []
        self._best_guess_prober = None

    def reset(self):
        super(CharSetGroupProber, self).reset()
        self._active_num = 0
        for prober in self.probers:
            if prober:
                prober.reset()

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 40 Column: 9

                      self._best_guess_prober = None

    def reset(self):
        super(CharSetGroupProber, self).reset()
        self._active_num = 0
        for prober in self.probers:
            if prober:
                prober.reset()
                prober.active = True

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 5

                      self._best_guess_prober = None

    @property
    def charset_name(self):
        if not self._best_guess_prober:
            self.get_confidence()
            if not self._best_guess_prober:
                return None
        return self._best_guess_prober.charset_name

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 58 Column: 5

                      return self._best_guess_prober.charset_name

    @property
    def language(self):
        if not self._best_guess_prober:
            self.get_confidence()
            if not self._best_guess_prober:
                return None
        return self._best_guess_prober.language

            

Reported by Pylint.

pipenv/vendor/importlib_resources/_compat.py
14 issues
Attempted relative import beyond top-level package
Error

Line: 45 Column: 9

                      return self.spec.origin

    def get_resource_reader(self, name):
        from . import readers, _adapters

        def _zip_reader(spec):
            with suppress(AttributeError):
                return readers.ZipReader(spec.loader, spec.name)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 96 Column: 5

                  Supersedes _adapters.wrap_spec to use TraversableResourcesLoader
    from above for older Python compatibility (<3.10).
    """
    from . import _adapters

    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)

            

Reported by Pylint.

Unused Path imported from zipfile as ZipPath
Error

Line: 9 Column: 5

              from contextlib import suppress

if sys.version_info >= (3, 10):
    from zipfile import Path as ZipPath  # type: ignore
else:
    from zipp import Path as ZipPath  # type: ignore


try:

            

Reported by Pylint.

Unused runtime_checkable imported from typing
Error

Line: 15 Column: 5

              

try:
    from typing import runtime_checkable  # type: ignore
except ImportError:

    def runtime_checkable(cls):  # type: ignore
        return cls


            

Reported by Pylint.

Unused Protocol imported from typing
Error

Line: 23 Column: 5

              

try:
    from typing import Protocol  # type: ignore
except ImportError:
    Protocol = abc.ABC  # type: ignore


class TraversableResourcesLoader:

            

Reported by Pylint.

Unused argument 'name'
Error

Line: 44 Column: 35

                  def path(self):
        return self.spec.origin

    def get_resource_reader(self, name):
        from . import readers, _adapters

        def _zip_reader(spec):
            with suppress(AttributeError):
                return readers.ZipReader(spec.loader, spec.name)

            

Reported by Pylint.

Unused argument 'spec'
Error

Line: 63 Column: 26

                          reader = _available_reader(spec)
            return reader if hasattr(reader, 'files') else None

        def _file_reader(spec):
            try:
                path = pathlib.Path(self.path)
            except TypeError:
                return None
            if path.exists():

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # flake8: noqa

import abc
import sys
import pathlib
from contextlib import suppress

if sys.version_info >= (3, 10):
    from zipfile import Path as ZipPath  # type: ignore

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 5

                  from typing import runtime_checkable  # type: ignore
except ImportError:

    def runtime_checkable(cls):  # type: ignore
        return cls


try:
    from typing import Protocol  # type: ignore

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

                      self.spec = spec

    @property
    def path(self):
        return self.spec.origin

    def get_resource_reader(self, name):
        from . import readers, _adapters


            

Reported by Pylint.

pipenv/vendor/urllib3/util/wait.py
14 issues
Global variable 'wait_for_socket' undefined at the module level
Error

Line: 132 Column: 5

                  # called. We could do it at import time, but then we might make the wrong
    # decision if someone goes wild with monkeypatching select.poll after
    # we're imported.
    global wait_for_socket
    if _have_working_poll():
        wait_for_socket = poll_wait_for_socket
    elif hasattr(select, "select"):
        wait_for_socket = select_wait_for_socket
    else:  # Platform-specific: Appengine.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import errno
import select
import sys
from functools import partial

try:
    from time import monotonic
except ImportError:
    from time import time as monotonic

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              __all__ = ["NoWayToWaitForSocketError", "wait_for_read", "wait_for_write"]


class NoWayToWaitForSocketError(Exception):
    pass


# How should we wait on sockets?
#

            

Reported by Pylint.

Argument name "fn" doesn't conform to snake_case naming style
Error

Line: 42 Column: 5

              
if sys.version_info >= (3, 5):
    # Modern Python, that retries syscalls by default
    def _retry_on_intr(fn, timeout):
        return fn(timeout)


else:
    # Old and broken Pythons.

            

Reported by Pylint.

Argument name "fn" doesn't conform to snake_case naming style
Error

Line: 48 Column: 5

              
else:
    # Old and broken Pythons.
    def _retry_on_intr(fn, timeout):
        if timeout is None:
            deadline = float("inf")
        else:
            deadline = monotonic() + timeout


            

Reported by Pylint.

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

Line: 58 Column: 13

                          try:
                return fn(timeout)
            # OSError for 3 <= pyver < 3.5, select.error for pyver <= 2.7
            except (OSError, select.error) as e:
                # 'e.args[0]' incantation works for both OSError and select.error
                if e.args[0] != errno.EINTR:
                    raise
                else:
                    timeout = deadline - monotonic()

            

Reported by Pylint.

Unnecessary "else" after "raise"
Error

Line: 60 Column: 17

                          # OSError for 3 <= pyver < 3.5, select.error for pyver <= 2.7
            except (OSError, select.error) as e:
                # 'e.args[0]' incantation works for both OSError and select.error
                if e.args[0] != errno.EINTR:
                    raise
                else:
                    timeout = deadline - monotonic()
                    if timeout < 0:
                        timeout = 0

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 71 Column: 1

                                  continue


def select_wait_for_socket(sock, read=False, write=False, timeout=None):
    if not read and not write:
        raise RuntimeError("must specify at least one of read=True, write=True")
    rcheck = []
    wcheck = []
    if read:

            

Reported by Pylint.

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

Line: 85 Column: 5

                  # it as "exceptional". We paper over the difference by checking the write
    # sockets for both conditions. (The stdlib selectors module does the same
    # thing.)
    fn = partial(select.select, rcheck, wcheck, wcheck)
    rready, wready, xready = _retry_on_intr(fn, timeout)
    return bool(rready or wready or xready)


def poll_wait_for_socket(sock, read=False, write=False, timeout=None):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 90 Column: 1

                  return bool(rready or wready or xready)


def poll_wait_for_socket(sock, read=False, write=False, timeout=None):
    if not read and not write:
        raise RuntimeError("must specify at least one of read=True, write=True")
    mask = 0
    if read:
        mask |= select.POLLIN

            

Reported by Pylint.

pipenv/patched/notpip/_internal/wheel_builder.py
13 issues
Unused variable 'ext'
Error

Line: 135 Column: 11

                          return True
        return False

    base, ext = req.link.splitext()
    if _contains_egg_info(base):
        return True

    # Otherwise, do not cache.
    return False

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 229 Column: 20

                                          wheel_hash.hexdigest())
                logger.info('Stored in directory: %s', output_dir)
                return dest_path
            except Exception as e:
                logger.warning(
                    "Building wheel for %s failed: %s",
                    req.name, e,
                )
        # Ignore return, we can't do anything else useful.

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 251 Column: 12

                  try:
        call_subprocess(clean_args, cwd=req.source_dir)
        return True
    except Exception:
        logger.error('Failed cleaning build dir for %s', req.name)
        return False


def build(

            

Reported by Pylint.

Argument name "s" doesn't conform to snake_case naming style
Error

Line: 38 Column: 1

              logger = logging.getLogger(__name__)


def _contains_egg_info(
        s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
    # type: (str, Pattern[str]) -> bool
    """Determine whether the string looks like an egg_info.

    :param s: The string to parse. E.g. foo-2.1

            

Reported by Pylint.

Too many return statements (7/6)
Error

Line: 48 Column: 1

                  return bool(_egg_info_re.search(s))


def _should_build(
    req,  # type: InstallRequirement
    need_wheel,  # type: bool
    check_binary_allowed,  # type: BinaryAllowedPredicate
):
    # type: (...) -> bool

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 89 Column: 1

                  return True


def should_build_for_wheel_command(
    req,  # type: InstallRequirement
):
    # type: (...) -> bool
    return _should_build(
        req, need_wheel=True, check_binary_allowed=_always_true

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 98 Column: 1

                  )


def should_build_for_install_command(
    req,  # type: InstallRequirement
    check_binary_allowed,  # type: BinaryAllowedPredicate
):
    # type: (...) -> bool
    return _should_build(

            

Reported by Pylint.

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

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

                  if req.link and req.link.is_vcs:
        # VCS checkout. Do not cache
        # unless it points to an immutable commit hash.
        assert not req.editable
        assert req.source_dir
        vcs_backend = vcs.get_backend_for_scheme(req.link.scheme)
        assert vcs_backend
        if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir):
            return True

            

Reported by Bandit.

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

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

                      # VCS checkout. Do not cache
        # unless it points to an immutable commit hash.
        assert not req.editable
        assert req.source_dir
        vcs_backend = vcs.get_backend_for_scheme(req.link.scheme)
        assert vcs_backend
        if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir):
            return True
        return False

            

Reported by Bandit.

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

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

                      assert not req.editable
        assert req.source_dir
        vcs_backend = vcs.get_backend_for_scheme(req.link.scheme)
        assert vcs_backend
        if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir):
            return True
        return False

    base, ext = req.link.splitext()

            

Reported by Bandit.

pipenv/patched/notpip/_internal/legacy_resolve.py
13 issues
Unused pkg_resources imported from pipenv.patched.notpip._vendor
Error

Line: 41 Column: 5

              
if MYPY_CHECK_RUNNING:
    from typing import Callable, DefaultDict, List, Optional, Set, Tuple
    from pipenv.patched.notpip._vendor import pkg_resources

    from pipenv.patched.notpip._internal.distributions import AbstractDistribution
    from pipenv.patched.notpip._internal.index.package_finder import PackageFinder
    from pipenv.patched.notpip._internal.operations.prepare import RequirementPreparer
    from pipenv.patched.notpip._internal.req.req_install import InstallRequirement

            

Reported by Pylint.

FIXME: Does this patch even work? it puts the python version
Error

Line: 354 Column: 3

                          ignore_requires_python=ignore_requires_python,
        )
        # Patched in - lets get the python version on here then
        # FIXME: Does this patch even work? it puts the python version
        # on the resolver... why?
        try:
            self.requires_python = get_requires_python(dist)
        except TypeError:
            self.requires_python = None

            

Reported by Pylint.

XXX: --no-install leads this to report 'Successfully
Error

Line: 418 Column: 3

                                  add_req(subreq, extras_requested=available_requested)

            if not req_to_install.editable and not req_to_install.satisfied_by:
                # XXX: --no-install leads this to report 'Successfully
                # downloaded' for only non-editable reqs, even though we took
                # action on them.
                requirement_set.successfully_downloaded.append(req_to_install)

        return more_reqs

            

Reported by Pylint.

Too many instance attributes (13/7)
Error

Line: 105 Column: 1

                      ))


class Resolver(object):
    """Resolves which packages need to be installed/uninstalled to perform \
    the requested operation without breaking the requirements of any package.
    """

    _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"}

            

Reported by Pylint.

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

Line: 105 Column: 1

                      ))


class Resolver(object):
    """Resolves which packages need to be installed/uninstalled to perform \
    the requested operation without breaking the requirements of any package.
    """

    _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"}

            

Reported by Pylint.

Too many arguments (12/5)
Error

Line: 112 Column: 5

              
    _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"}

    def __init__(
        self,
        preparer,  # type: RequirementPreparer
        finder,  # type: PackageFinder
        make_install_req,  # type: InstallRequirementProvider
        use_user_site,  # type: bool

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 127 Column: 9

                      ignore_compatibility=False,  # type: bool
    ):
        # type: (...) -> None
        super(Resolver, self).__init__()
        assert upgrade_strategy in self._allowed_strategies

        if py_version_info is None:
            py_version_info = sys.version_info[:3]
        else:

            

Reported by Pylint.

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

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

                  ):
        # type: (...) -> None
        super(Resolver, self).__init__()
        assert upgrade_strategy in self._allowed_strategies

        if py_version_info is None:
            py_version_info = sys.version_info[:3]
        else:
            py_version_info = normalize_version_info(py_version_info)

            

Reported by Bandit.

Unnecessary "elif" after "return"
Error

Line: 192 Column: 9

              
    def _is_upgrade_allowed(self, req):
        # type: (InstallRequirement) -> bool
        if self.upgrade_strategy == "to-satisfy-only":
            return False
        elif self.upgrade_strategy == "eager":
            return True
        else:
            assert self.upgrade_strategy == "only-if-needed"

            

Reported by Pylint.

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

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

                      elif self.upgrade_strategy == "eager":
            return True
        else:
            assert self.upgrade_strategy == "only-if-needed"
            return req.is_direct

    def _set_req_to_reinstall(self, req):
        # type: (InstallRequirement) -> None
        """

            

Reported by Bandit.

pipenv/patched/notpip/_internal/utils/subprocess.py
13 issues
Unable to import 'pipenv.patched.notpip._vendor.six.moves'
Error

Line: 10 Column: 1

              import os
import subprocess

from pipenv.patched.notpip._vendor.six.moves import shlex_quote

from pipenv.patched.notpip._internal.exceptions import InstallationError
from pipenv.patched.notpip._internal.utils.compat import console_to_str, str_to_display
from pipenv.patched.notpip._internal.utils.logging import subprocess_logger
from pipenv.patched.notpip._internal.utils.misc import HiddenText, path_to_display

            

Reported by Pylint.

Module 'subprocess' has no 'PIPE' member
Error

Line: 189 Column: 45

                      proc = subprocess.Popen(
            # Convert HiddenText objects to the underlying str.
            reveal_command_args(cmd),
            stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
            stdout=subprocess.PIPE, cwd=cwd, env=env,
        )
        proc.stdin.close()
    except Exception as exc:
        if log_failed_cmd:

            

Reported by Pylint.

Module 'subprocess' has no 'STDOUT' member
Error

Line: 189 Column: 20

                      proc = subprocess.Popen(
            # Convert HiddenText objects to the underlying str.
            reveal_command_args(cmd),
            stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
            stdout=subprocess.PIPE, cwd=cwd, env=env,
        )
        proc.stdin.close()
    except Exception as exc:
        if log_failed_cmd:

            

Reported by Pylint.

Module 'subprocess' has no 'PIPE' member
Error

Line: 190 Column: 20

                          # Convert HiddenText objects to the underlying str.
            reveal_command_args(cmd),
            stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
            stdout=subprocess.PIPE, cwd=cwd, env=env,
        )
        proc.stdin.close()
    except Exception as exc:
        if log_failed_cmd:
            subprocess_logger.critical(

            

Reported by Pylint.

Module import itself
Error

Line: 8 Column: 1

              
import logging
import os
import subprocess

from pipenv.patched.notpip._vendor.six.moves import shlex_quote

from pipenv.patched.notpip._internal.exceptions import InstallationError
from pipenv.patched.notpip._internal.utils.compat import console_to_str, str_to_display

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # The following comment should be removed at some point in the future.
# mypy: strict-optional=False

from __future__ import absolute_import

import logging
import os
import subprocess


            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 8
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              
import logging
import os
import subprocess

from pipenv.patched.notpip._vendor.six.moves import shlex_quote

from pipenv.patched.notpip._internal.exceptions import InstallationError
from pipenv.patched.notpip._internal.utils.compat import console_to_str, str_to_display

            

Reported by Bandit.

Too many local variables (23/15)
Error

Line: 117 Column: 1

                  return msg


def call_subprocess(
    cmd,  # type: Union[List[str], CommandArgs]
    show_stdout=False,  # type: bool
    cwd=None,  # type: Optional[str]
    on_returncode='raise',  # type: str
    extra_ok_returncodes=None,  # type: Optional[Iterable[int]]

            

Reported by Pylint.

Too many arguments (10/5)
Error

Line: 117 Column: 1

                  return msg


def call_subprocess(
    cmd,  # type: Union[List[str], CommandArgs]
    show_stdout=False,  # type: bool
    cwd=None,  # type: Optional[str]
    on_returncode='raise',  # type: str
    extra_ok_returncodes=None,  # type: Optional[Iterable[int]]

            

Reported by Pylint.

Too many branches (24/12)
Error

Line: 117 Column: 1

                  return msg


def call_subprocess(
    cmd,  # type: Union[List[str], CommandArgs]
    show_stdout=False,  # type: bool
    cwd=None,  # type: Optional[str]
    on_returncode='raise',  # type: str
    extra_ok_returncodes=None,  # type: Optional[Iterable[int]]

            

Reported by Pylint.