DelfiniItemWriterText

class pydelfini.item_io.DelfiniItemWriterText(collection_id, version_id, item_id, client)[source]

Bases: DelfiniItemWriterCore, TextIO

File-like interface for writing text data to items.

It is important to either use this in a context manager or else call the close() method when writing is complete, otherwise the full contents of the file may not be written.

Suggested usage:

with item.open('w') as fp:
    fp.write('my item content, as much as I have\n')

Attributes

buffer

closed

encoding

errors

line_buffering

mode

name

newlines

Parameters:
close()

Close and flush the stream, completing the file write.

Return type:

None

fileno()

N/A - not a real file

Raises:

OSError – always

Return type:

int

isatty()

Always False

Return type:

bool

read(n=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

n (int)

Return type:

str

readable()

Always False

Return type:

bool

readline(limit=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

limit (int)

Return type:

str

readlines(hint=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

hint (int)

Return type:

list[str]

seek(offset, whence=0)

N/A - not a real file

Raises:

OSError – always

Parameters:
Return type:

int

seekable()

Always False

Return type:

bool

truncate(size=None)

N/A - not a real file

Raises:

OSError – always

Parameters:

size (int | None)

Return type:

int

writable()

Always True

Return type:

bool

write(s)[source]

Write to the stream.

Parameters:

s (str) – content to write

Returns:

number of characters written

Return type:

int

writelines(lines)[source]

Write lines to the stream.

Parameters:

lines (Iterable[str]) – iterable of lines (str) to write

Return type:

None