def backup(self,<EOL>dst=None,<EOL>ignore=None,<EOL>ignore_ext=None,<EOL>ignore_pattern=None,<EOL>ignore_size_smaller_than=None,<EOL>ignore_size_larger_than=None,<EOL>case_sensitive=False):  
def preprocess_arg(arg):  <EOL><INDENT>if arg is None:<EOL><INDENT>return []<EOL><DEDENT>if isinstance(arg, (tuple, list)):<EOL><INDENT>return list(arg)<EOL><DEDENT>else:<EOL><INDENT>return [arg, ]<EOL><DEDENT><DEDENT>self.assert_is_dir_and_exists()<EOL>ignore = preprocess_arg(ignore)<EOL>for i in ignore:<EOL><INDENT>if i.startswith("<STR_LIT:/>") or i.startswith("<STR_LIT:\\>"):<EOL><INDENT>raise ValueError<EOL><DEDENT><DEDENT>ignore_ext = preprocess_arg(ignore_ext)<EOL>for ext in ignore_ext:<EOL><INDENT>if not ext.startswith("<STR_LIT:.>"):<EOL><INDENT>raise ValueError<EOL><DEDENT><DEDENT>ignore_pattern = preprocess_arg(ignore_pattern)<EOL>if case_sensitive:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>ignore = [i.lower() for i in ignore]<EOL>ignore_ext = [i.lower() for i in ignore_ext]<EOL>ignore_pattern = [i.lower() for i in ignore_pattern]<EOL><DEDENT>def filters(p):<EOL><INDENT>relpath = p.relative_to(self).abspath<EOL>if not case_sensitive:<EOL><INDENT>relpath = relpath.lower()<EOL><DEDENT>for i in ignore:<EOL><INDENT>if relpath.startswith(i):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if case_sensitive:<EOL><INDENT>ext = p.ext<EOL><DEDENT>else:<EOL><INDENT>ext = p.ext.lower()<EOL><DEDENT>if ext in ignore_ext:<EOL><INDENT>return False<EOL><DEDENT>for pattern in ignore_pattern:<EOL><INDENT>if pattern in relpath:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if ignore_size_smaller_than:<EOL><INDENT>if p.size < ignore_size_smaller_than:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if ignore_size_larger_than:<EOL><INDENT>if p.size > ignore_size_larger_than:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>self.make_zip_archive(<EOL>dst=dst, filters=filters, compress=True, overwrite=False, verbose=True,<EOL>)<EOL>
Create a compressed zip archive backup for a directory.

:param dst: the output file path.
:param ignore: file or directory defined in this list will be ignored.
:param ignore_ext: file with extensions defined in this list will be ignored.
:param ignore_pattern: any file or directory that contains this pattern
    will be ignored.
:param ignore_size_smaller_than: any file size smaller than this
    will be ignored.
:param ignore_size_larger_than: any file size larger than this
    will be ignored.

**中文文档**

为一个目录创建一个备份压缩包。可以通过过滤器选择你要备份的文件。