Commit Graph

470 Commits (19afbc2105d0ddd0027658e564a2c49d373fa2a2)

Author SHA1 Message Date
voussoir 19afbc2105
Enforce with_child basename is str. 2021-12-02 19:32:25 -08:00
voussoir e2fd04ccf1
Remove .absolute_path thanks to fspath. 2021-12-02 19:32:08 -08:00
voussoir b288cca519
Rewrite a lot of pathclass, spinal.walk using tuple-based Path.
I was inspired by the idea of "making impossible states impossible"
and using a data model that accurately represents what we intend for
it to represent. Instead of storing the path as a string where "it's
a string but actually you're supposed to know that the parts between
os.seps are different parts and the first one is special and...", we
can use a data model that directly says that. Storing the path as a
tuple of (Drive, Part, Part) helps me focus on the semantics of the
Path as a collection of parts joined by the os.sep.

Furthermore, storing the path as a string made some operations slow.
Every time we call one of the os.path functions with a string, it
has to do a lot of normalization and edge-case handling even when we
know it wouldn't be needed. By storing the path as a tuple, we can
instantly get the drive name, parent dir name, and basename without
asking os.path to split it for us every single time. It also makes
relative path / common ancestor checks a lot easier to understand.
Fewer operations need to go into the slow functions.
2021-11-30 21:16:47 -08:00
voussoir 7a48a7b69c
Let wait_for_internet take a backoff class to control sleeps. 2021-11-24 15:14:18 -08:00
voussoir bef06dac75
Add Pool.done, indicates all threads have completely finished. 2021-11-20 19:50:18 -08:00
voussoir 9b8dd35658
Let Pool._threads be a set instead of list. 2021-11-20 19:48:12 -08:00
voussoir 305c6bfdf4
Add lock around running_count increment, decrement.
I thought these assignments were atomic for int but they're not.
2021-11-20 19:48:12 -08:00
voussoir cca488bc7a
Move code to own function Pool.close. 2021-11-20 19:48:12 -08:00
voussoir 87392b31a3
Add some type annotations. 2021-11-20 19:48:11 -08:00
voussoir dcd4d20b07
Rename PooledThread.start -> mainloop. 2021-11-20 19:20:39 -08:00
voussoir f1aea14646
Move the sleep out of the locked portion. 2021-11-20 18:53:56 -08:00
voussoir 8f8a39eaca
Add Ratelimiter.__repr__. 2021-11-20 18:52:00 -08:00
voussoir 6d8a406ceb
Use time.monotonic. 2021-11-20 18:51:46 -08:00
voussoir edeff079f7
Use vlogging. 2021-11-20 18:49:31 -08:00
voussoir 8317e7c7b7
Add some docstrings. 2021-11-20 18:48:58 -08:00
voussoir 6d9300aa9d
Remove task_done since we never call queue.join. 2021-11-20 18:48:40 -08:00
voussoir 039ac45e17
Let Job.join accept a timeout. 2021-11-20 18:48:05 -08:00
voussoir f7250f8157
Let downloady take ratemeters to assist caller's reporting. 2021-11-20 18:46:20 -08:00
voussoir 2fbe24b272
Add argument --operatornotify-subject to override subject line. 2021-11-18 19:53:54 -08:00
voussoir 1c1bb49cb8
Add ----- between epilogues. 2021-11-18 17:06:00 -08:00
voussoir e995bd502d
Use os.path.normpath instead of normalize_sep. 2021-11-18 17:02:32 -08:00
voussoir f1b88b49fe
Raise typeerror if not Path or str, and dedent by early return. 2021-11-14 22:18:03 -08:00
voussoir 3049a62bc0
Use httperrors. 2021-11-13 01:21:32 -08:00
voussoir ef546886c9
Use sock.settimeout instead of module setdefaulttimeout. 2021-11-13 01:20:42 -08:00
voussoir 1bbb8bedee
Use voussoirkit.httperrors. 2021-11-13 01:20:26 -08:00
voussoir e8a0b0a050
Let get_external_ip take a timeout. 2021-11-13 01:20:13 -08:00
voussoir 53756662ad
Disambiguate kwargs. 2021-11-11 18:17:42 -08:00
voussoir 8838d2ffee
Fix capitalization in epilogue. 2021-11-10 23:41:50 -08:00
voussoir dafd81fe92
Remove donate.md. 2021-11-10 23:41:34 -08:00
voussoir 1c96931f85
Add argument thousands_separator. 2021-11-10 23:02:38 -08:00
voussoir 729d3e5cf3
Improve bytestring docstring. 2021-11-10 23:02:22 -08:00
voussoir 691b293939
Add argument raise_for_missing. 2021-11-10 23:01:55 -08:00
voussoir 4dddb21f74
Bump to version 0.0.70. 2021-11-08 23:37:24 -08:00
voussoir 5a33c9369e
Add global _did_earlybird to allow main_decorator to coexist.
This way you don't get duplicate handlers.
2021-11-08 23:35:00 -08:00
voussoir b1849ccefa
Add alias copy_dir = copy_directory. 2021-11-08 18:31:05 -08:00
voussoir 9e507fd61b
Significantly speed up bdecode by always indexing into original data. 2021-11-07 19:31:55 -08:00
voussoir 41ec819a35
Remove spinal.copy, just let the caller do it. 2021-11-07 19:28:32 -08:00
voussoir 7c205522ce
Alphabetize some arguments. 2021-11-07 19:28:03 -08:00
voussoir fa1df6f49c
Make naming of "verify_hash" feature more consistent. 2021-11-07 19:27:49 -08:00
voussoir 8cb50d8cac
Add betterhelp epilogue feature, flatten some logic. 2021-11-07 19:25:37 -08:00
voussoir 40410496fc
Alphabetize functions. 2021-11-07 18:59:32 -08:00
voussoir 6c063fd187
Add listdir_files, listdir_directories. 2021-11-07 18:59:02 -08:00
voussoir e737e60862
Revert files/directories argument to glob, use separate functions.
I thought it was clever at first, but now I'm feeling that having
mutually exclusive arguments to a single function in this case is
better served by just having two functions. Which also saves us
from ever having to deal with the exception case.
2021-11-07 18:58:35 -08:00
voussoir 125681da18
Let pathclass.join take spawn_kwargs. 2021-11-07 18:55:28 -08:00
voussoir 154f02f5bb
Use r-string for re.match windows drive letter. 2021-11-07 18:54:17 -08:00
voussoir 281e95f184
Make force_sep a kw-only argument. 2021-11-07 18:53:57 -08:00
voussoir 71830845d4
Add note that get_objects_by_id does not raise. 2021-11-07 18:52:50 -08:00
voussoir fbe2a664e5
Move decorate_and_route to flasktools. 2021-10-31 15:11:53 -07:00
voussoir 5dff2d446b
Add docstring and comments to give_theme_cookie. 2021-10-31 13:30:34 -07:00
voussoir bae4953097
Move give_theme_cookie to flasktools. 2021-10-30 17:29:28 -07:00