Skip to content

Commit 7924bd9

Browse files
committed
trivial: Address TODO
Signed-off-by: Stephen Finucane <[email protected]>
1 parent b509c70 commit 7924bd9

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/tox/tox_env/python/pip/pip_install.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def constrain_package_deps(self) -> bool:
134134
def use_frozen_constraints(self) -> bool:
135135
return bool(self._env.conf["use_frozen_constraints"])
136136

137-
def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type: str) -> None: # noqa: C901
137+
def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type: str) -> None:
138138
new_requirements: list[str] = []
139139
new_constraints: list[str] = []
140140

@@ -184,15 +184,7 @@ def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type
184184
args.extend(self.constraints.as_root_args)
185185
self._execute_installer(args, of_type)
186186
if self.constrain_package_deps and not self.use_frozen_constraints:
187-
# when we drop Python 3.8 we can use the builtin `.removeprefix`
188-
def remove_prefix(text: str, prefix: str) -> str:
189-
if text.startswith(prefix):
190-
return text[len(prefix) :]
191-
return text
192-
193-
combined_constraints = new_requirements + [
194-
remove_prefix(text=c, prefix="-c ") for c in new_constraints
195-
]
187+
combined_constraints = new_requirements + [c.removeprefix("-c ") for c in new_constraints]
196188
self.constraints_file().write_text("\n".join(combined_constraints))
197189

198190
@staticmethod

0 commit comments

Comments
 (0)