Skip to content

Commit

Permalink
Add a filtering function (untested) (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Mar 21, 2020
1 parent b685b5b commit 627343b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pip_review/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,25 @@ def parse_args():
return parser.parse_known_args()


def filter_forwards(args, exclude):
""" Return only the parts of `args` that do not appear in `exclude`. """
result = []
# Start with false, because an unknown argument not starting with a dash
# probably would just trip pip.
admitted = False
for arg in args:
if not arg.startswith('-'):
# assume this belongs with the previous argument.
if admitted:
result.append(arg)
elif arg.lstrip('-') in exclude:
admitted = False
else:
result.append(arg)
admitted = True
return result


def pip_cmd():
return [sys.executable, '-m', 'pip']

Expand Down

0 comments on commit 627343b

Please sign in to comment.