Commit graph

514 commits

Author SHA1 Message Date
c7f4d1dbf9
Respect the user's NO_COLOR environment variable. 2022-03-10 11:19:36 -08:00
2a6bc2a306
Include digits by default. 2022-03-10 11:18:21 -08:00
9530d0383a
Updates to downloady.
- Use new progressbars.
- Let the user pass a file handle to download bytes into.
- Use dynamic chunk sizing to get more regular progress bar updates.
2022-02-21 14:33:22 -08:00
232398eff0
Big updates to betterhelp.
Instead of handwriting the help text, which was time consuming and
prone to errors, I'm finally using the help parameter in
parser.add_argument. betterhelp will render and colorize this for
some good-looking automatic help text.

The make_helptext function is still extremely long and would be nice
to refactor, but I've been sitting on this commit for a few weeks now
and I want to get my git repositories back in sync.
2022-02-21 14:33:22 -08:00
c1cba4f287
Add replace_color. 2022-02-12 20:09:14 -08:00
797b4efd89
Let pipeable.output be a public function. 2022-02-12 20:09:14 -08:00
e34f3e6c32
Add progressbars.py.
I've been tweaking this file for weeks and I just want to publish
it now even though the code is still kind of ugly. I think the
interface is done.
2022-02-12 20:09:13 -08:00
ecd663b7e9
Some improvements to ratemeter.
threading.lock to ensure consistency
time.monotonic instead of time.time
Docstring wrapping
Remove math.ceil and round, not sure why I did that
2022-02-12 20:09:13 -08:00
f550c03c15
Replace constants IN_PIPE, OUT_PIPE with functions.
Since it's possible to monkeypatch over sys.stdout etc., it works
better to have functions instead of constants from the beginning
of runtime.
2022-02-12 20:09:12 -08:00
72efaec70c
Add niceprints.ASCII_BOX boxchars. 2022-01-19 20:57:37 -08:00
053a25cc58
Add DotDict.__iter__, yields key value pairs. 2022-01-19 20:57:04 -08:00
83a3bee53d
Update passwordy docstring formatting. 2022-01-19 20:56:40 -08:00
3a5235c636
Add --prefix, --suffix. 2022-01-19 20:29:58 -08:00
8d258241e7
Let pathclass.glob('.') return cwd.
This brings it more in line with regular glob for which glob('.') = ['.'].
2022-01-19 20:23:05 -08:00
9a0be7eda9
space message 2022-01-19 19:52:46 -08:00
bcab9b34d6
Add Path.assert_disk_space. 2022-01-19 19:23:11 -08:00
77769aa2ef
Alphabetize exceptions. 2022-01-19 18:38:05 -08:00
7fddee51df
Use sentinels for mode instead of strings. 2022-01-19 18:37:49 -08:00
0be376551f
Typecheck the numeric parameters to Ratelimiter. 2022-01-19 18:31:49 -08:00
75b095712d
Bump to version 0.0.72. 2022-01-11 19:40:23 -08:00
206e29d4bd
Fix hms command line use. 2022-01-11 19:39:55 -08:00
8b4202fe87
Always use urandom in all functions. Remove --urandom option. 2022-01-09 17:05:03 -08:00
d34103917f
Re-add the normalize_sep function, but more conservative.
Formerly I was normalizing backslash to forwardslash on unix, which is
bad. Then I removed the function because I thought normpath was the
right tool for the job. Now I'm finding a few situations I just want to
norm the sep again.
2022-01-09 16:59:09 -08:00
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
8d9416cb2f
Bump to version 0.0.71. 2021-12-23 17:08:34 -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