From f7127346488714570bc35bee266f47bad3438d20 Mon Sep 17 00:00:00 2001
From: Reid 'arrdem' McKenzie <me@arrdem.com>
Date: Sun, 29 Aug 2021 22:35:10 -0600
Subject: [PATCH] Fmt.

---
 .../src/python/anosql_migrations.py           |   1 -
 projects/calf/src/python/calf/lexer.py        |   1 -
 projects/calf/src/python/calf/parser.py       |   5 +-
 projects/calf/tests/python/test_lexer.py      |   1 -
 projects/damm/setup.py                        |   2 +-
 .../src/python/datalog/shell/__main__.py      |   3 +-
 projects/datalog/src/python/datalog/debris.py |   4 +
 .../datalog/src/python/datalog/evaluator.py   |   5 +-
 projects/datalog/src/python/datalog/reader.py |   1 -
 .../test/python/test_datalog_evaluator.py     |   2 -
 projects/flowmetal/scratch/astdump.py         | 116 +++++++++---------
 projects/kook/src/kook/client.py              |   1 -
 projects/lilith/src/python/lilith/__main__.py |   6 +-
 projects/lilith/src/python/lilith/reader.py   |   2 +-
 projects/lilith/test/python/conftest.py       |   2 +-
 projects/lilith/test/python/test_parser.py    |   2 +-
 projects/overwatch/bin/overwatchd             |  11 +-
 projects/proquint/setup.py                    |   2 +-
 .../proquint/test/python/test_hypothesis.py   |   1 -
 .../src/python/arrdem/updater/__main__.py     |   1 -
 .../src/python/ratchet/backend/sqlite.py      |   2 -
 21 files changed, 74 insertions(+), 97 deletions(-)

diff --git a/projects/anosql-migrations/src/python/anosql_migrations.py b/projects/anosql-migrations/src/python/anosql_migrations.py
index b7828e5..1cc581b 100644
--- a/projects/anosql-migrations/src/python/anosql_migrations.py
+++ b/projects/anosql-migrations/src/python/anosql_migrations.py
@@ -6,7 +6,6 @@ import logging
 import re
 import typing as t
 
-import anosql
 from anosql.core import from_str, Queries
 
 
diff --git a/projects/calf/src/python/calf/lexer.py b/projects/calf/src/python/calf/lexer.py
index 483c776..b831c04 100644
--- a/projects/calf/src/python/calf/lexer.py
+++ b/projects/calf/src/python/calf/lexer.py
@@ -12,7 +12,6 @@ import re
 from calf.grammar import TOKENS
 from calf.io.reader import PeekPosReader
 from calf.token import CalfToken
-from calf.util import *
 
 
 class CalfLexer:
diff --git a/projects/calf/src/python/calf/parser.py b/projects/calf/src/python/calf/parser.py
index 6589eb2..8d9d469 100644
--- a/projects/calf/src/python/calf/parser.py
+++ b/projects/calf/src/python/calf/parser.py
@@ -2,11 +2,10 @@
 The Calf parser.
 """
 
-from itertools import tee
 import logging
 
-from calf.grammar import MATCHING, WHITESPACE_TYPES
-from calf.lexer import CalfLexer, lex_buffer, lex_file
+from calf.grammar import MATCHING
+from calf.lexer import lex_buffer, lex_file
 from calf.token import *
 
 
diff --git a/projects/calf/tests/python/test_lexer.py b/projects/calf/tests/python/test_lexer.py
index dc51e90..88484fb 100644
--- a/projects/calf/tests/python/test_lexer.py
+++ b/projects/calf/tests/python/test_lexer.py
@@ -7,7 +7,6 @@ trip through the lexer.
 
 import calf.lexer as cl
 from conftest import parametrize
-import pytest
 
 
 def lex_single_token(buffer):
diff --git a/projects/damm/setup.py b/projects/damm/setup.py
index 2e0dd69..6c3c3f5 100644
--- a/projects/damm/setup.py
+++ b/projects/damm/setup.py
@@ -1,4 +1,4 @@
-from setuptools import find_packages, setup
+from setuptools import setup
 
 
 here = path.abspath(path.dirname(__file__))
diff --git a/projects/datalog-shell/src/python/datalog/shell/__main__.py b/projects/datalog-shell/src/python/datalog/shell/__main__.py
index abd8679..49cce32 100755
--- a/projects/datalog-shell/src/python/datalog/shell/__main__.py
+++ b/projects/datalog-shell/src/python/datalog/shell/__main__.py
@@ -59,7 +59,6 @@ from datalog.evaluator import select
 from datalog.reader import pr_str, read_command, read_dataset
 from datalog.types import (
   CachedDataset,
-  Constant,
   Dataset,
   LVar,
   PartlyIndexedDataset,
@@ -67,7 +66,7 @@ from datalog.types import (
   TableIndexedDataset
 )
 
-from prompt_toolkit import print_formatted_text, prompt, PromptSession
+from prompt_toolkit import print_formatted_text, PromptSession
 from prompt_toolkit.formatted_text import FormattedText
 from prompt_toolkit.history import FileHistory
 from prompt_toolkit.styles import Style
diff --git a/projects/datalog/src/python/datalog/debris.py b/projects/datalog/src/python/datalog/debris.py
index 7cdf126..a78516f 100644
--- a/projects/datalog/src/python/datalog/debris.py
+++ b/projects/datalog/src/python/datalog/debris.py
@@ -1,5 +1,9 @@
 """Debris."""
 
+from random import shuffle
+
+from datalog.types import LVar
+
 
 def shuffled(seq):
     """Because random.shuffle() is in-place >.>"""
diff --git a/projects/datalog/src/python/datalog/evaluator.py b/projects/datalog/src/python/datalog/evaluator.py
index f78e7ab..1f2de1c 100644
--- a/projects/datalog/src/python/datalog/evaluator.py
+++ b/projects/datalog/src/python/datalog/evaluator.py
@@ -3,11 +3,8 @@ A datalog engine.
 """
 
 from functools import reduce
-from itertools import chain
 
-from datalog.parser import parse
-from datalog.reader import pr_str, read
-from datalog.types import CachedDataset, Constant, Dataset, LVar, Rule, TableIndexedDataset
+from datalog.types import CachedDataset, Constant, Dataset, LVar, TableIndexedDataset
 
 
 def match(tuple, expr, bindings=None):
diff --git a/projects/datalog/src/python/datalog/reader.py b/projects/datalog/src/python/datalog/reader.py
index ceb1afb..2096823 100644
--- a/projects/datalog/src/python/datalog/reader.py
+++ b/projects/datalog/src/python/datalog/reader.py
@@ -3,7 +3,6 @@ A datalog reader.
 """
 
 from collections import defaultdict
-from itertools import chain
 
 from datalog.parser import FAILURE, Grammar
 from datalog.types import Constant, Dataset, LVar, Rule
diff --git a/projects/datalog/test/python/test_datalog_evaluator.py b/projects/datalog/test/python/test_datalog_evaluator.py
index 30fec5e..3fa9850 100644
--- a/projects/datalog/test/python/test_datalog_evaluator.py
+++ b/projects/datalog/test/python/test_datalog_evaluator.py
@@ -5,9 +5,7 @@ from datalog.types import (
   CachedDataset,
   Constant,
   Dataset,
-  LVar,
   PartlyIndexedDataset,
-  Rule,
   TableIndexedDataset
 )
 
diff --git a/projects/flowmetal/scratch/astdump.py b/projects/flowmetal/scratch/astdump.py
index 3e57df3..28c3e7d 100644
--- a/projects/flowmetal/scratch/astdump.py
+++ b/projects/flowmetal/scratch/astdump.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python3
-
 """
 A (toy) tool for emitting Python ASTs as YAML formatted data.
 """
@@ -12,85 +10,85 @@ import yaml
 
 
 def propnames(node):
-  """return names of attributes specific for the current node"""
+    """return names of attributes specific for the current node"""
 
-  props = {x for x in dir(node) if not x.startswith("_")}
+    props = {x for x in dir(node) if not x.startswith("_")}
 
-  if isinstance(node, ast.Module):
-    props -= {"body"}
+    if isinstance(node, ast.Module):
+        props -= {"body"}
 
-  if isinstance(node, (ast.Expr, ast.Attribute)):
-    props -= {"value"}
+    if isinstance(node, (ast.Expr, ast.Attribute)):
+        props -= {"value"}
 
-  if isinstance(node, ast.Constant):
-    props -= {"n", "s"}
+    if isinstance(node, ast.Constant):
+        props -= {"n", "s"}
 
-  if isinstance(node, ast.ClassDef):
-    props -= {"body"}
+    if isinstance(node, ast.ClassDef):
+        props -= {"body"}
 
-  return props
+    return props
 
 
 # Note that ast.NodeTransformer exists for mutations.
 # This is just for reads.
 class TreeDumper(ast.NodeVisitor):
-  def __init__(self):
-    super().__init__()
-    self._stack = []
+    def __init__(self):
+        super().__init__()
+        self._stack = []
 
-  def dump(self, node):
-    self.visit(node)
+    def dump(self, node):
+        self.visit(node)
 
-  def visit(self, node):
-    nodetype = type(node)
-    nodename = node.__class__.__name__
-    indent = " " * len(self._stack) * 2
-    print(indent + nodename)
-    for n in propnames(node):
-      print(indent + "%s: %s" % (n, node.__dict__[n]))
+    def visit(self, node):
+        nodetype = type(node)
+        nodename = node.__class__.__name__
+        indent = " " * len(self._stack) * 2
+        print(indent + nodename)
+        for n in propnames(node):
+            print(indent + "%s: %s" % (n, node.__dict__[n]))
 
-    self._stack.append(node)
-    self.generic_visit(node)
-    self._stack.pop()
+        self._stack.append(node)
+        self.generic_visit(node)
+        self._stack.pop()
 
 
 class YAMLTreeDumper(ast.NodeVisitor):
-  def __init__(self):
-    super().__init__()
-    self._stack = []
+    def __init__(self):
+        super().__init__()
+        self._stack = []
 
-  def node2yml(self, node):
-    try:
-      nodetype = type(node)
-      nodename = node.__class__.__name__
-      return {
-        "op": nodename,
-        "props": {n: node.__dict__[n] for n in propnames(node)},
-        "children": [],
-      }
-    except:
-      print(repr(node), propnames(node), dir(node))
+    def node2yml(self, node):
+        try:
+            nodetype = type(node)
+            nodename = node.__class__.__name__
+            return {
+                "op": nodename,
+                "props": {n: node.__dict__[n] for n in propnames(node)},
+                "children": [],
+            }
+        except:
+            print(repr(node), propnames(node), dir(node))
 
-  def visit(self, node):
-    yml_node = self.node2yml(node)
-    self._stack.append(yml_node)
-    old_stack = self._stack
-    self._stack = yml_node["children"]
-    self.generic_visit(node)
-    self._stack = old_stack
-    return yml_node
+    def visit(self, node):
+        yml_node = self.node2yml(node)
+        self._stack.append(yml_node)
+        old_stack = self._stack
+        self._stack = yml_node["children"]
+        self.generic_visit(node)
+        self._stack = old_stack
+        return yml_node
 
 
 if __name__ == "__main__":
-  parser = optparse.OptionParser(usage="%prog [options] <filename.py>")
-  opts, args = parser.parse_args()
+    parser = optparse.OptionParser(usage="%prog [options] <filename.py>")
+    opts, args = parser.parse_args()
 
-  if len(args) == 0:
-    parser.print_help()
-    sys.exit(-1)
-  filename = args[0]
+    if len(args) == 0:
+        parser.print_help()
+        sys.exit(-1)
+    filename = args[0]
 
-  with open(filename) as f:
-    root = ast.parse(f.read(), filename)
+    with open(filename) as f:
+        root = ast.parse(f.read(), filename)
 
-  print(yaml.dump(YAMLTreeDumper().visit(root), default_flow_style=False, sort_keys=False))
+    print(yaml.dump(YAMLTreeDumper().visit(root), default_flow_style=False, sort_keys=False))
diff --git a/projects/kook/src/kook/client.py b/projects/kook/src/kook/client.py
index 83a76f3..4194cf1 100644
--- a/projects/kook/src/kook/client.py
+++ b/projects/kook/src/kook/client.py
@@ -11,7 +11,6 @@ from kazoo.client import KazooClient
 from kazoo.exceptions import NodeExistsError
 from kazoo.protocol.states import ZnodeStat
 from kazoo.recipe.lock import Lock, ReadLock, WriteLock
-from kazoo.recipe.watchers import ChildrenWatch, DataWatch
 from kook.config import current_config, KookConfig
 from toolz.dicttoolz import assoc as _assoc, dissoc as _dissoc, merge as _merge, update_in
 
diff --git a/projects/lilith/src/python/lilith/__main__.py b/projects/lilith/src/python/lilith/__main__.py
index cca9ade..5439d34 100644
--- a/projects/lilith/src/python/lilith/__main__.py
+++ b/projects/lilith/src/python/lilith/__main__.py
@@ -7,9 +7,9 @@ import sys
 import traceback
 
 from lilith.interpreter import Bindings, eval as lil_eval, Runtime
-from lilith.parser import Apply, Args, parse_expr, Symbol
-from lilith.reader import Def, Import, Module, read_buffer, read_file
-from prompt_toolkit import print_formatted_text, prompt, PromptSession
+from lilith.parser import parse_expr, Symbol
+from lilith.reader import Def, Module, read_buffer, read_file
+from prompt_toolkit import print_formatted_text, PromptSession
 from prompt_toolkit.formatted_text import FormattedText
 from prompt_toolkit.history import FileHistory
 from prompt_toolkit.styles import Style
diff --git a/projects/lilith/src/python/lilith/reader.py b/projects/lilith/src/python/lilith/reader.py
index ce447eb..69ee591 100644
--- a/projects/lilith/src/python/lilith/reader.py
+++ b/projects/lilith/src/python/lilith/reader.py
@@ -6,7 +6,7 @@ import logging
 import typing as t
 from warnings import warn
 
-from lilith.parser import Args, Block, parse_buffer, Symbol
+from lilith.parser import Block, parse_buffer, Symbol
 
 
 log = logging.getLogger(__name__)
diff --git a/projects/lilith/test/python/conftest.py b/projects/lilith/test/python/conftest.py
index 25609e7..9f27b7d 100644
--- a/projects/lilith/test/python/conftest.py
+++ b/projects/lilith/test/python/conftest.py
@@ -2,7 +2,7 @@
 Pytest fixtures.
 """
 
-from lilith.parser import Block, GRAMMAR, parser_with_transformer
+from lilith.parser import GRAMMAR, parser_with_transformer
 import pytest
 
 
diff --git a/projects/lilith/test/python/test_parser.py b/projects/lilith/test/python/test_parser.py
index 6bea1cc..84c2568 100644
--- a/projects/lilith/test/python/test_parser.py
+++ b/projects/lilith/test/python/test_parser.py
@@ -1,6 +1,6 @@
 """tests covering the Lilith parser."""
 
-from lilith.parser import Apply, Args, Block, GRAMMAR, parse_buffer, parser_with_transformer, Symbol
+from lilith.parser import Apply, Args, Block, parse_buffer, Symbol
 import pytest
 
 
diff --git a/projects/overwatch/bin/overwatchd b/projects/overwatch/bin/overwatchd
index 8b3c53d..34556cb 100755
--- a/projects/overwatch/bin/overwatchd
+++ b/projects/overwatch/bin/overwatchd
@@ -21,23 +21,14 @@ import socket
 import subprocess
 import sys
 from sys import exit
-import syslog
 from telnetlib import Telnet
 from threading import Event, Lock, Thread
 from time import sleep
 
-from kazoo.client import KazooClient
-from kazoo.exceptions import (
-  ConnectionLoss,
-  LockTimeout,
-  NodeExistsError,
-  NoNodeError,
-  SessionExpiredError
-)
+from kazoo.exceptions import ConnectionLoss, LockTimeout, SessionExpiredError
 from kazoo.handlers.threading import KazooTimeoutError
 from kazoo.recipe.lock import Lock as KazooLock
 from kook.client import KookClient, lock
-import yaml
 
 
 log = logging.getLogger("arrdem.overwatchd")
diff --git a/projects/proquint/setup.py b/projects/proquint/setup.py
index db64e0a..ed777cd 100644
--- a/projects/proquint/setup.py
+++ b/projects/proquint/setup.py
@@ -1,4 +1,4 @@
-from setuptools import find_packages, setup
+from setuptools import setup
 
 
 here = path.abspath(path.dirname(__file__))
diff --git a/projects/proquint/test/python/test_hypothesis.py b/projects/proquint/test/python/test_hypothesis.py
index 23731b4..c459e20 100644
--- a/projects/proquint/test/python/test_hypothesis.py
+++ b/projects/proquint/test/python/test_hypothesis.py
@@ -3,7 +3,6 @@
 from hypothesis import given
 from hypothesis.strategies import integers
 import proquint
-import pytest
 
 
 @given(integers(min_value=0, max_value=1<<16))
diff --git a/projects/public-dns/src/python/arrdem/updater/__main__.py b/projects/public-dns/src/python/arrdem/updater/__main__.py
index b7b90c4..aefb0f1 100644
--- a/projects/public-dns/src/python/arrdem/updater/__main__.py
+++ b/projects/public-dns/src/python/arrdem/updater/__main__.py
@@ -10,7 +10,6 @@ import re
 from gandi.client import GandiAPI
 import jinja2
 import meraki
-import pkg_resources
 import yaml
 
 
diff --git a/projects/ratchet/src/python/ratchet/backend/sqlite.py b/projects/ratchet/src/python/ratchet/backend/sqlite.py
index dd30d50..65133ed 100644
--- a/projects/ratchet/src/python/ratchet/backend/sqlite.py
+++ b/projects/ratchet/src/python/ratchet/backend/sqlite.py
@@ -7,8 +7,6 @@ import os
 import socket
 import sqlite3 as sql
 
-from ratchet import Event, Message, Request
-
 
 SCHEMA_SCRIPT = """
 PRAGMA foreign_keys = ON;