repo
stringlengths 1
29
| path
stringlengths 24
332
| code
stringlengths 39
579k
|
---|---|---|
zaqar-9.0.0 | zaqar-9.0.0//zaqar/storage/redis/utils.pyfile:/zaqar/storage/redis/utils.py:function:descope_subscription_ids_set/descope_subscription_ids_set | def descope_subscription_ids_set(subset_key):
"""Descope subscriptions set with '.'
:returns: (queue, project)
"""
tokens = subset_key.split('.')
return tokens[1] or None, tokens[0] or None
|
linetools | linetools//isgm/emsystem.pyclass:EmSystem/from_emlines | @classmethod
def from_emlines(cls, emlines, vlim=None, **kwargs):
"""Instantiate from a list of EmLines
Parameters
----------
emlines : list
List of EmLine objects
vlim : list, optional
Velocity limits for the system
If not set, the first components sets vlim
"""
init_eml = emlines[0]
slf = cls(init_eml.attrib['coord'], init_eml.z, vlim=vlim)
if slf.chk_emline(init_eml):
slf._emlines.append(init_eml)
else:
raise IOError('Bad component input')
for emline in emlines[1:]:
slf.add_emline(emline)
return slf
|
nbg-py-0.1 | nbg-py-0.1//nbg/nbg.pyclass:Nbg/is_supported | @classmethod
def is_supported(cls, currency):
"""Check if currency is supported"""
if currency in cls._SUPPORTED_CURRENCIES:
return True
else:
return False
|