Shared Utilities

Internal developer documentation

This document is about the internal representation of classes. It is intended for developers of RCV Formats, rather than its users.

ElectionBuddy Parser

Parser used for both schema validation and conversion

Helper class for loading Electionbuddy CSVs

class common.electionbuddyparser.ElectionBuddyData(file_obj)

Bases: object

Structure to hold the raw data read from the file. Parses the data directly into a simple format. Used for both conversion and schema validation.

peek_line()

Peeks at the next line without advancing

read_each_round()

Start iterating over the CSV for each round

read_line_as_str()

Read line, and if it’s bytes, decode to utf-8

read_round()

Reads the CSV data for the next round

Utilities

Set of common utilities

A collection of shared helper utilities

common.utils.is_file_obj(filename_or_fileobj)

Is the given argument a File-like object?

common.utils.is_filename(filename_or_fileobj)

Is the given argument a filename?