Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
d84bdfe5
Unverified
Commit
d84bdfe5
authored
4 years ago
by
Richard van der Hoff
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
mypy for synapse.http.site (#7553)
parent
66a564c8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/7553.misc
+1
-0
1 addition, 0 deletions
changelog.d/7553.misc
synapse/http/site.py
+6
-3
6 additions, 3 deletions
synapse/http/site.py
tox.ini
+1
-0
1 addition, 0 deletions
tox.ini
with
8 additions
and
3 deletions
changelog.d/7553.misc
0 → 100644
+
1
−
0
View file @
d84bdfe5
Include `synapse.http.site` in type checking.
This diff is collapsed.
Click to expand it.
synapse/http/site.py
+
6
−
3
View file @
d84bdfe5
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
import
contextlib
import
contextlib
import
logging
import
logging
import
time
import
time
from
typing
import
Optional
from
twisted.python.failure
import
Failure
from
twisted.python.failure
import
Failure
from
twisted.web.server
import
Request
,
Site
from
twisted.web.server
import
Request
,
Site
...
@@ -45,7 +46,7 @@ class SynapseRequest(Request):
...
@@ -45,7 +46,7 @@ class SynapseRequest(Request):
request even after the client has disconnected.
request even after the client has disconnected.
Attributes:
Attributes:
logcontext
(LoggingContext)
: the log context for this request
logcontext: the log context for this request
"""
"""
def
__init__
(
self
,
channel
,
*
args
,
**
kw
):
def
__init__
(
self
,
channel
,
*
args
,
**
kw
):
...
@@ -53,10 +54,10 @@ class SynapseRequest(Request):
...
@@ -53,10 +54,10 @@ class SynapseRequest(Request):
self
.
site
=
channel
.
site
self
.
site
=
channel
.
site
self
.
_channel
=
channel
# this is used by the tests
self
.
_channel
=
channel
# this is used by the tests
self
.
authenticated_entity
=
None
self
.
authenticated_entity
=
None
self
.
start_time
=
0
self
.
start_time
=
0
.0
# we can't yet create the logcontext, as we don't know the method.
# we can't yet create the logcontext, as we don't know the method.
self
.
logcontext
=
None
self
.
logcontext
=
None
# type: Optional[LoggingContext]
global
_next_request_seq
global
_next_request_seq
self
.
request_seq
=
_next_request_seq
self
.
request_seq
=
_next_request_seq
...
@@ -182,6 +183,7 @@ class SynapseRequest(Request):
...
@@ -182,6 +183,7 @@ class SynapseRequest(Request):
self
.
finish_time
=
time
.
time
()
self
.
finish_time
=
time
.
time
()
Request
.
finish
(
self
)
Request
.
finish
(
self
)
if
not
self
.
_is_processing
:
if
not
self
.
_is_processing
:
assert
self
.
logcontext
is
not
None
with
PreserveLoggingContext
(
self
.
logcontext
):
with
PreserveLoggingContext
(
self
.
logcontext
):
self
.
_finished_processing
()
self
.
_finished_processing
()
...
@@ -249,6 +251,7 @@ class SynapseRequest(Request):
...
@@ -249,6 +251,7 @@ class SynapseRequest(Request):
def
_finished_processing
(
self
):
def
_finished_processing
(
self
):
"""
Log the completion of this request and update the metrics
"""
Log the completion of this request and update the metrics
"""
"""
assert
self
.
logcontext
is
not
None
usage
=
self
.
logcontext
.
get_resource_usage
()
usage
=
self
.
logcontext
.
get_resource_usage
()
if
self
.
_processing_finished_time
is
None
:
if
self
.
_processing_finished_time
is
None
:
...
...
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
0
View file @
d84bdfe5
...
@@ -193,6 +193,7 @@ commands = mypy \
...
@@ -193,6 +193,7 @@ commands = mypy \
synapse/handlers/saml_handler.py
\
synapse/handlers/saml_handler.py
\
synapse/handlers/sync.py
\
synapse/handlers/sync.py
\
synapse/handlers/ui_auth
\
synapse/handlers/ui_auth
\
synapse/http/site.py
\
synapse/logging/
\
synapse/logging/
\
synapse/metrics
\
synapse/metrics
\
synapse/module_api
\
synapse/module_api
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment