Skip to content

Commit

Permalink
com2ann: Convert Python type comments to type hints (#6352)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Apr 1, 2022
1 parent 478e6a6 commit 7f4446b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion openlibrary/plugins/openlibrary/sentry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Optional

import infogami
from infogami.utils import delegate
from openlibrary.utils.sentry import Sentry

sentry = None # type: Sentry
sentry: Optional[Sentry] = None


def setup():
Expand Down
5 changes: 3 additions & 2 deletions openlibrary/plugins/openlibrary/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import time
import traceback
from typing import Optional

from infogami.utils.app import find_page, find_view, find_mode
from openlibrary.core import stats as graphite_stats
Expand Down Expand Up @@ -177,8 +178,8 @@ def _get_top_level_path_for_metric(full_path):

class GraphiteRequestStats:
def __init__(self):
self.start = None # type: float
self.end = None # type: float
self.start: Optional[float] = None
self.end: Optional[float] = None
self.state = None # oneof 'started', 'completed'
self.method = 'unknown'
self.path_page_name = 'unknown'
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/upstream/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def is_plugin_enabled(self, name):
)

def POST(self):
f = self.get_form() # type: forms.RegisterForm
f: forms.RegisterForm = self.get_form()

if f.validates(web.input()):
try:
Expand Down

0 comments on commit 7f4446b

Please sign in to comment.