Dima Gerasimov
770dba5506
core.common: move away import related stuff to my.core.utils.imports
...
moving without backward compatibility, since it's extremely unlikely they are used for any external modules
in fact, unclear if these methods still have much value at all, but keeping for now just in case
2024-08-16 10:22:29 +01:00
Dima Gerasimov
66c08a6c80
core.common: move listify to core.utils.itertools, use better typing annotations for it
...
also some minor refactoring of my.rss
2024-08-16 10:22:29 +01:00
Dima Gerasimov
c64d7f5b67
core: cleanup itertool style helpers
...
- deprecate group_by_key, should use itertool.bucket instead
- move make_dict and ensure_unique to my.core.utils.itertools
2024-08-16 10:22:29 +01:00
Dima Gerasimov
973c4205df
core: cleanup deprecations, exclude from type checking and show runtime warnings
...
among affected things:
- core.common.assert_never
- core.common.cproperty
- core.common.isoparse
- core.common.mcachew
- core.common.the
- core.common.tzdatetime
- core.compat.sqlite_backup
2024-08-16 10:22:29 +01:00
Dima Gerasimov
a7439c7846
general: move assert_never to my.core.compat as it's in stdlib from 3.11
...
rely on typing-extensions for fallback
introducing typing-extensions dependency without fallback, should be ok since it's in the top 10 of popular packages
2024-08-16 10:22:29 +01:00
Dima Gerasimov
069264ce52
core.common: get rid of deprecated utcfromtimestamp
2024-08-10 17:46:30 +01:00
Dima Gerasimov
0e6dd32afe
ci: minor fixes after mypy update
2024-08-03 16:18:32 +01:00
karlicoss
51209c547e
my.twitter.android: refactor into a proper module
...
for now only extracting bookmarks, will use it for some time and see how it goes
2023-12-24 00:49:07 +00:00
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