Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove model_helpers.py for now. #2801

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
1 change: 0 additions & 1 deletion osv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
from .repos import *
from .sources import *
from .models import *
from .model_helpers import *
from .ecosystems import *
78 changes: 0 additions & 78 deletions osv/model_helpers.py

This file was deleted.

6 changes: 3 additions & 3 deletions osv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ class ImportFinding(ndb.Model):
last_attempt: datetime = ndb.DateTimeProperty()


def get_source_repository(source_name):
def get_source_repository(source_name: str) -> SourceRepository:
"""Get source repository."""
return SourceRepository.get_by_id(source_name)

Expand Down Expand Up @@ -957,14 +957,14 @@ def sorted_events(ecosystem, range_type, events) -> list[AffectedEvent]:


@ndb.tasklet
def get_aliases_async(bug_id) -> ndb.Future:
def get_aliases_async(bug_id: str) -> ndb.Future:
"""Gets aliases asynchronously."""
alias_group = yield AliasGroup.query(AliasGroup.bug_ids == bug_id).get_async()
return alias_group


@ndb.tasklet
def get_related_async(bug_id) -> ndb.Future:
def get_related_async(bug_id: str) -> ndb.Future:
"""Gets related bugs asynchronously."""
related_bugs = yield Bug.query(
Bug.related == bug_id, projection=[Bug.db_id]).fetch_async()
Expand Down
Loading