tehmaze/xmodem — pull request #5 by jquast (2014-11-30 06:56:10+00:00)
Title: Make logger bound to class instance, fix getc(1)

(note: pull the first PR to reduce this one)

- attach logging instance to object so it is late-binded
this is to prevent it from being bound on import
- all around, more logging on success and fail.
- a few pep8 (78-char limit, deleting trailing whitespace)
- a few spellfixes, 'w,t,f' in main() => read_ready, _, _ etc.
- assert status/sent bytes in main()
- use log.level(fmt, val, ...) instead of fmt % val, when the
logger is not enabled for that log level, the fmt and val
are not evaluated, reducing processing time, but when
fmt % val is used, it is always evaluated, this is mostly
only important for the "CRC val <> val" statement of each
block.
- remove a few unused imports in main()
- in send(), there are two calls to getc(1) that are expected
to get receive an ord()inal value, but this is not always the
case, the callback might return None on timeout, so allowance
is made for that.