def add_string_as_file(self, content, filename, pred=None):
        """Add a string to the archive as a file named `filename`"""

        # Generate summary string for logging
        summary = content.splitlines()[0] if content else ''
        if not isinstance(summary, six.string_types):
            summary = content.decode('utf8', 'ignore')

        if not self.test_predicate(cmd=False, pred=pred):
            self._log_info("skipped string ...'%s' due to predicate (%s)" %
                           (summary, self.get_predicate(pred=pred)))
            return

        self.copy_strings.append((content, filename))
        self._log_debug("added string ...'%s' as '%s'" % (summary, filename))
def add_string_as_file ( self , content , filename , pred = None ) : summary = content . splitlines ( ) [ 0 ] if content else '' if not isinstance ( summary , six . string_types ) : summary = content . decode ( 'utf8' , 'ignore' ) if not self . test_predicate ( cmd = False , pred = pred ) : self . _log_info ( "skipped string ...'%s' due to predicate (%s)" % ( summary , self . get_predicate ( pred = pred ) ) ) return self . copy_strings . append ( ( content , filename ) ) self . _log_debug ( "added string ...'%s' as '%s'" % ( summary , filename ) )
Add a string to the archive as a file named `filename`