Skip to content

Commit

Permalink
pylint engines\utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cockroacher committed Apr 7, 2024
1 parent ff0406e commit 3a1320f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions engines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@


def use_item(current_index, skip, take):
"""
Determines whether an item at a given index should be used based on the skip and
take parameters.
Parameters:
current_index (int): The index of the current item.
skip (int): The number of items to skip.
take (int): The number of items to take after skipping. If -1, takes all items.
Returns:
bool: True if the item should be used, False otherwise.
The function returns False if the current index is less than the number of items to skip or
if the current index is greater than or
equal to the sum of the skip and take parameters (unless take is -1).
Otherwise, it returns True.
"""
if skip > 0 and current_index < skip:
return False

Expand Down

0 comments on commit 3a1320f

Please sign in to comment.