Skip to content
Snippets Groups Projects
Forked from Maunium / synapse
7993 commits behind the upstream repository.
  • Richard van der Hoff's avatar
    67ff7b8b
    Improve type checking in `replication.tcp.Stream` (#7291) · 67ff7b8b
    Richard van der Hoff authored
    The general idea here is to get rid of the type: ignore annotations on all of the current_token and update_function assignments, which would have caught #7290.
    
    After a bit of experimentation, it seems like the least-awful way to do this is to pass the offending functions in as parameters to the Stream constructor. Unfortunately that means that the concrete implementations no longer have the same constructor signature as Stream itself, which means that it gets hard to correctly annotate STREAMS_MAP.
    
    I've also introduced a couple of new types, to take out some duplication.
    Improve type checking in `replication.tcp.Stream` (#7291)
    Richard van der Hoff authored
    The general idea here is to get rid of the type: ignore annotations on all of the current_token and update_function assignments, which would have caught #7290.
    
    After a bit of experimentation, it seems like the least-awful way to do this is to pass the offending functions in as parameters to the Stream constructor. Unfortunately that means that the concrete implementations no longer have the same constructor signature as Stream itself, which means that it gets hard to correctly annotate STREAMS_MAP.
    
    I've also introduced a couple of new types, to take out some duplication.
_base.py 15.90 KiB