summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <[email protected]>2022-02-02 12:13:27 -0800
committerScott <[email protected]>2022-02-02 12:13:27 -0800
commit31c81f6539969a5eba864d3305f9fb7bf716a367 (patch)
tree497c8911d370002ac195d31d196ba5bcd6da6db8
parent5317c50ce7a96a37acfab3800c0935580766dbbf (diff)
Used isort to sort imports. Also added to the git pre-commit hook.
-rw-r--r--acl.py4
-rwxr-xr-xansi.py2
-rw-r--r--argparse_utils.py1
-rw-r--r--arper.py6
-rwxr-xr-xbase_presence.py7
-rw-r--r--bootstrap.py11
-rw-r--r--camera_utils.py2
-rw-r--r--decorator_utils.py3
-rw-r--r--exec_utils.py1
-rw-r--r--executors.py17
-rw-r--r--file_utils.py10
-rw-r--r--function_utils.py1
-rw-r--r--google_assistant.py2
-rw-r--r--input_utils.py5
-rw-r--r--lockfile.py5
-rw-r--r--logging_utils.py6
-rw-r--r--logical_search.py14
-rw-r--r--math_utils.py2
-rw-r--r--orb_utils.py1
-rw-r--r--parallelize.py2
-rw-r--r--persistent.py2
-rwxr-xr-xprofanity_filter.py1
-rwxr-xr-xremote_worker.py3
-rw-r--r--requirements.txt3
-rw-r--r--site_config.py2
-rw-r--r--smart_future.py4
-rw-r--r--state_tracker.py4
-rw-r--r--string_utils.py15
-rw-r--r--text_utils.py3
-rw-r--r--unittest_utils.py11
-rw-r--r--waitable_presence.py2
31 files changed, 62 insertions, 90 deletions
diff --git a/acl.py b/acl.py
index 0692a04..a936339 100644
--- a/acl.py
+++ b/acl.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-from abc import ABC, abstractmethod
import enum
import fnmatch
import logging
import re
-from typing import Any, Callable, List, Optional, Set, Sequence
+from abc import ABC, abstractmethod
+from typing import Any, Callable, List, Optional, Sequence, Set
from overrides import overrides
diff --git a/ansi.py b/ansi.py
index 6897291..c13e352 100755
--- a/ansi.py
+++ b/ansi.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-from abc import abstractmethod
import difflib
import io
import logging
import re
import sys
+from abc import abstractmethod
from typing import Any, Callable, Dict, Iterable, Optional, Tuple
from overrides import overrides
diff --git a/argparse_utils.py b/argparse_utils.py
index 43536e4..5a270f6 100644
--- a/argparse_utils.py
+++ b/argparse_utils.py
@@ -8,7 +8,6 @@ from typing import Any
from overrides import overrides
-
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
diff --git a/arper.py b/arper.py
index ca5d1d5..ff1168e 100644
--- a/arper.py
+++ b/arper.py
@@ -6,19 +6,19 @@
import datetime
import logging
import os
-from typing import Any, Optional
import warnings
+from typing import Any, Optional
from overrides import overrides
import argparse_utils
-from collect.bidict import BiDict
import config
import exec_utils
import file_utils
import persistent
-import string_utils
import site_config
+import string_utils
+from collect.bidict import BiDict
logger = logging.getLogger(__name__)
diff --git a/base_presence.py b/base_presence.py
index 3ceddb3..ad852f9 100755
--- a/base_presence.py
+++ b/base_presence.py
@@ -1,20 +1,19 @@
#!/usr/bin/env python3
import datetime
-from collections import defaultdict
import logging
import re
-from typing import Dict, List, Optional, Set
import warnings
+from collections import defaultdict
+from typing import Dict, List, Optional, Set
# Note: this module is fairly early loaded. Be aware of dependencies.
import argparse_utils
import bootstrap
import config
+import site_config
from type.locations import Location
from type.people import Person
-import site_config
-
logger = logging.getLogger(__name__)
diff --git a/bootstrap.py b/bootstrap.py
index 98da78c..035a38e 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,19 +1,20 @@
#!/usr/bin/env python3
import functools
+import importlib
import logging
import os
-import importlib
+import sys
from inspect import stack
from typing import List
-import sys
+
+import config
+import logging_utils
+from argparse_utils import ActionNoYes
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
-from argparse_utils import ActionNoYes
-import config
-import logging_utils
logger = logging.getLogger(__name__)
diff --git a/camera_utils.py b/camera_utils.py
index d2c50dd..9e7efd6 100644
--- a/camera_utils.py
+++ b/camera_utils.py
@@ -5,8 +5,8 @@
import logging
import platform
import subprocess
-from typing import NamedTuple, Optional
import warnings
+from typing import NamedTuple, Optional
import cv2 # type: ignore
import numpy as np
diff --git a/decorator_utils.py b/decorator_utils.py
index cd69639..a5c5afe 100644
--- a/decorator_utils.py
+++ b/decorator_utils.py
@@ -14,14 +14,13 @@ import sys
import threading
import time
import traceback
-from typing import Any, Callable, Optional
import warnings
+from typing import Any, Callable, Optional
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
import exceptions
-
logger = logging.getLogger(__name__)
diff --git a/exec_utils.py b/exec_utils.py
index 061370f..df27335 100644
--- a/exec_utils.py
+++ b/exec_utils.py
@@ -9,7 +9,6 @@ import subprocess
import sys
from typing import List, Optional
-
logger = logging.getLogger(__file__)
diff --git a/executors.py b/executors.py
index 990df03..34528a3 100644
--- a/executors.py
+++ b/executors.py
@@ -2,33 +2,32 @@
from __future__ import annotations
-from abc import ABC, abstractmethod
import concurrent.futures as fut
-from collections import defaultdict
-from dataclasses import dataclass
import logging
-import numpy
import os
import platform
import random
import subprocess
import threading
import time
-from typing import Any, Callable, Dict, List, Optional, Set
import warnings
+from abc import ABC, abstractmethod
+from collections import defaultdict
+from dataclasses import dataclass
+from typing import Any, Callable, Dict, List, Optional, Set
import cloudpickle # type: ignore
+import numpy
from overrides import overrides
-from ansi import bg, fg, underline, reset
import argparse_utils
import config
-from decorator_utils import singleton
-from exec_utils import run_silently, cmd_in_background, cmd_with_timeout
import histogram as hist
+from ansi import bg, fg, reset, underline
+from decorator_utils import singleton
+from exec_utils import cmd_in_background, cmd_with_timeout, run_silently
from thread_utils import background_thread
-
logger = logging.getLogger(__name__)
parser = config.add_commandline_args(
diff --git a/file_utils.py b/file_utils.py
index f273ea4..905e23b 100644
--- a/file_utils.py
+++ b/file_utils.py
@@ -4,20 +4,18 @@
import datetime
import errno
+import glob
import hashlib
+import io
import logging
import os
-import io
import pathlib
import re
import time
-from typing import Optional
-import glob
-from os.path import isfile, join, exists
-from typing import List, TextIO
+from os.path import exists, isfile, join
+from typing import List, Optional, TextIO
from uuid import uuid4
-
logger = logging.getLogger(__name__)
diff --git a/function_utils.py b/function_utils.py
index f027f8c..3c8e4ae 100644
--- a/function_utils.py
+++ b/function_utils.py
@@ -18,6 +18,7 @@ def function_identifier(f: Callable) -> str:
"""
if f.__module__ == '__main__':
from pathlib import Path
+
import __main__
module = __main__.__file__
diff --git a/google_assistant.py b/google_assistant.py
index 0af4fa9..ec5f6a4 100644
--- a/google_assistant.py
+++ b/google_assistant.py
@@ -2,8 +2,8 @@
import logging
import sys
-from typing import NamedTuple, Optional
import warnings
+from typing import NamedTuple, Optional
import requests
import speech_recognition as sr # type: ignore
diff --git a/input_utils.py b/input_utils.py
index e0b457d..a166d7a 100644
--- a/input_utils.py
+++ b/input_utils.py
@@ -11,7 +11,6 @@ import readchar # type: ignore
import exceptions
-
logger = logging.getLogger(__file__)
@@ -52,9 +51,7 @@ def single_keystroke_response(
print(prompt, end="")
sys.stdout.flush()
try:
- response = _single_keystroke_response_internal(
- valid_responses, timeout_seconds
- )
+ response = _single_keystroke_response_internal(valid_responses, timeout_seconds)
if ord(response) == 3:
raise KeyboardInterrupt('User pressed ^C in input_utils.')
diff --git a/lockfile.py b/lockfile.py
index 03fbb9e..38134b2 100644
--- a/lockfile.py
+++ b/lockfile.py
@@ -1,20 +1,19 @@
#!/usr/bin/env python3
-from dataclasses import dataclass
import datetime
import json
import logging
import os
import signal
import sys
-from typing import Optional
import warnings
+from dataclasses import dataclass
+from typing import Optional
import config
import datetime_utils
import decorator_utils
-
cfg = config.add_commandline_args(f'Lockfile ({__file__})', 'Args related to lockfiles')
cfg.add_argument(
'--lockfile_held_duration_warning_threshold_sec',
diff --git a/logging_utils.py b/logging_utils.py
index a16a31b..fdbb7a3 100644
--- a/logging_utils.py
+++ b/logging_utils.py
@@ -8,15 +8,15 @@ import datetime
import enum
import io
import logging
-from logging.config import fileConfig
-from logging.handlers import RotatingFileHandler, SysLogHandler
import os
import random
import sys
+from logging.config import fileConfig
+from logging.handlers import RotatingFileHandler, SysLogHandler
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional
-from overrides import overrides
import pytz
+from overrides import overrides
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
diff --git a/logical_search.py b/logical_search.py
index c324ff8..4295aa0 100644
--- a/logical_search.py
+++ b/logical_search.py
@@ -2,20 +2,10 @@
from __future__ import annotations
-from collections import defaultdict
import enum
import sys
-from typing import (
- Any,
- Dict,
- List,
- NamedTuple,
- Optional,
- Set,
- Sequence,
- Tuple,
- Union,
-)
+from collections import defaultdict
+from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Union
class ParseError(Exception):
diff --git a/math_utils.py b/math_utils.py
index 3216d4a..3953ae5 100644
--- a/math_utils.py
+++ b/math_utils.py
@@ -2,8 +2,8 @@
import functools
import math
+from heapq import heappop, heappush
from typing import List
-from heapq import heappush, heappop
class RunningMedian(object):
diff --git a/orb_utils.py b/orb_utils.py
index fe82e2e..6a12b6f 100644
--- a/orb_utils.py
+++ b/orb_utils.py
@@ -6,7 +6,6 @@ import os
import config
-
parser = config.add_commandline_args(
f"Orb Utils ({__file__})",
"Args having to do with controlling Scott's Orb.",
diff --git a/parallelize.py b/parallelize.py
index cd3eff4..f2cfcbb 100644
--- a/parallelize.py
+++ b/parallelize.py
@@ -4,9 +4,9 @@
import atexit
-from enum import Enum
import functools
import typing
+from enum import Enum
class Method(Enum):
diff --git a/persistent.py b/persistent.py
index 1e520be..8832572 100644
--- a/persistent.py
+++ b/persistent.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
-from abc import ABC, abstractmethod
import atexit
import datetime
import enum
import functools
import logging
+from abc import ABC, abstractmethod
from typing import Any
import file_utils
diff --git a/profanity_filter.py b/profanity_filter.py
index 22de263..e227165 100755
--- a/profanity_filter.py
+++ b/profanity_filter.py
@@ -12,7 +12,6 @@ from nltk.stem import PorterStemmer
import decorator_utils
import string_utils
-
logger = logging.getLogger(__name__)
diff --git a/remote_worker.py b/remote_worker.py
index 12a5028..82b80ea 100755
--- a/remote_worker.py
+++ b/remote_worker.py
@@ -7,8 +7,8 @@ results.
import logging
import os
import signal
-import threading
import sys
+import threading
import time
from typing import Optional
@@ -21,7 +21,6 @@ import config
from stopwatch import Timer
from thread_utils import background_thread
-
logger = logging.getLogger(__file__)
cfg = config.add_commandline_args(
diff --git a/requirements.txt b/requirements.txt
index 04d3ee7..2302354 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,12 @@
aiohttp
antlr4 - python3 - runtime
bitstring
+black
cloudpickle
coverage
+flake8
holidays
+mypy
nltk
numpy
opencv - python
diff --git a/site_config.py b/site_config.py
index b09e735..2335899 100644
--- a/site_config.py
+++ b/site_config.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
-from dataclasses import dataclass
import logging
import platform
+from dataclasses import dataclass
from typing import Callable
# Note: this module is fairly early loaded. Be aware of dependencies.
diff --git a/smart_future.py b/smart_future.py
index 1f6e6f0..460dcb9 100644
--- a/smart_future.py
+++ b/smart_future.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from __future__ import annotations
+
import concurrent
import concurrent.futures as fut
import logging
@@ -9,10 +10,11 @@ from typing import Callable, List, Set, TypeVar
from overrides import overrides
+import id_generator
+
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
from deferred_operand import DeferredOperand
-import id_generator
logger = logging.getLogger(__name__)
diff --git a/state_tracker.py b/state_tracker.py
index 453faf7..12b94ae 100644
--- a/state_tracker.py
+++ b/state_tracker.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
-from abc import ABC, abstractmethod
import datetime
import logging
-import time
import threading
+import time
+from abc import ABC, abstractmethod
from typing import Dict, Optional
import pytz
diff --git a/string_utils.py b/string_utils.py
index 9a20466..55e6731 100644
--- a/string_utils.py
+++ b/string_utils.py
@@ -30,26 +30,17 @@ import base64
import contextlib # type: ignore
import datetime
import io
-from itertools import zip_longest
import json
import logging
import numbers
import random
import re
import string
-from typing import (
- Any,
- Callable,
- Dict,
- Iterable,
- List,
- Optional,
- Sequence,
- Tuple,
-)
import unicodedata
-from uuid import uuid4
import warnings
+from itertools import zip_longest
+from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple
+from uuid import uuid4
import list_utils
diff --git a/text_utils.py b/text_utils.py
index 0d07905..534813c 100644
--- a/text_utils.py
+++ b/text_utils.py
@@ -2,15 +2,14 @@
"""Utilities for dealing with "text"."""
-from collections import defaultdict
import logging
import math
import sys
+from collections import defaultdict
from typing import Dict, Generator, List, NamedTuple, Optional
from ansi import fg, reset
-
logger = logging.getLogger(__file__)
diff --git a/unittest_utils.py b/unittest_utils.py
index 81b339a..ba9ca28 100644
--- a/unittest_utils.py
+++ b/unittest_utils.py
@@ -7,7 +7,6 @@
caveat emptor.
"""
-from abc import ABC, abstractmethod
import contextlib
import functools
import inspect
@@ -16,20 +15,20 @@ import os
import pickle
import random
import statistics
-import time
import tempfile
-from typing import Any, Callable, Dict, List, Optional
+import time
import unittest
import warnings
+from abc import ABC, abstractmethod
+from typing import Any, Callable, Dict, List, Optional
+
+import sqlalchemy as sa
import bootstrap
import config
import function_utils
import scott_secrets
-import sqlalchemy as sa
-
-
logger = logging.getLogger(__name__)
cfg = config.add_commandline_args(
f'Logging ({__file__})', 'Args related to function decorators'
diff --git a/waitable_presence.py b/waitable_presence.py
index 77b6e81..8046bdc 100644
--- a/waitable_presence.py
+++ b/waitable_presence.py
@@ -13,9 +13,9 @@ from typing import Optional, Tuple
from overrides import overrides
import base_presence
-from type.locations import Location
import site_config
import state_tracker
+from type.locations import Location
logger = logging.getLogger(__name__)