mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-14 11:30:49 +00:00
mypy plugin: accept Literals in caches
This commit is contained in:
@@ -45,6 +45,7 @@ from mypy.types import (
|
||||
AnyType,
|
||||
CallableType,
|
||||
Instance,
|
||||
LiteralType,
|
||||
NoneType,
|
||||
Options,
|
||||
TupleType,
|
||||
@@ -813,6 +814,10 @@ def is_cacheable(
|
||||
if isinstance(rt, AnyType):
|
||||
return True, ("may be mutable" if verbose else None)
|
||||
|
||||
elif isinstance(rt, LiteralType):
|
||||
# Literal[True] etc
|
||||
return True, None
|
||||
|
||||
elif isinstance(rt, Instance):
|
||||
if (
|
||||
rt.type.fullname in IMMUTABLE_VALUE_TYPES
|
||||
|
||||
Reference in New Issue
Block a user