Skip to content

Commit

Permalink
Merge branch 'develop' into madlittlemods/17781-sliding-sync-fix-forg…
Browse files Browse the repository at this point in the history
…otten
  • Loading branch information
MadLittleMods committed Oct 17, 2024
2 parents 6bd638e + 9512b84 commit 40d2ffa
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 51 deletions.
1 change: 1 addition & 0 deletions changelog.d/17842.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix some typing issues uncovered by upgrading mypy to 1.11.x.
96 changes: 46 additions & 50 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts-dev/mypy_synapse_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def is_cacheable(
# For a type alias, check if the underlying real type is cachable.
return is_cacheable(mypy.types.get_proper_type(rt), signature, verbose)

elif isinstance(rt, UninhabitedType) and rt.is_noreturn:
elif isinstance(rt, UninhabitedType):
# There is no return value, just consider it cachable. This is only used
# in tests.
return True, None
Expand Down
4 changes: 4 additions & 0 deletions synmark/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def add_cmdline_args(cmd: List[str], args: Namespace) -> None:

if runner.args.worker:
if runner.args.log:
# sys.__stdout__ can technically be None, just exit if it's the case
if not sys.__stdout__:
exit(1)

globalLogBeginner.beginLoggingTo(
[textFileLogObserver(sys.__stdout__)], redirectStandardIO=False
)
Expand Down
3 changes: 3 additions & 0 deletions tests/media/test_oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#

import json
from typing import Any

from parameterized import parameterized

Expand Down Expand Up @@ -52,6 +53,7 @@ def parse_response(self, response: JsonDict) -> OEmbedResult:

def test_version(self) -> None:
"""Accept versions that are similar to 1.0 as a string or int (or missing)."""
version: Any
for version in ("1.0", 1.0, 1):
result = self.parse_response({"version": version})
# An empty Open Graph response is an error, ensure the URL is included.
Expand All @@ -69,6 +71,7 @@ def test_version(self) -> None:

def test_cache_age(self) -> None:
"""Ensure a cache-age is parsed properly."""
cache_age: Any
# Correct-ish cache ages are allowed.
for cache_age in ("1", 1.0, 1):
result = self.parse_response({"cache_age": cache_age})
Expand Down
2 changes: 2 additions & 0 deletions tests/push/test_push_rule_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def test_exact_event_match_boolean(self) -> None:
{"value": False},
"incorrect values should not match",
)
value: Any
for value in ("foobaz", 1, 1.1, None, [], {}):
self._assert_not_matches(
condition,
Expand Down Expand Up @@ -494,6 +495,7 @@ def test_exact_event_match_null(self) -> None:
{"value": None},
"exact value should match",
)
value: Any
for value in ("foobaz", True, False, 1, 1.1, [], {}):
self._assert_not_matches(
condition,
Expand Down

0 comments on commit 40d2ffa

Please sign in to comment.