summary refs log tree commit diff
path: root/synapse/util/__init__.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request from GHSA-x345-32rc-8h85Richard van der Hoff2021-05-111-14/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests for push rule pattern matching * tests for acl pattern matching * factor out common `re.escape` * Factor out common re.compile * Factor out common anchoring code * add word_boundary support to `glob_to_regex` * Use `glob_to_regex` in push rule evaluator NB that this drops support for character classes. I don't think anyone ever used them. * Improve efficiency of globs with multiple wildcards The idea here is that we compress multiple `*` globs into a single `.*`. We also need to consider `?`, since `*?*` is as hard to implement efficiently as `**`. * add assertion on regex pattern * Fix mypy * Simplify glob_to_regex * Inline the glob_to_regex helper function Signed-off-by: Dan Callahan <danc@element.io> * Moar comments Signed-off-by: Dan Callahan <danc@element.io> Co-authored-by: Dan Callahan <danc@element.io>
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Remove frozendict_json_encoder and support frozendicts everywhereRichard van der Hoff2020-10-281-3/+21
| | | | | | Not being able to serialise `frozendicts` is fragile, and it's annoying to have to think about which serialiser you want. There's no real downside to supporting frozendicts, so let's just have one json encoder.
* Use slots in attrs classes where possible (#8296)Patrick Cloke2020-09-141-1/+1
| | | | | slots use less memory (and attribute access is faster) while slightly limiting the flexibility of the class attributes. This focuses on objects which are instantiated "often" and for short periods of time.
* Merge tag 'v1.20.0rc3' into developPatrick Cloke2020-09-111-1/+1
|\ | | | | | | | | | | | | | | | | | | Synapse 1.20.0rc3 (2020-09-11) ============================== Bugfixes -------- - Fix a bug introduced in v1.20.0rc1 where the wrong exception was raised when invalid JSON data is encountered. ([\#8291](https://github.com/matrix-org/synapse/issues/8291))
| * Fix the exception that is raised when invalid JSON is encountered. (#8291)Patrick Cloke2020-09-101-1/+1
| |
* | Directly import json from the standard library. (#8259)Patrick Cloke2020-09-081-1/+1
|/ | | | | By importing from canonicaljson the simplejson module was still being used in some situations. After this change the std lib json is consistenty used throughout Synapse.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Be stricter about JSON that is accepted by Synapse (#8106)Patrick Cloke2020-08-191-2/+12
|
* Reduce unnecessary whitespace in JSON. (#7372)David Vo2020-08-071-0/+4
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-091-1/+1
|
* move batch_iter to a separate moduleRichard van der Hoff2020-01-161-17/+0
|
* Add kwargs and docBrendan Abolivier2019-07-291-2/+4
|
* Add ability to pass arguments to looping callsBrendan Abolivier2019-07-291-2/+2
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-1/+1
|
* Improve the backwards compatibility re-exports of synapse.logging.context ↵Amber Brown2019-07-051-5/+1
| | | | | | | | (#5617) * Improve the backwards compatibility re-exports of synapse.logging.context. * reexport logformatter too
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-4/+8
|
* Fix a number of "Starting txn from sentinel context" warnings (#5605)Richard van der Hoff2019-07-031-1/+7
| | | | Fixes #5602, #5603
* Run Black. (#5482)Amber Brown2019-06-201-14/+9
|
* Anchor returned regex to start and end of stringErik Johnston2018-10-191-2/+6
|
* Add config option to control alias creationErik Johnston2018-10-191-0/+21
|
* Remove unnecessary extra function call layerErik Johnston2018-10-081-16/+13
|
* Use errback pattern and catch async failuresErik Johnston2018-10-081-14/+29
|
* Log looping call exceptionsErik Johnston2018-10-051-1/+18
| | | | | | | | If a looping call function errors, then it kills the loop entirely. Currently it throws away the exception logs, so we should make it actually log them. Fixes #3929
* run isortAmber Brown2018-07-091-0/+1
|
* Remove all global reactor imports & pass it around explicitly (#3424)Amber Brown2018-06-251-0/+3
|
* Pass around the reactor explicitly (#3385)Amber Brown2018-06-221-12/+20
|
* Add batch_iter to utilsAdrian Tschira2018-05-191-0/+18
| | | | | | | | | There's a frequent idiom I noticed where an iterable is split up into a number of chunks/batches. Unfortunately that method does not work with iterators like dict.keys() in python3. This implementation works with iterators. Signed-off-by: Adrian Tschira <nota@notafile.com>
* Use deferred.addTimeout instead of time_bound_deferredRichard van der Hoff2018-04-231-56/+0
| | | | This doesn't feel like a wheel we need to reinvent.
* fix vars named `l`Richard van der Hoff2017-10-231-3/+3
| | | | E741 says "do not use variables named ‘l’, ‘O’, or ‘I’".
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-6/+6
| | | | what could possibly go wrong
* Instantiate DeferredTimedOutError correctlyRichard van der Hoff2017-05-021-1/+1
| | | | | | Call `super` correctly, so that we correctly initialise the `errcode` field. Fixes https://github.com/matrix-org/synapse/issues/2179.
* Fix time_bound_deferred to throw the right exceptionRichard van der Hoff2017-03-231-4/+6
| | | | | | Due to a failure to instantiate DeferredTimedOutError, time_bound_deferred would throw a CancelledError when the deferred timed out, which was rather confusing.
* Correctly handle timeout errorsErik Johnston2016-12-091-1/+6
|
* Clean transactions based on time. Add HttpTransactionCache tests.Kegan Dougal2016-11-141-1/+9
|
* Use SynapseError 504 for Timeout errorsErik Johnston2016-04-151-1/+2
|
* Remove some unused functions (#711)Mark Haines2016-04-081-3/+0
| | | | | | | | * Remove some unused functions * get_room_events_stream is only used in tests * is_exclusive_room might actually be something we want
* Initial cutErik Johnston2016-02-171-1/+1
|
* Fix up logcontextsErik Johnston2016-02-081-4/+2
|
* Fix flake8 warnings for new flake8Daniel Wagner-Hall2016-02-021-1/+1
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Track the cpu used in the main thread by each logging contextMark Haines2015-12-031-2/+1
|
* Run the background updates when starting synapse.Mark Haines2015-11-101-0/+8
|
* synapse/util/__init__.py:unwrap_deferred was unusedMark Haines2015-09-221-28/+0
|
* Refactor the notifier.wait_for_events code to be clearer. Add ↵Erik Johnston2015-06-181-2/+6
| | | | _NotifierUserStream.new_listener that accpets a token to avoid races.
* Awful idea for speeding up fetching of eventsErik Johnston2015-05-141-4/+4
|
* Refactor _get_eventsErik Johnston2015-05-141-0/+28
|
* Unwrap defer.gatherResults failuresErik Johnston2015-05-121-0/+6
|
* Fix up leak. Add warnings.Erik Johnston2015-05-081-1/+2
|
* Change the way we do logging contexts so that they survive divergencesErik Johnston2015-05-081-3/+5
|
* Consume errors in time_bound_deferredErik Johnston2015-02-171-2/+0
|
* Fix so timing out connections to actually work.Erik Johnston2015-02-111-9/+43
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2015-02-111-1/+9
|\ | | | | | | timeout-federation-requests
| * Add looping_call to ClockErik Johnston2015-02-091-1/+9
| |
* | Move time_bound_deferred into ClockErik Johnston2015-02-111-1/+20
|/
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Fix pep8 codestyle warningsMark Haines2014-11-201-0/+1
|
* Sometimes there isn't a current logging contextMark Haines2014-11-191-1/+1
|
* Preserve logging context in a few more places, drop the logging context ↵Mark Haines2014-11-191-1/+6
| | | | after it has been stashed to reduce potential for confusion
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* add in whitespace after copyright statements to improve legibilityMatthew Hodgson2014-08-131-0/+1
|
* Reference Matrix Home Servermatrix.org2014-08-121-0/+40