@@ -121,7 +121,7 @@ def constrain_package_deps(self) -> bool:
121121 def use_frozen_constraints (self ) -> bool :
122122 return bool (self ._env .conf ["use_frozen_constraints" ])
123123
124- def _install_requirement_file (self , arguments : PythonDeps , section : str , of_type : str ) -> None : # noqa: C901
124+ def _install_requirement_file (self , arguments : PythonDeps , section : str , of_type : str ) -> None :
125125 try :
126126 new_options , new_reqs = arguments .unroll ()
127127 except ValueError as exception :
@@ -161,15 +161,7 @@ def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type
161161 if args : # pragma: no branch
162162 self ._execute_installer (args , of_type )
163163 if self .constrain_package_deps and not self .use_frozen_constraints :
164- # when we drop Python 3.8 we can use the builtin `.removeprefix`
165- def remove_prefix (text : str , prefix : str ) -> str :
166- if text .startswith (prefix ):
167- return text [len (prefix ) :]
168- return text
169-
170- combined_constraints = new_requirements + [
171- remove_prefix (text = c , prefix = "-c " ) for c in new_constraints
172- ]
164+ combined_constraints = new_requirements + [c .removeprefix ("-c " ) for c in new_constraints ]
173165 self .constraints_file ().write_text ("\n " .join (combined_constraints ))
174166
175167 @staticmethod
0 commit comments