The following issues were found
pipenv/patched/notpip/_internal/req/req_uninstall.py
31 issues
Line: 133
Column: 33
def norm_join(*a):
# type: (str) -> str
return os.path.normcase(os.path.join(*a))
for root in unchecked:
if any(os.path.normcase(root).startswith(w)
for w in wildcards):
# This directory has already been handled.
Reported by Pylint.
Line: 481
Column: 38
pkg_resources.to_filename(dist.project_name))
egg_info_exists = dist.egg_info and os.path.exists(dist.egg_info)
# Special case for distutils installed package
distutils_egg_info = getattr(dist._provider, 'path', None)
# Uninstall cases order do matter as in the case of 2 installs of the
# same package, pip needs to uninstall the currently detected version
if (egg_info_exists and dist.egg_info.endswith('.egg-info') and
not dist.egg_info.endswith(develop_egg_link_egg_info)):
Reported by Pylint.
Line: 497
Column: 3
os.path.join(dist.egg_info, installed_file)
)
paths_to_remove.add(path)
# FIXME: need a test for this elif block
# occurs with --single-version-externally-managed/--record outside
# of pip
elif dist.has_metadata('top_level.txt'):
if dist.has_metadata('namespace_packages.txt'):
namespaces = dist.get_metadata('namespace_packages.txt')
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
import csv
import functools
import logging
import os
import sys
import sysconfig
Reported by Pylint.
Line: 61
Column: 1
return paths_to_remove
def _unique(fn):
# type: (Callable[..., Iterator[Any]]) -> Callable[..., Iterator[Any]]
@functools.wraps(fn)
def unique(*args, **kw):
# type: (Any, Any) -> Iterator[Any]
seen = set() # type: Set[Any]
Reported by Pylint.
Line: 85
Column: 5
UninstallPathSet.add() takes care of the __pycache__ .py[co].
"""
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
for row in r:
path = os.path.join(dist.location, row[0])
yield path
if path.endswith('.py'):
dn, fn = os.path.split(path)
Reported by Pylint.
Line: 90
Column: 13
path = os.path.join(dist.location, row[0])
yield path
if path.endswith('.py'):
dn, fn = os.path.split(path)
base = fn[:-3]
path = os.path.join(dn, base + '.pyc')
yield path
path = os.path.join(dn, base + '.pyo')
yield path
Reported by Pylint.
Line: 90
Column: 17
path = os.path.join(dist.location, row[0])
yield path
if path.endswith('.py'):
dn, fn = os.path.split(path)
base = fn[:-3]
path = os.path.join(dn, base + '.pyc')
yield path
path = os.path.join(dn, base + '.pyo')
yield path
Reported by Pylint.
Line: 151
Column: 1
# If all the files we found are in our remaining set of files to
# remove, then remove them from the latter set and add a wildcard
# for the directory.
if not (all_files - remaining):
remaining.difference_update(all_files)
wildcards.add(root + os.sep)
return set(map(case_map.__getitem__, remaining)) | wildcards
Reported by Pylint.
Line: 209
Column: 1
return will_remove, will_skip
class StashedUninstallPathSet(object):
"""A set of file rename operations to stash files while
tentatively uninstalling them."""
def __init__(self):
# type: () -> None
# Mapping from source file root to [Adjacent]TempDirectory
Reported by Pylint.
pipenv/vendor/dparse/updater.py
31 issues
Line: 78
Column: 62
class PipfileUpdater(object):
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
data = toml.loads(content)
if data:
for package_type in ['packages', 'dev-packages']:
if package_type in data:
if dependency.full_name in data[package_type]:
Reported by Pylint.
Line: 90
Column: 13
try:
from pipenv.project import Project
except ImportError:
raise ImportError("Updating a Pipfile requires the pipenv extra to be installed. Install it with "
"pip install dparse[pipenv]")
pipfile = tempfile.NamedTemporaryFile(delete=False)
p = Project(chdir=False)
p.write_toml(data=data, path=pipfile.name)
data = open(pipfile.name).read()
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import re
import json
import tempfile
import toml
import os
Reported by Pylint.
Line: 7
Column: 1
import json
import tempfile
import toml
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
Reported by Pylint.
Line: 10
Column: 1
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
Reported by Pylint.
Line: 10
Column: 1
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
Reported by Pylint.
Line: 10
Column: 1
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
Reported by Pylint.
Line: 15
Column: 5
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
"""
Updates the requirement to the latest version for the given content and adds hashes
if neccessary.
:param content: str, content
:return: str, updated content
Reported by Pylint.
Line: 15
Column: 5
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes=()):
"""
Updates the requirement to the latest version for the given content and adds hashes
if neccessary.
:param content: str, content
:return: str, updated content
Reported by Pylint.
Line: 22
Column: 1
:param content: str, content
:return: str, updated content
"""
new_line = "{name}{spec}{version}".format(name=dependency.full_name, spec=spec, version=version)
appendix = ''
# leave environment markers intact
if ";" in dependency.line:
# condense multiline, split out the env marker, strip comments and --hashes
new_line += ";" + dependency.line.splitlines()[0].split(";", 1)[1] \
Reported by Pylint.
pipenv/vendor/jinja2/bccache.py
31 issues
Line: 22
Column: 5
from types import CodeType
if t.TYPE_CHECKING:
import typing_extensions as te
from .environment import Environment
class _MemcachedClient(te.Protocol):
def get(self, key: str) -> bytes:
...
Reported by Pylint.
Line: 23
Column: 5
if t.TYPE_CHECKING:
import typing_extensions as te
from .environment import Environment
class _MemcachedClient(te.Protocol):
def get(self, key: str) -> bytes:
...
Reported by Pylint.
Line: 23
Column: 5
if t.TYPE_CHECKING:
import typing_extensions as te
from .environment import Environment
class _MemcachedClient(te.Protocol):
def get(self, key: str) -> bytes:
...
Reported by Pylint.
Line: 26
Column: 23
from .environment import Environment
class _MemcachedClient(te.Protocol):
def get(self, key: str) -> bytes:
...
def set(self, key: str, value: bytes, timeout: t.Optional[int] = None) -> None:
...
Reported by Pylint.
Line: 29
Column: 23
def get(self, key: str) -> bytes:
...
def set(self, key: str, value: bytes, timeout: t.Optional[int] = None) -> None:
...
bc_version = 5
# Magic bytes to identify Jinja bytecode cache files. Contains the
Reported by Pylint.
Line: 29
Column: 47
def get(self, key: str) -> bytes:
...
def set(self, key: str, value: bytes, timeout: t.Optional[int] = None) -> None:
...
bc_version = 5
# Magic bytes to identify Jinja bytecode cache files. Contains the
Reported by Pylint.
Line: 29
Column: 33
def get(self, key: str) -> bytes:
...
def set(self, key: str, value: bytes, timeout: t.Optional[int] = None) -> None:
...
bc_version = 5
# Magic bytes to identify Jinja bytecode cache files. Contains the
Reported by Pylint.
Line: 71
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle
self.reset()
return
# the source code of the file changed, we need to reload
checksum = pickle.load(f)
if self.checksum != checksum:
self.reset()
return
# if marshal_load fails then we need to reload
try:
Reported by Bandit.
Line: 77
Column: 13
return
# if marshal_load fails then we need to reload
try:
self.code = marshal.load(f)
except (EOFError, ValueError, TypeError):
self.reset()
return
def write_bytecode(self, f: t.BinaryIO) -> None:
Reported by Pylint.
Line: 77
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b302-marshal
return
# if marshal_load fails then we need to reload
try:
self.code = marshal.load(f)
except (EOFError, ValueError, TypeError):
self.reset()
return
def write_bytecode(self, f: t.BinaryIO) -> None:
Reported by Bandit.
pipenv/patched/notpip/_vendor/packaging/markers.py
31 issues
Line: 15
Column: 1
from pipenv.patched.notpip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pipenv.patched.notpip._vendor.pyparsing import Literal as L # noqa
from ._compat import string_types
from ._typing import MYPY_CHECK_RUNNING
from .specifiers import Specifier, InvalidSpecifier
if MYPY_CHECK_RUNNING: # pragma: no cover
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
Reported by Pylint.
Line: 16
Column: 1
from pipenv.patched.notpip._vendor.pyparsing import Literal as L # noqa
from ._compat import string_types
from ._typing import MYPY_CHECK_RUNNING
from .specifiers import Specifier, InvalidSpecifier
if MYPY_CHECK_RUNNING: # pragma: no cover
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
Reported by Pylint.
Line: 17
Column: 1
from ._compat import string_types
from ._typing import MYPY_CHECK_RUNNING
from .specifiers import Specifier, InvalidSpecifier
if MYPY_CHECK_RUNNING: # pragma: no cover
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
Operator = Callable[[str, str], bool]
Reported by Pylint.
Line: 141
Column: 1
MARKER_EXPR = Forward()
MARKER_ATOM = MARKER_ITEM | Group(LPAREN + MARKER_EXPR + RPAREN)
MARKER_EXPR << MARKER_ATOM + ZeroOrMore(BOOLOP + MARKER_EXPR)
MARKER = stringStart + MARKER_EXPR + stringEnd
def _coerce_parse_result(results):
Reported by Pylint.
Line: 304
Column: 13
err_str = "Invalid marker: {0!r}, parse error at {1!r}".format(
marker, marker[e.loc : e.loc + 8]
)
raise InvalidMarker(err_str)
def __str__(self):
# type: () -> str
return _format_marker(self._markers)
Reported by Pylint.
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
import operator
import os
import platform
import sys
Reported by Pylint.
Line: 11
Column: 1
import platform
import sys
from pipenv.patched.notpip._vendor.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from pipenv.patched.notpip._vendor.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pipenv.patched.notpip._vendor.pyparsing import Literal as L # noqa
from ._compat import string_types
from ._typing import MYPY_CHECK_RUNNING
Reported by Pylint.
Line: 53
Column: 1
"""
class Node(object):
def __init__(self, value):
# type: (Any) -> None
self.value = value
def __str__(self):
Reported by Pylint.
Line: 53
Column: 1
"""
class Node(object):
def __init__(self, value):
# type: (Any) -> None
self.value = value
def __str__(self):
Reported by Pylint.
Line: 66
Column: 5
# type: () -> str
return "<{0}({1!r})>".format(self.__class__.__name__, str(self))
def serialize(self):
# type: () -> str
raise NotImplementedError
class Variable(Node):
Reported by Pylint.
pipenv/exceptions.py
30 issues
Line: 395
Column: 9
class RequirementError(PipenvException):
def __init__(self, req=None):
from .utils import VCS_LIST
keys = ("name", "path",) + VCS_LIST + ("line", "uri", "url", "relpath")
if req is not None:
possible_display_values = [getattr(req, value, None) for value in keys]
req_value = next(iter(
val for val in possible_display_values if val is not None
Reported by Pylint.
Line: 407
Column: 33
slots = getattr(req, "__slots__", None)
keys_fn = getattr(req, "keys", None)
if getstate_fn:
req_value = getstate_fn()
elif slots:
slot_vals = [
(k, getattr(req, k, None)) for k in slots
if getattr(req, k, None)
]
Reported by Pylint.
Line: 410
Column: 61
req_value = getstate_fn()
elif slots:
slot_vals = [
(k, getattr(req, k, None)) for k in slots
if getattr(req, k, None)
]
req_value = "\n".join([
f" {k}: {v}" for k, v in slot_vals
])
Reported by Pylint.
Line: 417
Column: 56
f" {k}: {v}" for k, v in slot_vals
])
elif keys_fn:
values = [(k, req.get(k)) for k in keys_fn() if req.get(k)]
req_value = "\n".join([
f" {k}: {v}" for k, v in values
])
else:
req_value = getattr(req.line_instance, "line", None)
Reported by Pylint.
Line: 1
Column: 1
import itertools
import re
import sys
from collections import namedtuple
from traceback import format_tb
from pipenv import environments
from pipenv._compat import decode_for_output
Reported by Pylint.
Line: 41
Column: 1
]
def handle_exception(exc_type, exception, traceback, hook=sys.excepthook):
if environments.Setting().is_verbose() or not issubclass(exc_type, ClickException):
hook(exc_type, exception, traceback)
else:
tb = format_tb(traceback, limit=-6)
lines = itertools.chain.from_iterable([frame.splitlines() for frame in tb])
Reported by Pylint.
Line: 45
Column: 9
if environments.Setting().is_verbose() or not issubclass(exc_type, ClickException):
hook(exc_type, exception, traceback)
else:
tb = format_tb(traceback, limit=-6)
lines = itertools.chain.from_iterable([frame.splitlines() for frame in tb])
formatted_lines = []
for line in lines:
line = line.strip("'").strip('"').strip("\n").strip()
if not line.startswith("File"):
Reported by Pylint.
Line: 67
Column: 1
sys.excepthook = handle_exception
class PipenvException(ClickException):
message = "{0}: {{0}}".format(crayons.red("ERROR", bold=True))
def __init__(self, message=None, **kwargs):
if not message:
message = "Pipenv encountered a problem and had to exit."
Reported by Pylint.
Line: 93
Column: 1
click_echo(decode_for_output(f"{self.message}", file), file=file)
class PipenvCmdError(PipenvException):
def __init__(self, cmd, out="", err="", exit_code=1):
self.cmd = cmd
self.out = out
self.err = err
self.exit_code = exit_code
Reported by Pylint.
Line: 121
Column: 1
), err=True)
class JSONParseError(PipenvException):
def __init__(self, contents="", error_text=""):
self.error_text = error_text
PipenvException.__init__(self, contents)
def show(self, file=None):
Reported by Pylint.
pipenv/patched/notpip/_internal/index/package_finder.py
30 issues
Line: 1
Column: 1
"""Routines related to PyPI, indexes"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
from __future__ import absolute_import
import logging
import re
Reported by Pylint.
Line: 104
Column: 1
return True
class LinkEvaluator(object):
"""
Responsible for evaluating links for a particular project.
"""
Reported by Pylint.
Line: 104
Column: 1
return True
class LinkEvaluator(object):
"""
Responsible for evaluating links for a particular project.
"""
Reported by Pylint.
Line: 116
Column: 5
# site considers whether yanked releases are allowed. This also causes
# that decision to be made explicit in the calling code, which helps
# people when reading the code.
def __init__(
self,
project_name, # type: str
canonical_name, # type: str
formats, # type: FrozenSet[str]
target_python, # type: TargetPython
Reported by Pylint.
Line: 160
Column: 5
self.project_name = project_name
def evaluate_link(self, link):
# type: (Link) -> Tuple[bool, Optional[Text]]
"""
Determine whether a link is a candidate for installation.
:return: A tuple (is_candidate, result), where `result` is (1) a
Reported by Pylint.
Line: 160
Column: 5
self.project_name = project_name
def evaluate_link(self, link):
# type: (Link) -> Tuple[bool, Optional[Text]]
"""
Determine whether a link is a candidate for installation.
:return: A tuple (is_candidate, result), where `result` is (1) a
Reported by Pylint.
Line: 187
Column: 1
return (False, 'not a file')
if ext not in SUPPORTED_EXTENSIONS:
return (False, 'unsupported archive format: %s' % ext)
if "binary" not in self._formats and ext == WHEEL_EXTENSION and not self._ignore_compatibility:
reason = 'No binaries permitted for %s' % self.project_name
return (False, reason)
if "macosx10" in link.path and ext == '.zip' and not self._ignore_compatibility:
return (False, 'macosx10 one')
if ext == WHEEL_EXTENSION:
Reported by Pylint.
Line: 324
Column: 1
return filtered
class CandidatePreferences(object):
"""
Encapsulates some of the preferences for filtering and sorting
InstallationCandidate objects.
"""
Reported by Pylint.
Line: 324
Column: 1
return filtered
class CandidatePreferences(object):
"""
Encapsulates some of the preferences for filtering and sorting
InstallationCandidate objects.
"""
Reported by Pylint.
Line: 344
Column: 1
self.prefer_binary = prefer_binary
class BestCandidateResult(object):
"""A collection of candidates, returned by `PackageFinder.find_best_candidate`.
This class is only intended to be instantiated by CandidateEvaluator's
`compute_best_candidate()` method.
"""
Reported by Pylint.
pipenv/patched/safety/cli.py
29 issues
Line: 5
Column: 1
from __future__ import absolute_import
import sys
import click
from safety import __version__
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
Reported by Pylint.
Line: 6
Column: 1
import sys
import click
from safety import __version__
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
Reported by Pylint.
Line: 7
Column: 1
import click
from safety import __version__
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
try:
Reported by Pylint.
Line: 9
Column: 1
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
try:
from json.decoder import JSONDecodeError
except ImportError:
Reported by Pylint.
Line: 10
Column: 1
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
Reported by Pylint.
Line: 65
Column: 24
else:
import pkg_resources
packages = [
d for d in pkg_resources.working_set
if d.key not in {"python", "wsgiref", "argparse"}
]
proxy_dictionary = {}
if proxyhost is not None:
if proxyprotocol in ["http", "https"]:
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import sys
import click
from safety import __version__
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
Reported by Pylint.
Line: 8
Column: 1
from safety import __version__
from safety import safety
from safety.formatter import report
import itertools
from safety.util import read_requirements, read_vulnerabilities
from safety.errors import DatabaseFetchError, DatabaseFileNotFoundError, InvalidKeyError
try:
from json.decoder import JSONDecodeError
Reported by Pylint.
Line: 19
Column: 1
@click.group()
@click.version_option(version=__version__)
def cli():
pass
@cli.command()
@click.option("--key", default="",
Reported by Pylint.
Line: 50
Column: 1
@click.option("proxyhost", "--proxy-host", "-ph", multiple=False, type=str, default=None,
help="Proxy host IP or DNS --proxy-host")
@click.option("proxyport", "--proxy-port", "-pp", multiple=False, type=int, default=80,
help="Proxy port number --proxy-port")
@click.option("proxyprotocol", "--proxy-protocol", "-pr", multiple=False, type=str, default='http',
help="Proxy protocol (https or http) --proxy-protocol")
def check(key, db, json, full_report, bare, stdin, files, cache, ignore, output, proxyprotocol, proxyhost, proxyport):
if files and stdin:
click.secho("Can't read from --stdin and --file at the same time, exiting", fg="red", file=sys.stderr)
Reported by Pylint.
pipenv/patched/notpip/_vendor/html5lib/treewalkers/__init__.py
29 issues
Line: 13
Column: 1
from __future__ import absolute_import, division, unicode_literals
from .. import constants
from .._utils import default_etree
__all__ = ["getTreeWalker", "pprint"]
treeWalkerCache = {}
Reported by Pylint.
Line: 14
Column: 1
from __future__ import absolute_import, division, unicode_literals
from .. import constants
from .._utils import default_etree
__all__ = ["getTreeWalker", "pprint"]
treeWalkerCache = {}
Reported by Pylint.
Line: 48
Column: 13
treeType = treeType.lower()
if treeType not in treeWalkerCache:
if treeType == "dom":
from . import dom
treeWalkerCache[treeType] = dom.TreeWalker
elif treeType == "genshi":
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
Reported by Pylint.
Line: 51
Column: 13
from . import dom
treeWalkerCache[treeType] = dom.TreeWalker
elif treeType == "genshi":
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
Reported by Pylint.
Line: 54
Column: 13
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
from . import etree
if implementation is None:
implementation = default_etree
Reported by Pylint.
Line: 57
Column: 13
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
from . import etree
if implementation is None:
implementation = default_etree
# XXX: NEVER cache here, caching is done in the etree submodule
return etree.getETreeModule(implementation, **kwargs).TreeWalker
return treeWalkerCache.get(treeType)
Reported by Pylint.
Line: 48
Column: 13
treeType = treeType.lower()
if treeType not in treeWalkerCache:
if treeType == "dom":
from . import dom
treeWalkerCache[treeType] = dom.TreeWalker
elif treeType == "genshi":
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
Reported by Pylint.
Line: 51
Column: 13
from . import dom
treeWalkerCache[treeType] = dom.TreeWalker
elif treeType == "genshi":
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
Reported by Pylint.
Line: 54
Column: 13
from . import genshi
treeWalkerCache[treeType] = genshi.TreeWalker
elif treeType == "lxml":
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
from . import etree
if implementation is None:
implementation = default_etree
Reported by Pylint.
Line: 57
Column: 13
from . import etree_lxml
treeWalkerCache[treeType] = etree_lxml.TreeWalker
elif treeType == "etree":
from . import etree
if implementation is None:
implementation = default_etree
# XXX: NEVER cache here, caching is done in the etree submodule
return etree.getETreeModule(implementation, **kwargs).TreeWalker
return treeWalkerCache.get(treeType)
Reported by Pylint.
pipenv/vendor/urllib3/util/retry.py
29 issues
Line: 11
Column: 1
from collections import namedtuple
from itertools import takewhile
from ..exceptions import (
ConnectTimeoutError,
InvalidHeader,
MaxRetryError,
ProtocolError,
ProxyError,
Reported by Pylint.
Line: 20
Column: 1
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
# Data structure for representing the metadata of requests that result in a retry.
Reported by Pylint.
Line: 31
Column: 3
)
# TODO: In v2 we can remove this sentinel and metaclass with deprecated options.
_Default = object()
class _RetryMeta(type):
@property
Reported by Pylint.
Line: 241
Column: 3
history=None,
respect_retry_after_header=True,
remove_headers_on_redirect=_Default,
# TODO: Deprecated, remove in v2.0
method_whitelist=_Default,
):
if method_whitelist is not _Default:
if allowed_methods is not _Default:
Reported by Pylint.
Line: 303
Column: 3
respect_retry_after_header=self.respect_retry_after_header,
)
# TODO: If already given in **kw we use what's given to us
# If not given we need to figure out what to pass. We decide
# based on whether our class has the 'method_whitelist' property
# and if so we pass the deprecated 'method_whitelist' otherwise
# we use 'allowed_methods'. Remove in v2.0
if "method_whitelist" not in kw and "allowed_methods" not in kw:
Reported by Pylint.
Line: 434
Column: 3
"""Checks if a given HTTP method should be retried upon, depending if
it is included in the allowed_methods
"""
# TODO: For now favor if the Retry implementation sets its own method_whitelist
# property outside of our constructor to avoid breaking custom implementations.
if "method_whitelist" in self.__dict__:
warnings.warn(
"Using 'method_whitelist' with Retry is deprecated and "
"will be removed in v2.0. Use 'allowed_methods' instead",
Reported by Pylint.
Line: 588
Column: 3
def __getattr__(self, item):
if item == "method_whitelist":
# TODO: Remove this deprecated alias in v2.0
warnings.warn(
"Using 'method_whitelist' with Retry is deprecated and "
"will be removed in v2.0. Use 'allowed_methods' instead",
DeprecationWarning,
)
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
import email
import logging
import re
import time
import warnings
from collections import namedtuple
from itertools import takewhile
Reported by Pylint.
Line: 37
Column: 5
class _RetryMeta(type):
@property
def DEFAULT_METHOD_WHITELIST(cls):
warnings.warn(
"Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and "
"will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead",
DeprecationWarning,
)
Reported by Pylint.
Line: 37
Column: 5
class _RetryMeta(type):
@property
def DEFAULT_METHOD_WHITELIST(cls):
warnings.warn(
"Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and "
"will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead",
DeprecationWarning,
)
Reported by Pylint.
pipenv/patched/notpip/_internal/cli/cmdoptions.py
29 issues
Line: 21
Column: 1
import warnings
from distutils.util import strtobool
from functools import partial
from optparse import SUPPRESS_HELP, Option, OptionGroup
from textwrap import dedent
from pipenv.patched.notpip._internal.exceptions import CommandError
from pipenv.patched.notpip._internal.locations import USER_CACHE_DIR, get_src_prefix
from pipenv.patched.notpip._internal.models.format_control import FormatControl
Reported by Pylint.
Line: 35
Column: 5
if MYPY_CHECK_RUNNING:
from typing import Any, Callable, Dict, Optional, Tuple
from optparse import OptionParser, Values
from pipenv.patched.notpip._internal.cli.parser import ConfigOptionParser
logger = logging.getLogger(__name__)
Reported by Pylint.
Line: 133
Column: 24
)
def _path_option_check(option, opt, value):
# type: (Option, str, str) -> str
return os.path.expanduser(value)
class PipOption(Option):
Reported by Pylint.
Line: 133
Column: 32
)
def _path_option_check(option, opt, value):
# type: (Option, str, str) -> str
return os.path.expanduser(value)
class PipOption(Option):
Reported by Pylint.
Line: 428
Column: 25
)
def _handle_src(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
value = os.path.abspath(value)
setattr(parser.values, option.dest, value)
Reported by Pylint.
Line: 455
Column: 31
return getattr(values, option.dest)
def _handle_no_binary(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
existing = _get_format_control(parser.values, option)
FormatControl.handle_mutual_excludes(
value, existing.no_binary, existing.only_binary,
)
Reported by Pylint.
Line: 463
Column: 33
)
def _handle_only_binary(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
existing = _get_format_control(parser.values, option)
FormatControl.handle_mutual_excludes(
value, existing.only_binary, existing.no_binary,
)
Reported by Pylint.
Line: 545
Column: 36
return (version_info, None)
def _handle_python_version(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""
Handle a provided --python-version value.
"""
version_info, error_msg = _convert_python_version(value)
Reported by Pylint.
Line: 651
Column: 34
) # type: Callable[..., Option]
def _handle_no_cache_dir(option, opt, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""
Process a value provided for the --no-cache-dir option.
This is an optparse.Option callback for the --no-cache-dir option.
Reported by Pylint.
Line: 698
Column: 31
) # type: Callable[..., Option]
def _handle_build_dir(option, opt, value, parser):
# type: (Option, str, str, OptionParser) -> None
if value:
value = os.path.abspath(value)
setattr(parser.values, option.dest, value)
Reported by Pylint.