## Arguments:
        - 'args' and 'kwargs' will be passed to 'self.save()'
769185
def show(self, temp_file_name = 'ani.mp4', **kwargs):
        
        ## [NOTE] Make this method as a method of base class.

        ## [NOTE] This should be modified to prevent erasing other existing file with the same name.
       	assert type(temp_file_name) is str
 
        self.save(temp_file_name, **kwargs)

        ## [NOTE] Consider removing the temp file.
        
        ## [NOTE] Implement automatic showing.
        return HTML("""
        <video width="%d" height="%d" controls>
          <source src="%s" type="video/mp4">
          </video>
          """ % (640, 300, temp_file_name))
548880
def argument(*args, **kwargs):
    

    def decorator(func):
        adaptor = ScriptAdaptor._get_adaptor(func)
        group = kwargs.pop('group', None)
        adaptor._add_argument(args, kwargs, group=group)
        return func
    return decorator
156919
def save(self, *args, **kwargs):
        
        self.slug = self.create_slug()
        super(Slugable, self).save(*args, **kwargs)
787096
def arg(*args, **kwargs):
    
    def _arg(f):
        if not hasattr(f, '_subcommand_args'):
            f._subcommand_args = []
        f._subcommand_args.append((args, kwargs))
        return f
    return _arg
599402
def process_kwargs(obj, kwargs):
    '''
    
    '''
    with Modules() as m:
        kwargs = m.kwargs(obj, kwargs)
    return kwargs
1109196
def _clean_arguments(kwargs):
        
        if not isinstance(kwargs, dict):
            return kwargs
        for k in list(kwargs.keys()):
            if kwargs[k] is None:
                kwargs.pop(k)
            elif kwargs[k] is False:
                kwargs[k] = 0
            elif kwargs[k] is True:
                kwargs[k] = 1
        return kwargs
200056
def put(self, *args, **kwargs):
        
        return self.session.put(*args, **self.get_kwargs(**kwargs))
882829
def save_load_result(func):
    """"""
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        """
        Default behavior is no saving and loading. Specify save_name to save
        and load.

        Parameters
        ----------
        save_name: str, optional
            File name including directory and excluding extension.
        save: bool, optional
            Whether or not to save.
        load: bool, optional
            Whether or not to load.
        overwrite existing: bool, optional
            When the save path already contains file: if True, file will be
            overwritten, if False the data will be saved with the system time
            appended to the file name.
        warn_if_error: bool, optional
            Whether or not to issue UserWarning if load=True and save_name
            is not None but there is an error loading.

        Returns
        -------
        Result
            func output.
        """
        save_name = kwargs.pop('save_name', None)
        save = kwargs.pop('save', save_name is not None)
        load = kwargs.pop('load', save_name is not None)
        overwrite_existing = kwargs.pop('overwrite_existing', True)
        warn_if_error = kwargs.pop('warn_if_error', False)
        if load:
            if save_name is None:
                warnings.warn(
                    ('{} has load=True but cannot load because '
                     'save_name=None'.format(func.__name__)),
                    UserWarning)
            else:
                try:
                    return pickle_load(save_name)
                except (OSError, IOError) as err:
                    if warn_if_error:
                        msg = ('{} had {} loading file {}.'.format(
                            func.__name__, type(err).__name__, save_name))
                        msg = ' Continuing without loading.'
                        warnings.warn(msg, UserWarning)
        result = func(*args, **kwargs)
        if save:
            if save_name is None:
                warnings.warn((func.__name__ + ' has save=True but cannot ' +
                               'save because save_name=None'), UserWarning)
            else:
                pickle_save(result, save_name,
                            overwrite_existing=overwrite_existing)
        return result
    return wrapper
260524
def get_form_kwargs(self, key):
        
        kwargs = {
            'initial': self.get_initial(key),
            'prefix': self.get_prefix(key),
        }

        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        return kwargs
141824
def _clone_args(self):
        
        keys = list(self.keys)
        kw = {}
        if self.allow_any or self.extras:
            kw['allow_extra'] = list(self.extras)
            if self.allow_any:
                kw['allow_extra'].append('*')
            kw['allow_extra_trafaret'] = self.extras_trafaret
        if self.ignore_any or self.ignore:
            kw['ignore_extra'] = list(self.ignore)
            if self.ignore_any:
                kw['ignore_any'].append('*')
        return keys, kw
1191712
def arg(*args, **kwargs):
    
    def decorate(func):
        """
        Decorate
        """
        # we'll set the command name with the passed cmd_name argument, if
        # exist, else the command name will be the function name
        func.__cmd_name__ = kwargs.pop(
            'cmd_name', getattr(func, '__cmd_name__', func.__name__))
        # retrieve the class (SillyClass)
        func.__cls__ = utils.check_class()
        if not hasattr(func, '__arguments__'):
            # if the funcion hasn't the __arguments__ yet, we'll setup them
            # using get_functarguments.
            func.__arguments__ = utils.get_functarguments(func)
        if len(args) or len(kwargs):
            # if we have some argument or keyword argument
            # we'll try to get the destination name from the kwargs ('dest')
            # else we'll use the last arg name as destination
            arg_name = kwargs.get(
                'dest', args[-1].lstrip('-').replace('-', '_'))
            try:
                # we try to get the command index.
                idx = func.__named__.index(arg_name)
                # and delete it from the named list
                del func.__named__[idx]
                # and delete it from the arguments list
                del func.__arguments__[idx]
            except ValueError:
                pass
            # append the args and kwargs to the function arguments list
            func.__arguments__.append((args, kwargs,))
        if func.__cls__ is None and isinstance(func, types.FunctionType):
            # if the function don't have a class and is a FunctionType
            # we'll add it directly to he commands list.
            ap_ = ArgParseInator(skip_init=True)
            if func.__cmd_name__ not in ap_.commands:
                # we'll add it if not exists
                ap_.commands[func.__cmd_name__] = func
        return func
    return decorate
574555
def save(self, *args, **kwargs):
        
        slug = "{}:{}".format(self.level.uid, self.code)
        if self.parent:
            self.uid = "{}_{}".format(self.parent.uid, slug)
        else:
            self.uid = slug
        self.slug = uuslug(
            self.name, instance=self, max_length=100, separator="-", start_no=2
        )
        super(Division, self).save(*args, **kwargs)
393338
def get_post_form_kwargs(self):
        
        kwargs = {
            'user': self.request.user,
            'forum': self.get_forum(),
            'topic': self.get_topic(),
        }

        post = self.get_post()
        if post:
            kwargs.update({'instance': post})

        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        return kwargs
866253
def with_args(self, *args, **kwargs):
        

        self.args = args
        self.kwargs = kwargs
        self.verify_arguments()
        return self
136906
def prepare_args(self, args, kwargs):
        
        args, kwargs = super().prepare_args(args, kwargs)
        form_kwargs = self.get_form_kwargs()
        self.form = self.Form(**form_kwargs)
        return args, kwargs
570562
def _clean_kwargs(self, kwargs, fn):
        '''
        
        '''
        # Do not do the cleaning if server config
        # doesnt ask to ignore
        if not self.server.IGNORE_UNEXPECTED_KWARGS:
            return kwargs

        expected_kwargs = set(inspect.getargspec(fn).args)
        got_kwargs = set(kwargs.keys())
        unexpected_kwargs = got_kwargs - expected_kwargs
        for k in unexpected_kwargs:
            del kwargs[k]

        return kwargs
688872
def save(self, *args, **kwargs):
        
        writer = None
        if 'writer' in kwargs.keys():
            writer = kwargs.pop('writer')
        else: writer = default_writer
        super().save(*args, **kwargs, writer=writer)