mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 06:46:15 +00:00
fix ruff complaints
This commit is contained in:
+6
-16
@@ -315,7 +315,7 @@ class Entry:
|
||||
return "*"
|
||||
specifier = f"=={specifier}"
|
||||
elif specifier.startswith("==") and specifier.count("=") > 3:
|
||||
specifier = "=={}".format(specifier.lstrip("="))
|
||||
specifier = f"=={specifier.lstrip('=')}"
|
||||
return specifier
|
||||
|
||||
@staticmethod
|
||||
@@ -476,13 +476,8 @@ class Entry:
|
||||
if self.project.s.is_verbose():
|
||||
err.print(f"Tried constraint: {constraint!r}")
|
||||
msg = (
|
||||
"Cannot resolve conflicting version {}{} while {}{} is "
|
||||
"locked.".format(
|
||||
self.name,
|
||||
constraint.specifier,
|
||||
self.name,
|
||||
self.updated_specifier,
|
||||
)
|
||||
f"Cannot resolve conflicting version {self.name}{constraint.specifier} "
|
||||
f"while {self.name}{self.updated_specifier} is locked."
|
||||
)
|
||||
raise DependencyConflict(msg)
|
||||
return True
|
||||
@@ -495,14 +490,9 @@ class Entry:
|
||||
from pipenv.exceptions import DependencyConflict
|
||||
|
||||
msg = (
|
||||
"Cannot resolve conflicting versions: (Root: {}) {}{} (Pipfile) "
|
||||
"Incompatible with {}{} (resolved)\n".format(
|
||||
self.name,
|
||||
parent.pipfile_name,
|
||||
parent.pipfile_entry.requirement.specifiers,
|
||||
parent.name,
|
||||
parent.updated_specifiers,
|
||||
)
|
||||
f"Cannot resolve conflicting versions: (Root: {self.name}) "
|
||||
f"{parent.pipfile_name}{parent.pipfile_entry.requirement.specifiers} (Pipfile) "
|
||||
f"Incompatible with {parent.name}{parent.updated_specifiers} (resolved)\n"
|
||||
)
|
||||
raise DependencyConflict(msg)
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ def _get_powershell_path():
|
||||
]
|
||||
powershell_path = next(iter(_walk_for_powershell(pth) for pth in paths), None)
|
||||
if not powershell_path:
|
||||
powershell_path = subprocess.run(["where", "powershell"])
|
||||
powershell_path = subprocess.run(["where", "powershell"], check=False)
|
||||
if powershell_path.stdout:
|
||||
return powershell_path.stdout.strip()
|
||||
|
||||
@@ -165,7 +165,7 @@ def _get_sid_with_powershell():
|
||||
"-Command",
|
||||
"Invoke-Expression '[System.Security.Principal.WindowsIdentity]::GetCurrent().user | Write-Host'",
|
||||
]
|
||||
sid = subprocess.run(args, capture_output=True)
|
||||
sid = subprocess.run(args, capture_output=True, check=False)
|
||||
return sid.stdout.strip()
|
||||
|
||||
|
||||
@@ -289,6 +289,7 @@ def set_write_bit(fn: str) -> None:
|
||||
# >>> sys.stdout.encoding
|
||||
# "UTF8"
|
||||
encoding=locale.getpreferredencoding(),
|
||||
check=False,
|
||||
)
|
||||
if not c.err and c.returncode == 0:
|
||||
return
|
||||
|
||||
@@ -69,7 +69,9 @@ def subprocess_run(
|
||||
other_kwargs["stdout"] = subprocess.PIPE
|
||||
other_kwargs["stderr"] = subprocess.PIPE
|
||||
if block:
|
||||
return subprocess.run(args, text=text, encoding=encoding, **other_kwargs)
|
||||
return subprocess.run(
|
||||
args, text=text, encoding=encoding, check=False, **other_kwargs
|
||||
)
|
||||
else:
|
||||
return subprocess.Popen(
|
||||
args, universal_newlines=text, encoding=encoding, **other_kwargs
|
||||
|
||||
@@ -144,8 +144,8 @@ class Resolver:
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
"<Resolver (constraints={self.initial_constraints}, req_dir={self.req_dir}, "
|
||||
"sources={self.sources})>".format(self=self)
|
||||
f"<Resolver (constraints={self.initial_constraints}, req_dir={self.req_dir}, "
|
||||
f"sources={self.sources})>"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -130,8 +130,7 @@ def tomlkit_dict_to_python(toml_dict):
|
||||
converted = toml_dict.copy()
|
||||
else:
|
||||
raise TypeError(
|
||||
"Invalid type for conversion: expected Container, Dict, or Table, "
|
||||
"got {!r}".format(toml_dict)
|
||||
f"Invalid type for conversion: expected Container, Dict, or Table, got {toml_dict}"
|
||||
)
|
||||
if isinstance(converted, dict):
|
||||
return {k: tomlkit_value_to_python(v) for k, v in converted.items()}
|
||||
|
||||
@@ -236,7 +236,7 @@ class _PipenvInstance:
|
||||
self._path = None
|
||||
|
||||
def run_command(self, cmd):
|
||||
result = subprocess.run(cmd, shell=True, capture_output=True)
|
||||
result = subprocess.run(cmd, shell=True, capture_output=True, check=False)
|
||||
try:
|
||||
std_out_decoded = result.stdout.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -23,7 +22,7 @@ def test_basic_category_install_from_requirements(pipenv_instance_private_pypi):
|
||||
with pipenv_instance_private_pypi(pipfile=False) as p:
|
||||
# Write a requirements file
|
||||
with open("requirements.txt", "w") as f:
|
||||
f.write(f"six==1.16.0")
|
||||
f.write("six==1.16.0")
|
||||
|
||||
c = p.pipenv("install --categories prereq")
|
||||
assert c.returncode == 0
|
||||
|
||||
Reference in New Issue
Block a user