The following issues were found
tests/integration/test_install_twists.py
146 issues
Line: 5
Column: 1
import shutil
import sys
import pytest
from flaky import flaky
from pipenv._compat import Path
from pipenv.utils import mkdir_p, temp_environ
Reported by Pylint.
Line: 7
Column: 1
import pytest
from flaky import flaky
from pipenv._compat import Path
from pipenv.utils import mkdir_p, temp_environ
Reported by Pylint.
Line: 123
Column: 32
@pytest.mark.local
@pytest.mark.install
@pytest.mark.skip(reason="this doesn't work on windows")
def test_e_dot(PipenvInstance, pip_src_dir):
with PipenvInstance() as p:
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
c = p.pipenv(f"install -e '{path}' --dev")
assert c.returncode == 0
Reported by Pylint.
Line: 224
Column: 40
@pytest.mark.files
@pytest.mark.local
@pytest.mark.resolver
def test_local_package(PipenvInstance, pip_src_dir, testsroot):
"""This test ensures that local packages (directories with a setup.py)
installed in editable mode have their dependencies resolved as well"""
file_name = "requests-2.19.1.tar.gz"
package = "requests-2.19.1"
# Not sure where travis/appveyor run tests from
Reported by Pylint.
Line: 340
Column: 69
@pytest.mark.run
@pytest.mark.files
@pytest.mark.install
def test_multiple_editable_packages_should_not_race(PipenvInstance, testsroot):
"""Test for a race condition that can occur when installing multiple 'editable' packages at
once, and which causes some of them to not be importable.
This issue had been fixed for VCS packages already, but not local 'editable' packages.
Reported by Pylint.
Line: 359
Column: 27
with PipenvInstance(chdir=True) as p:
for pkg_name in pkgs:
source_path = p._pipfile.get_fixture_path(f"git/{pkg_name}/").as_posix()
shutil.copytree(source_path, pkg_name)
pipfile_string += '"{0}" = {{path = "./{0}", editable = true}}\n'.format(pkg_name)
with open(p.pipfile_path, 'w') as f:
Reported by Pylint.
Line: 383
Column: 9
c = p.pipenv("update --outdated")
assert c.returncode == 0
assert "Skipped Update" in c.stderr
p._pipfile.update("ibm-db-sa-py3", "*")
c = p.pipenv("update --outdated")
assert c.returncode != 0
assert "out-of-date" in c.stdout
Reported by Pylint.
Line: 1
Column: 1
import os
import shutil
import sys
import pytest
from flaky import flaky
from pipenv._compat import Path
Reported by Pylint.
Line: 16
Column: 1
@pytest.mark.extras
@pytest.mark.install
@pytest.mark.local
def test_local_extras_install(PipenvInstance):
"""Ensure -e .[extras] installs.
"""
with PipenvInstance(chdir=True) as p:
setup_py = os.path.join(p.path, "setup.py")
with open(setup_py, "w") as fh:
Reported by Pylint.
Line: 19
Column: 40
def test_local_extras_install(PipenvInstance):
"""Ensure -e .[extras] installs.
"""
with PipenvInstance(chdir=True) as p:
setup_py = os.path.join(p.path, "setup.py")
with open(setup_py, "w") as fh:
contents = """
from setuptools import setup, find_packages
setup(
Reported by Pylint.
pipenv/patched/notpip/_vendor/msgpack/fallback.py
144 issues
Line: 10
Column: 23
if sys.version_info[0] == 2:
PY2 = True
int_types = (int, long)
def dict_iteritems(d):
return d.iteritems()
else:
PY2 = False
int_types = int
Reported by Pylint.
Line: 35
Column: 5
if hasattr(sys, 'pypy_version_info'):
# cStringIO is slow on PyPy, StringIO is faster. However: PyPy's own
# StringBuilder is fastest.
from __pypy__ import newlist_hint
try:
from __pypy__.builders import BytesBuilder as StringBuilder
except ImportError:
from __pypy__.builders import StringBuilder
USING_STRINGBUILDER = True
Reported by Pylint.
Line: 62
Column: 1
newlist_hint = lambda size: []
from .exceptions import (
BufferFull,
OutOfData,
ExtraData,
FormatError,
StackError,
Reported by Pylint.
Line: 70
Column: 1
StackError,
)
from . import ExtType
EX_SKIP = 0
EX_CONSTRUCT = 1
EX_READ_ARRAY_HEADER = 2
Reported by Pylint.
Line: 101
Column: 31
except TypeError:
# try to use legacy buffer protocol if 2.7, otherwise re-raise
if PY2:
view = memoryview(buffer(obj))
warnings.warn("using old buffer interface to unpack %s; "
"this leads to unpacking errors if slicing is used and "
"will be removed in a future version" % type(obj),
RuntimeWarning, stacklevel=3)
else:
Reported by Pylint.
Line: 23
Column: 5
if sys.version_info < (3, 5):
# Ugly hack...
RecursionError = RuntimeError
def _is_recursionerror(e):
return len(e.args) == 1 and isinstance(e.args[0], str) and \
e.args[0].startswith('maximum recursion depth exceeded')
else:
Reported by Pylint.
Line: 29
Column: 28
return len(e.args) == 1 and isinstance(e.args[0], str) and \
e.args[0].startswith('maximum recursion depth exceeded')
else:
def _is_recursionerror(e):
return True
if hasattr(sys, 'pypy_version_info'):
# cStringIO is slow on PyPy, StringIO is faster. However: PyPy's own
# StringBuilder is fastest.
Reported by Pylint.
Line: 88
Column: 43
DEFAULT_RECURSE_LIMIT = 511
def _check_type_strict(obj, t, type=type, tuple=tuple):
if type(t) is tuple:
return type(obj) in t
else:
return type(obj) is t
Reported by Pylint.
Line: 88
Column: 32
DEFAULT_RECURSE_LIMIT = 511
def _check_type_strict(obj, t, type=type, tuple=tuple):
if type(t) is tuple:
return type(obj) in t
else:
return type(obj) is t
Reported by Pylint.
Line: 136
Column: 15
unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs)
unpacker.feed(packed)
try:
ret = unpacker._unpack()
except OutOfData:
raise ValueError("Unpack failed: incomplete input")
except RecursionError as e:
if _is_recursionerror(e):
raise StackError
Reported by Pylint.
pipenv/vendor/vistir/misc.py
142 issues
Line: 22
Column: 1
import six
from six.moves.queue import Empty, Queue
from .cmdparse import Script
from .compat import (
Iterable,
Path,
StringIO,
TimeoutError,
Reported by Pylint.
Line: 23
Column: 1
from six.moves.queue import Empty, Queue
from .cmdparse import Script
from .compat import (
Iterable,
Path,
StringIO,
TimeoutError,
_fs_decode_errors,
Reported by Pylint.
Line: 35
Column: 1
partialmethod,
to_native_string,
)
from .contextmanagers import spinner as spinner
from .environment import MYPY_RUNNING
from .termcolors import ANSI_REMOVAL_RE, colorize
if os.name != "nt":
Reported by Pylint.
Line: 36
Column: 1
to_native_string,
)
from .contextmanagers import spinner as spinner
from .environment import MYPY_RUNNING
from .termcolors import ANSI_REMOVAL_RE, colorize
if os.name != "nt":
class WindowsError(OSError):
Reported by Pylint.
Line: 37
Column: 1
)
from .contextmanagers import spinner as spinner
from .environment import MYPY_RUNNING
from .termcolors import ANSI_REMOVAL_RE, colorize
if os.name != "nt":
class WindowsError(OSError):
pass
Reported by Pylint.
Line: 68
Column: 5
if MYPY_RUNNING:
from typing import Any, Dict, Generator, IO, List, Optional, Text, Tuple, Union
from .spin import VistirSpinner
def _get_logger(name=None, level="ERROR"):
# type: (Optional[str], str) -> logging.Logger
if not name:
Reported by Pylint.
Line: 878
Column: 26
except (UnicodeDecodeError, UnicodeEncodeError):
if translation_map is not None:
if six.PY2:
output = unicode.translate( # noqa: F821
to_text(output, encoding=encoding, errors=errors), translation_map
)
else:
output = output.translate(translation_map)
else:
Reported by Pylint.
Line: 996
Column: 36
if six.PY2:
def write(self, x):
if isinstance(x, (str, buffer, bytearray)): # noqa: F821
try:
self.flush()
except Exception:
pass
# This is modified from the initial implementation to rely on
Reported by Pylint.
Line: 1177
Column: 9
stream_map = {"stdin": sys.stdin, "stdout": sys.stdout, "stderr": sys.stderr}
if os.name == "nt" or sys.platform.startswith("win"):
from ._winconsole import _get_windows_console_stream, _wrap_std_stream
else:
_get_windows_console_stream = lambda *args: None # noqa
_wrap_std_stream = lambda *args: None # noqa
Reported by Pylint.
Line: 1233
Column: 5
def _can_use_color(stream=None, color=None):
from .termcolors import DISABLE_COLORS
if DISABLE_COLORS:
return False
if not color:
if not stream:
Reported by Pylint.
pipenv/vendor/attr/_make.py
140 issues
Line: 13
Column: 1
from operator import itemgetter
from . import _config, setters
from ._compat import (
PY2,
PYPY,
isclass,
iteritems,
Reported by Pylint.
Line: 14
Column: 1
from operator import itemgetter
from . import _config, setters
from ._compat import (
PY2,
PYPY,
isclass,
iteritems,
metadata_proxy,
Reported by Pylint.
Line: 24
Column: 1
ordered_dict,
set_closure_cell,
)
from .exceptions import (
DefaultAlreadySetError,
FrozenInstanceError,
NotAnAttrsClassError,
PythonTooOldError,
UnannotatedAttributeError,
Reported by Pylint.
Line: 1788
Column: 62
return tuple(
key(value) if key else value
for value, key in (
(getattr(obj, a.name), a.order_key) for a in attrs
)
)
def __lt__(self, other):
"""
Reported by Pylint.
Line: 2613
Column: 16
"""
warnings.warn(_CMP_DEPRECATION, DeprecationWarning, stacklevel=2)
return self.eq and self.order
# Don't use attr.evolve since fields(Attribute) doesn't work
def evolve(self, **changes):
"""
Copy *self* and apply *changes*.
Reported by Pylint.
Line: 2613
Column: 28
"""
warnings.warn(_CMP_DEPRECATION, DeprecationWarning, stacklevel=2)
return self.eq and self.order
# Don't use attr.evolve since fields(Attribute) doesn't work
def evolve(self, **changes):
"""
Copy *self* and apply *changes*.
Reported by Pylint.
Line: 2639
Column: 65
Play nice with pickle.
"""
return tuple(
getattr(self, name) if name != "metadata" else dict(self.metadata)
for name in self.__slots__
)
def __setstate__(self, state):
"""
Reported by Pylint.
Line: 121
Column: 5
def attrib(
default=NOTHING,
validator=None,
repr=True,
cmp=None,
hash=None,
init=True,
metadata=None,
type=None,
Reported by Pylint.
Line: 123
Column: 5
validator=None,
repr=True,
cmp=None,
hash=None,
init=True,
metadata=None,
type=None,
converter=None,
factory=None,
Reported by Pylint.
Line: 126
Column: 5
hash=None,
init=True,
metadata=None,
type=None,
converter=None,
factory=None,
kw_only=False,
eq=None,
order=None,
Reported by Pylint.
tests/integration/test_install_uri.py
140 issues
Line: 4
Column: 1
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function
import os
import pytest
from flaky import flaky
from pipenv._compat import Path
from pipenv.utils import subprocess_run
Reported by Pylint.
Line: 6
Column: 1
import os
import pytest
from flaky import flaky
from pipenv._compat import Path
from pipenv.utils import subprocess_run
Reported by Pylint.
Line: 54
Column: 9
@pytest.mark.needs_internet
def test_git_vcs_install_with_env_var(PipenvInstance):
with PipenvInstance(chdir=True) as p:
p._pipfile.add("six", {"git": "git://${GIT_HOST}/benjaminp/six.git", "ref": "1.11.0"})
os.environ["GIT_HOST"] = "github.com"
c = p.pipenv("install")
assert c.returncode == 0
assert "six" in p.pipfile["packages"]
assert "git" in p.pipfile["packages"]["six"]
Reported by Pylint.
Line: 90
Column: 16
def test_urls_work(PipenvInstance):
with PipenvInstance(chdir=True) as p:
# the library this installs is "django-cms"
path = p._pipfile.get_url("django", "3.4.x.zip")
c = p.pipenv(
"install {0}".format(path)
)
assert c.returncode == 0
Reported by Pylint.
Line: 106
Column: 41
@pytest.mark.urls
@pytest.mark.files
def test_file_urls_work(PipenvInstance, pip_src_dir):
with PipenvInstance(chdir=True) as p:
whl = Path(__file__).parent.parent.joinpath(
"pypi", "six", "six-1.11.0-py2.py3-none-any.whl"
)
try:
Reported by Pylint.
Line: 217
Column: 20
def test_install_local_vcs_not_in_lockfile(PipenvInstance):
with PipenvInstance(chdir=True) as p:
# six_path = os.path.join(p.path, "six")
six_path = p._pipfile.get_fixture_path("git/six/").as_posix()
c = subprocess_run(["git", "clone", six_path, "./six"])
assert c.returncode == 0
c = p.pipenv("install -e ./six")
assert c.returncode == 0
six_key = list(p.pipfile["packages"].keys())[0]
Reported by Pylint.
Line: 267
Column: 22
the resolution graph of non-editable vcs dependencies.
"""
with PipenvInstance(chdir=True) as p:
jinja2_uri = p._pipfile.get_fixture_path("git/jinja2").as_uri()
with open(p.pipfile_path, "w") as f:
f.write(
"""
[[source]]
url = "https://pypi.org/simple"
Reported by Pylint.
Line: 300
Column: 16
@pytest.mark.needs_internet
def test_vcs_can_use_markers(PipenvInstance):
with PipenvInstance(chdir=True) as p:
path = p._pipfile.get_fixture_path("git/six/.git")
p._pipfile.install("six", {"git": "{0}".format(path.as_uri()), "markers": "sys_platform == 'linux'"})
assert "six" in p.pipfile["packages"]
c = p.pipenv("install")
assert c.returncode == 0
assert "six" in p.lockfile["default"]
Reported by Pylint.
Line: 301
Column: 9
def test_vcs_can_use_markers(PipenvInstance):
with PipenvInstance(chdir=True) as p:
path = p._pipfile.get_fixture_path("git/six/.git")
p._pipfile.install("six", {"git": "{0}".format(path.as_uri()), "markers": "sys_platform == 'linux'"})
assert "six" in p.pipfile["packages"]
c = p.pipenv("install")
assert c.returncode == 0
assert "six" in p.lockfile["default"]
assert "git" in p.lockfile["default"]["six"]
Reported by Pylint.
Line: 1
Column: 1
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function
import os
import pytest
from flaky import flaky
from pipenv._compat import Path
from pipenv.utils import subprocess_run
Reported by Pylint.
pipenv/project.py
136 issues
Line: 13
Column: 1
import sys
import urllib.parse
import pipfile
import pipfile.api
import toml
import tomlkit
import vistir
Reported by Pylint.
Line: 14
Column: 1
import urllib.parse
import pipfile
import pipfile.api
import toml
import tomlkit
import vistir
from pipenv.cmdparse import Script
Reported by Pylint.
Line: 16
Column: 1
import pipfile
import pipfile.api
import toml
import tomlkit
import vistir
from pipenv.cmdparse import Script
from pipenv.core import system_which
from pipenv.environment import Environment
Reported by Pylint.
Line: 17
Column: 1
import pipfile.api
import toml
import tomlkit
import vistir
from pipenv.cmdparse import Script
from pipenv.core import system_which
from pipenv.environment import Environment
from pipenv.environments import Setting, is_type_checking, is_in_virtualenv, normalize_pipfile_path
Reported by Pylint.
Line: 283
Column: 9
@property
def working_set(self):
# type: () -> pkg_resources.WorkingSet
from .utils import load_path
sys_path = load_path(self.which("python"))
import pkg_resources
return pkg_resources.WorkingSet(sys_path)
@property
Reported by Pylint.
Line: 350
Column: 59
def get_outdated_packages(self):
# type: () -> List[pkg_resources.Distribution]
return self.environment.get_outdated_packages(pre=self.pipfile.get("pre", False))
@classmethod
def _sanitize(cls, name):
# type: (str) -> Tuple[str, str]
# Replace dangerous characters into '_'. The length of the sanitized
Reported by Pylint.
Line: 623
Column: 9
@property
def _pipfile(self):
from .vendor.requirementslib.models.pipfile import \
Pipfile as ReqLibPipfile
pf = ReqLibPipfile.load(self.pipfile_location)
return pf
@property
Reported by Pylint.
Line: 706
Column: 9
def create_pipfile(self, python=None):
"""Creates the Pipfile, filled with juicy defaults."""
from .vendor.pip_shims.shims import InstallCommand
# Inherit the pip's index configuration of install command.
command = InstallCommand()
indexes = command.cmd_opts.get_option("--extra-index-url").default
sources = [self.default_source]
Reported by Pylint.
Line: 793
Column: 9
return self.get_or_create_lockfile(from_pipfile=True)
def get_lockfile_meta(self):
from .vendor.plette.lockfiles import PIPFILE_SPEC_CURRENT
if self.lockfile_exists:
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
elif "source" in self.parsed_pipfile:
sources = [dict(source) for source in self.parsed_pipfile["source"]]
else:
Reported by Pylint.
Line: 900
Column: 9
return source
def get_source(self, name=None, url=None, refresh=False):
from .utils import is_url_equal
def find_source(sources, name=None, url=None):
source = None
if name:
source = next(iter(
Reported by Pylint.
pipenv/vendor/click/__init__.py
134 issues
Line: 7
Column: 1
around a simple API that does not come with too much magic and is
composable.
"""
from .core import Argument as Argument
from .core import BaseCommand as BaseCommand
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
Reported by Pylint.
Line: 8
Column: 1
composable.
"""
from .core import Argument as Argument
from .core import BaseCommand as BaseCommand
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
Reported by Pylint.
Line: 9
Column: 1
"""
from .core import Argument as Argument
from .core import BaseCommand as BaseCommand
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
Reported by Pylint.
Line: 10
Column: 1
from .core import Argument as Argument
from .core import BaseCommand as BaseCommand
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
Reported by Pylint.
Line: 11
Column: 1
from .core import BaseCommand as BaseCommand
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
Reported by Pylint.
Line: 12
Column: 1
from .core import Command as Command
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
from .decorators import command as command
Reported by Pylint.
Line: 13
Column: 1
from .core import CommandCollection as CommandCollection
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
from .decorators import command as command
from .decorators import confirmation_option as confirmation_option
Reported by Pylint.
Line: 14
Column: 1
from .core import Context as Context
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
from .decorators import command as command
from .decorators import confirmation_option as confirmation_option
from .decorators import group as group
Reported by Pylint.
Line: 15
Column: 1
from .core import Group as Group
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
from .decorators import command as command
from .decorators import confirmation_option as confirmation_option
from .decorators import group as group
from .decorators import help_option as help_option
Reported by Pylint.
Line: 16
Column: 1
from .core import MultiCommand as MultiCommand
from .core import Option as Option
from .core import Parameter as Parameter
from .decorators import argument as argument
from .decorators import command as command
from .decorators import confirmation_option as confirmation_option
from .decorators import group as group
from .decorators import help_option as help_option
from .decorators import make_pass_decorator as make_pass_decorator
Reported by Pylint.
tests/integration/test_uninstall.py
126 issues
Line: 4
Column: 1
import os
import shutil
import pytest
from pipenv.utils import temp_environ
@pytest.mark.uninstall
Reported by Pylint.
Line: 1
Column: 1
import os
import shutil
import pytest
from pipenv.utils import temp_environ
@pytest.mark.uninstall
Reported by Pylint.
Line: 11
Column: 1
@pytest.mark.uninstall
@pytest.mark.install
def test_uninstall_requests(PipenvInstance):
# Uninstalling requests can fail even when uninstall Django below
# succeeds, if requests was de-vendored.
# See https://github.com/pypa/pipenv/issues/3644 for problems
# caused by devendoring
with PipenvInstance() as p:
Reported by Pylint.
Line: 11
Column: 1
@pytest.mark.uninstall
@pytest.mark.install
def test_uninstall_requests(PipenvInstance):
# Uninstalling requests can fail even when uninstall Django below
# succeeds, if requests was de-vendored.
# See https://github.com/pypa/pipenv/issues/3644 for problems
# caused by devendoring
with PipenvInstance() as p:
Reported by Pylint.
Line: 16
Column: 30
# succeeds, if requests was de-vendored.
# See https://github.com/pypa/pipenv/issues/3644 for problems
# caused by devendoring
with PipenvInstance() as p:
c = p.pipenv("install requests")
assert c.returncode == 0
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
Reported by Pylint.
Line: 17
Column: 9
# See https://github.com/pypa/pipenv/issues/3644 for problems
# caused by devendoring
with PipenvInstance() as p:
c = p.pipenv("install requests")
assert c.returncode == 0
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
assert c.returncode == 0
Reported by Pylint.
Line: 18
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# caused by devendoring
with PipenvInstance() as p:
c = p.pipenv("install requests")
assert c.returncode == 0
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
assert c.returncode == 0
Reported by Bandit.
Line: 19
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
with PipenvInstance() as p:
c = p.pipenv("install requests")
assert c.returncode == 0
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
assert c.returncode == 0
c = p.pipenv("uninstall requests")
Reported by Bandit.
Line: 21
Column: 9
assert c.returncode == 0
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
assert c.returncode == 0
c = p.pipenv("uninstall requests")
assert c.returncode == 0
assert "requests" not in p.pipfile["dev-packages"]
Reported by Pylint.
Line: 22
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert "requests" in p.pipfile["packages"]
c = p.pipenv("run python -m requests.help")
assert c.returncode == 0
c = p.pipenv("uninstall requests")
assert c.returncode == 0
assert "requests" not in p.pipfile["dev-packages"]
Reported by Bandit.
pipenv/patched/yaml3/constructor.py
124 issues
Line: 11
Column: 1
'ConstructorError'
]
from .error import *
from .nodes import *
import collections.abc, datetime, base64, binascii, re, sys, types
class ConstructorError(MarkedYAMLError):
Reported by Pylint.
Line: 12
Column: 1
]
from .error import *
from .nodes import *
import collections.abc, datetime, base64, binascii, re, sys, types
class ConstructorError(MarkedYAMLError):
pass
Reported by Pylint.
Line: 16
Column: 24
import collections.abc, datetime, base64, binascii, re, sys, types
class ConstructorError(MarkedYAMLError):
pass
class BaseConstructor:
yaml_constructors = {}
Reported by Pylint.
Line: 32
Column: 16
def check_data(self):
# If there are more documents available?
return self.check_node()
def check_state_key(self, key):
"""Block special attributes/methods from being set in a newly created
object, to prevent user-controlled methods from being called during
deserialization"""
Reported by Pylint.
Line: 38
Column: 12
"""Block special attributes/methods from being set in a newly created
object, to prevent user-controlled methods from being called during
deserialization"""
if self.get_state_keys_blacklist_regexp().match(key):
raise ConstructorError(None, None,
"blacklisted key '%s' in instance state found" % (key,), None)
def get_data(self):
# Construct and return the next document.
Reported by Pylint.
Line: 44
Column: 12
def get_data(self):
# Construct and return the next document.
if self.check_node():
return self.construct_document(self.get_node())
def get_single_data(self):
# Ensure that the stream contains a single document and construct it.
node = self.get_single_node()
Reported by Pylint.
Line: 45
Column: 44
def get_data(self):
# Construct and return the next document.
if self.check_node():
return self.construct_document(self.get_node())
def get_single_data(self):
# Ensure that the stream contains a single document and construct it.
node = self.get_single_node()
if node is not None:
Reported by Pylint.
Line: 49
Column: 16
def get_single_data(self):
# Ensure that the stream contains a single document and construct it.
node = self.get_single_node()
if node is not None:
return self.construct_document(node)
return None
def construct_document(self, node):
Reported by Pylint.
Line: 93
Column: 39
constructor = self.yaml_multi_constructors[None]
elif None in self.yaml_constructors:
constructor = self.yaml_constructors[None]
elif isinstance(node, ScalarNode):
constructor = self.__class__.construct_scalar
elif isinstance(node, SequenceNode):
constructor = self.__class__.construct_sequence
elif isinstance(node, MappingNode):
constructor = self.__class__.construct_mapping
Reported by Pylint.
Line: 95
Column: 39
constructor = self.yaml_constructors[None]
elif isinstance(node, ScalarNode):
constructor = self.__class__.construct_scalar
elif isinstance(node, SequenceNode):
constructor = self.__class__.construct_sequence
elif isinstance(node, MappingNode):
constructor = self.__class__.construct_mapping
if tag_suffix is None:
data = constructor(self, node)
Reported by Pylint.
pipenv/vendor/cerberus/tests/test_errors.py
121 issues
Line: 3
Column: 1
# -*- coding: utf-8 -*-
from cerberus import Validator, errors
from cerberus.tests import assert_fail
ValidationError = errors.ValidationError
Reported by Pylint.
Line: 4
Column: 1
# -*- coding: utf-8 -*-
from cerberus import Validator, errors
from cerberus.tests import assert_fail
ValidationError = errors.ValidationError
Reported by Pylint.
Line: 13
Column: 5
def test__error_1():
v = Validator(schema={'foo': {'type': 'string'}})
v.document = {'foo': 42}
v._error('foo', errors.BAD_TYPE, 'string')
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'type')
assert error.code == 0x24
assert error.rule == 'type'
Reported by Pylint.
Line: 14
Column: 13
v = Validator(schema={'foo': {'type': 'string'}})
v.document = {'foo': 42}
v._error('foo', errors.BAD_TYPE, 'string')
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'type')
assert error.code == 0x24
assert error.rule == 'type'
assert error.constraint == 'string'
Reported by Pylint.
Line: 29
Column: 5
def test__error_2():
v = Validator(schema={'foo': {'keysrules': {'type': 'integer'}}})
v.document = {'foo': {'0': 'bar'}}
v._error('foo', errors.KEYSRULES, ())
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'keysrules')
assert error.code == 0x83
assert error.rule == 'keysrules'
Reported by Pylint.
Line: 30
Column: 13
v = Validator(schema={'foo': {'keysrules': {'type': 'integer'}}})
v.document = {'foo': {'0': 'bar'}}
v._error('foo', errors.KEYSRULES, ())
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'keysrules')
assert error.code == 0x83
assert error.rule == 'keysrules'
assert error.constraint == {'type': 'integer'}
Reported by Pylint.
Line: 49
Column: 5
]
v = Validator(schema={'foo': {'oneof': valids}})
v.document = {'foo': '0x100'}
v._error('foo', errors.ONEOF, (), 0, 2)
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'oneof')
assert error.code == 0x92
assert error.rule == 'oneof'
Reported by Pylint.
Line: 50
Column: 13
v = Validator(schema={'foo': {'oneof': valids}})
v.document = {'foo': '0x100'}
v._error('foo', errors.ONEOF, (), 0, 2)
error = v._errors[0]
assert error.document_path == ('foo',)
assert error.schema_path == ('foo', 'oneof')
assert error.code == 0x92
assert error.rule == 'oneof'
assert error.constraint == valids
Reported by Pylint.
Line: 106
Column: 31
def test_nested_error_paths(validator):
# interpreters of the same version on some platforms showed different sort results
# over various runs:
def assert_has_all_errors(errors, *ref_errs):
for ref_err in ref_errs:
for error in errors:
if error == ref_err:
break
else:
Reported by Pylint.
Line: 128
Column: 5
assert_fail(document, schema, validator=validator)
det = validator.document_error_tree
set = validator.schema_error_tree
assert len(det.errors) == 0
assert len(set.errors) == 0
assert len(det['a_dict'].errors) == 2
Reported by Pylint.