The following issues were found
pipenv/vendor/cerberus/tests/conftest.py
6 issues
Line: 5
Column: 1
from copy import deepcopy
import pytest
from cerberus import Validator
@pytest.fixture
Reported by Pylint.
Line: 7
Column: 1
import pytest
from cerberus import Validator
@pytest.fixture
def document():
return deepcopy(sample_document)
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
from copy import deepcopy
import pytest
from cerberus import Validator
Reported by Pylint.
Line: 11
Column: 1
@pytest.fixture
def document():
return deepcopy(sample_document)
@pytest.fixture
def schema():
Reported by Pylint.
Line: 16
Column: 1
@pytest.fixture
def schema():
return deepcopy(sample_schema)
@pytest.fixture
def validator():
Reported by Pylint.
Line: 21
Column: 1
@pytest.fixture
def validator():
return Validator(sample_schema)
sample_schema = {
'a_string': {'type': 'string', 'minlength': 2, 'maxlength': 10},
Reported by Pylint.
pipenv/vendor/urllib3/util/timeout.py
6 issues
Line: 9
Column: 1
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# urllib3
_Default = object()
Reported by Pylint.
Line: 144
Column: 13
try:
float(value)
except (TypeError, ValueError):
raise ValueError(
"Timeout value %s was %s, but it must be an "
"int, float or None." % (name, value)
)
try:
Reported by Pylint.
Line: 158
Column: 13
)
except TypeError:
# Python 3
raise ValueError(
"Timeout value %s was %s, but it must be an "
"int, float or None." % (name, value)
)
return value
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
import time
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
from ..exceptions import TimeoutStateError
Reported by Pylint.
Line: 20
Column: 1
current_time = getattr(time, "monotonic", time.time)
class Timeout(object):
"""Timeout configuration.
Timeouts can be defined as a default for a pool:
.. code-block:: python
Reported by Pylint.
Line: 255
Column: 9
:raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect`
has not yet been called on this object.
"""
if (
self.total is not None
and self.total is not self.DEFAULT_TIMEOUT
and self._read is not None
and self._read is not self.DEFAULT_TIMEOUT
):
Reported by Pylint.
pipenv/patched/notpip/_vendor/distlib/__init__.py
6 issues
Line: 1
Column: 1
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2019 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import logging
__version__ = '0.3.0'
Reported by Pylint.
Line: 11
Column: 1
__version__ = '0.3.0'
class DistlibException(Exception):
pass
try:
from logging import NullHandler
except ImportError: # pragma: no cover
Reported by Pylint.
Line: 17
Column: 5
try:
from logging import NullHandler
except ImportError: # pragma: no cover
class NullHandler(logging.Handler):
def handle(self, record): pass
def emit(self, record): pass
def createLock(self): self.lock = None
logger = logging.getLogger(__name__)
Reported by Pylint.
Line: 18
Column: 35
from logging import NullHandler
except ImportError: # pragma: no cover
class NullHandler(logging.Handler):
def handle(self, record): pass
def emit(self, record): pass
def createLock(self): self.lock = None
logger = logging.getLogger(__name__)
logger.addHandler(NullHandler())
Reported by Pylint.
Line: 19
Column: 33
except ImportError: # pragma: no cover
class NullHandler(logging.Handler):
def handle(self, record): pass
def emit(self, record): pass
def createLock(self): self.lock = None
logger = logging.getLogger(__name__)
logger.addHandler(NullHandler())
Reported by Pylint.
Line: 20
Column: 31
class NullHandler(logging.Handler):
def handle(self, record): pass
def emit(self, record): pass
def createLock(self): self.lock = None
logger = logging.getLogger(__name__)
logger.addHandler(NullHandler())
Reported by Pylint.
pipenv/patched/notpip/_internal/utils/deprecation.py
6 issues
Line: 55
Column: 5
# Enable our Deprecation Warnings
warnings.simplefilter("default", PipDeprecationWarning, append=True)
global _original_showwarning
if _original_showwarning is None:
_original_showwarning = warnings.showwarning
warnings.showwarning = _showwarning
Reported by Pylint.
Line: 25
Column: 1
DEPRECATION_MSG_PREFIX = "DEPRECATION: "
class PipDeprecationWarning(Warning):
pass
_original_showwarning = None # type: Any
Reported by Pylint.
Line: 29
Column: 1
pass
_original_showwarning = None # type: Any
# Warnings <-> Logging Integration
def _showwarning(message, category, filename, lineno, file=None, line=None):
if file is not None:
Reported by Pylint.
Line: 33
Column: 1
# Warnings <-> Logging Integration
def _showwarning(message, category, filename, lineno, file=None, line=None):
if file is not None:
if _original_showwarning is not None:
_original_showwarning(
message, category, filename, lineno, file, line,
)
Reported by Pylint.
Line: 50
Column: 1
)
def install_warning_logger():
# type: () -> None
# Enable our Deprecation Warnings
warnings.simplefilter("default", PipDeprecationWarning, append=True)
global _original_showwarning
Reported by Pylint.
Line: 55
Column: 5
# Enable our Deprecation Warnings
warnings.simplefilter("default", PipDeprecationWarning, append=True)
global _original_showwarning
if _original_showwarning is None:
_original_showwarning = warnings.showwarning
warnings.showwarning = _showwarning
Reported by Pylint.
pipenv/vendor/packaging/utils.py
6 issues
Line: 8
Column: 1
import re
from typing import FrozenSet, NewType, Tuple, Union, cast
from .tags import Tag, parse_tag
from .version import InvalidVersion, Version
BuildTag = Union[Tuple[()], Tuple[int, str]]
NormalizedName = NewType("NormalizedName", str)
Reported by Pylint.
Line: 9
Column: 1
from typing import FrozenSet, NewType, Tuple, Union, cast
from .tags import Tag, parse_tag
from .version import InvalidVersion, Version
BuildTag = Union[Tuple[()], Tuple[int, str]]
NormalizedName = NewType("NormalizedName", str)
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.
import re
from typing import FrozenSet, NewType, Tuple, Union, cast
from .tags import Tag, parse_tag
from .version import InvalidVersion, Version
Reported by Pylint.
Line: 32
Column: 1
_build_tag_regex = re.compile(r"(\d+)(.*)")
def canonicalize_name(name: str) -> NormalizedName:
# This is taken from PEP 503.
value = _canonicalize_regex.sub("-", name).lower()
return cast(NormalizedName, value)
Reported by Pylint.
Line: 81
Column: 1
return "".join(parts)
def parse_wheel_filename(
filename: str,
) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:
if not filename.endswith(".whl"):
raise InvalidWheelFilename(
f"Invalid wheel filename (extension must be '.whl'): {filename}"
Reported by Pylint.
Line: 117
Column: 1
return (name, version, build, tags)
def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]:
if filename.endswith(".tar.gz"):
file_stem = filename[: -len(".tar.gz")]
elif filename.endswith(".zip"):
file_stem = filename[: -len(".zip")]
else:
Reported by Pylint.
pipenv/vendor/urllib3/util/request.py
6 issues
Line: 5
Column: 1
from base64 import b64encode
from ..exceptions import UnrewindableBodyError
from ..packages.six import b, integer_types
# Pass as a value within ``headers`` to skip
# emitting some HTTP headers that are added automatically.
# The only headers that are supported are ``Accept-Encoding``,
Reported by Pylint.
Line: 6
Column: 1
from base64 import b64encode
from ..exceptions import UnrewindableBodyError
from ..packages.six import b, integer_types
# Pass as a value within ``headers`` to skip
# emitting some HTTP headers that are added automatically.
# The only headers that are supported are ``Accept-Encoding``,
# ``Host``, and ``User-Agent``.
Reported by Pylint.
Line: 17
Column: 5
ACCEPT_ENCODING = "gzip,deflate"
try:
import brotli as _unused_module_brotli # noqa: F401
except ImportError:
pass
else:
ACCEPT_ENCODING += ",br"
Reported by Pylint.
Line: 132
Column: 13
try:
body_seek(body_pos)
except (IOError, OSError):
raise UnrewindableBodyError(
"An error occurred when rewinding request body for redirect/retry."
)
elif body_pos is _FAILEDTELL:
raise UnrewindableBodyError(
"Unable to record file position for rewinding "
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
from base64 import b64encode
from ..exceptions import UnrewindableBodyError
from ..packages.six import b, integer_types
# Pass as a value within ``headers`` to skip
# emitting some HTTP headers that are added automatically.
Reported by Pylint.
Line: 26
Column: 1
_FAILEDTELL = object()
def make_headers(
keep_alive=None,
accept_encoding=None,
user_agent=None,
basic_auth=None,
proxy_basic_auth=None,
Reported by Pylint.
pipenv/patched/piptools/exceptions.py
6 issues
Line: 6
Column: 5
class NoCandidateFound(PipToolsError):
def __init__(self, ireq, candidates_tried, finder):
self.ireq = ireq
self.candidates_tried = candidates_tried
self.finder = finder
def __str__(self):
Reported by Pylint.
Line: 54
Column: 5
class IncompatibleRequirements(PipToolsError):
def __init__(self, ireq_a, ireq_b):
self.ireq_a = ireq_a
self.ireq_b = ireq_b
def __str__(self):
message = "Incompatible requirements found: {} and {}"
Reported by Pylint.
Line: 1
Column: 1
class PipToolsError(Exception):
pass
class NoCandidateFound(PipToolsError):
def __init__(self, ireq, candidates_tried, finder):
self.ireq = ireq
self.candidates_tried = candidates_tried
self.finder = finder
Reported by Pylint.
Line: 1
Column: 1
class PipToolsError(Exception):
pass
class NoCandidateFound(PipToolsError):
def __init__(self, ireq, candidates_tried, finder):
self.ireq = ireq
self.candidates_tried = candidates_tried
self.finder = finder
Reported by Pylint.
Line: 5
Column: 1
pass
class NoCandidateFound(PipToolsError):
def __init__(self, ireq, candidates_tried, finder):
self.ireq = ireq
self.candidates_tried = candidates_tried
self.finder = finder
Reported by Pylint.
Line: 53
Column: 1
return "\n".join(lines)
class IncompatibleRequirements(PipToolsError):
def __init__(self, ireq_a, ireq_b):
self.ireq_a = ireq_a
self.ireq_b = ireq_b
def __str__(self):
Reported by Pylint.
pipenv/vendor/yarg/parse.py
6 issues
Line: 30
Column: 1
import requests
from .exceptions import HTTPError
def _get(pypi_server):
"""
Query the PyPI RSS feed and return a list
Reported by Pylint.
Line: 43
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
raise HTTPError(status_code=response.status_code,
reason=response.reason)
if hasattr(response.content, 'decode'):
tree = xml.etree.ElementTree.fromstring(response.content.decode())
else:
tree = xml.etree.ElementTree.fromstring(response.content)
channel = tree.find('channel')
return channel.findall('item')
Reported by Bandit.
Line: 45
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree
if hasattr(response.content, 'decode'):
tree = xml.etree.ElementTree.fromstring(response.content.decode())
else:
tree = xml.etree.ElementTree.fromstring(response.content)
channel = tree.find('channel')
return channel.findall('item')
def newest_packages(
Reported by Bandit.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright (c) 2014 Kura
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
Reported by Pylint.
Line: 26
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b405-import-xml-etree
# SOFTWARE.
from datetime import datetime
import xml.etree.ElementTree
import requests
from .exceptions import HTTPError
Reported by Bandit.
Line: 98
Column: 1
return i
class Package(object):
"""
A PyPI package generated from the RSS feed information.
:param pypi_dict: A dictionary retrieved from the PyPI server.
"""
Reported by Pylint.
pipenv/vendor/shellingham/posix/proc.py
6 issues
Line: 6
Column: 1
import re
import sys
from ._core import Process
STAT_PPID = 3
STAT_TTY = 6
Reported by Pylint.
Line: 43
Column: 3
path = os.path.join("/proc", str(pid), "cmdline")
encoding = sys.getfilesystemencoding() or "utf-8"
with io.open(path, encoding=encoding, errors="replace") as f:
# XXX: Command line arguments can be arbitrary byte sequences, not
# necessarily decodable. For Shellingham's purpose, however, we don't
# care. (pypa/pipenv#2820)
# cmdline appends an extra NULL at the end, hence the [:-1].
return tuple(f.read().split("\0")[:-1])
Reported by Pylint.
Line: 1
Column: 1
import io
import os
import re
import sys
from ._core import Process
STAT_PPID = 3
Reported by Pylint.
Line: 33
Column: 63
def _get_stat(pid, name):
path = os.path.join("/proc", str(pid), name)
with io.open(path, encoding="ascii", errors="replace") as f:
# We only care about TTY and PPID -- all numbers.
parts = STAT_PATTERN.findall(f.read())
return parts[STAT_TTY], parts[STAT_PPID]
Reported by Pylint.
Line: 42
Column: 64
def _get_cmdline(pid):
path = os.path.join("/proc", str(pid), "cmdline")
encoding = sys.getfilesystemencoding() or "utf-8"
with io.open(path, encoding=encoding, errors="replace") as f:
# XXX: Command line arguments can be arbitrary byte sequences, not
# necessarily decodable. For Shellingham's purpose, however, we don't
# care. (pypa/pipenv#2820)
# cmdline appends an extra NULL at the end, hence the [:-1].
return tuple(f.read().split("\0")[:-1])
Reported by Pylint.
Line: 50
Column: 1
return tuple(f.read().split("\0")[:-1])
class ProcFormatError(EnvironmentError):
pass
def get_process_mapping():
"""Try to look up the process tree via the /proc interface."""
Reported by Pylint.
pipenv/patched/notpip/_vendor/urllib3/util/timeout.py
6 issues
Line: 8
Column: 1
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# urllib3
_Default = object()
Reported by Pylint.
Line: 134
Column: 13
try:
float(value)
except (TypeError, ValueError):
raise ValueError(
"Timeout value %s was %s, but it must be an "
"int, float or None." % (name, value)
)
try:
Reported by Pylint.
Line: 148
Column: 13
)
except TypeError:
# Python 3
raise ValueError(
"Timeout value %s was %s, but it must be an "
"int, float or None." % (name, value)
)
return value
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
Reported by Pylint.
Line: 19
Column: 1
current_time = getattr(time, "monotonic", time.time)
class Timeout(object):
""" Timeout configuration.
Timeouts can be defined as a default for a pool::
timeout = Timeout(connect=2.0, read=7.0)
Reported by Pylint.
Line: 245
Column: 9
:raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect`
has not yet been called on this object.
"""
if (
self.total is not None
and self.total is not self.DEFAULT_TIMEOUT
and self._read is not None
and self._read is not self.DEFAULT_TIMEOUT
):
Reported by Pylint.