forked-synapse/synapse/rest/admin
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
..
__init__.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
_base.py synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID (#13024) 2022-08-22 14:17:59 +01:00
background_updates.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
devices.py Add a type hint for get_device_handler() and fix incorrect types. (#14055) 2022-11-22 14:08:04 -05:00
event_reports.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
federation.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
media.py synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID (#13024) 2022-08-22 14:17:59 +01:00
registration_tokens.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
rooms.py Move StateFilter to synapse.types (#14668) 2022-12-12 16:19:30 +00:00
server_notice_servlet.py Clean up synapse.rest.admin (#11535) 2021-12-08 16:59:40 +00:00
statistics.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
username_available.py Clean up synapse.rest.admin (#11535) 2021-12-08 16:59:40 +00:00
users.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00