grepedit/notifyd.py: Convert to Python 3
authorDarshaka Pathirana <dpat@syn-net.org>
Fri, 7 May 2021 15:40:57 +0000 (17:40 +0200)
committerDarshaka Pathirana <dpat@syn-net.org>
Fri, 3 Dec 2021 11:54:54 +0000 (12:54 +0100)
commita4b7aa61ed1e89cae05d079a44e520658323e927
tree8ccee2ead7f12171cdfae6cbefaf9848754c56a1
parent95f1a389296e098bfd40ad9bbf05f795de3b6440
grepedit/notifyd.py: Convert to Python 3

Run the following commands:

  % 2to3-2.7 -w usr_bin/grepedit
  % isort usr_bin/grepedit
  % black usr_bin/grepedit

In grepedit the following print statement has been split manually:

+                print(
+                    "%s:%s has changed since the grep command ran- "
+                    "not modifying this line" % key
+                )

And:

  % 2to3-2.7 -w usr_bin/notifyd.py
  % black usr_bin/notifyd.py
  % isort usr_bin/notifyd.py

In notifyd.py added some ignore statements/comments (for the examples
which were actually comments).

The following errors/warnings were fixed manually:

  ❯ flake8 --max-line-length 88 usr_bin/notifyd.py
  usr_bin/notifyd.py:201:1: E741 ambiguous variable name 'l'
  usr_bin/notifyd.py:214:5: E722 do not use bare 'except'

Variable 'l' has been renamed to 'listen' and the bare 'except' has been
changed to catch 'OSError' as described in the socket documentation:
https://docs.python.org/3/library/socket.html

grepedit + notifyd.py + osd_server.py has not been functionally tested.
Please test. (But this is not the scope of this change, as it had to be
dropped anyway as it is missing Python 3 support. If an errors occurs,
please file a bug report.)

black defaults to line length 88 and flake to 79.
Decided to go set --max-line-length 88 for flake8.

Note that osd_server.py is just a symlink to notifyd.py.
Makefile
usr_bin/grepedit
usr_bin/notifyd.py