Commit Graph

22 Commits

Author SHA1 Message Date
Mike Fährmann
b9429de774 [tests] use f-strings (##7671) 2025-08-14 10:22:42 +02:00
Mike Fährmann
e08ec7e083 update copyright notices 2025-06-13 00:03:41 +02:00
Mike Fährmann
811b665e33 remove @staticmethod decorators
There might have been a time when calling a static method was faster
than a regular method, but that is no longer the case. According to
micro-benchmarks, it is 70% slower in CPython 3.13 and it also makes
executing the code of a class definition slower.
2025-06-12 22:50:52 +02:00
Mike Fährmann
bf927cbd4f [config] fix using same key multiple times with 'apply' (#7127) 2025-03-16 19:37:04 +01:00
Mike Fährmann
80454460ce [config] support accumulating non-list values
fixes 1264fc518b
2024-11-16 21:13:57 +01:00
Mike Fährmann
9c65db2a92 consistent 'with open(…) as fp:' syntax 2024-06-14 01:22:00 +02:00
Mike Fährmann
ba062712ad [tests] '__main__' -> "__main__" 2024-02-27 02:10:05 +01:00
Mike Fährmann
dd884b02ee replace json.loads with direct calls to JSONDecoder.decode 2023-02-09 15:22:00 +01:00
Mike Fährmann
392d022b04 implement 'config.accumulate()' (#994) 2020-09-14 21:13:08 +02:00
Mike Fährmann
53cc498d9c improve config lookup when there are multiple possible locations
This specifically applies to all Mastodon extractors and all
extractors with a 'basecategory', i.e. 'booru', 'foolslide', etc.

Values inside those general config locations wouldn't be recognized
when a value with the same was set on the 'extractor' level.

For example 'extractor.mastodon.directory' should be used over
'extractor.directory' when both are set, but this was impossible
with the previous implementation.

(fixes #843)
2020-06-21 00:07:10 +02:00
Mike Fährmann
8f2c1da041 skip example config tests if files are not available (#730) 2020-05-08 22:56:00 +02:00
Mike Fährmann
5df8f2959b insert local directory into PYTHONPATH when running tests 2020-05-02 01:15:50 +02:00
Mike Fährmann
ff47641b13 test whether default/example config files contain valid JSON 2020-04-30 00:00:41 +02:00
Mike Fährmann
b5c964332b improve config.py test coverage 2019-11-25 17:20:00 +01:00
Mike Fährmann
f5604492c3 update interface of config functions 2019-11-24 00:42:28 +01:00
Mike Fährmann
176b7253a1 update function signature for config.load() 2019-03-01 14:13:34 +01:00
Mike Fährmann
b50bdbf3d7 change config specifiers in input file format
Instead of a dictionary/object, input file options are now specified
by a 'key=value' pair starting with '-' for options only applying to
the next URL or '-G' for Global options applying to all following URLs.

See the docstring of parse_inputfile() for details.

Example option specifiers:

- filename = "{id}.{extension}"
- extractor.pixiv.user.directory = ["Pixiv Users", "{user[id]}"]
-spaces="are_optional"
-G keywords = {"global": "option"}
2018-02-16 03:10:41 +01:00
Mike Fährmann
e4b3077168 improve config module
- speed improvements, especially in the 'interpolate' function
- 'interpolate' now prioritizes base-level values if they exist
  - "username" is chosen before "extractor.<category>.username"
  - -u/--username & co can now override config-file values
2017-03-27 11:59:27 +02:00
Mike Fährmann
4f123b8513 code adjustments according to pep8 2017-01-30 19:40:15 +01:00
Mike Fährmann
bea33ae9cb implement config.setdefault 2015-10-07 00:58:43 +02:00
Mike Fährmann
2026223ed1 change argument format for config-calls 2015-10-05 12:42:42 +02:00
Mike Fährmann
7ac106096f add tests for config-module 2015-10-03 20:24:35 +02:00