Put the object/collection into a file URL.
328791
def write(url, content, **args):
    """"""
    with HTTPSResource(url, **args) as resource:
        resource.write(content)
619481
def to_url(self):
        """"""
        base_url = urlparse(self.url)

        query = parse_qs(base_url.query)
        for k, v in self.items():
            query.setdefault(k, []).append(to_utf8_optional_iterator(v))
        scheme = base_url.scheme
        netloc = base_url.netloc
        path = base_url.path
        params = base_url.params
        fragment = base_url.fragment

        url = (scheme, netloc, path, params, urlencode(query, True), fragment)
        return urlunparse(url)
950524
def add_file(self, path):
        """"""
        libdoc = LibraryDocumentation(path)
        if len(libdoc.keywords) > 0:
            if libdoc.doc.startswith("Documentation for resource file"):
                # bah! The file doesn't have an file-level documentation
                # and libdoc substitutes some placeholder text.
                libdoc.doc = ""

            collection_id = self.add_collection(path, libdoc.name, libdoc.type,
                                                libdoc.doc, libdoc.version,
                                                libdoc.scope, libdoc.named_args,
                                                libdoc.doc_format)
            self._load_keywords(collection_id, libdoc=libdoc)
124368
function(url, options, fn){
        var r = request.post(url, fn);
        var form = r.form();
        form.append('field', options.field);
        form.append('files', fs.createReadStream(options.filepath));
        return form;
    }
1026808
def to_files(self, resource, directory):
        
        collections = self.__collect(resource)
        for (mb_cls, coll) in iteritems_(collections):
            fn = get_write_collection_path(mb_cls,
                                           self.__content_type,
                                           directory=directory)
            with open_text(os.path.join(directory, fn)) as strm:
                dump_resource(coll, strm, content_type=self.__content_type)
1361069
function() {
          return through.obj(function(file, encode, done){
            addBefore(file.path);
            this.push(file);
            done();
          });
        }
147220
def move_to_collection(self, request, *args, **kwargs):
        """"""
        ids = self.get_ids(request.data)
        src_collection_id = self.get_id(request.data, 'source_collection')
        dst_collection_id = self.get_id(request.data, 'destination_collection')

        src_collection = self._get_collection_for_user(src_collection_id, request.user)
        dst_collection = self._get_collection_for_user(dst_collection_id, request.user)

        entity_qs = self._get_entities(request.user, ids)
        entity_qs.move_to_collection(src_collection, dst_collection)

        return Response()
382919
function fileToObject(file) {
  return {
    lastModified: file.lastModified,
    lastModifiedDate: file.lastModifiedDate,
    name: file.filename || file.name,
    size: file.size,
    type: file.type,
    uid: file.uid,
    response: file.response,
    error: file.error,
    percent: 0,
    originFileObj: file
  };
}
830798
def build_url(self):
        """"""

        if not self.api_filters:
            return self.url

        # Reduce complex objects to simpler strings
        for k, v in self.api_filters.items():
            if isinstance(v, datetime):  # datetime > UNIX timestamp
                self.api_filters[k] = int(calendar.timegm(v.timetuple()))
            if isinstance(v, (tuple, list)):  # tuples & lists > x,y,z
                self.api_filters[k] = ",".join([str(_) for _ in v])

        if (
            self.id_filter in self.api_filters and
            len(str(self.api_filters[self.id_filter])) > self.URL_LENGTH_LIMIT
        ):
            self.build_url_chunks()
            return self.split_urls.pop(0)

        filters = '&'.join("%s=%s" % (k, v) for (k, v) in self.api_filters.items())

        return "%s?%s" % (self.url, filters)
516097
function createRef(file){

		// Create a new fileRef
		var pointer = new fileRef({
			name : file.name,
			type : file.type,
			file : file
		}, current_network, current_bucket, true);

		ref.push( pointer );

		if(current_folder==="local"){
			readFile(file, function(dataURL){

				// Update list
				pointer.update({
					thumbnail : dataURL,
					picture : dataURL
				});
			});
		}
		else{
			// Upload the files to the current directory
			hello.api(current_folder, "post", {file: file}, function(r){
				// Once the files have been successfully upload lets update the pointer
				pointer.update({
					id : r.id,
					thumbnail : r.source,
					picture : r.source
				});
			});
		}
	}
772764
def _put_obj(irods_path, obj):
    """"""
    text = json.dumps(obj, indent=2)
    _put_text(irods_path, text)
776942
def putURL(self, url, headers, body=None):
        
        return self._load_resource("PUT", url, headers, body)
977196
def write(url, object_, **args):
    """"""
    default_content_type = ('text/plain', {'charset': 'US-ASCII'})
    content_encoding = args.get('content_encoding', 'base64')
    content_type, params = args.get('content_type', default_content_type)
    data = content_types.get(content_type).format(object_, **params)
    args['data'].write('data:{}'.format(content_type))
    for param, value in params.items():
        args['data'].write(';{}={}'.format(param, value))
    if content_encoding == 'base64':
        args['data'].write(';base64,{}'.format(base64.b64decode(data)))
    else:
        args['data'].write(',{}', urllib.quote(data))
    args['data'].seek(0)
938336
def download_object(self, obj_name, directory, structure=True):
        
        return self.download(obj=obj_name, directory=directory,
                structure=structure)
660314
private <T> T postFileForObject(String url, File file, Class<T> objectClass, String... params) {
        logger.debug("PostFileForObject request on Trello API at url {} for class {} with params {}", url,
                objectClass.getCanonicalName(), params);

        return httpClient.postFileForObject(url, file, objectClass, enrichParams(params));
    }
130887
def serialize(obj, **options):
    '''
    
    '''

    try:
        if 'file_out' in options:
            return toml.dump(obj, options['file_out'], **options)
        else:
            return toml.dumps(obj, **options)
    except Exception as error:
        raise SerializationError(error)
425168
def format(collection, **params):
    """"""
    binary = io.BytesIO()
    with zipfile.ZipFile(binary, 'w') as zip_:
        now = datetime.datetime.utcnow().timetuple()
        for filename, content in collection:
            content_type, encoding = mimetypes.guess_type(filename)
            content = content_types.get(content_type).parse(content, **params)
            content = content_encodings.get(encoding).decode(content)
            zip_info = zipfile.ZipInfo(filename, now)
            zip_info.file_size = len(content)
            zip_.writestr(zip_info, content)
    binary.seek(0)
    return binary.read()