4b8ae01786
Add starting_balance parameter, and by default make it nonzero.
2022-01-09 16:55:53 -08:00
e5114ecf2c
Alphabetize docstring.
2022-01-09 16:55:15 -08:00
c914d4236e
Make only_shrink a keyword-only argument.
2022-01-09 16:54:15 -08:00
c1886ba536
Add OVERWRITE_ sentinels for different overwrite techniques.
2022-01-04 13:07:16 -08:00
31156aa67c
Sort scandir entries.
...
In spinal.walk sorting is optional because there I prioritize
configurability and speed, but for pathclass.walk I think it
makes sense to prioritize comfort and just-works results.
2022-01-04 12:47:17 -08:00
d3d5bd1fa2
Add base mutable class.
2021-12-27 22:33:18 -08:00
10a312b996
Add return value written_files.
2021-12-27 17:08:54 -08:00
373d8dd36d
Improve operatornotify betterhelp epilogue.
2021-12-23 17:07:36 -08:00
90a7c4b76a
Add "or" to the title_capitalize lowercase list.
2021-12-23 17:07:22 -08:00
597705fc57
Add hms_letters functions to make 00h00m00s outputs.
2021-12-21 17:09:40 -08:00
9381c2c9c7
Also log commits without user-given messages.
2021-12-21 17:02:26 -08:00
28b4c8626b
Fix ratelimiter reject mode always subtracting balance.
2021-12-21 17:02:08 -08:00
0a0bbae88c
Use unicode_width instead of len, improve in_box.
2021-12-20 16:45:47 -08:00
ca4b78c654
Add stringtools.unicode_width.
2021-12-20 16:44:10 -08:00
a73263f27d
Log absolute_path instead of the Path object.
2021-12-20 16:43:14 -08:00
359c255817
Make pathclass globs faster by checking scandir for stat first.
2021-12-16 21:14:35 -08:00
c2dae46c99
Update interactive.py.
2021-12-14 20:37:40 -08:00
90f14e04f8
Improve a few uses of pathclass.
2021-12-07 12:41:58 -08:00
f2190b9bfb
Add Path.walk_directories, walk_files.
2021-12-07 12:41:35 -08:00
23fe4d1d1e
Call path.assert_is_directory before walking.
2021-12-02 19:32:39 -08:00
19afbc2105
Enforce with_child basename is str.
2021-12-02 19:32:25 -08:00
e2fd04ccf1
Remove .absolute_path thanks to fspath.
2021-12-02 19:32:08 -08:00
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
7a48a7b69c
Let wait_for_internet take a backoff class to control sleeps.
2021-11-24 15:14:18 -08:00
bef06dac75
Add Pool.done, indicates all threads have completely finished.
2021-11-20 19:50:18 -08:00
9b8dd35658
Let Pool._threads be a set instead of list.
2021-11-20 19:48:12 -08:00
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
cca488bc7a
Move code to own function Pool.close.
2021-11-20 19:48:12 -08:00
87392b31a3
Add some type annotations.
2021-11-20 19:48:11 -08:00
dcd4d20b07
Rename PooledThread.start -> mainloop.
2021-11-20 19:20:39 -08:00
f1aea14646
Move the sleep out of the locked portion.
2021-11-20 18:53:56 -08:00
8f8a39eaca
Add Ratelimiter.__repr__.
2021-11-20 18:52:00 -08:00
6d8a406ceb
Use time.monotonic.
2021-11-20 18:51:46 -08:00
edeff079f7
Use vlogging.
2021-11-20 18:49:31 -08:00
8317e7c7b7
Add some docstrings.
2021-11-20 18:48:58 -08:00
6d9300aa9d
Remove task_done since we never call queue.join.
2021-11-20 18:48:40 -08:00
039ac45e17
Let Job.join accept a timeout.
2021-11-20 18:48:05 -08:00
f7250f8157
Let downloady take ratemeters to assist caller's reporting.
2021-11-20 18:46:20 -08:00
2fbe24b272
Add argument --operatornotify-subject to override subject line.
2021-11-18 19:53:54 -08:00
1c1bb49cb8
Add ----- between epilogues.
2021-11-18 17:06:00 -08:00
e995bd502d
Use os.path.normpath instead of normalize_sep.
2021-11-18 17:02:32 -08:00
f1b88b49fe
Raise typeerror if not Path or str, and dedent by early return.
2021-11-14 22:18:03 -08:00
3049a62bc0
Use httperrors.
2021-11-13 01:21:32 -08:00
ef546886c9
Use sock.settimeout instead of module setdefaulttimeout.
2021-11-13 01:20:42 -08:00
1bbb8bedee
Use voussoirkit.httperrors.
2021-11-13 01:20:26 -08:00
e8a0b0a050
Let get_external_ip take a timeout.
2021-11-13 01:20:13 -08:00
53756662ad
Disambiguate kwargs.
2021-11-11 18:17:42 -08:00
8838d2ffee
Fix capitalization in epilogue.
2021-11-10 23:41:50 -08:00
1c96931f85
Add argument thousands_separator.
2021-11-10 23:02:38 -08:00
729d3e5cf3
Improve bytestring docstring.
2021-11-10 23:02:22 -08:00
691b293939
Add argument raise_for_missing.
2021-11-10 23:01:55 -08:00
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
b1849ccefa
Add alias copy_dir = copy_directory.
2021-11-08 18:31:05 -08:00
9e507fd61b
Significantly speed up bdecode by always indexing into original data.
2021-11-07 19:31:55 -08:00
41ec819a35
Remove spinal.copy, just let the caller do it.
2021-11-07 19:28:32 -08:00
7c205522ce
Alphabetize some arguments.
2021-11-07 19:28:03 -08:00
fa1df6f49c
Make naming of "verify_hash" feature more consistent.
2021-11-07 19:27:49 -08:00
8cb50d8cac
Add betterhelp epilogue feature, flatten some logic.
2021-11-07 19:25:37 -08:00
40410496fc
Alphabetize functions.
2021-11-07 18:59:32 -08:00
6c063fd187
Add listdir_files, listdir_directories.
2021-11-07 18:59:02 -08:00
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
125681da18
Let pathclass.join take spawn_kwargs.
2021-11-07 18:55:28 -08:00
154f02f5bb
Use r-string for re.match windows drive letter.
2021-11-07 18:54:17 -08:00
281e95f184
Make force_sep a kw-only argument.
2021-11-07 18:53:57 -08:00
71830845d4
Add note that get_objects_by_id does not raise.
2021-11-07 18:52:50 -08:00
fbe2a664e5
Move decorate_and_route to flasktools.
2021-10-31 15:11:53 -07:00
5dff2d446b
Add docstring and comments to give_theme_cookie.
2021-10-31 13:30:34 -07:00
bae4953097
Move give_theme_cookie to flasktools.
2021-10-30 17:29:28 -07:00
f267d55f9d
Use functools.wraps.
2021-10-30 17:29:01 -07:00
38de31f1e2
Let the wrapped mains take additional arguments.
...
Just in case the application wants to do so.
2021-10-30 17:27:05 -07:00
2756fb87e3
Add docstring for monkeypatch_requests.
2021-10-25 12:29:28 -07:00
ba6cb79529
If level is None, don't bother making the nullcontext.
2021-10-25 12:28:22 -07:00
c3c22270ee
Add earlybird_config.
2021-10-25 11:28:07 -07:00
6e315303de
Finally finally fix vlogging/operatornotify interplay?
...
I realized that vlogging.main_decorator shouldn't be using basic_config
in the first place because main decorator should always create a stderr
handler and I was just contorting the previous code to make that happen
via basic_config. So instead let's just add it ourselves.
2021-10-25 11:27:57 -07:00
414fc60f48
Reduce redundancy in get_level_by_argv with tryremove.
2021-10-25 10:57:30 -07:00
083b466d07
Alphabetize functions.
2021-10-24 23:38:23 -07:00
7d9489b5ae
Add snake_case alias get_logger, getLogger.
2021-10-24 23:34:08 -07:00
ea08e2399e
Fix root.handlers check which I accidentally removed.
2021-10-24 23:30:41 -07:00
b68ac864fa
Return a pathclass object from @property drive.
2021-10-24 00:16:33 -07:00
d082a0fbb5
Finally solve vlogging/opnot interplay by just setting NOTSET always.
2021-10-18 18:20:17 -07:00
d38c7c074e
Add mutables.py.
...
I might regret this!
2021-10-15 22:57:23 -07:00
4e4fcdb77f
Add httperrors.py.
...
I'm on the fence about whether I'll really migrate everything over
to use this, but it's been sitting on my computer for weeks and I
haven't decided to delete it yet, so let's go.
2021-10-15 21:35:46 -07:00
bcb6c7df19
Fix use of pathclass in overwrite.
2021-10-12 21:12:24 -07:00
a94de2adde
Add some docstrings, return annotations.
2021-10-10 12:06:54 -07:00
6edba068e5
Add global constant INTERNET_IP.
2021-10-10 12:02:09 -07:00
1a375e4964
Assert stdin exists for all interactive functions.
2021-10-10 00:42:18 -07:00
a4196f2b13
Add aliases assert_is_dir, assert_not_dir.
2021-10-10 00:31:43 -07:00
05586e7e79
Let is_directory be canonical function, but keep the aliases.
2021-10-10 00:31:25 -07:00
87fbede7d5
Add option log_return_value.
2021-10-09 17:56:31 -07:00
531424c8c1
Remove *args, force use of named arguments.
2021-10-09 17:55:52 -07:00
c87fc584da
Call vlogging.basic_config as part of main_decorator.
2021-10-09 17:48:35 -07:00
e826eeca2c
Add vlogging.basic_config.
2021-10-09 17:47:48 -07:00
5b6a1b4c9c
Use abstract base class to help the subclass know what to do.
2021-10-09 12:12:18 -07:00
8eefc4a095
Small docstring improvements.
2021-10-05 16:53:30 -07:00
0a1ab15637
Add convenient pathclass.read, write.
2021-10-04 17:19:20 -07:00
39d6140138
Move assert_not_deleted to worms.
2021-10-02 12:45:17 -07:00
129eb3f8aa
Rename make_json_response -> json_response.
2021-10-01 23:01:36 -07:00
aa1e2d5756
Add worms.py.
2021-10-01 22:35:38 -07:00
a3ddeb8e09
Improve needs_rewrite detection.
2021-09-30 16:20:12 -07:00
c1edd8fc33
Clarify variables.
2021-09-30 16:20:04 -07:00
e273eb22a5
Change hash header.
2021-09-24 18:32:07 -07:00
8801407f58
Add --warning level.
2021-09-23 22:49:22 -07:00
7021308c9e
Add call to coinitialize.
2021-09-23 22:49:19 -07:00
5f6d291729
Fix docstring wrapping.
2021-09-23 22:39:09 -07:00
3c82dc64e0
Don't write to streams when pythonw makes them None.
2021-09-23 22:37:55 -07:00
5a2eca486f
Remove backwards compat function output.
2021-09-23 22:37:39 -07:00
bebcd6c7f3
Fix docstring column wrapping.
2021-09-23 22:36:39 -07:00
cd1fce3211
Add aliases is_directory, is_folder -> is_dir.
2021-09-23 22:36:14 -07:00
446626f1ce
Add pathclass.glob, glob_many.
2021-09-23 22:36:01 -07:00
85ea9ec660
Add winglob.glob_many.
2021-09-23 22:34:34 -07:00
f10942fd3f
Remove __del__ because the order of del is not guaranteed.
...
Sometimes the streamhandler is garbage collected before the
loghandler, in which case this makes a bad error.
2021-09-23 22:34:02 -07:00
6c0233c239
Update downloady with better use of pathclass, vlogging.
2021-09-23 22:32:48 -07:00
ac8e83a11e
Reduce arguments for main_log_context. Deal with argv in main_dec.
2021-09-16 21:46:31 -07:00
d0d7cf2145
Replace in+remove with index+pop.
...
The code turns out to be longer with these duplicate try-except,
but they are different enough that I can't really condense it
at the moment.
2021-09-16 21:19:46 -07:00
b561fd24b5
Reduce indentation by returning early.
2021-09-16 21:17:36 -07:00
adc99d383e
Call strip on --subject text.
2021-09-16 17:37:38 -07:00
e0f37b986c
Use double backslash even in docstring.
2021-09-13 18:00:56 -07:00
79c4f59cf2
Fully rewrite passwordy.
2021-09-11 11:15:31 -07:00
3032ed135d
Replace prints with stderr.
2021-09-11 11:13:03 -07:00
8d0ba6b946
Set pipeable.stdout, stderr line='' default.
2021-09-11 11:12:38 -07:00
df6a52452a
Use argparse for fusker.
2021-09-11 11:12:00 -07:00
0416f0babf
Discourage writes to pathclass._absolute_path.
2021-09-09 17:30:46 -07:00
d37e6fdf0b
Add networktools.wait_for_internet.
2021-09-08 21:54:03 -07:00
0274b9d4a5
Move checkerboard_image to imagetools.
2021-09-05 01:35:46 -07:00
1c23fbef63
Move truthystring to stringtools.
2021-09-05 01:11:27 -07:00
bdab1331b8
Move cached_endpoint, required_fields to flasktools.
2021-09-03 12:44:00 -07:00
ccd3bf72c0
Add gentools.run.
2021-08-31 19:22:50 -07:00
8eed09c14b
Specifically state that the exception killed the log context.
2021-08-28 14:58:11 -07:00
51d9a5202a
Fix get_all_volumes for 64-bit python.
2021-08-24 22:34:09 -07:00
3d29322cc1
Split get_level_by_argv into own function.
...
To facilitate other uses of the opt-in flags besides just attaching
to the logger.
2021-08-23 22:42:30 -07:00
e2f4357b15
Add SILENT to get_level_by_name.
2021-08-23 22:41:07 -07:00
d3a1578cca
Add some type annotations to test the waters.
2021-08-22 20:48:34 -07:00
98ee6e82c6
Improve various docstrings.
2021-08-22 20:46:12 -07:00
81f81a6c24
Don't log exit status if --operatornotify/level wasn't passed.
2021-08-22 19:50:04 -07:00
9c880f2825
A few docstring improvements.
2021-08-21 15:20:11 -07:00
4c4fae62cf
Delete clipext.py.
2021-08-17 14:01:00 -07:00
8ce994a54b
Replace use of clipext with pipeable, split_lines=False.
2021-08-17 14:00:29 -07:00
cb5228fe0c
Add argument split_lines for when you just want the whole text.
...
Calling '\n'.join(pipeable.input()) is not great because in many
situations, you're splitting text and joining it back together again
for no reason. With this option, we can let the code do the right
thing, and use pipeable as a general-purpose inputter in
more situations.
2021-08-17 14:00:11 -07:00
db8c6e42e3
Add TypeError if arg is not a string.
2021-08-17 13:48:57 -07:00
f5e5db1908
Let hms use pipeable.input_many instead of go.
2021-08-17 13:46:47 -07:00
93605e2577
Split long useragent string.
2021-08-13 23:40:29 -07:00
6442e8e40c
Fix ctrlc_return1 to return the wrapped return value.
2021-08-13 23:40:29 -07:00
14dcbda9fd
Add networktools, though some ideas are still not implemented.
2021-08-13 23:40:28 -07:00
1d6f9eee10
Add niceprints.py.
2021-08-13 23:40:28 -07:00
72fdcb2b04
Clarify pipeable.input_many docstring.
2021-08-11 01:01:14 -07:00
cdf551f28a
Let glob_filenames, glob_directories be singular strings.
2021-08-11 01:01:02 -07:00
eddd7b3818
Remove set_level_by_argv.
2021-08-10 11:54:04 -07:00
61db9296c8
Improve some docstrings.
2021-08-10 11:53:55 -07:00
16d9b85e62
Various lint appeasements.
2021-08-10 11:37:01 -07:00
63251b979b
Describe Path parameters in docstring.
2021-08-09 16:27:33 -07:00