proio¶
-
class
proio.
Event
(proto_obj=None)[source]¶ Class representing a single event
-
add_entries
(tag, *entries)[source]¶ is like
add_entry()
, except that it takes any number of entries, and returns a list of corresponding IDs.- Parameters
tag (string) – tag
*entries (Message) – entries
- Returns
identifiers for entry
- Return type
int list
-
add_entry
(tag, entry)[source]¶ takes a tag and protobuf message entry and adds it to the Event. The return value is an integer ID number used to reference the added entry.
- Parameters
tag (string) – tag
entry (Message) – entry
- Returns
identifier for entry
- Return type
int
-
all_entries
()[source]¶ returns a list of entry IDs for the event.
- Returns
identifiers for entries
- Return type
int list
-
delete_tag
(tag)[source]¶ removes the tag that matches the given tag string from the event.
- Parameters
tag (string) – tag
returns a list of tags that point to a given entry ID.
- Parameters
ID (int) – identifier for entry
- Returns
list of strings
-
get_entry
(ID)[source]¶ takes an entry ID and returns the corresponding entry. Returns None if the entry does not exist.
- Parameters
ID (int) – identifier for entry
- Returns
entry message object
- Return type
google.protobuf.message.Message
-
remove_entry
(ID)[source]¶ removes an entry from the event by its entry ID.
- Parameters
ID (int) – identifier for entry
-
tag_entry
(ID, *tags)[source]¶ adds tags to an entry identified by ID.
- Parameters
ID (int) – identifier for entry
*tags (string) – tags
-
tagged_entries
(tag)[source]¶ takes a tag string and returns a list of entry IDs that the tag references.
- Parameters
tag (string) – tag
- Returns
identifiers for entries
- Return type
int list
returns a list of tags that exist in the event.
- Returns
list of strings
-
-
class
proio.
Reader
(filename=None, fileobj=None)[source]¶ Reader for proio files
This class can be used with the with statement, and it also may be used as an iterator that sequentially iterates all events. A filename may be omitted in favor of specifying fileobj.
- Parameters
filename (string) – name of input file to read
fileobj – file object to read from
- Example
with proio.Reader('input.proio') as reader: for event in reader: ...
-
class
proio.
Writer
(filename=None, fileobj=None)[source]¶ Writer for proio files
This class can be used with the with statement. A filename may be omitted in favor of specifying fileobj.
- Parameters
filename (string) – name of output file to create or overwrite
fileobj – file object to write to
- Example
with proio.Writer('output.proio') as writer: ...
-
close
()[source]¶ closes the file object assigned to the Writer. This is automatically called at the end of a with statement.
-
flush
()[source]¶ flushes all buffered data to the output file object. This is automatically called at the end of a with statement.
-
push
(event)[source]¶ takes an event and serializes it into the output bucket.
- Parameters
event (Event) – event to serialize to output