synapse-product/synapse/rest/media/v1
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 Relax ignore-missing-imports for modules that have stubs now and update mypy (#11006) 2021-10-08 14:49:41 +01:00
_base.py Fix bug where we wedge media plugins if clients disconnect early (#13660) 2022-08-30 12:17:48 +01:00
config_resource.py Use direct references for configuration variables (part 5). (#10897) 2021-09-24 07:25:21 -04:00
download_resource.py Add Cross-Origin-Resource-Policy header to thumbnail and download media endpoints (#12944) 2022-06-27 14:44:05 +01:00
filepath.py Fix media repository failing when media store path contains symlinks (#11446) 2021-12-02 16:05:24 +00:00
media_repository.py Respond with proper error responses on unknown paths. (#14621) 2022-12-08 11:37:05 -05:00
media_storage.py Uniformize spam-checker API, part 5: expand other spam-checker callbacks to return Tuple[Codes, dict] (#13044) 2022-07-11 16:52:10 +00:00
oembed.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
preview_html.py fix linting error from the 1.61.1 main -> develop merge 2022-06-28 16:47:04 +01:00
preview_url_resource.py Do not wait for background updates to complete do expire URL cache. (#13657) 2022-08-30 07:15:54 -04:00
storage_provider.py Use ParamSpec in type hints for synapse.logging.context (#12150) 2022-03-08 15:58:14 +00:00
thumbnail_resource.py Provide more info why we don't have any thumbnails to serve (#13038) 2022-07-15 11:42:21 -05:00
thumbnailer.py Prefer type(x) is int to isinstance(x, int) (#14945) 2023-01-31 10:33:07 +00:00
upload_resource.py Add a MXCUri class to make working with mxc uri's easier. (#13162) 2022-09-15 12:57:16 +00:00