20 Commits

Author SHA1 Message Date
Toby Harradine
af096bc1cc Config locks (#2654)
* Config locks

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add locks for all_XXX

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Remove a word

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add acquire_lock kwarg for value context manager

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add towncrier entry

Signed-off-by: Toby <tobyharradine@gmail.com>

* Fix issues with `get_custom_lock` and `get_members_lock`

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-23 16:50:07 -04:00
Will
0852d1be9f
[V3 Config] Require custom group initialization before usage (#2545)
* Require custom group initialization before usage and write that data to disk

* Style

* add tests

* remove custom info update method from drivers

* clean up remnant

* Turn config objects into a singleton to deal with custom group identifiers

* Fix dumbassery

* Stupid stupid stupid
2019-04-04 21:47:08 -04:00
Toby Harradine
ce25011f0d
[Config] Cast keys to str on get/set/clear (#2217)
This is a step towards a more consistent front-end behaviour of Config, where errors are either circumvented or raised in the same way regardless of the driver being used.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-11 11:18:57 +11:00
zephyrkul
ebc657dcc6 [Config] Add Group.clear_raw method (#2178)
Adds a `clear_raw` method to Group objects, similar to the existing `get_raw` and `set_raw` methods.
Documentation included.
2018-10-05 13:03:27 +10:00
Toby Harradine
dbed24aaca
[Config] Group.__call__() has same behaviour as Group.all() (#2018)
* Make calling groups useful

This makes config.Group.__call__ effectively an alias for Group.all(),
with the added bonus of becoming a context manager.

get_raw has been updated as well to reflect the new behaviour of
__call__.

* Fix unintended side-effects of new behaviour

* Add tests

* Add test for get_raw mixing in defaults

* Another cleanup for relying on old behaviour internally

* Fix bank relying on old behaviour

* Reformat
2018-08-26 23:30:36 +10:00
Will
edadd8f2fd [V3 Config] Fix for unnecessary writes on context mgr exit (#1859)
* Fix for #1857

* And copy it so we don't have mutability issues

* Add a test
2018-06-23 12:15:22 +10:00
Tobotimus
0298b53803 [V3 JSON] Drivers deepcopy input/output data (#1855)
* [V3 JSON] Return deepcopy in JSON driver

* Add a test

* foo not bar

* Add a test for setting and then mutating

* Resolve issue for setting and mutating as well

* Reformat
2018-06-11 12:31:01 -04:00
Will
e01cdbb091 Black tests and setup.py (#1657) 2018-05-15 09:09:54 +10:00
Will
29ce2401ca [V3 Config] Fix unloading and implement singleton driver (#1458)
* Add the identifier as an initialization parameter

* Remove config object singleton and opt for a shared JSON datastore

* Fix bot unloading to deal with memory leaks

* Fix tests

* Fix clear all bug
2018-04-02 16:47:27 -08:00
Will
64af7800dc [V3 Config] Adjust functionality of get_attr (#1342)
* Intermediate commit

* Add defaulting stuff to config

* Remove set_attr in favor of set_raw

* Modify get_attr

* Fix issue with clearing data
2018-02-26 11:13:01 -09:00
Will
e13de0950c [V3 Config] Implement a true clear method (#1344)
* Add clear methods to drivers

* Update config clear methods, add to Value

* Add test
2018-02-25 21:07:28 -09:00
Will
6678b29396
[V3 Config] Fix async context manager bug and add test (#1308)
* Fix config bug and add test

* Fix the full bug

* Extra safeness
2018-02-14 19:12:13 -05:00
Tobotimus
9dbf56f942 [Config] Retrieve/save values with async context manager (#1131)
* [Config] Retrieve/save values with async context manager

* Add a little docstring

* Documentation

* Implement async with syntax in existing modules
2017-12-03 18:07:34 -09:00
Tobotimus
815678584f [V3 Config] Redesign "all_from_XXX" and "clear_all" methods (#1033)
* Added alternative to all_from_kind

* Returned dicts include default values

Also added docstrings

Also removed all_globals since it's kind of redundant and it wasn't working out for me

* Refactored clear_all

* Tests

* Tests again..

* Make all new methods coroutines
2017-10-19 23:22:58 -04:00
Will
da28630644 [Config] Modify config's all methods to provide default values (#916)
* Add in functionality for Tobotimus

* Cover all_guilds

* Make it obvious

* Fix auto rename of docstrings

* Fix downloader docs warning
2017-08-14 11:56:53 -08:00
Will
de912a3cfb [Config] Asynchronous getters (#907)
* Make config get async

* Asyncify alias

* Asyncify bank

* Asyncify cog manager

* IT BOOTS

* Asyncify core commands

* Asyncify repo manager

* Asyncify downloader

* Asyncify economy

* Asyncify alias TESTS

* Asyncify economy TESTS

* Asyncify downloader TESTS

* Asyncify config TESTS

* A bank thing

* Asyncify Bank cog

* Warning message in docs

* Update docs with await syntax

* Update docs with await syntax
2017-08-11 21:43:21 -04:00
Will
d4da9edb3e [Config] Fix 'all' handling to match docs (#889)
* Fix some stuff to match docs

* For Palm__ <3
2017-08-09 21:39:19 -04:00
Will
99bfb2fc7a [Config] Rewrite (#869) 2017-07-31 01:40:31 +02:00
Will
422bbba7f6 [Config] Fix get() functionality (#815) 2017-06-16 20:35:32 +02:00
Will
3988fbbc09 [Core] Replaced JsonDB with Config (#770) 2017-05-28 04:28:59 +02:00