prior to this change it would error with
@dataclass
> class pushshift_config(uconfig.pushshift):
E AttributeError: type object 'test_config' has no attribute 'pushshift'
* initial pushshift/rexport merge implementation, using id for merging
* smarter module deprecation warning using regex
* add `RedditBase` from promnesia
* `import_source` helper for gracefully handing mixin data sources
* my.core.serialize: simplejson support, more types
I added a couple extra checks to the default function,
serializing datetime, dates and dataclasses (incase
orjson isn't installed)
(copied from below)
if orjson couldn't be imported, try simplejson
This is included for compatibility reasons because orjson
is rust-based and compiling on rarer architectures may not work
out of the box
as an example, I've been having issues getting it to install
on my phone (termux/android)
unlike the builtin JSON modue which serializes NamedTuples as lists
(even if you provide a default function), simplejson correctly
serializes namedtuples to dictionaries
this just gives another option to people, simplejson is pure python
so no one should have issues with that. orjson is still way faster,
so still preferable if its easy and theres a precompiled build
for your architecture (which there typically is)
If you're ever running this with simplejson installed and not orjson,
its pretty easy to tell as the JSON styling is different; orjson has
no spaces between tokens, simplejson puts spaces between tokens. e.g.
simplejson: {"a": 5, "b": 10}
orjson: {"a":5,"b":10}
- restructure query code for cli, some test fixes
- initial query_range implementation
refactored functions in query some more
to allow re-use in range_range, select()
pretty much just calls out to a bunch
of handlers now
everything is backwards-compatible with the previous
interface, the only minor changes were to the doctor cmd
which can now accept more than one item to run,
and the --skip-config-check to skip the config_ok
check if the user specifies to
added a test using click.testing.CliRunner (tests
the CLI in an isolated environment), though
additional tests which aren't testing the CLI
itself (parsing arguments or decorator behaviour)
can just call the functions themselves, as they
no longer accept a argparser.Namespace and instead
accept the direct arguments
- modernize:
- add REQUIRES spec for pdfannots library
- config dataclass/config stub
- stats function
- absolute my.core imports in anticipation of splitting core
- use 'paths' instead of 'roots' (better reflects the semantics), use get_files
backward compatible via config migration
- properly run tests/mypy
this fixes two distinct mypy errors
one where NamedTuple/dataclassees can't be
defined locally
https://github.com/python/mypy/issues/7281
which happens when you run mypy like
mypy -p my.core on warm cache
the second error is the core/types.py file shadowing the
stdlib types module
addresses https://github.com/karlicoss/HPI/issues/103
for now via experimental time.tz.force_abbreviations config variable
not sure if this whole things is doomed to be resolved properly
- rely on appdirs for default cache path instead of hardcoded /var/tmp/cachew
technically backwards incompatible, but no action needed
you might want to clean /var/tmp/cachew after updating
- use default cache path (e.g. ~/.cache) by default
see https://github.com/ActiveState/appdirs#some-example-output for more info
*warning*: things will be cached by default now (used to be uncached before)
- treat cache_dir = None in the config
*warning*: kind of backwards incompatible.. but again nothing disasterous