create an export for a volume
350125
def create(self, volume_id, ip=None):
        
        if ip:
            return self.http_put('/volumes/%s/export?ip=%s' % (volume_id, ip))
        return self.http_put('/volumes/%s/export' % volume_id)
6366
def export(self, node):
        """"""
        dictexporter = self.dictexporter or DictExporter()
        data = dictexporter.export(node)
        return json.dumps(data, **self.kwargs)
147382
def write_volume(self):
        """"""
        # Update the volume
        data = datatools.get_data()
        data["discord"]["servers"][self.server_id][_data.modulename]["volume"] = self.volume
        datatools.write_data(data)
243802
function localExport(opt) {
    var ind = _.reGet(/\d/)(opt.chart.renderTo);
    _.assign(opt, {
      'exporting': {
        'buttons': {
          'contextButton': {
            'y': -10,
            'menuItems': [{
              'text': 'Save as PNG',
              onclick: function() {
                this.createCanvas(opt.title, 'png', ind);
              },
              'separator': false
            }, {
              'text': 'Save as JPEG',
              onclick: function() {
                this.createCanvas(opt.title, 'jpeg', ind);
              },
              'separator': false
            }]
          }
        }
      }
    })
    return opt;
  }
466796
def export_envar(self, key, val):
        """"""
        line = "export " + key + "=" + str(val)
        self._add(line)
94146
def export(self, storage_client, overwrite=True):
        
        '''
            
        '''
        
        title = '%s.export' % self.__class__.__name__
        
    # validate storage client
        method_list = [ 'save', 'load', 'list', 'export', 'delete', 'remove', '_import', 'collection_name' ]
        for method in method_list:
            if not getattr(storage_client, method, None):
                from labpack.parsing.grammar import join_words
                raise ValueError('%s(storage_client=...) must be a client object with %s methods.' % (title, join_words(method_list)))
            
    # walk collection folder to find files
        import os
        root_segments = self.collection_folder.split(os.sep)
        count = 0
        skipped = 0
        for file_path in self.localhost.walk(self.collection_folder):
            path_segments = file_path.split(os.sep)
            for i in range(len(root_segments)):
                del path_segments[0]
            record_key = os.path.join(*path_segments)
            record_key = record_key.replace('\\','/')
            
    # read and save files
            record_data = open(file_path, 'rb').read()
            last_modified = os.path.getmtime(file_path)
            outcome = storage_client._import(record_key, record_data, overwrite=overwrite, last_modified=last_modified)
            if outcome:
                count += 1
            else:
                skipped += 1
            
    # report outcome
        plural = ''
        skip_insert = ''
        new_folder = storage_client.collection_name
        if count != 1:
            plural = 's'
        if skipped > 0:
            skip_plural = ''
            if skipped > 1:
                skip_plural = 's'
            skip_insert = ' %s record%s skipped to avoid overwrite.' % (str(skipped), skip_plural)
        exit_msg = '%s record%s exported to %s.%s' % (str(count), plural, new_folder, skip_insert)
        return exit_msg
1068125
def volume_create_attach(name, call=None, **kwargs):
    '''
    
    '''
    if call == 'function':
        raise SaltCloudSystemExit(
            'The create_attach_volumes action must be called with '
            '-a or --action.'
        )

    if type(kwargs['volumes']) is str:
        volumes = salt.utils.yaml.safe_load(kwargs['volumes'])
    else:
        volumes = kwargs['volumes']

    ret = []
    for volume in volumes:
        created = False

        volume_dict = {
            'name': volume['name'],
        }
        if 'volume_id' in volume:
            volume_dict['volume_id'] = volume['volume_id']
        elif 'snapshot' in volume:
            volume_dict['snapshot'] = volume['snapshot']
        else:
            volume_dict['size'] = volume['size']

            if 'type' in volume:
                volume_dict['type'] = volume['type']
            if 'iops' in volume:
                volume_dict['iops'] = volume['iops']

        if 'id' not in volume_dict:
            created_volume = create_volume(**volume_dict)
            created = True
            volume_dict.update(created_volume)

        attach = attach_volume(
            name=volume['name'],
            server_name=name,
            device=volume.get('device', None),
            call='action'
        )

        if attach:
            msg = (
                '{0} attached to {1} (aka {2})'.format(
                    volume_dict['id'],
                    name,
                    volume_dict['name'],
                )
            )
            log.info(msg)
            ret.append(msg)
    return ret
1285532
def attach(self, volume_id, instance_id, device_path):
        """"""
        return self.call("AttachVolume",
                         VolumeId=volume_id, InstanceId=instance_id,
                         Device=device_path)
1099801
def export(outfile, pk):
    """"""
    load_dbenv_if_not_loaded(
    )  # Important to load the dbenv in the last moment

    from aiida.orm import load_node
    node = load_node(pk)
    string = str(node)

    if outfile:
        with open(outfile, 'w') as f:
            f.write(string)
    else:
        click.echo(string)
1156845
function exports(_selection) {
            _selection.each(function (_data) {
                data = cleanData(_data);

                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;

                buildScales();
                buildSVG(this);
                drawDayLabels();
                drawHourLabels();
                drawBoxes();
            });
        }
124424
def create_from_tuple(cls, volume):
        
        if isinstance(volume, six.string_types):
            return Volume(target=volume)
        elif len(volume) == 2:
            return Volume(source=volume[0],
                          target=volume[1])
        elif len(volume) == 3:
            return Volume(source=volume[0],
                          target=volume[1],
                          mode=volume[2])
        else:
            logger.debug("Cannot create volume instance from {}."
                         "It has to be tuple of form target x source,target x source,target,mode.".format(volume))
            raise ConuException("Cannot create volume instance.")
1281453
def exporter(directory, method, datasets):
    """"""
    if method.lower() == 'json':
        # Convert json_dict to a JSON styled string
        json_string = json.dumps(datasets, indent=4)
        savefile = open('{}/exported.json'.format(directory), 'w+')
        savefile.write(json_string)
        savefile.close()

    if method.lower() == 'csv':
        with open('{}/exported.csv'.format(directory), 'w+') as csvfile:
            csv_writer = csv.writer(
                csvfile, delimiter=',', quoting=csv.QUOTE_MINIMAL)
            for key, values in datasets.items():
                if values is None:
                    csv_writer.writerow([key])
                else:
                    csv_writer.writerow([key] + values)
        csvfile.close()
345483
def append_volume(runtime, source, target, writable=False):
        # type: (List[Text], Text, Text, bool) -> None
        """"""
        runtime.append(u"--volume={}:{}:{}".format(
            docker_windows_path_adjust(source), target,
            "rw" if writable else "ro"))
1292052
def make_vol_opt(hostdir, contdir, options=None):
    ''''''
    vol = '--volume={}:{}'.format(hostdir, contdir)
    if options != None:
        if isinstance(options, str):
            options = (options,)
        vol += ':' + ','.join(options)
    return vol
1116518
def export(self, out_filename):
        
        with zipfile.ZipFile(out_filename, 'w', zipfile.ZIP_DEFLATED) as arc:
            id_list = list(self.get_thread_info())
            for num, my_info in enumerate(id_list):
                logging.info('Working on item %i : %s', num, my_info['number'])
                my_thread = GitHubCommentThread(
                    self.gh_info.owner, self.gh_info.realm, my_info['title'],
                    self.gh_info.user, self.gh_info.token,
                    thread_id=my_info['number'])
                csec = my_thread.get_comment_section()
                cdict = [item.to_dict() for item in csec.comments]
                my_json = json.dumps(cdict)
                arc.writestr('%i__%s' % (my_info['number'], my_info['title']),
                             my_json)
264385
def export(self, fn:PathOrStr, **kwargs):
        ""
        pickle.dump(self.get_state(**kwargs), open(fn, 'wb'))
474494
def add_export(exports='/etc/exports', path=None, hosts=None, options=None):
    '''
    
    '''
    if options is None:
        options = []
    if not isinstance(hosts, six.string_types):
        # Lists, etc would silently mangle /etc/exports
        raise TypeError('hosts argument must be a string')
    edict = list_exports(exports)
    if path not in edict:
        edict[path] = []
    new = {'hosts': hosts, 'options': options}
    edict[path].append(new)
    _write_exports(exports, edict)

    return new