The biggest change here is the implementation of an open() method for each driver, which the BaseDriver() calls on instantiation. This prevents the user from having to manage their own __init__ and is more pythonic. BaseDriver() can now also verify that the I/O mode is valid, although it may crash before it reaches the BaseDriver(). For example, this will raise an exception in the NewlineJSON library rather than in BaseDriver(). We could probably just rely on the underlying opening/closing for handling I/O mode validation but lets keep it to a simple r | w | a for now.
with gpsdio.open('something.json', 'bad-mode') as dst:
pass
Closes #99 and partially addresses #106.
The biggest change here is the implementation of an
open()
method for each driver, which theBaseDriver()
calls on instantiation. This prevents the user from having to manage their own__init__
and is more pythonic.BaseDriver()
can now also verify that the I/O mode is valid, although it may crash before it reaches theBaseDriver()
. For example, this will raise an exception in the NewlineJSON library rather than inBaseDriver()
. We could probably just rely on the underlying opening/closing for handling I/O mode validation but lets keep it to a simpler | w | a
for now.