Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add function to get unnamed arguments from input output files #2509

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions snakemake/io.py
Expand Up @@ -1517,6 +1517,21 @@ def _insert_items(self, index, items):
elif i == index:
self._set_name(name, i, end=i + len(items))

def _get_unnamed_arguments(self):
SilasK marked this conversation as resolved.
Show resolved Hide resolved
"""
Get unnamed arguments and return them as a list.
"""

keys_with_positions = self._names
if len(keys_with_positions) == 0:
# all arguments are unnamed
return list(self)

first_key = next(iter(keys_with_positions.items()))
n_unnamed_arguments = first_key[1][0]

return [self[i] for i in range(n_unnamed_arguments)]

def keys(self):
return self._names.keys()

Expand Down