MatrixSynapse/synapse/handlers
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
..
ui_auth
__init__.py
account.py
account_data.py
account_validity.py
admin.py
appservice.py
auth.py
cas.py
deactivate_account.py
device.py
devicemessage.py
directory.py
e2e_keys.py
e2e_room_keys.py
event_auth.py
events.py
federation.py
federation_event.py
identity.py
initial_sync.py
message.py Prefer `type(x) is int` to `isinstance(x, int)` (#14945) 2023-01-31 10:33:07 +00:00
oidc.py
pagination.py
password_policy.py
presence.py
profile.py
push_rules.py
read_marker.py
receipts.py
register.py
relations.py
room.py
room_batch.py
room_list.py
room_member.py
room_member_worker.py
room_summary.py
saml.py
search.py
send_email.py
set_password.py
sso.py
state_deltas.py
stats.py
sync.py
typing.py
user_directory.py