anonymousland-synapse/synapse/federation
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
..
sender Improve logging and opentracing for to-device message handling (#14598) 2022-12-06 09:52:55 +00:00
transport Bump the client-side timeout for /state (#14912) 2023-01-25 16:11:06 +00:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
federation_base.py Track when the pulled event signature fails (#13815) 2022-10-03 14:53:29 -05:00
federation_client.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
federation_server.py Also use stable name in SendJoinResponse struct (#14841) 2023-01-16 12:40:25 +00:00
persistence.py Remove log_function and its uses (#11761) 2022-01-18 13:06:04 +00:00
send_queue.py Spread out sending device lists to remote hosts (#12132) 2022-03-04 11:48:15 +00:00
units.py Convert Transaction and Edu object to attrs (#10542) 2021-08-06 09:39:59 -04:00