Commit Graph

586 Commits (1a19d608c63b0211457f99834fd077cad7379ff1)

Author SHA1 Message Date
voussoir 5ddc83e3ff
Call expanduser in pathclass init. 2022-03-23 14:37:04 -07:00
voussoir 1026d4414c
Add a calling card to @transaction for runtime determination. 2022-03-22 22:17:32 -07:00
voussoir 9c9123e2d2
Update type annotation, savepoint_id is an int. 2022-03-22 22:16:42 -07:00
voussoir a76982e581
Add type annotation sqlite3.Cursor. 2022-03-22 22:16:26 -07:00
voussoir 6da730e5a6
Add worms.id_type to improve behavior of int ids.
If the project uses numerical IDs, and processes user input from a web
request URL where everything is a string, it is tedious to convert
between str and int on the application side. If done improperly, it
messes up the cache because the int id and str id will be entered
separately. So we let the database handle the id type and raise errors
if necessary.
2022-03-21 19:41:59 -07:00
voussoir 8f2b0ebc6a
Add sqlhelpers.Inject. 2022-03-20 13:04:28 -07:00
voussoir 629594b6ae
Add SSE functions. 2022-03-20 13:01:26 -07:00
voussoir f79fcf6432
Improve flasktools.cached_endpoint.
- Store separate states for different url and param permutations.
- Add the etag_function which allows you to decide not to run the
  function in the first place, instead of running it and seeing
  that its return value matches the previous value.
2022-03-20 13:00:46 -07:00
voussoir 4b0d50c193
Add isinstance check for sqlite3.Row. 2022-03-19 20:03:50 -07:00
voussoir 465f22fedb
Instead of checking get_tables, just check the COLUMN_INDEX.
This reduces the number of frivolous sql queries we make, since
the index contians all the tables anyway. The side effect is that
the function won't acknowledge tables created during the run time,
which I kind of think is a good thing since it reduces accident
surface area to the tables outlined by the programmer during init.
2022-03-19 20:03:26 -07:00
voussoir 59df12a23f
Simplify worms.get_tables with select_column. 2022-03-19 19:51:25 -07:00
voussoir 6867fb3011
Remove normalize_db_row, just use row_factory = Row. 2022-03-15 18:17:23 -07:00
voussoir ac647a37a8
Let comma_space_split return empty list if string is all blank. 2022-03-15 13:37:57 -07:00
voussoir 5f5f41885e
Move get_tables into alphabetical order. 2022-03-15 13:37:28 -07:00
voussoir 05b009a7c6
Escape backslashes when stringifying. 2022-03-15 13:29:14 -07:00
voussoir ee4914fa63
Add self.last_commit_id to help application know state of the world.
This allows caching layers to make better decisions about when to
reload data.
2022-03-14 15:37:46 -07:00
voussoir 9b2ad4d027
Let delete, insert, update return the self.execute return value. 2022-03-14 15:35:51 -07:00
voussoir 512f1591ef
Add select_one_value. 2022-03-14 15:34:41 -07:00
voussoir 38f9d8046c
Add worms.raise_without_rollback. 2022-03-14 15:32:11 -07:00
voussoir 0fd09984bc
Let object tokens repr themselves in the diagram. 2022-03-14 15:30:46 -07:00
voussoir ed952ffdda
Use getrandbits instead of passwordy strings for savepoint ids.
Better perf, why not.
2022-03-10 11:55:07 -08:00
voussoir d17a79c128
Store into cache using instance.id instead of requested id.
This helps ensure that the keys of the cache are the true and correct
data type and not just whatever the user provided. SQLite coerces
strings and ints.
2022-03-10 11:24:52 -08:00
voussoir c7f4d1dbf9
Respect the user's NO_COLOR environment variable. 2022-03-10 11:19:36 -08:00
voussoir 2a6bc2a306
Include digits by default. 2022-03-10 11:18:21 -08:00
voussoir 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
voussoir 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
voussoir c1cba4f287
Add replace_color. 2022-02-12 20:09:14 -08:00
voussoir 797b4efd89
Let pipeable.output be a public function. 2022-02-12 20:09:14 -08:00
voussoir 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
voussoir 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
voussoir 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
voussoir 72efaec70c
Add niceprints.ASCII_BOX boxchars. 2022-01-19 20:57:37 -08:00
voussoir 053a25cc58
Add DotDict.__iter__, yields key value pairs. 2022-01-19 20:57:04 -08:00
voussoir 83a3bee53d
Update passwordy docstring formatting. 2022-01-19 20:56:40 -08:00
voussoir 3a5235c636
Add --prefix, --suffix. 2022-01-19 20:29:58 -08:00
voussoir 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
voussoir 9a0be7eda9
space message 2022-01-19 19:52:46 -08:00
voussoir bcab9b34d6
Add Path.assert_disk_space. 2022-01-19 19:23:11 -08:00
voussoir 77769aa2ef
Alphabetize exceptions. 2022-01-19 18:38:05 -08:00
voussoir 7fddee51df
Use sentinels for mode instead of strings. 2022-01-19 18:37:49 -08:00
voussoir 0be376551f
Typecheck the numeric parameters to Ratelimiter. 2022-01-19 18:31:49 -08:00
voussoir 75b095712d
Bump to version 0.0.72. 2022-01-11 19:40:23 -08:00
voussoir 206e29d4bd
Fix hms command line use. 2022-01-11 19:39:55 -08:00
voussoir 8b4202fe87
Always use urandom in all functions. Remove --urandom option. 2022-01-09 17:05:03 -08:00
voussoir 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
voussoir 4b8ae01786
Add starting_balance parameter, and by default make it nonzero. 2022-01-09 16:55:53 -08:00
voussoir e5114ecf2c
Alphabetize docstring. 2022-01-09 16:55:15 -08:00
voussoir c914d4236e
Make only_shrink a keyword-only argument. 2022-01-09 16:54:15 -08:00
voussoir c1886ba536
Add OVERWRITE_ sentinels for different overwrite techniques. 2022-01-04 13:07:16 -08:00
voussoir 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