Ethan Dalool
f897abce11
Simplify this regex, remove unnecessary capture group.
2020-03-12 14:02:25 -07:00
Ethan Dalool
9abf74cb9b
Set decimal_places to 0 when result is in bytes.
...
So that you get "100 b" instead of "100.000 b".
2020-03-12 14:00:38 -07:00
Ethan Dalool
169c944c38
Add easy mains suitable for most simple use cases.
2020-03-10 22:40:12 -07:00
Ethan Dalool
6eb43fb69d
Rename betterhelp decorator to single_betterhelp, organize funcs.
2020-03-10 22:34:53 -07:00
Ethan Dalool
0368bfe87c
Fix DotDict instantiation when calling DD(some_dict).
2020-03-10 21:04:49 -07:00
Ethan Dalool
8245e31036
Don't show the _DotDict__default attribute in str.
2020-03-10 21:04:14 -07:00
Ethan Dalool
895ae3265d
Add a small comment to dotdict.
2020-03-03 01:57:50 -08:00
Ethan Dalool
4a0c0f4b48
Rename clear_done_and_start_jobs to start.
...
Originally the long name was to make it super clear that by
starting the queue you are going to lose whatever is in pool.jobs.
But then _jobs became private so the end user shouldn't be
touching that anyway. So we're free to make the public interface
simpler and just call it start.
2020-03-03 01:57:32 -08:00
Ethan Dalool
22321162f4
Remove scrap comments.
2020-03-03 01:55:54 -08:00
Ethan Dalool
46e6e82fa0
Make running_count and unfinished_count @property.
2020-03-03 01:55:22 -08:00
Ethan Dalool
13f19719b2
Add Pathclass.touch.
2020-03-02 17:46:19 -08:00
Ethan Dalool
35eec077ed
Add bencode.py.
2020-02-28 15:34:49 -08:00
Ethan Dalool
011e844d4d
Compare os.path.getsize before even opening handles.
2020-02-25 13:10:25 -08:00
Ethan Dalool
64bcb8167c
Indicate hash alg in quickid, but only md5 for now.
2020-02-25 13:10:02 -08:00
Ethan Dalool
ebf1c86a9f
Rename equal -> equal_handle, quickid -> quickid_handle.
...
It's too easy to forget if the plain equal/quickid names refer
to functions that take path arguments or handle arguments.
2020-02-25 10:42:05 -08:00
Ethan Dalool
b0c33b8137
Nevermind about sqlparse, too slow for my taste at the moment.
...
This was adding about 100ms to my start times for Etiquette,
which is too high as I'm trying to make Etiquette more cli friendly.
2020-02-25 10:41:13 -08:00
Ethan Dalool
104fdf637c
Oops, add missing import sys.
2020-02-25 10:39:30 -08:00
Ethan Dalool
c22bcd290f
Add pathclass.assert_exists and assert_not_exists.
2020-02-19 16:22:22 -08:00
Ethan Dalool
e334396d56
Add dotdict.py.
2020-02-19 13:11:26 -08:00
Ethan Dalool
b66a89268b
Use sqlparse to strip comments before finding columns.
2020-02-19 13:06:57 -08:00
Ethan Dalool
f7e314f392
Replace some % formatters with fstrings.
2020-02-18 00:42:33 -08:00
Ethan Dalool
7c0f3979a4
Add a parent SpinalException class.
2020-02-18 00:23:57 -08:00
Ethan Dalool
ef89ba67c2
Rename hash_file's callback to callback_progress.
2020-02-18 00:20:51 -08:00
Ethan Dalool
edd2ee716b
Split file hashing code into own function hash_file.
2020-02-18 00:17:38 -08:00
Ethan Dalool
1976ccb843
Let known_size checking of verify_hash be optional.
2020-02-18 00:09:15 -08:00
Ethan Dalool
df9b829346
Replace some % formatters with fstrings.
2020-02-18 00:06:26 -08:00
Ethan Dalool
807470b9a2
Remove spinal.is_subfolder function. Pathclass has in operator.
2020-02-17 23:50:05 -08:00
Ethan Dalool
7713e735cc
Remove the version number from bytestring.
...
It used to be a separate module, now it's in voussoirkit.
2020-02-17 23:42:07 -08:00
Ethan Dalool
d3d4eae8f6
Improve ratelimiter docstrings.
2020-02-17 23:40:42 -08:00
Ethan Dalool
941b9b5350
Add a lock to make Ratelimiter thread-safe.
2020-02-17 23:39:43 -08:00
Ethan Dalool
9b8b0b6339
Replace else-if with elif.
2020-02-17 23:08:35 -08:00
Ethan Dalool
1d0f96a966
Fix typo succesful -> successful.
2020-02-17 23:01:15 -08:00
Ethan Dalool
e5b07cd72d
Add some comments to pipeable.
2020-02-17 22:58:26 -08:00
Ethan Dalool
560b918815
Remove this unused argv function.
2020-02-17 22:57:20 -08:00
Ethan Dalool
267ae16c5d
Add a parent PipeableException class.
2020-02-17 22:56:39 -08:00
Ethan Dalool
eb3698637f
Use SystemExit instead of sys.exit, like my other programs.
2020-02-17 22:56:19 -08:00
Ethan Dalool
4890129360
Add argument stop_event to safely finish & quit a copy thread.
2020-02-15 18:00:09 -08:00
Ethan Dalool
64d0968040
Use with statement for _job_manager_lock.
2020-02-12 19:17:49 -08:00
Ethan Dalool
f6872e77cf
Make job._joinme_lock private to discourage outside editing.
2020-02-12 19:12:12 -08:00
Ethan Dalool
bf5d621dd3
Make pool._job_manager_lock private to discourage outside editing.
2020-02-12 19:11:55 -08:00
Ethan Dalool
7041448c82
Make pool._jobs private to discourage outside editing.
2020-02-12 19:11:24 -08:00
Ethan Dalool
1921e62011
Add method add_many for batch creation of jobs.
2020-02-12 19:06:20 -08:00
Ethan Dalool
7de2833df9
Make the job's thread private and toss it after it's done.
2020-02-12 17:30:23 -08:00
Ethan Dalool
b7a2c3b19b
Simplify pool.join logic by just calling each job's join.
2020-02-12 17:29:29 -08:00
Ethan Dalool
a1f26200fa
Add the ability to pause the threadpool.
2020-02-12 16:56:07 -08:00
Ethan Dalool
630159768d
Use slice assignment instead of list.remove for clearing jobs.
2020-02-12 16:53:52 -08:00
Ethan Dalool
87a3002351
Add threadpool.py.
2020-02-11 17:07:00 -08:00
Ethan Dalool
eef6bf5175
Add sentinel.py.
2020-02-11 17:06:42 -08:00
Ethan Dalool
2add4e4ec1
Add helper function september_now so you can skip the now() call.
...
Especially so outsiders don't have to write the long call
eternalseptember.september_string(eternalseptember.now(), ...) if
they don't have their own now function.
2020-02-11 17:06:35 -08:00
Ethan Dalool
beaa7a47e1
Rename this variable strftime -> strf.
2020-02-11 17:05:05 -08:00
Ethan Dalool
8a3e823a2e
Update ifmain to my standard format.
2020-02-11 17:03:26 -08:00
Ethan Dalool
0e92201e06
Add getpermission.py.
2020-02-09 11:54:28 -08:00
Ethan Dalool
6691722e7c
main should return args.func(args) value.
2020-02-08 17:19:54 -08:00
Ethan Dalool
87ab04abab
Add support for parsers that can be used bare, no required args.
2020-02-07 12:33:46 -08:00
Ethan Dalool
abe73ae24d
Add extract_table_column_map and reverse_table_column_map.
2020-02-06 20:18:42 -08:00
Ethan Dalool
593ff020dc
Add docstring to hex_byte.
2020-02-06 20:18:09 -08:00
Ethan Dalool
6cac1d5a25
Show all missing columns when raising the missing error.
2020-02-06 20:17:49 -08:00
Ethan Dalool
8238481262
Fix == between two Extensions.
2020-02-06 11:52:18 -08:00
Ethan Dalool
1707b40292
Add imagetools.py.
2020-02-04 19:26:12 -08:00
Ethan Dalool
2dad632122
If one handle gets permissionerror, close other one before return.
2020-02-03 19:29:27 -08:00
Ethan Dalool
6a63454f62
Fix exclude_directories not being used because if yield_dirs.
2020-02-03 16:43:39 -08:00
Ethan Dalool
0cff7b8734
Fix directories yielded twice, once as current and once as child.
2020-02-01 16:20:40 -08:00
Ethan Dalool
0cb646fda0
Appease some flake8 linting.
2020-01-31 20:53:29 -08:00
Ethan Dalool
3ff49e1a44
Improve spinal performance with os.walk, sacrificing breadth first.
...
Previously, os.path.isdir was one of the biggest time sinks in spinal.
Switching from my custom code to os.walk, thanks to its use of scandir,
saves a lot of time. For searching my 2TB drive with a hot cache, time
shrank from 70s to 35s.
However, os.walk doesn't support breadth first search, so that's gone
unless I reimplement os.walk myself to support it.
2020-01-31 20:25:47 -08:00
Ethan Dalool
0d6e5d4a13
Let subparser_betterhelp inspect parser for aliases.
2020-01-30 19:29:39 -08:00
Ethan Dalool
31048fc89a
Add functools.wraps.
2020-01-30 19:01:31 -08:00
Ethan Dalool
22febf2ef7
Add docstring to add_previews.
2020-01-30 19:00:22 -08:00
Ethan Dalool
35e0527222
Improve these variable names for clarity.
2020-01-30 18:54:41 -08:00
Ethan Dalool
895a223359
Add docstring to docstring_preview.
2020-01-30 18:54:25 -08:00
Ethan Dalool
0ccd269cc2
Strip resultant preview, let the caller organize whitespace.
2020-01-30 18:51:43 -08:00
Ethan Dalool
73483838c9
Remove bespoke indent function. Honestly just use textwrap.
2020-01-30 18:48:10 -08:00
Ethan Dalool
dc64fc3c47
Move helpstrings to global constant.
2020-01-30 18:46:47 -08:00
Ethan Dalool
f599d7e394
Match Python glob's argument signature.
2020-01-28 17:40:30 -08:00
Ethan Dalool
2af2389b8d
Add winglob.fnmatch.
2020-01-28 17:35:49 -08:00
Ethan Dalool
b88450b567
Add pathclass.Extension class to enrich extension operations.
...
I often found myself writing code like if a.extension == 'png' and
trying to remember if I'm supposed to compare against 'png' or '.png',
and then it would trip up on files like A.PNG because I forgot to
lower() it.
So this class handles all that for you. You can == against it and it
will use os.path.normcase to give you OS-appropriate case sens,
and == works whether you include the dot or not. Then you can use
ext.with_dot or ext.no_dot to get reliably dotted strings.
2020-01-27 21:33:09 -08:00
Ethan Dalool
b13f93c006
Rearrange and somewhat simplify passwordy main.
2020-01-21 17:46:25 -08:00
Ethan Dalool
e6350f05d0
Add function urandom_hex to passwordy.
2020-01-21 17:45:34 -08:00
Ethan Dalool
751ab5eaac
Add method spawn that inherits force_sep.
...
I am considering some other instance attributes similar to force_sep.
And since these need to be carried over into newly spawned Paths,
I want to consolidate that into a single method so I don't have
to risk forgetting it on a new object.
2020-01-20 21:52:40 -08:00
Ethan Dalool
5e397b1928
Simplify normalize_sep.
2020-01-20 21:49:14 -08:00
Ethan Dalool
af1538a139
Tighten the regex for bare drives.
2020-01-20 21:29:33 -08:00
Ethan Dalool
b4d3ac87de
Avoid winshell import error for linux.
2020-01-19 21:00:16 -08:00
Ethan Dalool
adaa65a9a7
Lowercase before checking .lnk extension.
2020-01-15 22:35:29 -08:00
Ethan Dalool
75b95f0259
Add winwhich.py.
2020-01-11 01:39:20 -08:00
Ethan Dalool
e3f080b74f
Update winglob module docstring.
2020-01-11 01:37:33 -08:00
Ethan Dalool
efbc1c44bb
Add hms.py.
2020-01-06 22:18:50 -08:00
Ethan Dalool
b0b0464fdc
Add winglob.py.
2020-01-05 23:28:53 -08:00
Ethan Dalool
6faab40fb2
Let chunk_size be an argument to override global default.
2020-01-05 21:31:19 -08:00
Ethan Dalool
c33d16bff0
Replace calls to str_to_fp with pathclass.Path.
2020-01-05 21:29:27 -08:00
Ethan Dalool
76abee4607
Add newline to passwordy.
2020-01-05 21:24:43 -08:00
Ethan Dalool
07da8dd413
Add betterhelp.py
2019-08-06 23:42:04 -07:00
Ethan Dalool
b0ed32a1d5
Add Path.dot_extension property.
2019-08-05 17:34:17 -07:00
Ethan Dalool
452ad7f937
Add force_sep attribute.
2019-08-03 01:01:00 -07:00
Ethan Dalool
85572ba406
Add parameter simple to remove .\ from relative path.
2019-08-01 08:58:13 -07:00
Ethan Dalool
d9d10a843e
Fix relative backsteps.
2019-08-01 08:57:18 -07:00
Ethan Dalool
6a34c8eae9
Add method Path.add_extension.
2019-08-01 08:47:27 -07:00
Ethan Dalool
b8aaecd15f
Move case correction to after self==other check.
2019-08-01 08:47:04 -07:00
Ethan Dalool
e478aca497
Improve Path.__contains__ check.
2019-08-01 08:46:37 -07:00
Ethan Dalool
8ad50ca714
Add pipeable to voussoirkit.
2019-06-11 22:45:04 -07:00
Ethan Dalool
d71fc60862
Fix a bug in pathclass.Path.relative_path when cwd is root.
2019-02-17 23:43:33 -08:00
Ethan Dalool
2e5a71c765
Define listify seperately so you can call with any iterable.
...
The literal function will still be a bit more strict on the types
it accepts, but if you have something that you know is okay
to iterate you can call listify directly.
2019-01-01 18:01:37 -08:00
Ethan Dalool
fb2de5746c
Add function sqlhelpers.literal.
2019-01-01 17:43:56 -08:00
Ethan Dalool
b4b51e3604
Initial migratory commit.
2018-12-17 22:10:00 -08:00