forked-synapse/synapse/rest
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
..
admin Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
client Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
consent Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
key Use servlets for /key/ endpoints. (#14229) 2022-10-20 11:32:47 -04:00
media Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
synapse Support OIDC backchannel logouts (#11414) 2022-10-31 13:07:30 -04:00
__init__.py Use ClientRestResource on both the main process and workers. (#14528) 2022-12-02 13:10:05 -05:00
health.py Add missing type hints to non-client REST servlets. (#10817) 2021-09-15 08:45:32 -04:00
models.py Use Pydantic to systematically validate a first batch of endpoints in synapse.rest.client.account. (#13188) 2022-08-15 19:05:57 +00:00
well_known.py Implementation of HTTP 307 response for MSC3886 POST endpoint (#14018) 2022-10-18 15:52:25 +00:00