{"action":"closed","issue":{"url":"https://api.github.com/repos/SkyTruth/gpsdio/issues/106","labels_url":"https://api.github.com/repos/SkyTruth/gpsdio/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/SkyTruth/gpsdio/issues/106/comments","events_url":"https://api.github.com/repos/SkyTruth/gpsdio/issues/106/events","html_url":"https://github.com/SkyTruth/gpsdio/issues/106","id":95883445,"number":106,"title":"Driver model should be more \"subclassy\"","user":{"login":"geowurster","id":2676083,"avatar_url":"https://avatars.githubusercontent.com/u/2676083?v=3","gravatar_id":"","url":"https://api.github.com/users/geowurster","html_url":"https://github.com/geowurster","followers_url":"https://api.github.com/users/geowurster/followers","following_url":"https://api.github.com/users/geowurster/following{/other_user}","gists_url":"https://api.github.com/users/geowurster/gists{/gist_id}","starred_url":"https://api.github.com/users/geowurster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geowurster/subscriptions","organizations_url":"https://api.github.com/users/geowurster/orgs","repos_url":"https://api.github.com/users/geowurster/repos","events_url":"https://api.github.com/users/geowurster/events{/privacy}","received_events_url":"https://api.github.com/users/geowurster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/SkyTruth/gpsdio/milestones/1","html_url":"https://github.com/SkyTruth/gpsdio/milestones/v0.1","labels_url":"https://api.github.com/repos/SkyTruth/gpsdio/milestones/1/labels","id":1112603,"number":1,"title":"v0.1","description":"","creator":{"login":"geowurster","id":2676083,"avatar_url":"https://avatars.githubusercontent.com/u/2676083?v=3","gravatar_id":"","url":"https://api.github.com/users/geowurster","html_url":"https://github.com/geowurster","followers_url":"https://api.github.com/users/geowurster/followers","following_url":"https://api.github.com/users/geowurster/following{/other_user}","gists_url":"https://api.github.com/users/geowurster/gists{/gist_id}","starred_url":"https://api.github.com/users/geowurster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geowurster/subscriptions","organizations_url":"https://api.github.com/users/geowurster/orgs","repos_url":"https://api.github.com/users/geowurster/repos","events_url":"https://api.github.com/users/geowurster/events{/privacy}","received_events_url":"https://api.github.com/users/geowurster/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":11,"state":"open","created_at":"2015-05-15T19:05:08Z","updated_at":"2015-08-11T21:06:51Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-07-19T04:10:42Z","updated_at":"2015-08-11T21:06:51Z","closed_at":"2015-08-11T21:06:51Z","body":"Current model basically just asks the developer to hack together a file-like object and pass it directly to `gpsdio.base.BaseDriver()` or `gpsdio.base.BaseCompressionDriver()` but its not very Pythonic.  Consider adding a `BaseDriver.open()` that should be overwritten when necessary:\r\n\r\n```python\r\nimport codecs.open as open\r\n\r\n\r\nclass BaseDriver(object):\r\n\r\n    io_modes = ('r', 'w', 'a')\r\n\r\n    def __init__(self, path, mode, **open_args):\r\n        if mode not in self.io_modes:\r\n            raise ValueError(\"Unsupported IO mode {}\".format(mode))\r\n        self._f = self.open(path, mode, **open_args)\r\n\r\n    def __repr__(self):\r\n        return \"Some usefule representation\"\r\n\r\n    def __enter__(self):\r\n        return self\r\n\r\n    def __exit__(self, exc_type, exc_val, exc_tb):\r\n        self.close()\r\n\r\n    def __iter__(self):\r\n        return self\r\n\r\n    def __getattr__(self, item):\r\n        return getattr(self._f, item)\r\n\r\n    @property\r\n    def f(self):\r\n        return self._f\r\n\r\n    def open(self, path, mode, **open_args):\r\n        open_args['encoding'] = open_args.pop('encoding', 'utf-8')\r\n        if isinstance(path, str):\r\n            return open(path, mode, **open_args)\r\n        else:\r\n            return path\r\n\r\n    def __next__(self):\r\n        return next(self.f)\r\n\r\n    next = __next__\r\n\r\n    def write(self, msg, **write_args):\r\n        self.f.write(msg)\r\n```"}}