Skip to content

Commit

Permalink
Rename remove_value() -> omit_list_value()
Browse files Browse the repository at this point in the history
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
  • Loading branch information
2 people authored and atugushev committed Sep 20, 2023
1 parent 222e761 commit ebd4a4f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions piptools/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
is_url_requirement,
key_from_ireq,
key_from_req,
remove_value,
omit_list_value,
strip_extras,
)

Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(
raise PipToolsError("Legacy resolver deprecated feature must be enabled.")

# Make sure there is no enabled 2020-resolver
options.features_enabled = remove_value(
options.features_enabled = omit_list_value(
options.features_enabled, "2020-resolver"
)

Expand Down Expand Up @@ -534,7 +534,7 @@ def __init__(
self._constraints_map = {key_from_ireq(ireq): ireq for ireq in constraints}

# Make sure there is no enabled legacy resolver
options.deprecated_features_enabled = remove_value(
options.deprecated_features_enabled = omit_list_value(
options.deprecated_features_enabled, "legacy-resolver"
)

Expand Down
6 changes: 2 additions & 4 deletions piptools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,8 @@ def get_sys_path_for_python_executable(python_executable: str) -> List[str]:
return [os.path.abspath(path) for path in paths]


def remove_value(lst: List[_T], value: _T) -> List[_T]:
"""
Returns new list without a given value.
"""
def omit_list_value(lst: List[_T], value: _T) -> List[_T]:
"""Produce a new list with a given value skipped."""
return [item for item in lst if item != value]


Expand Down
4 changes: 1 addition & 3 deletions piptools/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ def _format_requirement(
if ireq.comes_from:
required_by.add(_comes_from_as_string(ireq.comes_from))

if hasattr(ireq, "_required_by"):
for name in ireq._required_by:
required_by.add(name)
required_by |= set(getattr(ireq, "_required_by", set()))

if required_by:
if self.annotation_style == "split":
Expand Down

0 comments on commit ebd4a4f

Please sign in to comment.