- deploying Docker image of IDAES with solvers on JupyterHub on AWS
- script and automate so can deploy multiple versions
- bleeding-edge version deployed through CI
- last-release version as a sandbox
In particular need of attention:
""" | |
Csvish is a line-oriented format that combines JSON metadata and CSV data. | |
Format rules: | |
- Pure whitespace lines are ignored | |
- Lines starting with '##' are comments and ignored | |
- Lines starting with '%%' start a new section. The whitespace-stripped characters | |
after the '%%' are the section name. A dot (".") in the section name creates | |
a sub-section, e.g. "animal.dog.metadata". The section data type is inferred. | |
- Lines after '%%' starting with '{' are parsed as JSON until the start of the |
import requests | |
from typing import List, Dict, Union | |
def get_contributors(owner: str, repo: str, extra_fields: List[str] = None, | |
simplify=True) -> Union[List[str], List[Dict[str, str]]]: | |
"""Get a list of contributors to a Github repo. | |
Args: | |
owner: Repository owner (organization) | |
repo: Repository name |
# Imports | |
from pyomo.environ import (Constraint, | |
Var, | |
ConcreteModel, | |
Expression, | |
Objective, | |
SolverFactory, | |
TransformationFactory, | |
value) | |
from pyomo.network import Arc, SequentialDecomposition |
from logging import getLogger, Filter, LoggerAdapter, StreamHandler, Formatter, INFO, ERROR, DEBUG | |
logger = getLogger("test") | |
class IdaesModFilter(Filter): | |
"""Filter that keeps a list of allowed 'modules' in an attribute. | |
""" | |
def __init__(self, modules): | |
self.modules = modules # list of modules to allow | |
def filter(self, record): |
In particular need of attention:
#!/usr/bin/env python | |
""" | |
Annotate source code with a notice (see NOTICE_TEXT). | |
An existing notice will be replaced, and if there is no notice | |
encountered then one will be inserted. Detection of the notice | |
is exceedingly simple: if any line without a comment is encountered, from | |
the top of the file, before the standard "separator" of a long string | |
of comment characters, then the notice will be inserted. Likewise, the | |
"end" of the notice is either the same separator used for the beginning or |
import importlib | |
from mock import MagicMock, patch | |
def example(): | |
with patch_modules(): | |
import something.not.importable | |
print("yay! it worked!") | |
def patch_modules(): | |
sm = mock_import('not.importable', 'something') |
I hereby claim:
To claim this, I am signing this object: