python_utils.git
20 months agoEasier and more self documenting patterns for loading/saving Persistent master
Scott Gasch [Thu, 1 Sep 2022 18:42:34 +0000 (11:42 -0700)]
Easier and more self documenting patterns for loading/saving Persistent
state via pickle and json.

20 months agoGet rid of hardcoded remote worker pool in favor of a config file.
Scott Gasch [Thu, 1 Sep 2022 17:21:11 +0000 (10:21 -0700)]
Get rid of hardcoded remote worker pool in favor of a config file.

20 months agoChanges towards splitting up the library and (maybe?) publishing on PyPi.
Scott Gasch [Tue, 30 Aug 2022 22:36:23 +0000 (15:36 -0700)]
Changes towards splitting up the library and (maybe?) publishing on PyPi.

20 months agoUpdate requirements; new homeassistant dep. Also don't import kazoo
Scott Gasch [Wed, 24 Aug 2022 01:27:09 +0000 (18:27 -0700)]
Update requirements; new homeassistant dep.  Also don't import kazoo
unless we try to load args from zookeeper.

20 months agoImprove docs.
Scott Gasch [Tue, 23 Aug 2022 16:59:49 +0000 (09:59 -0700)]
Improve docs.

20 months agoImprove comments.
Scott Gasch [Sun, 21 Aug 2022 14:29:55 +0000 (07:29 -0700)]
Improve comments.

20 months agoMake release return a bool. Improve tests and logging.
Scott Gasch [Sun, 21 Aug 2022 02:06:09 +0000 (19:06 -0700)]
Make release return a bool.  Improve tests and logging.

20 months agoAdd a unittest for this zookeeper stuff.
Scott Gasch [Sun, 21 Aug 2022 00:22:33 +0000 (17:22 -0700)]
Add a unittest for this zookeeper stuff.

20 months agoAdds a releasable and renewable lease subclass.
Scott Gasch [Sat, 20 Aug 2022 23:13:25 +0000 (16:13 -0700)]
Adds a releasable and renewable lease subclass.

20 months agoClarify/improve docs around leases and lease reacquisition.
Scott Gasch [Sat, 20 Aug 2022 18:20:16 +0000 (11:20 -0700)]
Clarify/improve docs around leases and lease reacquisition.

20 months agoFix bug in translate_timezone and improve test.
Scott Gasch [Sat, 20 Aug 2022 17:19:50 +0000 (10:19 -0700)]
Fix bug in translate_timezone and improve test.

20 months agoAdd a listener for state changes to zookeeper elections to, hopefully,
Scott Gasch [Sat, 20 Aug 2022 17:04:25 +0000 (10:04 -0700)]
Add a listener for state changes to zookeeper elections to, hopefully,
react immediately upon loss of connection.  Also modify elections to
thread.join(timeout) to react immediately on child thread exit.  Also
move zk stuff into the core of the decorators so that we don't have
one global zk client instance that gets torn down the first time its
used.

20 months agoBreak a dependency from zookeeper to config.
Scott Gasch [Sat, 20 Aug 2022 04:47:01 +0000 (21:47 -0700)]
Break a dependency from zookeeper to config.

20 months agoReduce the doctest lease duration...
Scott Gasch [Sat, 20 Aug 2022 01:27:57 +0000 (18:27 -0700)]
Reduce the doctest lease duration...

20 months agoAdd zookeeper.py; some handy wrappers for leader election and leases.
Scott Gasch [Sat, 20 Aug 2022 01:24:01 +0000 (18:24 -0700)]
Add zookeeper.py; some handy wrappers for leader election and leases.

20 months agoRemove unnecessary / stray debugging exception dumps.
Scott Gasch [Thu, 18 Aug 2022 23:54:36 +0000 (16:54 -0700)]
Remove unnecessary / stray debugging exception dumps.

20 months agoThis command broke b/c i relies on environment vars -> config so it's
Scott Gasch [Thu, 18 Aug 2022 16:15:41 +0000 (09:15 -0700)]
This command broke b/c i relies on environment vars -> config so it's
a decent test.

20 months agoCleanup / add untracked files.
Scott Gasch [Thu, 18 Aug 2022 15:59:05 +0000 (08:59 -0700)]
Cleanup / add untracked files.

20 months agoAdd an option to exit immediately upon setting zookeeper. Change the
Scott Gasch [Thu, 18 Aug 2022 15:54:59 +0000 (08:54 -0700)]
Add an option to exit immediately upon setting zookeeper.  Change the
verbosity of a warning.

20 months agoMore new config bugs: needs to support a .get() method... doh.
Scott Gasch [Thu, 18 Aug 2022 06:41:48 +0000 (23:41 -0700)]
More new config bugs: needs to support a .get() method... doh.

20 months agoUgh. Fix a bug in the new refactor of the env var config stuff.
Scott Gasch [Thu, 18 Aug 2022 02:53:17 +0000 (19:53 -0700)]
Ugh.  Fix a bug in the new refactor of the env var config stuff.

20 months agoDynamic config arguments stab #1.
Scott Gasch [Thu, 18 Aug 2022 02:12:33 +0000 (19:12 -0700)]
Dynamic config arguments stab #1.

20 months agoCleanup config in preparation for zookeeper-based dynamic configs.
Scott Gasch [Thu, 18 Aug 2022 00:23:44 +0000 (17:23 -0700)]
Cleanup config in preparation for zookeeper-based dynamic configs.

20 months agoDo not allow data that is too large in zookeeper.
Scott Gasch [Wed, 17 Aug 2022 19:01:26 +0000 (12:01 -0700)]
Do not allow data that is too large in zookeeper.

20 months agoPersist the zookeeper client and connection. A step towards a config watcher.
Scott Gasch [Wed, 17 Aug 2022 18:33:58 +0000 (11:33 -0700)]
Persist the zookeeper client and connection.  A step towards a config watcher.

20 months agoUpdate requirements to include kazoo
Scott Gasch [Wed, 17 Aug 2022 18:06:35 +0000 (11:06 -0700)]
Update requirements to include kazoo

20 months agoAllow config.py to save/load config from zookeeper. No watching yet.
Scott Gasch [Wed, 17 Aug 2022 18:04:31 +0000 (11:04 -0700)]
Allow config.py to save/load config from zookeeper.  No watching yet.

20 months agoUpdate requirements to include psutil.
Scott Gasch [Wed, 17 Aug 2022 17:13:46 +0000 (10:13 -0700)]
Update requirements to include psutil.

20 months agoHacky fix for inconsistently named camera.
Scott Gasch [Mon, 15 Aug 2022 17:36:47 +0000 (10:36 -0700)]
Hacky fix for inconsistently named camera.

20 months agoFix a threading related bug in tplink_utils.
Scott Gasch [Mon, 15 Aug 2022 16:20:20 +0000 (09:20 -0700)]
Fix a threading related bug in tplink_utils.

20 months agoSkip line about X11 forwarding in data read via ssh.
Scott Gasch [Sat, 13 Aug 2022 00:41:14 +0000 (17:41 -0700)]
Skip line about X11 forwarding in data read via ssh.

20 months agoUpdate requirements.txt and fix a bug in unscrambler.
Scott Gasch [Fri, 12 Aug 2022 17:32:51 +0000 (10:32 -0700)]
Update requirements.txt and fix a bug in unscrambler.

20 months agoMore changes to get 3.9 working.
Scott Gasch [Wed, 10 Aug 2022 17:28:55 +0000 (10:28 -0700)]
More changes to get 3.9 working.

20 months agoUpgrade to python 3.9.
Scott Gasch [Wed, 10 Aug 2022 17:11:27 +0000 (10:11 -0700)]
Upgrade to python 3.9.

21 months agoMake base_presence runnable from anywhere.
Scott Gasch [Wed, 27 Jul 2022 18:45:07 +0000 (11:45 -0700)]
Make base_presence runnable from anywhere.

22 months agoUpdate docs.
Scott Gasch [Wed, 6 Jul 2022 16:58:12 +0000 (09:58 -0700)]
Update docs.

22 months agoUse an overtly named method on SamplingIterator.
Scott Gasch [Tue, 5 Jul 2022 19:02:22 +0000 (12:02 -0700)]
Use an overtly named method on SamplingIterator.

22 months agoUpdate docs.
Scott Gasch [Tue, 5 Jul 2022 18:49:54 +0000 (11:49 -0700)]
Update docs.

22 months agoUpdate docs.
Scott Gasch [Tue, 5 Jul 2022 18:25:35 +0000 (11:25 -0700)]
Update docs.

22 months agoAdd pushback iter.
Scott Gasch [Tue, 5 Jul 2022 01:54:02 +0000 (18:54 -0700)]
Add pushback iter.

22 months agoUpdate docs.
Scott Gasch [Mon, 4 Jul 2022 18:23:40 +0000 (11:23 -0700)]
Update docs.

22 months agoFix iter_utils docs.
Scott Gasch [Mon, 4 Jul 2022 07:35:35 +0000 (00:35 -0700)]
Fix iter_utils docs.

22 months agoAdd inital cut of iter_utils with a coupel of iters I needed. Tweak
Scott Gasch [Mon, 4 Jul 2022 07:33:26 +0000 (00:33 -0700)]
Add inital cut of iter_utils with a coupel of iters I needed.  Tweak
math_utils population.

22 months agoBugfixes in math_utils.
Scott Gasch [Sat, 2 Jul 2022 16:59:20 +0000 (09:59 -0700)]
Bugfixes in math_utils.

22 months agoMinor cleanup.
Scott Gasch [Fri, 1 Jul 2022 05:37:26 +0000 (22:37 -0700)]
Minor cleanup.

22 months agoAdd logging to trie.
Scott Gasch [Tue, 14 Jun 2022 14:57:54 +0000 (07:57 -0700)]
Add logging to trie.

22 months agoAt python3.10 importlib.abc is a separate module that must be imported.
Scott Gasch [Sun, 12 Jun 2022 05:37:32 +0000 (22:37 -0700)]
At python3.10 importlib.abc is a separate module that must be imported.

23 months agoDocs and test.
Scott Gasch [Thu, 9 Jun 2022 00:29:57 +0000 (17:29 -0700)]
Docs and test.

23 months agoImprove dateparse and make string_utils.extract_date.
Scott Gasch [Thu, 9 Jun 2022 00:23:33 +0000 (17:23 -0700)]
Improve dateparse and make string_utils.extract_date.

23 months agoAdd some colors from https://drafts.csswg.org/css-color/#named-colors.
Scott Gasch [Wed, 8 Jun 2022 17:26:48 +0000 (10:26 -0700)]
Add some colors from https://drafts.csswg.org/css-color/#named-colors.

23 months agoFix tplink outlets with children is_on to check the children.
Scott Gasch [Tue, 7 Jun 2022 16:04:44 +0000 (09:04 -0700)]
Fix tplink outlets with children is_on to check the children.

23 months agoGet rid of sanity check on bsearch; just use __debug__.
Scott Gasch [Sun, 5 Jun 2022 05:35:03 +0000 (22:35 -0700)]
Get rid of sanity check on bsearch; just use __debug__.

23 months agoDetect a debugger.
Scott Gasch [Sun, 5 Jun 2022 05:33:12 +0000 (22:33 -0700)]
Detect a debugger.

23 months agoSpacing tweak.
Scott Gasch [Sat, 4 Jun 2022 16:08:58 +0000 (09:08 -0700)]
Spacing tweak.

23 months agoAdd timeout_seconds to cmd_showing_output.
Scott Gasch [Sat, 4 Jun 2022 16:06:07 +0000 (09:06 -0700)]
Add timeout_seconds to cmd_showing_output.

23 months agoTake a lock before reading cross thread.
Scott Gasch [Sat, 4 Jun 2022 00:12:38 +0000 (17:12 -0700)]
Take a lock before reading cross thread.

23 months agoUpdate README
Scott Gasch [Fri, 3 Jun 2022 17:22:18 +0000 (10:22 -0700)]
Update README

23 months agoMake run_tests.py also run a subset of tests w/o coverage (in addition
Scott Gasch [Fri, 3 Jun 2022 17:14:01 +0000 (10:14 -0700)]
Make run_tests.py also run a subset of tests w/o coverage (in addition
to with coverage) when --coverage is passed so that they can pay attention
to perf regressions.

23 months agoAdd --all and cleanup clear_line().
Scott Gasch [Fri, 3 Jun 2022 15:21:52 +0000 (08:21 -0700)]
Add --all and cleanup clear_line().

23 months agoImprove docs in ANSI.py
Scott Gasch [Fri, 3 Jun 2022 04:56:40 +0000 (21:56 -0700)]
Improve docs in ANSI.py

23 months agoMake the bar graph thing do fractions.
Scott Gasch [Fri, 3 Jun 2022 04:43:08 +0000 (21:43 -0700)]
Make the bar graph thing do fractions.

23 months agoOne bugfix and some cosmetics.
Scott Gasch [Fri, 3 Jun 2022 03:09:09 +0000 (20:09 -0700)]
One bugfix and some cosmetics.

23 months agoUpdate docs.
Scott Gasch [Fri, 3 Jun 2022 02:51:18 +0000 (19:51 -0700)]
Update docs.

23 months agoHammer on that run_tests.py thing again.
Scott Gasch [Fri, 3 Jun 2022 00:56:29 +0000 (17:56 -0700)]
Hammer on that run_tests.py thing again.

23 months agoRename old run_tests.sh script; it's not used in hooks anymore.
Scott Gasch [Fri, 3 Jun 2022 00:36:52 +0000 (17:36 -0700)]
Rename old run_tests.sh script; it's not used in hooks anymore.

23 months agoRename a method in exec_utils.
Scott Gasch [Fri, 3 Jun 2022 00:33:29 +0000 (17:33 -0700)]
Rename a method in exec_utils.

23 months agoCode cleanup for run_test.py
Scott Gasch [Thu, 2 Jun 2022 20:47:26 +0000 (13:47 -0700)]
Code cleanup for run_test.py

23 months agoAdd a .coveragerc file to make sure we run coverage in parallel.
Scott Gasch [Thu, 2 Jun 2022 18:10:45 +0000 (11:10 -0700)]
Add a .coveragerc file to make sure we run coverage in parallel.

23 months agoFinal touches on the new test runner.
Scott Gasch [Thu, 2 Jun 2022 18:09:16 +0000 (11:09 -0700)]
Final touches on the new test runner.

23 months agoUpdate run_tests.py.
Scott Gasch [Thu, 2 Jun 2022 17:57:38 +0000 (10:57 -0700)]
Update run_tests.py.

23 months agoInitial stab at a smarter doc/unit/integration/coverage test runner.
Scott Gasch [Thu, 2 Jun 2022 15:23:18 +0000 (08:23 -0700)]
Initial stab at a smarter doc/unit/integration/coverage test runner.

23 months agoMore doc updates.
Scott Gasch [Wed, 1 Jun 2022 05:12:19 +0000 (22:12 -0700)]
More doc updates.

23 months agoMore docs cleanup.
Scott Gasch [Wed, 1 Jun 2022 01:00:09 +0000 (18:00 -0700)]
More docs cleanup.

23 months agoImprove docstrings for sphinx.
Scott Gasch [Tue, 31 May 2022 22:36:40 +0000 (15:36 -0700)]
Improve docstrings for sphinx.

23 months agoClean up more docs to work with sphinx.
Scott Gasch [Mon, 30 May 2022 00:53:26 +0000 (17:53 -0700)]
Clean up more docs to work with sphinx.

23 months agoConvert comment into doctest.
Scott Gasch [Sun, 29 May 2022 22:06:35 +0000 (15:06 -0700)]
Convert comment into doctest.

23 months agoFix geocode's doctest.
Scott Gasch [Sun, 29 May 2022 02:32:39 +0000 (19:32 -0700)]
Fix geocode's doctest.

23 months agoTweak around docstring to make prettier sphinx autodocs.
Scott Gasch [Sun, 29 May 2022 02:29:08 +0000 (19:29 -0700)]
Tweak around docstring to make prettier sphinx autodocs.

23 months agoSphinx docs link back to code.
Scott Gasch [Sat, 28 May 2022 20:06:40 +0000 (13:06 -0700)]
Sphinx docs link back to code.

23 months agoAdding files needed to run sphinx as a pre-push hook.
Scott Gasch [Sat, 28 May 2022 20:02:44 +0000 (13:02 -0700)]
Adding files needed to run sphinx as a pre-push hook.

23 months agoAllowances for getting sphinx docs set up.
Scott Gasch [Sat, 28 May 2022 19:58:51 +0000 (12:58 -0700)]
Allowances for getting sphinx docs set up.

23 months agoAdd method to get up/down/enter keystrokes.
Scott Gasch [Tue, 24 May 2022 23:13:32 +0000 (16:13 -0700)]
Add method to get up/down/enter keystrokes.

23 months agoFix an edge condition around the Nth weekday of the month when
Scott Gasch [Fri, 13 May 2022 02:14:34 +0000 (19:14 -0700)]
Fix an edge condition around the Nth weekday of the month when
the first day of the month is that target weekday.

23 months agoTry multiple strategies to determine the console size.
Scott Gasch [Fri, 13 May 2022 00:56:51 +0000 (17:56 -0700)]
Try multiple strategies to determine the console size.

2 years agoAdd curl commandline comment.
Scott Gasch [Sun, 1 May 2022 05:44:30 +0000 (22:44 -0700)]
Add curl commandline comment.

2 years agoBetter logging + cleanup.
Scott Gasch [Sun, 1 May 2022 00:42:14 +0000 (17:42 -0700)]
Better logging + cleanup.

2 years agoShard large geocode inputs.
Scott Gasch [Sun, 1 May 2022 00:34:34 +0000 (17:34 -0700)]
Shard large geocode inputs.

2 years agoBatch geocoding. Also use format=json for the single address request to
Scott Gasch [Sun, 1 May 2022 00:24:53 +0000 (17:24 -0700)]
Batch geocoding.  Also use format=json for the single address request to
remove the need for beautifulsoup.

2 years agoAdd some docs and doctests to things that have 0% coverage.
Scott Gasch [Sat, 30 Apr 2022 17:59:48 +0000 (10:59 -0700)]
Add some docs and doctests to things that have 0% coverage.

2 years agoHandle census site unavailability w/o throwing.
Scott Gasch [Fri, 29 Apr 2022 18:26:25 +0000 (11:26 -0700)]
Handle census site unavailability w/o throwing.

2 years agoOops, update type hints in geocode.
Scott Gasch [Wed, 27 Apr 2022 14:46:40 +0000 (07:46 -0700)]
Oops, update type hints in geocode.

2 years agoChange address, recognize numbers, add copyright.
Scott Gasch [Wed, 27 Apr 2022 14:42:49 +0000 (07:42 -0700)]
Change address, recognize numbers, add copyright.

2 years agoCleanup geocode.
Scott Gasch [Wed, 27 Apr 2022 02:36:56 +0000 (19:36 -0700)]
Cleanup geocode.

2 years agoGeocoder.
Scott Gasch [Wed, 27 Apr 2022 01:04:46 +0000 (18:04 -0700)]
Geocoder.

2 years agoTeach chord parser about Minor7
Scott Gasch [Wed, 27 Apr 2022 00:57:07 +0000 (17:57 -0700)]
Teach chord parser about Minor7

2 years agoIgnore ANTLR generated files.
Scott Gasch [Fri, 22 Apr 2022 21:32:15 +0000 (14:32 -0700)]
Ignore ANTLR generated files.

2 years agoAdd powerset to list_utils; improve chord parser.
Scott Gasch [Fri, 22 Apr 2022 21:28:44 +0000 (14:28 -0700)]
Add powerset to list_utils; improve chord parser.

2 years agoAdd a chord parser test.
Scott Gasch [Fri, 22 Apr 2022 16:42:08 +0000 (09:42 -0700)]
Add a chord parser test.

2 years agoChord name parsing.
Scott Gasch [Fri, 22 Apr 2022 03:05:21 +0000 (20:05 -0700)]
Chord name parsing.

2 years agoWork on docs and readability.
Scott Gasch [Wed, 20 Apr 2022 03:54:03 +0000 (20:54 -0700)]
Work on docs and readability.