(self, fileobject, skip_unknown=False)
Write the PKG-INFO format data to a file object.
Write the PKG-INFO format data to a file object.
Write the PKG - INFO format data to a file object .
def write_file(self, fileobject, skip_unknown=False):
        """Write the PKG-INFO format data to a file object."""
        self.set_metadata_version()

        for field in _version2fieldlist(self['Metadata-Version']):
            values = self.get(field)
            if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']):
                continue
            if field in _ELEMENTSFIELD:
                self._write_field(fileobject, field, ','.join(values))
                continue
            if field not in _LISTFIELDS:
                if field == 'Description':
                    if self.metadata_version in ('1.0', '1.1'):
                        values = values.replace('\n', '\n        ')
                    else:
                        values = values.replace('\n', '\n       |')
                values = [values]

            if field in _LISTTUPLEFIELDS:
                values = [','.join(value) for value in values]

            for value in values:
                self._write_field(fileobject, field, value)
def write_file ( self , fileobject , skip_unknown = False ) : self . set_metadata_version ( ) for field in _version2fieldlist ( self [ 'Metadata-Version' ] ) : values = self . get ( field ) if skip_unknown and values in ( 'UNKNOWN' , [ ] , [ 'UNKNOWN' ] ) : continue if field in _ELEMENTSFIELD : self . _write_field ( fileobject , field , ',' . join ( values ) ) continue if field not in _LISTFIELDS : if field == 'Description' : if self . metadata_version in ( '1.0' , '1.1' ) : values = values . replace ( '\n' , '\n        ' ) else : values = values . replace ( '\n' , '\n       |' ) values = [ values ] if field in _LISTTUPLEFIELDS : values = [ ',' . join ( value ) for value in values ] for value in values : self . _write_field ( fileobject , field , value )