-
-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Labels
bugSomething isn't workingSomething isn't workingroadmapRoadmap features we are/wanna workin' onRoadmap features we are/wanna workin' on
Milestone
Description
Describe the bug
This is a bug that needs to be addressed after PR #303 is merged and before PR #301 is merged into master (or vice versa). Since PR #301 introduces a new parameter, use_largeimage to Slide, this parameter needs to also be passed along to Slide. To avoid conflicts, this should be done between the time one of these two PRs is merged into master.
Expected behavior
SlideSetshould take an extra parameter,slide_kwargswhich is a dict, which gets expanded and passed along as-is to eachSlidewhen it is called by the iterator.- While we're at it,
SlideSetshould disallow positional arguments beyond the the obligatory ones.
Solution would be something like this:
class SlideSet:
"""Slideset object. It is considered a collection of Slides."""
def __init__(
self,
slides_path: str,
processed_path: str,
valid_extensions: List[str],
*,
keep_slides: List[str] = None,
slide_kwargs: dict = None,
) -> None:
self._slides_path = slides_path
self._processed_path = processed_path
self._valid_extensions = valid_extensions
self._keep_slides = keep_slides
self._slide_kwargs = slide_kwargs
def __iter__(self) -> Iterator[Slide]:
"""Slides of the slideset
Returns
-------
generator of `Slide` objects.
"""
slide_names = [
name
for name in os.listdir(self._slides_path)
if (os.path.splitext(name)[1] in self._valid_extensions)
]
if self._keep_slides is not None:
slide_names = [name for name in slide_names if name in self._keep_slides]
return iter(
[
Slide(
os.path.join(self._slides_path, name),
self._processed_path,
**self._slide_kwargs
)
for name in slide_names
]
)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingroadmapRoadmap features we are/wanna workin' onRoadmap features we are/wanna workin' on