swiftly.filelikeiter

Wraps an iterable to behave as a file-like object.

Copyright (c) 2010-2012 OpenStack Foundation

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class swiftly.filelikeiter.FileLikeIter(iterable)[source]

Bases: object

Wraps an iterable to behave as a file-like object.

Taken from work I did for OpenStack Swift swift.common.utils.FileLikeIter, Copyright (c) 2010-2012 OpenStack Foundation.

close() → None or (perhaps) an integer. Close the file.[source]

Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status upon closing.

next() → the next value, or raise StopIteration[source]
read([size]) → read at most size bytes, returned as a string.[source]

If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.

readline([size]) → next line from the file, as a string.[source]

Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.

readlines([size]) → list of strings, each a line from the file.[source]

Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.

Previous topic

swiftly.dencrypt

This Page