def upload_file(_file, directory):
    f = None
    filename = None
    try:
        if not os.path.exists(directory):
            logging.debug('Creating session storage ..')
            os.makedirs(directory)

        if not os.path.exists(directory):
            logging.error('Failed to create session storage ..')
            return None

        logging.debug('Copying file content ..')
        f = tempfile.NamedTemporaryFile('w+', suffix='.py', dir=directory, delete=False)
        fname = f.name
        for chunk in _file.chunks():
            f.write(chunk)
        f.close()

        parser = Parser(fname)
        target_file = os.path.join(directory, parser.get_filename())
        os.rename(fname, target_file)
        filename = parser.get_filename()
    except:
        logging.exception('Failed to upload file: ')
    finally:
        logging.debug('Cleaning up ..')
        if f is not None and os.path.exists(f.name):
            logging.debug('Deleting ' + f.name)
            os.remove(f.name)

    return filename
Delete a member configuration on the NVE interface.
dataset/ETHPy150Open CiscoDevNet/yang-explorer/server/explorer/utils/uploader.py/upload_file--crossover with--dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py/CiscoNexusDriver.delete_nve_member