From 532df2c5b57c7517dfb3dddd8c1358fbadf8baf3 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Fri, 25 Mar 2022 09:41:31 -0700 Subject: [PATCH] Since this thing is on the innerwebs I suppose it should have a copyright... --- acl.py | 2 ++ ansi.py | 6 +++++- argparse_utils.py | 3 +++ arper.py | 2 ++ base_presence.py | 6 +++++- bootstrap.py | 6 +++++- cached/weather_data.py | 4 ++++ cached/weather_forecast.py | 4 ++++ camera_utils.py | 2 ++ collect/bidict.py | 4 ++++ collect/bst.py | 4 ++++ collect/shared_dict.py | 5 +---- collect/trie.py | 8 ++++++-- config.py | 2 ++ constants.py | 2 ++ conversion_utils.py | 2 ++ dateparse/dateparse_utils.py | 2 ++ datetime_utils.py | 2 ++ decorator_utils.py | 3 +++ deferred_operand.py | 6 +++++- dict_utils.py | 2 ++ directory_filter.py | 6 +++++- exceptions.py | 2 ++ exec_utils.py | 2 ++ executors.py | 2 ++ file_utils.py | 2 ++ function_utils.py | 2 ++ google_assistant.py | 6 +++++- histogram.py | 2 ++ id_generator.py | 6 +++++- input_utils.py | 2 ++ letter_compress.py | 2 ++ list_utils.py | 2 ++ lockfile.py | 2 ++ logging_utils.py | 2 ++ logical_search.py | 6 +++++- math_utils.py | 2 ++ misc_utils.py | 2 ++ ml/model_trainer.py | 2 ++ ml/quick_label.py | 2 ++ orb_utils.py | 2 ++ parallelize.py | 2 ++ persistent.py | 2 ++ profanity_filter.py | 2 ++ remote_worker.py | 3 +++ site_config.py | 2 ++ smart_future.py | 6 +++++- smart_home/cameras.py | 2 ++ smart_home/chromecasts.py | 2 ++ smart_home/device.py | 6 +++++- smart_home/device_utils.py | 2 ++ smart_home/lights.py | 2 ++ smart_home/outlets.py | 2 ++ smart_home/registry.py | 2 ++ smart_home/thermometers.py | 2 ++ smart_home/tplink_utils.py | 2 +- state_tracker.py | 6 +++++- stopwatch.py | 2 ++ tests/acl_test.py | 4 ++++ tests/centcount_test.py | 4 ++++ tests/dateparse_utils_test.py | 4 ++++ tests/decorator_utils_test.py | 4 ++++ tests/dict_utils_test.py | 4 ++++ tests/exec_utils_test.py | 4 ++++ tests/google_assistant_test.py | 4 ++++ tests/letter_compress_test.py | 4 ++++ tests/logging_utils_test.py | 4 ++++ tests/money_test.py | 4 ++++ tests/parallelize_itest.py | 4 ++++ tests/profanity_filter_test.py | 4 ++++ tests/rate_test.py | 4 ++++ tests/run_some_dependencies_test.py | 2 ++ tests/shared_dict_test.py | 4 ++++ tests/string_utils_test.py | 4 ++++ tests/thread_utils_test.py | 4 ++++ tests/waitable_presence_test.py | 5 ++++- text_utils.py | 2 ++ thread_utils.py | 2 ++ type/centcount.py | 2 ++ type/locations.py | 2 ++ type/money.py | 2 ++ type/people.py | 2 ++ type/rate.py | 2 ++ type_utils.py | 2 ++ unittest_utils.py | 10 ++++++---- unscrambler.py | 2 ++ waitable_presence.py | 2 ++ 87 files changed, 258 insertions(+), 23 deletions(-) diff --git a/acl.py b/acl.py index cf59d6a..de516e4 100644 --- a/acl.py +++ b/acl.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This module defines various flavors of Access Control Lists.""" import enum diff --git a/ansi.py b/ansi.py index a497600..dee5242 100755 --- a/ansi.py +++ b/ansi.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A bunch of color names mapped into RGB tuples and some methods for setting the text color, background, etc... using ANSI escape -sequences.""" +sequences. + +""" import contextlib import difflib diff --git a/argparse_utils.py b/argparse_utils.py index 045d882..83a3aa4 100644 --- a/argparse_utils.py +++ b/argparse_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +# © Copyright 2021-2022, Scott Gasch + """Helpers for commandline argument parsing.""" import argparse @@ -32,6 +34,7 @@ class ActionNoYes(argparse.Action): --no_enable_the_thing """ + def __init__(self, option_strings, dest, default=None, required=False, help=None): if default is None: msg = 'You must provide a default with Yes/No action' diff --git a/arper.py b/arper.py index 4f362f4..b4c079e 100644 --- a/arper.py +++ b/arper.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A caching layer around the kernel's network mapping between IPs and MACs""" diff --git a/base_presence.py b/base_presence.py index 8be4d93..f996d54 100755 --- a/base_presence.py +++ b/base_presence.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a module dealing with trying to guess a person's location based on the location of certain devices (e.g. phones, laptops) belonging to that person. It works with networks I run that log -device MAC addresses active.""" +device MAC addresses active. + +""" import datetime import logging diff --git a/bootstrap.py b/bootstrap.py index 52359f1..1174686 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,10 +1,14 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a module for wrapping around python programs and doing some minor setup and tear down work for them. With it, you can break into pdb on unhandled top level exceptions, profile your code by passing a commandline argument in, audit module import events, examine where -memory is being used in your program, and so on.""" +memory is being used in your program, and so on. + +""" import functools import importlib diff --git a/cached/weather_data.py b/cached/weather_data.py index 1b0bef4..29a1d54 100644 --- a/cached/weather_data.py +++ b/cached/weather_data.py @@ -1,6 +1,10 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + +"""How's the weather?""" + import datetime import json import logging diff --git a/cached/weather_forecast.py b/cached/weather_forecast.py index 807f36d..b8a20ed 100644 --- a/cached/weather_forecast.py +++ b/cached/weather_forecast.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""How's the weather going to be tomorrow?""" + import datetime import logging import os diff --git a/camera_utils.py b/camera_utils.py index 378d286..bfa23ab 100644 --- a/camera_utils.py +++ b/camera_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with webcam images.""" import logging diff --git a/collect/bidict.py b/collect/bidict.py index d288174..375721e 100644 --- a/collect/bidict.py +++ b/collect/bidict.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""Bidirectional Dictionary.""" + class BiDict(dict): def __init__(self, *args, **kwargs): diff --git a/collect/bst.py b/collect/bst.py index 712683e..d394194 100644 --- a/collect/bst.py +++ b/collect/bst.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""Binary search tree.""" + from typing import Any, Generator, List, Optional diff --git a/collect/shared_dict.py b/collect/shared_dict.py index f4ec914..3207927 100644 --- a/collect/shared_dict.py +++ b/collect/shared_dict.py @@ -4,7 +4,7 @@ The MIT License (MIT) Copyright (c) 2020 LuizaLabs -Additions Copyright (c) 2022 Scott Gasch +Additions/Modifications Copyright (c) 2022 Scott Gasch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,6 @@ This class is based on https://github.com/luizalabs/shared-memory-dict import pickle from contextlib import contextmanager -from functools import wraps from multiprocessing import RLock, shared_memory from typing import ( Any, @@ -42,8 +41,6 @@ from typing import ( ValuesView, ) -from decorator_utils import synchronized - class PickleSerializer: def dumps(self, obj: dict) -> bytes: diff --git a/collect/trie.py b/collect/trie.py index fef28cb..547d67a 100644 --- a/collect/trie.py +++ b/collect/trie.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a Trie class, see: https://en.wikipedia.org/wiki/Trie. - It attempts to follow Pythonic container patterns. See doctests - for examples.""" +It attempts to follow Pythonic container patterns. See doctests +for examples. + +""" from typing import Any, Generator, Sequence diff --git a/config.py b/config.py index 57593c3..bea7018 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Global configuration driven by commandline arguments, environment variables and saved configuration files. This works across several modules. diff --git a/constants.py b/constants.py index 934edb2..1a61581 100644 --- a/constants.py +++ b/constants.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Universal constants.""" from typing import Final diff --git a/conversion_utils.py b/conversion_utils.py index cf4fcaa..68292ca 100644 --- a/conversion_utils.py +++ b/conversion_utils.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + """Utilities involving converting between different units.""" from typing import Callable, SupportsFloat diff --git a/dateparse/dateparse_utils.py b/dateparse/dateparse_utils.py index d0d1eca..bd0d491 100755 --- a/dateparse/dateparse_utils.py +++ b/dateparse/dateparse_utils.py @@ -3,6 +3,8 @@ # pylint: disable=W0201 # pylint: disable=R0904 +# © Copyright 2021-2022, Scott Gasch + """Parse dates in a variety of formats.""" import datetime diff --git a/datetime_utils.py b/datetime_utils.py index cbebf4d..b05097a 100644 --- a/datetime_utils.py +++ b/datetime_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities related to dates and times and datetimes.""" import datetime diff --git a/decorator_utils.py b/decorator_utils.py index 5d1e779..084e260 100644 --- a/decorator_utils.py +++ b/decorator_utils.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch +# Portions (marked) below retain the original author's copyright. + """Decorators.""" import enum diff --git a/deferred_operand.py b/deferred_operand.py index 1de2bfb..df76237 100644 --- a/deferred_operand.py +++ b/deferred_operand.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a helper class that tries to define every __dunder__ method so as to defer that evaluation of an object as long as possible. It -is used by smart_future.py as a base class.""" +is used by smart_future.py as a base class. + +""" from abc import ABC, abstractmethod from typing import Any, Generic, TypeVar diff --git a/dict_utils.py b/dict_utils.py index ecd23fd..6f0f572 100644 --- a/dict_utils.py +++ b/dict_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Helper functions for dealing with dictionaries.""" from itertools import islice diff --git a/directory_filter.py b/directory_filter.py index 6985831..69e5547 100644 --- a/directory_filter.py +++ b/directory_filter.py @@ -1,10 +1,14 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Two predicates that can help avoid unnecessary disk I/O by detecting if a particular file is identical to the contents about to be written or if a particular directory already contains a file that is identical to the one to be written. See class docs below for -examples.""" +examples. + +""" import hashlib import logging diff --git a/exceptions.py b/exceptions.py index aa0aecb..bd49988 100644 --- a/exceptions.py +++ b/exceptions.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Some exceptions used elsewhere.""" # This module is commonly used by others in here and should avoid diff --git a/exec_utils.py b/exec_utils.py index a440de5..ae406ef 100644 --- a/exec_utils.py +++ b/exec_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Helper methods concerned with executing subprocesses.""" import atexit diff --git a/executors.py b/executors.py index fcdd3e7..e07933f 100644 --- a/executors.py +++ b/executors.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + """Defines three executors: a thread executor for doing work using a threadpool, a process executor for doing work in other processes on the same machine and a remote executor for farming out work to other diff --git a/file_utils.py b/file_utils.py index 98e8c26..91aeea0 100644 --- a/file_utils.py +++ b/file_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for working with files.""" import contextlib diff --git a/function_utils.py b/function_utils.py index f107762..f74a852 100644 --- a/function_utils.py +++ b/function_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Helper methods dealing with functions.""" from typing import Callable diff --git a/google_assistant.py b/google_assistant.py index adfdca4..b767df7 100644 --- a/google_assistant.py +++ b/google_assistant.py @@ -1,7 +1,11 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A module to serve as a local client library around HTTP calls to -the Google Assistant via a local gateway.""" +the Google Assistant via a local gateway. + +""" import logging import warnings diff --git a/histogram.py b/histogram.py index 3796470..52a0d1f 100644 --- a/histogram.py +++ b/histogram.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + """A text-based simple histogram helper class.""" import math diff --git a/id_generator.py b/id_generator.py index dc2ac9c..f15efa3 100644 --- a/id_generator.py +++ b/id_generator.py @@ -1,7 +1,11 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A helper class for generating thread safe monotonically increasing -id numbers.""" +id numbers. + +""" import itertools import logging diff --git a/input_utils.py b/input_utils.py index 7d5e180..77094da 100644 --- a/input_utils.py +++ b/input_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities related to user input.""" import logging diff --git a/letter_compress.py b/letter_compress.py index 42f06da..6cb6b74 100644 --- a/letter_compress.py +++ b/letter_compress.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A simple compression helper for lowercase ascii text.""" import bitstring diff --git a/list_utils.py b/list_utils.py index 7f28ade..5c70df3 100644 --- a/list_utils.py +++ b/list_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Some useful(?) utilities for dealing with Lists.""" import random diff --git a/lockfile.py b/lockfile.py index f64a2c3..ae48e57 100644 --- a/lockfile.py +++ b/lockfile.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """File-based locking helper.""" from __future__ import annotations diff --git a/logging_utils.py b/logging_utils.py index 7b70d75..6ceba65 100644 --- a/logging_utils.py +++ b/logging_utils.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + """Utilities related to logging.""" import collections diff --git a/logical_search.py b/logical_search.py index ef55a2b..b6d7479 100644 --- a/logical_search.py +++ b/logical_search.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a module concerned with the creation of and searching of a corpus of documents. The corpus is held in memory for fast -searching.""" +searching. + +""" from __future__ import annotations import enum diff --git a/math_utils.py b/math_utils.py index 49ad407..dec34f0 100644 --- a/math_utils.py +++ b/math_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Mathematical helpers.""" import collections diff --git a/misc_utils.py b/misc_utils.py index a73728a..f844f72 100644 --- a/misc_utils.py +++ b/misc_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Miscellaneous utilities.""" import os diff --git a/ml/model_trainer.py b/ml/model_trainer.py index 1509577..e3d89c2 100644 --- a/ml/model_trainer.py +++ b/ml/model_trainer.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a blueprint for training sklearn ML models.""" from __future__ import annotations diff --git a/ml/quick_label.py b/ml/quick_label.py index da9a1d2..15256a3 100644 --- a/ml/quick_label.py +++ b/ml/quick_label.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A helper to facilitate quick manual labeling of ML training data.""" import glob diff --git a/orb_utils.py b/orb_utils.py index 6a12b6f..f1d0ee0 100644 --- a/orb_utils.py +++ b/orb_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities related to changing the orb's color.""" import os diff --git a/parallelize.py b/parallelize.py index b2a1ced..77d7649 100644 --- a/parallelize.py +++ b/parallelize.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A decorator to help with dead simple parallelization.""" diff --git a/persistent.py b/persistent.py index c902313..27aa4b3 100644 --- a/persistent.py +++ b/persistent.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A Persistent is just a class with a load and save method. This module defines the Persistent base and a decorator that can be used to create a persistent singleton that autoloads and autosaves.""" diff --git a/profanity_filter.py b/profanity_filter.py index c1767bf..a1f0c0b 100755 --- a/profanity_filter.py +++ b/profanity_filter.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A helper to identify and optionally obscure some bad words.""" import logging diff --git a/remote_worker.py b/remote_worker.py index 75dfe8e..8aef1de 100755 --- a/remote_worker.py +++ b/remote_worker.py @@ -1,7 +1,10 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A simple utility to unpickle some code, run it, and pickle the results. + """ import logging diff --git a/site_config.py b/site_config.py index 5a4eeff..5604de6 100644 --- a/site_config.py +++ b/site_config.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Location/site dependent data.""" import logging diff --git a/smart_future.py b/smart_future.py index a1f6d97..7aac8eb 100644 --- a/smart_future.py +++ b/smart_future.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A future that can be treated like the result that it contains and will not block until it is used. At that point, if the underlying value is not yet available, it will block until it becomes -available.""" +available. + +""" from __future__ import annotations import concurrent diff --git a/smart_home/cameras.py b/smart_home/cameras.py index f77ddc6..e7705b2 100644 --- a/smart_home/cameras.py +++ b/smart_home/cameras.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with the webcams.""" import logging diff --git a/smart_home/chromecasts.py b/smart_home/chromecasts.py index dd6d217..408ccf0 100644 --- a/smart_home/chromecasts.py +++ b/smart_home/chromecasts.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with the webcams.""" import atexit diff --git a/smart_home/device.py b/smart_home/device.py index 82f1fa6..64302ad 100644 --- a/smart_home/device.py +++ b/smart_home/device.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Most basic definition of a smart device: it must have a name and a MAC address and may have some optional keywords. All devices have -these whether they are lights, outlets, thermostats, etc...""" +these whether they are lights, outlets, thermostats, etc... + +""" import re from typing import List, Optional diff --git a/smart_home/device_utils.py b/smart_home/device_utils.py index 40a7b70..0c0ca98 100644 --- a/smart_home/device_utils.py +++ b/smart_home/device_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """General utility functions involving smart home devices.""" import logging diff --git a/smart_home/lights.py b/smart_home/lights.py index 2a0b1cd..ee23fb0 100644 --- a/smart_home/lights.py +++ b/smart_home/lights.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with the smart lights.""" import datetime diff --git a/smart_home/outlets.py b/smart_home/outlets.py index 3765567..fcc3c4e 100644 --- a/smart_home/outlets.py +++ b/smart_home/outlets.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with the smart outlets.""" import asyncio diff --git a/smart_home/registry.py b/smart_home/registry.py index f79ae90..d63474d 100644 --- a/smart_home/registry.py +++ b/smart_home/registry.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A searchable registry of known smart home devices and a factory for constructing our wrappers around them.""" diff --git a/smart_home/thermometers.py b/smart_home/thermometers.py index 90199b9..73117bc 100644 --- a/smart_home/thermometers.py +++ b/smart_home/thermometers.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Code involving querying various smart home thermometers.""" import logging diff --git a/smart_home/tplink_utils.py b/smart_home/tplink_utils.py index 30d3bd8..abf4970 100644 --- a/smart_home/tplink_utils.py +++ b/smart_home/tplink_utils.py @@ -10,7 +10,7 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Modifications by Scott Gasch Copyright 2020-2022 also released under +Modifications by Scott Gasch Copyright © 2020-2022 also released under the Apache 2.0 license as required by the license (see above). Unless required by applicable law or agreed to in writing, software diff --git a/state_tracker.py b/state_tracker.py index 1cf62af..62eb183 100644 --- a/state_tracker.py +++ b/state_tracker.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Several helpers to keep track of internal state via periodic polling. StateTracker expects to be invoked periodically to maintain state whereas the others automatically update themselves and, -optionally, expose an event for client code to wait on state changes.""" +optionally, expose an event for client code to wait on state changes. + +""" import datetime import logging diff --git a/stopwatch.py b/stopwatch.py index ae8e01a..4e69b69 100644 --- a/stopwatch.py +++ b/stopwatch.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A simple stopwatch decorator / context for timing things.""" import contextlib diff --git a/tests/acl_test.py b/tests/acl_test.py index a1d827e..4009617 100755 --- a/tests/acl_test.py +++ b/tests/acl_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""acl unittest.""" + import re import unittest diff --git a/tests/centcount_test.py b/tests/centcount_test.py index c4b3b0c..53204c9 100755 --- a/tests/centcount_test.py +++ b/tests/centcount_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""centcount unittest.""" + import unittest import unittest_utils as uu diff --git a/tests/dateparse_utils_test.py b/tests/dateparse_utils_test.py index 42df954..6e539ff 100755 --- a/tests/dateparse_utils_test.py +++ b/tests/dateparse_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""dateparse_utils unittest.""" + import datetime import random import re diff --git a/tests/decorator_utils_test.py b/tests/decorator_utils_test.py index 2cc2b5f..68f1389 100755 --- a/tests/decorator_utils_test.py +++ b/tests/decorator_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""decorator_utils unittest such as it is.""" + import unittest import decorator_utils as du diff --git a/tests/dict_utils_test.py b/tests/dict_utils_test.py index a8f6273..8964f91 100755 --- a/tests/dict_utils_test.py +++ b/tests/dict_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""dict_utils unittest.""" + import unittest import dict_utils as du diff --git a/tests/exec_utils_test.py b/tests/exec_utils_test.py index eb179da..4c003aa 100755 --- a/tests/exec_utils_test.py +++ b/tests/exec_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""exec_utils unittest.""" + import unittest import exec_utils diff --git a/tests/google_assistant_test.py b/tests/google_assistant_test.py index 857c1e4..a162594 100755 --- a/tests/google_assistant_test.py +++ b/tests/google_assistant_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""google_assistant unittest.""" + import unittest from unittest.mock import MagicMock, patch diff --git a/tests/letter_compress_test.py b/tests/letter_compress_test.py index e67838a..1a47ba4 100755 --- a/tests/letter_compress_test.py +++ b/tests/letter_compress_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""letter_compress unittest.""" + import math import random import unittest diff --git a/tests/logging_utils_test.py b/tests/logging_utils_test.py index a9625d6..99ceeae 100755 --- a/tests/logging_utils_test.py +++ b/tests/logging_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""logging_utils unittest.""" + import os import sys import tempfile diff --git a/tests/money_test.py b/tests/money_test.py index f981532..bbca499 100755 --- a/tests/money_test.py +++ b/tests/money_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""money unittest.""" + import unittest import unittest_utils as uu diff --git a/tests/parallelize_itest.py b/tests/parallelize_itest.py index 409b8dc..ef154a7 100755 --- a/tests/parallelize_itest.py +++ b/tests/parallelize_itest.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""parallelize unittest.""" + import logging import sys diff --git a/tests/profanity_filter_test.py b/tests/profanity_filter_test.py index e452d6a..94b2725 100755 --- a/tests/profanity_filter_test.py +++ b/tests/profanity_filter_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""profanity_filter unittest, you fucker.""" + import unittest import profanity_filter as pf diff --git a/tests/rate_test.py b/tests/rate_test.py index e750119..df4ccae 100755 --- a/tests/rate_test.py +++ b/tests/rate_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""rate unittest.""" + import unittest import unittest_utils as uu diff --git a/tests/run_some_dependencies_test.py b/tests/run_some_dependencies_test.py index fcc9e7a..c9f48a5 100755 --- a/tests/run_some_dependencies_test.py +++ b/tests/run_some_dependencies_test.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """This is a "test" that just runs a few system utilities that have dependencies on this library in "do nothing" mode and makes sure they exit cleanly. diff --git a/tests/shared_dict_test.py b/tests/shared_dict_test.py index 0b73a45..230bdb9 100755 --- a/tests/shared_dict_test.py +++ b/tests/shared_dict_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""shared_dict unittest.""" + import unittest import parallelize as p diff --git a/tests/string_utils_test.py b/tests/string_utils_test.py index 5184894..c111b64 100755 --- a/tests/string_utils_test.py +++ b/tests/string_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""string_utils unittest.""" + import unittest import bootstrap diff --git a/tests/thread_utils_test.py b/tests/thread_utils_test.py index 7fcdca8..40ecfac 100755 --- a/tests/thread_utils_test.py +++ b/tests/thread_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""thread_utils unittest.""" + import threading import time import unittest diff --git a/tests/waitable_presence_test.py b/tests/waitable_presence_test.py index ff4225c..f9e95e9 100755 --- a/tests/waitable_presence_test.py +++ b/tests/waitable_presence_test.py @@ -1,6 +1,9 @@ #!/usr/bin/env python3 -import re +# © Copyright 2021-2022, Scott Gasch + +"""waitable_presence unittest.""" + import unittest from unittest.mock import MagicMock diff --git a/text_utils.py b/text_utils.py index a6337d6..f04c618 100644 --- a/text_utils.py +++ b/text_utils.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with "text".""" import contextlib diff --git a/thread_utils.py b/thread_utils.py index 2375f3d..01755de 100644 --- a/thread_utils.py +++ b/thread_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utilities for dealing with threads + threading.""" import functools diff --git a/type/centcount.py b/type/centcount.py index 4529695..e78d068 100644 --- a/type/centcount.py +++ b/type/centcount.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """An amount of money (USD) represented as an integral count of cents.""" diff --git a/type/locations.py b/type/locations.py index e02b8ab..b311064 100644 --- a/type/locations.py +++ b/type/locations.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """An enum to represent locations.""" import enum diff --git a/type/money.py b/type/money.py index b84652b..99637d1 100644 --- a/type/money.py +++ b/type/money.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A class to represent money. See also centcount.py""" import re diff --git a/type/people.py b/type/people.py index d942ebb..521c63b 100644 --- a/type/people.py +++ b/type/people.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """An enum to represent people.""" import enum diff --git a/type/rate.py b/type/rate.py index c365848..5848906 100644 --- a/type/rate.py +++ b/type/rate.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A class to represent a rate of change.""" from typing import Optional diff --git a/type_utils.py b/type_utils.py index c2f432a..5e4187e 100644 --- a/type_utils.py +++ b/type_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Utility functions for dealing with typing.""" import logging diff --git a/unittest_utils.py b/unittest_utils.py index 88e4195..28b577e 100644 --- a/unittest_utils.py +++ b/unittest_utils.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """Helpers for unittests. Note that when you import this we - automatically wrap unittest.main() with a call to - bootstrap.initialize so that we getLogger config, commandline args, - logging control, etc... this works fine but it's a little hacky so - caveat emptor. +automatically wrap unittest.main() with a call to bootstrap.initialize +so that we getLogger config, commandline args, logging control, +etc... this works fine but it's a little hacky so caveat emptor. + """ import contextlib diff --git a/unscrambler.py b/unscrambler.py index 1b24230..a40213e 100644 --- a/unscrambler.py +++ b/unscrambler.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A fast word unscrambler library.""" import logging diff --git a/waitable_presence.py b/waitable_presence.py index 9247a67..6473add 100644 --- a/waitable_presence.py +++ b/waitable_presence.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A PresenceDetector that is waitable. This is not part of base_presence.py because I do not want to bring these dependencies into that lower-level module (especially state_tracker). -- 2.45.2