Dima Gerasimov
a843407e40
core/compat: move fromisoformat to .core.compat module
2023-11-19 23:45:08 +00:00
karlicoss
71cb66df5f
core: add helper for more_iterable to check that all types involved are hashable
...
Otherwise unique_everseen performance may degrade to quadratic rather than linear
For now hidden behind HPI_CHECK_UNIQUE_EVERSEEN flag
also switch some modules to use it
2023-10-31 01:02:17 +00:00
karlicoss
70bf51a125
core/stats: exclude contextmanagers from guess_stats
2023-10-28 00:08:32 +01:00
karlicoss
86ea605aec
core/stats: enable processing input files, report first and last filename
...
can be useful for quick investigation/testing setup
2023-10-22 00:47:36 +01:00
karlicoss
c335c0c9d8
core/stats: report datetime of first item in addition to last
...
quite useful for quickly determining time span of a data source
2023-10-22 00:47:36 +01:00
karlicoss
a60d69fb30
core/stats: get rid of duplicated keys for 'auto stats'
...
previously:
```
{'iter_data': {'iter_data': {'count': 9, 'last': datetime.datetime(2020, 1, 3, 1, 1, 1)}}}
```
after
```
{'iter_data': {'count': 9, 'last': datetime.datetime(2020, 1, 3, 1, 1, 1)}}
```
2023-10-22 00:47:36 +01:00
karlicoss
c63e80ce94
core: more consistent handling of zip archives in get_files + tests
2023-10-20 21:13:59 +01:00
karlicoss
fe26efaea8
core/kompress: move vendorized to _deprecated, use kompress library directly
2023-10-12 23:47:05 +01:00
karlicoss
68289c1be3
general: fix ignores after mypy version update
2023-10-12 23:47:05 +01:00
Dima Gerasimov
5fe21240b4
core: move mcachew into my.core.cachew; use better typing annotations (copied from cachew)
2023-06-08 01:29:49 +01:00
Dima Gerasimov
fe88380499
general: switch to using native 3.8 versions for cached_property/Literal/Protocol instead of compat
2023-05-16 01:18:30 +01:00
Dima Gerasimov
c34656e8fb
general: update mypy config, seems that logs of type: ignore aren't necessary anymore
2023-05-16 01:18:30 +01:00
Dima Gerasimov
d464b1e607
core: implement more methods for ZipPath and better support for get_files
2023-04-03 22:58:54 +01:00
Kian-Meng Ang
d2ef23fcb4
docs: fix typos
...
found via `codespell -L copie,datas,pres,fo,tooks,noo,ue,ket,frop`
2023-03-27 03:02:35 +01:00
Dima Gerasimov
7098d6831f
fix mypy in _identity
...
seems easier to just ignore considering it's "internal" function
also a couple of tests to make sure it infers types correctly
2022-10-19 00:06:23 +01:00
Dima Gerasimov
016f28250b
general: initial flake8 checks (for now manual)
...
fix fairly uncontroversial stuff in my.core like
- line spacing, which isn't too annoying (e.g. unlike many inline whitespace checks that break vertical formatting)
- unused imports/variables
- too broad except
2022-06-05 22:28:38 +01:00
Dima Gerasimov
7a1b7b1554
core/general: add assert_never + typing annotations for dataset
2022-06-03 23:49:27 +01:00
Dima Gerasimov
4e59a65f9a
core/general: move cached_property into compat, use standard implementation from python3.8
2022-05-31 14:08:50 +01:00
seanbreckenridge
0ce44bf0d1
doctor: better quick option propogation for stats ( #239 )
...
doctor: better quick option propogation for stats
* use contextmanager for quick stats instead of editing global state
directly
* send quick to lots of stat related functions, so they
could possibly be used without doctor, if someone wanted to
* if a stats function has a 'quick' kwarg, send the value
there as well
* add an option to sort locations in my.time.tz.via_location
2022-05-02 00:13:05 +01:00
Dima Gerasimov
73c9e46c4c
core: better support for compressed stuff, add .tar.gz
2022-01-27 22:58:33 +00:00
Sean Breckenridge
7493770d4d
core: remove vendorized py37 isoformat code
2022-01-27 19:25:42 +00:00
Sean Breckenridge
3f4fb64d56
core: drop py36 support, update docs for reddit ( #193 )
...
* docs: update references to my.reddit
* ci: remove 3.6, add 3.9
2022-01-27 08:26:15 +00:00
Dima Gerasimov
dd928964e6
general: fix mypy errors after mypy and pytz stubs updates
...
see 968fd6d01d/stubs/pytz/pytz/tzinfo.pyi (L6)
it says all concrete instances should not be None
2021-12-19 18:53:29 +00:00
Sean Breckenridge
821bc08a23
core/structure: help locate/extract gdpr exports ( #175 )
...
* core/structure: help locate/extract gdpr exports
* ci: add install-types to install stub packages
2021-07-08 00:44:55 +01:00
Dima Gerasimov
0517f7ffb8
core/influxdb: add main method to create influx measurement and fill with values
...
allows running something like
python3 -m my.core.influxdb populate my.zotero
2021-04-27 20:10:10 +01:00
Dima Gerasimov
393ed0d9ce
core: set _max_workers for dummy concurrent pool
2021-04-22 11:11:39 +01:00
Sean Breckenridge
fb49243005
core: add hpi query command ( #157 )
...
- 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
2021-04-06 17:19:58 +01:00
Dima Gerasimov
b306ccc839
core: add ensure_unique iterator transfromation
2021-04-02 20:09:53 +01:00
Dima Gerasimov
ad177a1ccd
my.pdfs: cleanup/refactor
...
- 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
2021-04-01 17:27:06 +01:00
Dima Gerasimov
5c38872efc
core: add DummyExecutor to make it easier to debug concurrent code with Pools
2021-04-01 17:27:06 +01:00
Sean Breckenridge
eb26cf8633
my.core.serialize: orjson with additional default and _serialize hook ( #140 )
...
basic orjson serialize, json.dumps fallback
Lots of surrounding changes from this discussion:
0593c69056
2021-03-20 00:48:03 +00:00
Dima Gerasimov
ca4d58e4e7
core: add helper to 'freeze' dataclasses, in order to derive a schema from the properties
2021-02-25 19:56:35 +00:00
Dima Gerasimov
86497f9b13
new: basic arbtt module
2021-02-25 19:56:35 +00:00
Dima Gerasimov
271cd7feef
core/cachew: use cache_dir in mcachew if it wasn't specified by the user
2021-02-21 19:51:58 +00:00
Dima Gerasimov
9afe1811a5
core/cachew: special handling for None in order to preserve cache_dir() path
...
+ add 'suffix' argument for more straighforward logic
2021-02-21 19:51:58 +00:00
Dima Gerasimov
da3c1c9b74
core/cachew: rely on ~/.cache for default cache path
...
- 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
2021-02-21 19:51:58 +00:00
Dima Gerasimov
4ad4f34cda
core: improve mypy coverage
2021-02-18 02:04:40 +00:00
Dima Gerasimov
f102101b39
core/windows: fix get_files and its tests
2021-02-16 06:40:42 +00:00
Dima Gerasimov
6239879245
core: add more tests for stat/datetime guessing
2021-02-14 16:20:38 +00:00
Dima Gerasimov
4012f9b7c2
core: more generic functions to jsonify data, rescuetime: fix influxdb filling
2021-02-14 16:20:38 +00:00
Dima Gerasimov
07f901e1e5
core: helpers for automatic dataframes from sequences of NamedTuple/dataclass
...
also use in my.rescuetime
2021-02-14 16:20:38 +00:00
Dima Gerasimov
df9a7f7390
core.pandas: add check for 'error' column + add empty one by default
2021-02-14 16:20:38 +00:00
Dima Gerasimov
ddea816a49
my.stackexchange: use proper pip package, add stat
...
+ 'anonymous' mode for stat() function
2020-12-11 07:02:16 +01:00
Dima Gerasimov
8abe66526d
my.photos: minor fixes/configcleanup + speedup
2020-11-25 04:47:30 +01:00
Dima Gerasimov
29ad315578
core/cli: some enhacements for frendlier errors/default config
...
see https://github.com/karlicoss/HPI/issues/110
2020-11-23 20:46:26 +01:00
Dima Gerasimov
ed4b6c409f
doctor & stat improvements
...
- doctor: log when there is no stats() function and suggest to use it
- check that stats() result isn't None
- warn when there is not data in the iterable
2020-11-01 02:02:43 +01:00
Dima Gerasimov
96be32aa51
mypy-friendly compat functions handling
2020-11-01 01:51:10 +01:00
Dima Gerasimov
3a9e3e080f
my.time.tz: implement different policies for localizing
2020-11-01 01:51:10 +01:00
Dima Gerasimov
15789a4149
kyhton.kompress: move to core (with a fallback, used in promnesia)
2020-10-29 03:13:18 +01:00
Dima Gerasimov
cc127f1876
kython.klogging
...
- move to core
- add a proper description why it's useful
- make default level INFO
- use HPI_LOGS variable for easier log level control (abdc6df1ea
)
2020-10-29 03:13:18 +01:00