will8211 / unimatrix

Python script to simulate the display from "The Matrix" in terminal. Uses half-width katakana unicode characters by default, but can use custom character sets. Accepts keyboard controls while running. Based on CMatrix.
GNU General Public License v3.0
1.73k stars 159 forks source link

PEP8, typos. Renamed Key_handler -> KeyHandler. #18

Closed Cabalist closed 6 years ago

Cabalist commented 6 years ago

Just a collection of PEP8 and typo fixes. I renamed Key_handler -> KeyHandler for consistency and marked a couple methods as static. This is very cool and has worked on my various terminals. :)

will8211 commented 6 years ago

Thanks for PEP8-ing!

I was quite surprised to see that getch() worked without a try/except. But I looked at the docs and in fact without a key press in the buffer, it returns a curses.ERR, which is not a Python error, but an innocuous -1 value. I'll probably return on a -1 anyway, since it seems inefficient to run through all the whole function each time when there's no key press.

Also, PEP8 says, "Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have an encoding declaration," so I'll remove that.

Thanks for catching all those typos, good eye!

Cabalist commented 6 years ago

I didn't realize that no encoding declaration was needed in a sole Python3 environment. Neat!