Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Add type hints to matrix federation client / agent. #8806

Merged
merged 5 commits into from
Nov 25, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add additional types to the well known resolver.
  • Loading branch information
clokep committed Nov 24, 2020
commit a006ce9e0dbecbcad419c666411bfb2bccbd052d
16 changes: 8 additions & 8 deletions synapse/http/federation/well_known_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import random
import time
Expand All @@ -21,10 +20,11 @@
import attr

from twisted.internet import defer
from twisted.internet.interfaces import IReactorTime
from twisted.web.client import RedirectAgent, readBody
from twisted.web.http import stringToDatetime
from twisted.web.http_headers import Headers
from twisted.web.iweb import IResponse
from twisted.web.iweb import IAgent, IResponse

from synapse.logging.context import make_deferred_yieldable
from synapse.util import Clock, json_decoder
Expand Down Expand Up @@ -81,11 +81,11 @@ class WellKnownResolver:

def __init__(
self,
reactor,
agent,
user_agent,
well_known_cache=None,
had_well_known_cache=None,
reactor: IReactorTime,
agent: IAgent,
user_agent: bytes,
well_known_cache: Optional[TTLCache] = None,
had_well_known_cache: Optional[TTLCache] = None,
):
self._reactor = reactor
self._clock = Clock(reactor)
Expand Down Expand Up @@ -127,7 +127,7 @@ async def get_well_known(self, server_name: bytes) -> WellKnownLookupResult:
with Measure(self._clock, "get_well_known"):
result, cache_period = await self._fetch_well_known(
server_name
) # type: Tuple[Optional[bytes], float]
) # type: Optional[bytes], float

except _FetchWellKnownFailure as e:
if prev_result and e.temporary:
Expand Down