Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .routing import app
from .utils import encode, decode
from .utils import encode, decode
8 changes: 6 additions & 2 deletions modules/paragraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ def annotated_with_entities(self):
all_tags.pop(overlap)
for ent in all_tags[::-1]:
annotated = Paragraph.__insert_helper(
annotated, "</{}>".format(ent["tag"].lower()), ent["end"],
annotated,
"</{}>".format(ent["tag"].lower()),
ent["end"],
)
annotated = Paragraph.__insert_helper(
annotated, "<{}>".format(ent["tag"].lower()), ent["start"],
annotated,
"<{}>".format(ent["tag"].lower()),
ent["start"],
)
return annotated

Expand Down
4 changes: 2 additions & 2 deletions modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def cached_property(property_function: Callable) -> Callable:
"""
For making properties store themselves as private properties.
This is so that the same property does not get computed twice by storing the
the result but at the same time unneeded properties never get called.
the result but at the same time unneeded properties never get called.
"""

@property
Expand All @@ -24,7 +24,7 @@ def decorated_property(self):

def indirectly_cached_property(property_function: Callable) -> Callable:
"""
Like cached property but runs another function that indirectly sets the
Like cached property but runs another function that indirectly sets the
private variable to the solution.
"""

Expand Down
7 changes: 5 additions & 2 deletions modules/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ def annotated_tree(self):
# TODO: make asynchronous
new_string = "<annotated>{}</annotated>".format(
Paragraph(
s, vocab=vocab, raw_ents=doc.ents, spaced_raw_text=spaced_raw_text,
s,
vocab=vocab,
raw_ents=doc.ents,
spaced_raw_text=spaced_raw_text,
).annotated_with_entities
) # 410ms TODO SPEED UP
tag.string = ""
Expand All @@ -205,7 +208,7 @@ def description(self):
"word_count": self.word_count,
"reading_ease": self.reading_ease,
"grade_level": self.grade_level,
"key_terms": self.key_terms if self.use_vocab else None
"key_terms": self.key_terms if self.use_vocab else None,
}

def __str__(self):
Expand Down
4 changes: 2 additions & 2 deletions oath.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# raise ValueError('Wrong hosted domain.')

# ID token is valid. Get the user's Google Account ID from the decoded token.
userid = idinfo['sub']
userid = idinfo["sub"]
except ValueError as e:
# Invalid token
print(e)
print(e)