Collection¶
- is_blank(data: Optional[Union[str, List[str]]]) bool ¶
Line is blank if it is either length 0 or contains only spaces.
- class Collection(title: str = '', author: str = '', created_at: str = '', updated_at: str = '', notes: str = '')¶
Collection of one or more game puzzles.
- dump(dst: Union[str, Path, BufferedWriter, TextIOWrapper, FileIO, StringIO, BytesIO])¶
Saves collection to
dst
in SokobanYASC .sok format.Note
Doesn’t care about file extension if
dst
is path to file.- Parameters
dst – Path to destination file or destination stream object.
- load(src: Union[str, Path, BufferedReader, TextIOWrapper, FileIO, StringIO, BytesIO], tessellation_hint: Tessellation = Tessellation.SOKOBAN)¶
Loads collection from
src
.Loader supports SokobanYASC .sok format, but will happily try to load older, similar textual sokoban files (usually with extensions
.txt
,.tsb
or.hsb
).- Parameters
src – source file path or input stream object
tessellation_hint – If puzzles in file don’t specify their game tessellation assume this value.
- loads(data: Union[str, bytes], tessellation_hint: Tessellation = Tessellation.SOKOBAN)¶
Loads collections from
data
.- Parameters
data – raw collection data
tessellation_hint – If puzzles in file don’t specify their game tessellation assume this value.