-
Notifications
You must be signed in to change notification settings - Fork 31
Support multiple resource buckets #373
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
800148a
Make path attribute of BaseResource a property
nawatts d8b3c9e
Add resource subclasses for public resources
nawatts 60765d5
Add configuration for source of gnomAD public resources
nawatts f44ae96
Add Google Cloud Public Datasets provider for gnomAD public resources
nawatts c1852a1
Ignore Pylint error
nawatts 8e6e20e
Reorder imports
nawatts 626292b
Change import style
nawatts ed1f887
Use absolute import
nawatts 54a1b72
Move constants to beginning of file
nawatts 8775563
Parametrize tests for GnomadPublicTableResource
nawatts a2d658e
Add tests for other types of gnomAD public resources
nawatts 4e715b5
Refactor test parameters for gnomAD public resources
nawatts dcc6dd5
Fix paths for public resources in requester pays bucket
nawatts e548924
Fix path validation for gnomAD public resources
nawatts bc1b495
Add return type for test helper function
nawatts 842768c
Add changelog entry
nawatts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Configuration for loading resources.""" | ||
|
||
from enum import Enum | ||
from typing import Union | ||
|
||
|
||
class GnomadPublicResourceSource(Enum): | ||
"""Sources for public gnomAD resources.""" | ||
|
||
nawatts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
GNOMAD = "gnomAD" | ||
GOOGLE_CLOUD_PUBLIC_DATASETS = "Google Cloud Public Datasets" | ||
|
||
|
||
DEFAULT_GNOMAD_PUBLIC_RESOURCE_SOURCE = GnomadPublicResourceSource.GNOMAD | ||
|
||
|
||
class _GnomadPublicResourceConfiguration: | ||
"""Configuration for public gnomAD resources.""" | ||
|
||
__source: Union[ | ||
GnomadPublicResourceSource, str | ||
] = DEFAULT_GNOMAD_PUBLIC_RESOURCE_SOURCE | ||
|
||
@property | ||
def source(self) -> Union[GnomadPublicResourceSource, str]: | ||
""" | ||
Get the source for public gnomAD resource files. | ||
|
||
This is used to determine which URLs gnomAD resources will be loaded from. | ||
|
||
:returns: Source name or path to root of resources directory | ||
""" | ||
return self.__source | ||
|
||
@source.setter | ||
def source(self, source: Union[GnomadPublicResourceSource, str]) -> None: | ||
""" | ||
Set the default source for resource files. | ||
|
||
This is used to determine which URLs gnomAD resources will be loaded from. | ||
|
||
:param source: Source name or path to root of resources directory | ||
""" | ||
self.__source = source | ||
|
||
|
||
gnomad_public_resource_configuration = _GnomadPublicResourceConfiguration() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.