synapse-product/synapse/storage
David Robertson 796a4b7482
Prefer type(x) is int to isinstance(x, int) (#14945)
* Perfer `type(x) is int` to `isinstance(x, int)`

This covered all additional instances I could see where `x` was
user-controlled.
The remaining cases are

```
$ rg -s 'isinstance.*[^_]int'
tests/replication/_base.py
576:        if isinstance(obj, int):

synapse/util/caches/stream_change_cache.py
136:        assert isinstance(stream_pos, int)
214:        assert isinstance(stream_pos, int)
246:        assert isinstance(stream_pos, int)
267:        assert isinstance(stream_pos, int)

synapse/replication/tcp/external_cache.py
133:        if isinstance(result, int):

synapse/metrics/__init__.py
100:        if isinstance(calls, (int, float)):

synapse/handlers/appservice.py
262:        assert isinstance(new_token, int)

synapse/config/_util.py
62:        if isinstance(p, int):
```

which cover metrics, logic related to `jsonschema`, and replication and
data streams. AFAICS these are all internal to Synapse

* Changelog
2023-01-31 10:33:07 +00:00
..
controllers Faster joins: Update room stats and the user directory on workers when finishing join (#14874) 2023-01-23 10:31:36 +00:00
databases Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
engines Make sqlite database migrations transactional again (#14910) 2023-01-25 13:38:53 +00:00
schema Drop unused table presence (#14825) 2023-01-13 14:17:03 +00:00
util Always notify replication when a stream advances (#14877) 2023-01-20 18:02:18 +00:00
__init__.py Rename storage classes (#12913) 2022-05-31 12:17:50 +00:00
_base.py Update all stream IDs after processing replication rows (#14723) 2023-01-04 11:49:26 +00:00
background_updates.py Handle half-created indices in receipts index background update (#14650) 2022-12-09 23:02:11 +00:00
database.py Batch look-ups to see if rooms are partial stated. (#14917) 2023-01-26 17:15:36 +00:00
keys.py Use auto_attribs/native type hints for attrs classes. (#11692) 2022-01-13 13:49:28 +00:00
prepare_database.py Snapshot schema 72 (#13873) 2022-09-26 18:28:32 +01:00
push_rule.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
roommember.py Do not include rooms with an unknown room version in a sync response. (#10644) 2021-08-19 11:12:55 -04:00
types.py Tidy up and type-hint the database engine modules (#12734) 2022-05-17 00:34:38 +01:00