function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def post_with_null_author(): return make_post(with_author=False)
marshmallow-code/marshmallow-jsonapi
[ 218, 64, 218, 52, 1442088655 ]
def __init__( self, plotly_name="bordercolor", parent_name="sankey.hoverlabel", **kwargs
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, model, data): # try and import pytorch global torch if torch is None: import torch if version.parse(torch.__version__) < version.parse("0.4"): warnings.warn("Your PyTorch version is older than 0.4 and not supported.") # check if...
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def add_handles(self, model, forward_handle, backward_handle): """ Add handles to all non-container layers in the model. Recursively for non-container layers """ handles_list = [] model_children = list(model.children()) if model_children: for child in ...
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def gradient(self, idx, inputs): self.model.zero_grad() X = [x.requires_grad_() for x in inputs] outputs = self.model(*X) selected = [val for val in outputs[:, idx]] grads = [] if self.interim: interim_inputs = self.layer.target_input for idx, inpu...
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def deeplift_grad(module, grad_input, grad_output): """The backward hook which computes the deeplift gradient for an nn.Module """ # first, get the module type module_type = module.__class__.__name__ # first, check the module is supported if module_type in op_handler: if op_handler[m...
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def get_target_input(module, input, output): """A forward hook which saves the tensor - attached to its graph. Used if we want to explain the interim outputs of a model """ try: del module.target_input except AttributeError: pass setattr(module, 'target_input', input)
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def deeplift_tensor_grad(grad): return_grad = complex_module_gradients[-1] del complex_module_gradients[-1] return return_grad
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def passthrough(module, grad_input, grad_output): """No change made to gradients""" return None
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def linear_1d(module, grad_input, grad_output): """No change made to gradients.""" return None
slundberg/shap
[ 18731, 2825, 18731, 1626, 1479842228 ]
def _coerce_iterator_output(self, expr, state=None): import supriya.patterns if not isinstance(expr, supriya.patterns.Event): expr = supriya.patterns.NoteEvent(**expr) if expr.get("uuid") is None: expr = new(expr, uuid=uuid.uuid4()) return expr
Pulgama/supriya
[ 208, 25, 208, 13, 1394072845 ]
def play(self, clock=None, server=None): import supriya.patterns import supriya.realtime event_player = supriya.patterns.RealtimeEventPlayer( self, clock=clock, server=server or supriya.realtime.Server.default() ) event_player.start() return event_player
Pulgama/supriya
[ 208, 25, 208, 13, 1394072845 ]
def with_effect(self, synthdef, release_time=0.25, **settings): import supriya.patterns return supriya.patterns.Pfx( self, synthdef=synthdef, release_time=release_time, **settings )
Pulgama/supriya
[ 208, 25, 208, 13, 1394072845 ]
def to_return(self): result = {} try: for returnable in self.returnables: result[returnable] = getattr(self, returnable) result = self._filter_params(result) except Exception: raise return result
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_password(self): if self._values['device_password'] is None: return None return self._values['device_password']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_username(self): if self._values['device_username'] is None: return None return self._values['device_username']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_address(self): if self.device_is_address: return self._values['device']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_port(self): if self._values['device_port'] is None: return None return int(self._values['device_port'])
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_is_address(self): if is_valid_ip(self.device): return True return False
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_is_id(self): pattern = r'[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}' if re.match(pattern, self.device): return True return False
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_is_name(self): if not self.device_is_address and not self.device_is_id: return True return False
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_reference(self): if not self.managed: return None if self.device_is_address: # This range lookup is how you do lookups for single IP addresses. Weird. filter = "address+eq+'{0}...{0}'".format(self.device) elif self.device_is_name: filter...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def pool_id(self): filter = "(name%20eq%20'{0}')".format(self.pool) uri = 'https://{0}:{1}/mgmt/cm/device/licensing/pool/regkey/licenses?$filter={2}&$top=1'.format( self.client.provider['server'], self.client.provider['server_port'], filter ) resp = se...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def member_id(self): if self.device_is_address: # This range lookup is how you do lookups for single IP addresses. Weird. filter = "deviceAddress+eq+'{0}...{0}'".format(self.device) elif self.device_is_name: filter = "deviceName+eq+'{0}'".format(self.device) e...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_port(self): if self._values['managed']: return None return self._values['device_port']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_username(self): if self._values['managed']: return None return self._values['device_username']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_password(self): if self._values['managed']: return None return self._values['device_password']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_reference(self): if not self._values['managed']: return None return self._values['device_reference']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def device_address(self): if self._values['managed']: return None return self._values['device_address']
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def managed(self): return None
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def __init__(self, want, have=None): self.want = want self.have = have
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def __default(self, param): attr1 = getattr(self.want, param) try: attr2 = getattr(self.have, param) if attr1 != attr2: return attr1 except AttributeError: return attr1
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def __init__(self, *args, **kwargs): self.module = kwargs.get('module', None) self.client = F5RestClient(**self.module.params) self.want = ModuleParameters(params=self.module.params, client=self.client) self.have = ApiParameters() self.changes = UsableChanges()
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def _update_changed_options(self): diff = Difference(self.want, self.have) updatables = Parameters.updatables changed = dict() for k in updatables: change = diff.compare(k) if change is None: continue else: if isinstance...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def exec_module(self): start = datetime.now().isoformat() version = bigiq_version(self.client) changed = False result = dict() state = self.want.state if state == "present": changed = self.present() elif state == "absent": changed = self.a...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def present(self): if self.exists(): return False return self.create()
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def remove(self): self._set_changed_options() if self.module.check_mode: return True self.remove_from_device() if self.exists(): raise F5ModuleError("Failed to delete the resource.") # Artificial sleeping to wait for remote licensing (on BIG-IP) to complet...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def create_on_device(self): params = self.changes.api_params() uri = 'https://{0}:{1}/mgmt/cm/device/licensing/pool/regkey/licenses/{2}/offerings/{3}/members/'.format( self.client.provider['server'], self.client.provider['server_port'], self.want.pool_id, ...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def absent(self): if self.exists(): return self.remove() return False
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def __init__(self): self.supports_check_mode = True argument_spec = dict( pool=dict(required=True), key=dict(required=True, no_log=True), device=dict(required=True), managed=dict(type='bool'), device_port=dict(type='int', default=443), ...
F5Networks/f5-ansible-modules
[ 357, 221, 357, 48, 1448045671 ]
def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1)
tgbugs/pyontutils
[ 15, 123, 15, 42, 1455242132 ]
def __init__(self, pool_size=2, strides=None, padding='valid'): if strides is None: strides = pool_size assert padding in {'valid', 'same'}, 'border_mode must be in {valid, same}' self.pool_length = pool_size self.stride = strides self.border_mode = padding
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=2, strides=None, padding='valid'): super(LW_MaxPooling1D, self).__init__(pool_size, strides, padding)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=2, strides=None, padding='valid'): super(LW_AveragePooling1D, self).__init__(pool_size, strides, padding)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2), strides=None, padding='valid', data_format='default'): if data_format == 'default': data_format = default_data_format assert data_format in {'channels_last', 'channels_first'}, 'data_format must be in {channels_last, channels_first}' self.pool_siz...
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2), strides=None, padding='valid', data_format='default'): super(LW_MaxPooling2D, self).__init__(pool_size, strides, padding, data_format)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2), strides=None, padding='valid', data_format='default'): super(LW_AveragePooling2D, self).__init__(pool_size, strides, padding, data_format)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2, 2), strides=None, border_mode='valid', dim_ordering='default'): if dim_ordering == 'default': dim_ordering = default_data_format assert dim_ordering in {'channels_last', 'channels_first'}, 'data_format must be in {channels_last, channels_first}' se...
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2, 2), strides=None, border_mode='valid', dim_ordering='default'): super(LW_MaxPooling3D, self).__init__(pool_size, strides, border_mode, dim_ordering)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, pool_size=(2, 2, 2), strides=None, border_mode='valid', dim_ordering='default'): super(LW_AveragePooling3D, self).__init__(pool_size, strides, border_mode, dim_ordering)
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self): pass
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, data_format='default'): if data_format == 'default': data_format = default_data_format self.dim_ordering = data_format
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def __init__(self, data_format='default'): if data_format == 'default': data_format = default_data_format self.dim_ordering = data_format
SummaLabs/DLS
[ 30, 19, 30, 4, 1501015843 ]
def fetch_queue_lengths(queue_names): """Connect to Redis server and request queue lengths.
alphagov/govuk-puppet
[ 124, 43, 124, 14, 1449848184 ]
def configure_callback(conf): """Receive configuration block""" global REDIS_HOST, REDIS_PORT, VERBOSE_LOGGING, QUEUE_NAMES for node in conf.children: if node.key == 'Host': REDIS_HOST = node.values[0] elif node.key == 'Port': REDIS_PORT = int(node.values[0]) ...
alphagov/govuk-puppet
[ 124, 43, 124, 14, 1449848184 ]
def log_verbose(msg): if not VERBOSE_LOGGING: return collectd.info('redis plugin [verbose]: %s' % msg)
alphagov/govuk-puppet
[ 124, 43, 124, 14, 1449848184 ]
def step_impl(context): context.execute_steps(u''' given I open History dialog ''') history = context.browser.find_element_by_id("HistoryPopup") entries = history.find_elements_by_xpath('.//li[not(@data-clone-template)]') assert len(entries) > 0, "There are no entries in the history" ite...
jsargiot/restman
[ 56, 12, 56, 4, 1399144829 ]
def step_impl(context, url): # Wait for modal to appear WebDriverWait(context.browser, 10).until( expected_conditions.visibility_of_element_located( (By.ID, 'ShareRequestForm'))) output = context.browser.execute_script("return restman.ui.editors.get('#ShareRequestEditor').getValue();") ...
jsargiot/restman
[ 56, 12, 56, 4, 1399144829 ]
def step_impl(context): context.execute_steps(u''' given I open History dialog ''') # Click on import context.browser.find_element_by_id('ImportHistory').click() WebDriverWait(context.browser, 10).until( expected_conditions.visibility_of_element_located( (By.ID, 'ImportRe...
jsargiot/restman
[ 56, 12, 56, 4, 1399144829 ]
def step_impl(context, url): req = json.dumps({ "method": "POST", "url": url, "headers": { "Content-Type": "application/json", "X-Test-Header": "shared_request" }, "body": { "type": "form", "content": { "SomeKey"...
jsargiot/restman
[ 56, 12, 56, 4, 1399144829 ]
def __init__(self): self.events_count = 0 self.events_count_by_type = dict()
baroquehq/baroque
[ 5, 2, 5, 1, 1490877723 ]
def count_all(self): """Tells how many events have been counted globally Returns: int """ return self.events_count
baroquehq/baroque
[ 5, 2, 5, 1, 1490877723 ]
def __init__(self, uri=None, path=None, host=None): """ ContributorOrcid - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name ...
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def uri(self): """ Gets the uri of this ContributorOrcid. :return: The uri of this ContributorOrcid. :rtype: str """ return self._uri
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def uri(self, uri): """ Sets the uri of this ContributorOrcid. :param uri: The uri of this ContributorOrcid. :type: str """ self._uri = uri
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def path(self): """ Gets the path of this ContributorOrcid. :return: The path of this ContributorOrcid. :rtype: str """ return self._path
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def path(self, path): """ Sets the path of this ContributorOrcid. :param path: The path of this ContributorOrcid. :type: str """ self._path = path
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def host(self): """ Gets the host of this ContributorOrcid. :return: The host of this ContributorOrcid. :rtype: str """ return self._host
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def host(self, host): """ Sets the host of this ContributorOrcid. :param host: The host of this ContributorOrcid. :type: str """ self._host = host
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict())
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, ContributorOrcid): return False return self.__dict__ == other.__dict__
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
[ 13, 7, 13, 28, 1486087622 ]
def test_correct_login(self): # Ensure login behaves correctly with correct credentials. with self.client: response = self.client.post( "/login", data=dict(email="ad@min.com", password="admin_user"), follow_redirects=True, ) ...
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def test_logout_route_requires_login(self): # Ensure logout route requres logged in user. response = self.client.get("/logout", follow_redirects=True) self.assertIn(b"Please log in to access this page", response.data)
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def test_validate_success_login_form(self): # Ensure correct data validates. form = LoginForm(email="ad@min.com", password="admin_user") self.assertTrue(form.validate())
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def test_get_by_id(self): # Ensure id is correct for the current/logged in user. with self.client: self.client.post( "/login", data=dict(email="ad@min.com", password="admin_user"), follow_redirects=True, ) self.assertTru...
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def test_check_password(self): # Ensure given password is correct after unhashing. user = User.query.filter_by(email="ad@min.com").first() self.assertTrue( bcrypt.check_password_hash(user.password, "admin_user") ) self.assertFalse(bcrypt.check_password_hash(user.passw...
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def test_register_route(self): # Ensure about route behaves correctly. response = self.client.get("/register", follow_redirects=True) self.assertIn(b"<h1>Register</h1>\n", response.data)
realpython/flask-skeleton
[ 424, 136, 424, 2, 1421857705 ]
def filename(self): pass
lasote/conan
[ 2, 3, 2, 2, 1448989002 ]
def test___doc__(self): self.assertEqual( ctds.Parameter.__doc__, '''\
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def test_parameter(self): param1 = ctds.Parameter(b'123', output=True) self.assertEqual(param1.value, b'123') self.assertTrue(isinstance(param1, ctds.Parameter)) param2 = ctds.Parameter(b'123') self.assertEqual(param1.value, b'123') self.assertEqual(type(param1), type(pa...
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def _test__cmp__(self, __cmp__, expected, oper): cases = ( (ctds.Parameter(b'1234'), ctds.Parameter(b'123')), (ctds.Parameter(b'123'), ctds.Parameter(b'123')), (ctds.Parameter(b'123'), ctds.Parameter(b'123', output=True)), (ctds.Parameter(b'123'), ctds.Parameter(b...
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def test___cmp__ne(self): self._test__cmp__( lambda left, right: left != right, ( True, False, False, True, False, True, PY3, True, True, ...
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def test___cmp__le(self): self._test__cmp__( lambda left, right: left <= right, ( False, True, True, True, True, TypeError if PY3 else False, TypeError if PY3 else True, ...
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def test___cmp__ge(self): self._test__cmp__( lambda left, right: left >= right, ( True, True, True, False, True, TypeError if PY3 else True, TypeError if PY3 else True, ...
zillow/ctds
[ 79, 13, 79, 21, 1457558644 ]
def __init__(self, c_data: _C_MultiHMatrix, **params): # Users should use one of the two constructors below. self.c_data = c_data self.shape = (self.lib.multi_nbrows(c_data), self.lib.multi_nbcols(c_data)) self.size = self.lib.nbhmats(c_data) self.lib.getHMatrix.restype=ctypes...
PierreMarchand20/htool
[ 18, 4, 18, 2, 1483540397 ]
def from_coefs(cls, getcoefs, nm, points_target, points_source=None, **params): """Construct an instance of the class from a evaluation function. Parameters ---------- getcoefs: Callable A function evaluating an array of matrices at given coordinates. points_target: ...
PierreMarchand20/htool
[ 18, 4, 18, 2, 1483540397 ]
def from_submatrices(cls, getsubmatrix, nm, points_target, points_source=None, **params): """Construct an instance of the class from a evaluation function. Parameters ---------- points: np.ndarray of shape (N, 3) The coordinates of the points. getsubmatrix: Callable ...
PierreMarchand20/htool
[ 18, 4, 18, 2, 1483540397 ]
def _set_building_params(cls, *, eta=None, minclustersize=None, epsilon=None, maxblocksize=None): """Put the parameters in the C++ backend.""" if epsilon is not None: cls.lib.setepsilon.restype = None cls.lib.setepsilon.argtypes = [ ctypes.c_double ] cls.lib.setepsilo...
PierreMarchand20/htool
[ 18, 4, 18, 2, 1483540397 ]
def __getitem__(self, key): # self.lib.getHMatrix.restype=ctypes.POINTER(_C_HMatrix) # self.lib.getHMatrix.argtypes=[ctypes.POINTER(_C_MultiHMatrix), ctypes.c_int] # c_data_hmatrix = self.lib.getHMatrix(self.c_data,key) # return HMatrix(c_data_hmatrix,**self.params) return self....
PierreMarchand20/htool
[ 18, 4, 18, 2, 1483540397 ]
def f(): x = `1` # 4 str
kmod/icbd
[ 12, 5, 12, 1, 1397488176 ]
def get_bug_info(self, repository, bug_id): """Get the information for the specified bug. This should return a dictionary with 'summary', 'description', and 'status' keys. This is cached for 60 seconds to reduce the number of queries to the bug trackers and make things seem fas...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def getParentAndBase(path): match = PREFIX.match(path) if match is None: if path.endswith('/'): stripped_path = path[:-1] else: stripped_path = path base = FNAME_MATCH.search(stripped_path) if base is None: raise ValueError('Invalid path') ...
algorithmiaio/algorithmia-python
[ 138, 40, 138, 9, 1436379917 ]
def md5_for_file(fname): hash_md5 = hashlib.md5() with open(fname, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return str(hash_md5.hexdigest())
algorithmiaio/algorithmia-python
[ 138, 40, 138, 9, 1436379917 ]
def setUp(self): self.latitude = 32.074322 self.longitude = 34.792081 self.radius_meters = 100 self.number_of_vertices = 36 self.polycircle = \ polycircles.Polycircle(latitude=self.latitude, longitude=self.longitude, ...
adamatan/polycircles
[ 13, 7, 13, 8, 1397365713 ]
def test_lon_lat_output(self): """Asserts that the vertices in the lat-lon output are in the right order (lat before long).""" for vertex in self.polycircle.to_lon_lat(): assert_almost_equal(vertex[0], self.longitude, places=2) assert_almost_equal(vertex[1], self.latitude...
adamatan/polycircles
[ 13, 7, 13, 8, 1397365713 ]
def test_kml_equals_lon_lat(self): """Asserts that the return value of to_kml() property is identical to the return value of to_lon_lat().""" assert_equal(self.polycircle.to_kml(), self.polycircle.to_lon_lat())
adamatan/polycircles
[ 13, 7, 13, 8, 1397365713 ]
def naturaltime(seconds: float, future=False) -> str: assert future if seconds < 120: return "in {} second{}".format( int(seconds), "s" if seconds >= 2 else "" ) minutes = seconds / 60 if minutes < 120: return "in {} minute{}".format( int(minutes), "s" if ...
gjcarneiro/yacron
[ 400, 38, 400, 9, 1500314642 ]
def next_sleep_interval() -> float: now = get_now(datetime.timezone.utc) target = now.replace(second=0) + WAKEUP_INTERVAL return (target - now).total_seconds()
gjcarneiro/yacron
[ 400, 38, 400, 9, 1500314642 ]
def web_site_from_url(runner: web.AppRunner, url: str) -> web.BaseSite: parsed = urlparse(url) if parsed.scheme == "http": assert parsed.hostname is not None assert parsed.port is not None return web.TCPSite(runner, parsed.hostname, parsed.port) elif parsed.scheme == "unix": ...
gjcarneiro/yacron
[ 400, 38, 400, 9, 1500314642 ]
def __init__( self, config_arg: Optional[str], *, config_yaml: Optional[str] = None
gjcarneiro/yacron
[ 400, 38, 400, 9, 1500314642 ]