anonymousland-synapse/synapse/events
David Robertson 796a4b7482
Prefer type(x) is int to isinstance(x, int) ()
* 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
..
__init__.py Remove redundant types from comments. () 2022-11-16 15:25:24 +00:00
builder.py Move StateFilter to synapse.types () 2022-12-12 16:19:30 +00:00
presence_router.py Implement cancellation support/protection for module callbacks () 2022-05-09 12:31:14 +01:00
snapshot.py Move StateFilter to synapse.types () 2022-12-12 16:19:30 +00:00
spamcheck.py Instrument _check_sigs_and_hash_and_fetch to trace time spent in child concurrent calls () 2022-08-23 21:53:37 -05:00
third_party_rules.py Make _get_state_map_for_room not break when room state events don't contain an event id. () 2022-07-07 08:14:32 +00:00
utils.py Add missing type hints for tests.events. () 2023-01-25 15:14:03 -05:00
validator.py Prefer type(x) is int to isinstance(x, int) () 2023-01-31 10:33:07 +00:00