I hereby claim:
- I am dangunter on github.
- I am dangunter (https://keybase.io/dangunter) on keybase.
- I have a public key whose fingerprint is C5CC 7682 13C4 6971 2E3E 7853 6225 E467 93E1 03FB
To claim this, I am signing this object:
| """ | |
| Text progress bar | |
| """ | |
| import sys | |
| class PBar(object): | |
| """Text progress bar. | |
| """ | |
| c0 = '.' # left end marker | |
| c1 = '_' # completed char |
I hereby claim:
To claim this, I am signing this object:
| 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') |
| #!/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 |
In particular need of attention:
| 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): |
| # Imports | |
| from pyomo.environ import (Constraint, | |
| Var, | |
| ConcreteModel, | |
| Expression, | |
| Objective, | |
| SolverFactory, | |
| TransformationFactory, | |
| value) | |
| from pyomo.network import Arc, SequentialDecomposition |
| 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 |