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
| See https://github.com/dmyersturnbull/genomics-io/tree/master/core/src/main/java/org/pharmgkb/parsers/escape | |
| package org.pharmgkb.parsers.escape; | |
| import com.google.common.base.Preconditions; | |
| import com.google.common.collect.ImmutableSet; | |
| import javax.annotation.Nonnull; | |
| import javax.annotation.concurrent.NotThreadSafe; | |
| import javax.annotation.concurrent.ThreadSafe; |
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
| // copied from https://github.com/dmyersturnbull/genomics-io/blob/master/core/src/main/java/org/pharmgkb/parsers/utils/HttpHeadResponse.java | |
| package org.pharmgkb.parsers.utils; | |
| import com.google.common.collect.ImmutableMap; | |
| import javax.annotation.Nonnegative; | |
| import javax.annotation.Nonnull; | |
| import javax.annotation.concurrent.Immutable; | |
| import java.io.IOException; | |
| import java.net.HttpURLConnection; |
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
| // copied from https://github.com/dmyersturnbull/genomics-io/blob/master/core/src/main/java/org/pharmgkb/parsers/utils/Try.java | |
| package org.pharmgkb.parsers.utils; | |
| import javax.annotation.Nonnull; | |
| import javax.annotation.Nullable; | |
| import java.util.Objects; | |
| import java.util.Optional; | |
| import java.util.function.Function; | |
| import java.util.function.Supplier; |
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
| import enum | |
| from warnings import warn | |
| from functools import wraps | |
| class CodeIncompleteError(Exception): pass | |
| class ImmatureWarning(UserWarning): pass | |
| class ObsoleteWarning(UserWarning): pass | |
| @enum.unique | |
| class CodeStatus(enum.Enum): |
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
| import enum | |
| class SmartEnum(enum.Enum): | |
| """ | |
| An enum with a classmethod `of` that parses a string of the member's name. | |
| """ | |
| @classmethod | |
| def of(cls, v): | |
| """ |
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
| class FancyCmaps: | |
| """ | |
| Useful colormaps for matplotlib. Most importantly: | |
| - white_red | |
| - white_blue | |
| - blue_white | |
| - white_black | |
| The built-in matplotlib ones don't actually go between pure color values!! | |
| For ex, 'Greys' doesn't go from pure white to pure black! | |
| So colormaps to consider avoiding include Greys, Blues, Greens, (etc), bwr, and seismic. |
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
| class DevNull: | |
| """Pretends to write but doesn't.""" | |
| def write(self, msg): | |
| pass | |
| def flush(self): | |
| pass | |
| def close(self): |
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
| from matplotlib.axes import Axes | |
| @classmethod | |
| def despine(cls, ax: Axes) -> Axes: | |
| """ | |
| Removes all spines and ticks on an Axes. | |
| """ | |
| ax.set_yticks([]) | |
| ax.set_yticks([]) | |
| ax.set_xticklabels([]) |
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
| from typing import Type | |
| from functools import wraps | |
| def copy_docstring(from_obj: Type): | |
| """ | |
| Decorator. | |
| Copies the docstring from `from_obj` to this function or class. | |
| """ | |
| @wraps(copy_docstring) |
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
| from IPython.display import display, Markdown, HTML | |
| display(HTML("<style>.container { width:100% !important; }</style>")) | |