repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
raags/passdb
passdb/manage_passdb.py
MPassdb.add_user
def add_user(self, recipient_email): """ Add user to encryption """ self.import_key(emailid=recipient_email) emailid_list = self.list_user_emails() self.y = self.decrypt() emailid_list.append(recipient_email) self.encrypt(emailid_list=emailid_list)
python
def add_user(self, recipient_email): """ Add user to encryption """ self.import_key(emailid=recipient_email) emailid_list = self.list_user_emails() self.y = self.decrypt() emailid_list.append(recipient_email) self.encrypt(emailid_list=emailid_list)
[ "def", "add_user", "(", "self", ",", "recipient_email", ")", ":", "self", ".", "import_key", "(", "emailid", "=", "recipient_email", ")", "emailid_list", "=", "self", ".", "list_user_emails", "(", ")", "self", ".", "y", "=", "self", ".", "decrypt", "(", ...
Add user to encryption
[ "Add", "user", "to", "encryption" ]
train
https://github.com/raags/passdb/blob/7fd6665e291bbfb4db59c1230ae0257e48ad503e/passdb/manage_passdb.py#L72-L80
raags/passdb
passdb/manage_passdb.py
MPassdb.delete_user
def delete_user(self, recipient_email): """ Remove user from encryption """ emailid_list = self.list_user_emails() if recipient_email not in emailid_list: raise Exception("User {0} not present!".format(recipient_email)) else: emailid_list.remove(re...
python
def delete_user(self, recipient_email): """ Remove user from encryption """ emailid_list = self.list_user_emails() if recipient_email not in emailid_list: raise Exception("User {0} not present!".format(recipient_email)) else: emailid_list.remove(re...
[ "def", "delete_user", "(", "self", ",", "recipient_email", ")", ":", "emailid_list", "=", "self", ".", "list_user_emails", "(", ")", "if", "recipient_email", "not", "in", "emailid_list", ":", "raise", "Exception", "(", "\"User {0} not present!\"", ".", "format", ...
Remove user from encryption
[ "Remove", "user", "from", "encryption" ]
train
https://github.com/raags/passdb/blob/7fd6665e291bbfb4db59c1230ae0257e48ad503e/passdb/manage_passdb.py#L82-L92
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/__init__.py
parse_meta
def parse_meta(filename, data): """ Parse `data` to EPublication. Args: filename (str): Used to choose right parser based at suffix. data (str): Content of the metadata file. Returns: EPublication: object. """ if "." not in filename: raise MetaParsingException( ...
python
def parse_meta(filename, data): """ Parse `data` to EPublication. Args: filename (str): Used to choose right parser based at suffix. data (str): Content of the metadata file. Returns: EPublication: object. """ if "." not in filename: raise MetaParsingException( ...
[ "def", "parse_meta", "(", "filename", ",", "data", ")", ":", "if", "\".\"", "not", "in", "filename", ":", "raise", "MetaParsingException", "(", "\"Can't recognize type of your metadata ('%s')!\"", "%", "filename", ")", "suffix", "=", "filename", ".", "rsplit", "("...
Parse `data` to EPublication. Args: filename (str): Used to choose right parser based at suffix. data (str): Content of the metadata file. Returns: EPublication: object.
[ "Parse", "data", "to", "EPublication", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/__init__.py#L30-L55
nefarioustim/parker
parker/consumemodel.py
get_instance
def get_instance(page_to_consume): """Return an instance of ConsumeModel.""" global _instances if isinstance(page_to_consume, basestring): uri = page_to_consume page_to_consume = consumepage.get_instance(uri) elif isinstance(page_to_consume, consumepage.ConsumePage): uri = page_t...
python
def get_instance(page_to_consume): """Return an instance of ConsumeModel.""" global _instances if isinstance(page_to_consume, basestring): uri = page_to_consume page_to_consume = consumepage.get_instance(uri) elif isinstance(page_to_consume, consumepage.ConsumePage): uri = page_t...
[ "def", "get_instance", "(", "page_to_consume", ")", ":", "global", "_instances", "if", "isinstance", "(", "page_to_consume", ",", "basestring", ")", ":", "uri", "=", "page_to_consume", "page_to_consume", "=", "consumepage", ".", "get_instance", "(", "uri", ")", ...
Return an instance of ConsumeModel.
[ "Return", "an", "instance", "of", "ConsumeModel", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumemodel.py#L12-L32
nefarioustim/parker
parker/consumemodel.py
ConsumeModel.load_from_config
def load_from_config(self, config): """Load model from passed configuration.""" self.site = config.get("id", False) self.classification = config.get("class", False) self.tags = config.get("tags", False) self._load_key_value( config.get("key_value_data", False) ...
python
def load_from_config(self, config): """Load model from passed configuration.""" self.site = config.get("id", False) self.classification = config.get("class", False) self.tags = config.get("tags", False) self._load_key_value( config.get("key_value_data", False) ...
[ "def", "load_from_config", "(", "self", ",", "config", ")", ":", "self", ".", "site", "=", "config", ".", "get", "(", "\"id\"", ",", "False", ")", "self", ".", "classification", "=", "config", ".", "get", "(", "\"class\"", ",", "False", ")", "self", ...
Load model from passed configuration.
[ "Load", "model", "from", "passed", "configuration", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumemodel.py#L53-L73
nefarioustim/parker
parker/consumemodel.py
ConsumeModel.get_dict
def get_dict(self): """Return a dictionary of the object primed for dumping.""" data = self.data_dict.copy() data.update({ "class": self.classification, "tags": self.tags, "key_value_data": self.key_value_dict, "crumbs": self.crumb_list if len(sel...
python
def get_dict(self): """Return a dictionary of the object primed for dumping.""" data = self.data_dict.copy() data.update({ "class": self.classification, "tags": self.tags, "key_value_data": self.key_value_dict, "crumbs": self.crumb_list if len(sel...
[ "def", "get_dict", "(", "self", ")", ":", "data", "=", "self", ".", "data_dict", ".", "copy", "(", ")", "data", ".", "update", "(", "{", "\"class\"", ":", "self", ".", "classification", ",", "\"tags\"", ":", "self", ".", "tags", ",", "\"key_value_data\...
Return a dictionary of the object primed for dumping.
[ "Return", "a", "dictionary", "of", "the", "object", "primed", "for", "dumping", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumemodel.py#L75-L94
GemHQ/round-py
round/devices.py
Devices.create
def create(self, name, redirect_uri=None): """Create a new Device object. Devices tie Users and Applications together. For your Application to access and act on behalf of a User, the User must authorize a Device created by your Application. This function will return a `device_t...
python
def create(self, name, redirect_uri=None): """Create a new Device object. Devices tie Users and Applications together. For your Application to access and act on behalf of a User, the User must authorize a Device created by your Application. This function will return a `device_t...
[ "def", "create", "(", "self", ",", "name", ",", "redirect_uri", "=", "None", ")", ":", "data", "=", "dict", "(", "name", "=", "name", ")", "if", "redirect_uri", ":", "data", "[", "'redirect_uri'", "]", "=", "redirect_uri", "auth_request_resource", "=", "...
Create a new Device object. Devices tie Users and Applications together. For your Application to access and act on behalf of a User, the User must authorize a Device created by your Application. This function will return a `device_token` which you must store and use after the D...
[ "Create", "a", "new", "Device", "object", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/devices.py#L16-L49
rdo-management/python-rdomanager-oscplugin
rdomanager_oscplugin/plugin.py
build_option_parser
def build_option_parser(parser): """Hook to add global options Called from openstackclient.shell.OpenStackShell.__init__() after the builtin parser has been initialized. This is where a plugin can add global options such as an API version setting. :param argparse.ArgumentParser parser: The parser...
python
def build_option_parser(parser): """Hook to add global options Called from openstackclient.shell.OpenStackShell.__init__() after the builtin parser has been initialized. This is where a plugin can add global options such as an API version setting. :param argparse.ArgumentParser parser: The parser...
[ "def", "build_option_parser", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "'--os-rdomanager-oscplugin-api-version'", ",", "metavar", "=", "'<rdomanager-oscplugin-api-version>'", ",", "default", "=", "utils", ".", "env", "(", "'OS_RDOMANAGER_OSCPLUGIN_API_...
Hook to add global options Called from openstackclient.shell.OpenStackShell.__init__() after the builtin parser has been initialized. This is where a plugin can add global options such as an API version setting. :param argparse.ArgumentParser parser: The parser object that has been initialize...
[ "Hook", "to", "add", "global", "options" ]
train
https://github.com/rdo-management/python-rdomanager-oscplugin/blob/165a166fb2e5a2598380779b35812b8b8478c4fb/rdomanager_oscplugin/plugin.py#L42-L61
rdo-management/python-rdomanager-oscplugin
rdomanager_oscplugin/plugin.py
ClientWrapper.baremetal
def baremetal(self): """Returns an baremetal service client""" # TODO(d0ugal): When the ironicclient has it's own OSC plugin, the # following client handling code should be removed in favor of the # upstream version. if self._baremetal is not None: return self._bare...
python
def baremetal(self): """Returns an baremetal service client""" # TODO(d0ugal): When the ironicclient has it's own OSC plugin, the # following client handling code should be removed in favor of the # upstream version. if self._baremetal is not None: return self._bare...
[ "def", "baremetal", "(", "self", ")", ":", "# TODO(d0ugal): When the ironicclient has it's own OSC plugin, the", "# following client handling code should be removed in favor of the", "# upstream version.", "if", "self", ".", "_baremetal", "is", "not", "None", ":", "return", "self...
Returns an baremetal service client
[ "Returns", "an", "baremetal", "service", "client" ]
train
https://github.com/rdo-management/python-rdomanager-oscplugin/blob/165a166fb2e5a2598380779b35812b8b8478c4fb/rdomanager_oscplugin/plugin.py#L72-L93
rdo-management/python-rdomanager-oscplugin
rdomanager_oscplugin/plugin.py
ClientWrapper.orchestration
def orchestration(self): """Returns an orchestration service client""" # TODO(d0ugal): This code is based on the upstream WIP implementation # and should be removed when it lands: # https://review.openstack.org/#/c/111786 if self._orchestration is not None: return s...
python
def orchestration(self): """Returns an orchestration service client""" # TODO(d0ugal): This code is based on the upstream WIP implementation # and should be removed when it lands: # https://review.openstack.org/#/c/111786 if self._orchestration is not None: return s...
[ "def", "orchestration", "(", "self", ")", ":", "# TODO(d0ugal): This code is based on the upstream WIP implementation", "# and should be removed when it lands:", "# https://review.openstack.org/#/c/111786", "if", "self", ".", "_orchestration", "is", "not", "None", ":", "return", ...
Returns an orchestration service client
[ "Returns", "an", "orchestration", "service", "client" ]
train
https://github.com/rdo-management/python-rdomanager-oscplugin/blob/165a166fb2e5a2598380779b35812b8b8478c4fb/rdomanager_oscplugin/plugin.py#L95-L131
rdo-management/python-rdomanager-oscplugin
rdomanager_oscplugin/plugin.py
ClientWrapper.management
def management(self): """Returns an management service client""" endpoint = self._instance.get_endpoint_for_service_type( "management", region_name=self._instance._region_name, ) token = self._instance.auth.get_token(self._instance.session) self._manage...
python
def management(self): """Returns an management service client""" endpoint = self._instance.get_endpoint_for_service_type( "management", region_name=self._instance._region_name, ) token = self._instance.auth.get_token(self._instance.session) self._manage...
[ "def", "management", "(", "self", ")", ":", "endpoint", "=", "self", ".", "_instance", ".", "get_endpoint_for_service_type", "(", "\"management\"", ",", "region_name", "=", "self", ".", "_instance", ".", "_region_name", ",", ")", "token", "=", "self", ".", "...
Returns an management service client
[ "Returns", "an", "management", "service", "client" ]
train
https://github.com/rdo-management/python-rdomanager-oscplugin/blob/165a166fb2e5a2598380779b35812b8b8478c4fb/rdomanager_oscplugin/plugin.py#L133-L146
ronaldguillen/wave
wave/utils/mediatypes.py
media_type_matches
def media_type_matches(lhs, rhs): """ Returns ``True`` if the media type in the first argument <= the media type in the second argument. The media types are strings as described by the HTTP spec. Valid media type strings include: 'application/json; indent=4' 'application/json' 'text/*...
python
def media_type_matches(lhs, rhs): """ Returns ``True`` if the media type in the first argument <= the media type in the second argument. The media types are strings as described by the HTTP spec. Valid media type strings include: 'application/json; indent=4' 'application/json' 'text/*...
[ "def", "media_type_matches", "(", "lhs", ",", "rhs", ")", ":", "lhs", "=", "_MediaType", "(", "lhs", ")", "rhs", "=", "_MediaType", "(", "rhs", ")", "return", "lhs", ".", "match", "(", "rhs", ")" ]
Returns ``True`` if the media type in the first argument <= the media type in the second argument. The media types are strings as described by the HTTP spec. Valid media type strings include: 'application/json; indent=4' 'application/json' 'text/*' '*/*'
[ "Returns", "True", "if", "the", "media", "type", "in", "the", "first", "argument", "<", "=", "the", "media", "type", "in", "the", "second", "argument", ".", "The", "media", "types", "are", "strings", "as", "described", "by", "the", "HTTP", "spec", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/utils/mediatypes.py#L14-L29
ronaldguillen/wave
wave/utils/mediatypes.py
order_by_precedence
def order_by_precedence(media_type_lst): """ Returns a list of sets of media type strings, ordered by precedence. Precedence is determined by how specific a media type is: 3. 'type/subtype; param=val' 2. 'type/subtype' 1. 'type/*' 0. '*/*' """ ret = [set(), set(), set(), set()] ...
python
def order_by_precedence(media_type_lst): """ Returns a list of sets of media type strings, ordered by precedence. Precedence is determined by how specific a media type is: 3. 'type/subtype; param=val' 2. 'type/subtype' 1. 'type/*' 0. '*/*' """ ret = [set(), set(), set(), set()] ...
[ "def", "order_by_precedence", "(", "media_type_lst", ")", ":", "ret", "=", "[", "set", "(", ")", ",", "set", "(", ")", ",", "set", "(", ")", ",", "set", "(", ")", "]", "for", "media_type", "in", "media_type_lst", ":", "precedence", "=", "_MediaType", ...
Returns a list of sets of media type strings, ordered by precedence. Precedence is determined by how specific a media type is: 3. 'type/subtype; param=val' 2. 'type/subtype' 1. 'type/*' 0. '*/*'
[ "Returns", "a", "list", "of", "sets", "of", "media", "type", "strings", "ordered", "by", "precedence", ".", "Precedence", "is", "determined", "by", "how", "specific", "a", "media", "type", "is", ":" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/utils/mediatypes.py#L32-L46
mbodenhamer/syn
syn/base_utils/py.py
subclasses
def subclasses(cls, lst=None): '''Recursively gather subclasses of cls. ''' if lst is None: lst = [] for sc in cls.__subclasses__(): if sc not in lst: lst.append(sc) subclasses(sc, lst=lst) return lst
python
def subclasses(cls, lst=None): '''Recursively gather subclasses of cls. ''' if lst is None: lst = [] for sc in cls.__subclasses__(): if sc not in lst: lst.append(sc) subclasses(sc, lst=lst) return lst
[ "def", "subclasses", "(", "cls", ",", "lst", "=", "None", ")", ":", "if", "lst", "is", "None", ":", "lst", "=", "[", "]", "for", "sc", "in", "cls", ".", "__subclasses__", "(", ")", ":", "if", "sc", "not", "in", "lst", ":", "lst", ".", "append",...
Recursively gather subclasses of cls.
[ "Recursively", "gather", "subclasses", "of", "cls", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L50-L59
mbodenhamer/syn
syn/base_utils/py.py
nearest_base
def nearest_base(cls, bases): '''Returns the closest ancestor to cls in bases. ''' if cls in bases: return cls dists = {base: index(mro(cls), base) for base in bases} dists2 = {dist: base for base, dist in dists.items() if dist is not None} if not dists2: return None return ...
python
def nearest_base(cls, bases): '''Returns the closest ancestor to cls in bases. ''' if cls in bases: return cls dists = {base: index(mro(cls), base) for base in bases} dists2 = {dist: base for base, dist in dists.items() if dist is not None} if not dists2: return None return ...
[ "def", "nearest_base", "(", "cls", ",", "bases", ")", ":", "if", "cls", "in", "bases", ":", "return", "cls", "dists", "=", "{", "base", ":", "index", "(", "mro", "(", "cls", ")", ",", "base", ")", "for", "base", "in", "bases", "}", "dists2", "=",...
Returns the closest ancestor to cls in bases.
[ "Returns", "the", "closest", "ancestor", "to", "cls", "in", "bases", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L93-L103
mbodenhamer/syn
syn/base_utils/py.py
get_typename
def get_typename(x): '''Returns the name of the type of x, if x is an object. Otherwise, returns the name of x. ''' if isinstance(x, type): ret = x.__name__ else: ret = x.__class__.__name__ return ret
python
def get_typename(x): '''Returns the name of the type of x, if x is an object. Otherwise, returns the name of x. ''' if isinstance(x, type): ret = x.__name__ else: ret = x.__class__.__name__ return ret
[ "def", "get_typename", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "type", ")", ":", "ret", "=", "x", ".", "__name__", "else", ":", "ret", "=", "x", ".", "__class__", ".", "__name__", "return", "ret" ]
Returns the name of the type of x, if x is an object. Otherwise, returns the name of x.
[ "Returns", "the", "name", "of", "the", "type", "of", "x", "if", "x", "is", "an", "object", ".", "Otherwise", "returns", "the", "name", "of", "x", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L105-L112
mbodenhamer/syn
syn/base_utils/py.py
same_lineage
def same_lineage(o1, o2): '''Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).''' def comp(x, y): return issubclass(x, y) or issubclass(y, x) if isinstance(o1, type) and isinstance(o2, type): return comp(o1, o2) elif not (isi...
python
def same_lineage(o1, o2): '''Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).''' def comp(x, y): return issubclass(x, y) or issubclass(y, x) if isinstance(o1, type) and isinstance(o2, type): return comp(o1, o2) elif not (isi...
[ "def", "same_lineage", "(", "o1", ",", "o2", ")", ":", "def", "comp", "(", "x", ",", "y", ")", ":", "return", "issubclass", "(", "x", ",", "y", ")", "or", "issubclass", "(", "y", ",", "x", ")", "if", "isinstance", "(", "o1", ",", "type", ")", ...
Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).
[ "Returns", "True", "iff", "o1", "and", "o2", "are", "of", "the", "same", "class", "lineage", "(", "that", "is", "a", "direct", "line", "of", "descent", "without", "branches", ")", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L117-L126
mbodenhamer/syn
syn/base_utils/py.py
getfunc
def getfunc(obj, name=''): '''Get the function corresponding to name from obj, not the method.''' if name: obj = getattr(obj, name) return getattr(obj, '__func__', obj)
python
def getfunc(obj, name=''): '''Get the function corresponding to name from obj, not the method.''' if name: obj = getattr(obj, name) return getattr(obj, '__func__', obj)
[ "def", "getfunc", "(", "obj", ",", "name", "=", "''", ")", ":", "if", "name", ":", "obj", "=", "getattr", "(", "obj", ",", "name", ")", "return", "getattr", "(", "obj", ",", "'__func__'", ",", "obj", ")" ]
Get the function corresponding to name from obj, not the method.
[ "Get", "the", "function", "corresponding", "to", "name", "from", "obj", "not", "the", "method", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L220-L224
mbodenhamer/syn
syn/base_utils/py.py
getkey
def getkey(mapping, value, default=None, use_id=False): '''Returns the first key mapping to value, as encountered via iteritems(), otherwise default. Obviously, works best for injective maps. ''' if use_id: for key, val in mapping.items(): if val is value: return key ...
python
def getkey(mapping, value, default=None, use_id=False): '''Returns the first key mapping to value, as encountered via iteritems(), otherwise default. Obviously, works best for injective maps. ''' if use_id: for key, val in mapping.items(): if val is value: return key ...
[ "def", "getkey", "(", "mapping", ",", "value", ",", "default", "=", "None", ",", "use_id", "=", "False", ")", ":", "if", "use_id", ":", "for", "key", ",", "val", "in", "mapping", ".", "items", "(", ")", ":", "if", "val", "is", "value", ":", "retu...
Returns the first key mapping to value, as encountered via iteritems(), otherwise default. Obviously, works best for injective maps.
[ "Returns", "the", "first", "key", "mapping", "to", "value", "as", "encountered", "via", "iteritems", "()", "otherwise", "default", ".", "Obviously", "works", "best", "for", "injective", "maps", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L299-L310
mbodenhamer/syn
syn/base_utils/py.py
get_mod
def get_mod(cls): '''Returns the string identifying the module that cls is defined in. ''' if isinstance(cls, (type, types.FunctionType)): ret = cls.__module__ else: ret = cls.__class__.__module__ return ret
python
def get_mod(cls): '''Returns the string identifying the module that cls is defined in. ''' if isinstance(cls, (type, types.FunctionType)): ret = cls.__module__ else: ret = cls.__class__.__module__ return ret
[ "def", "get_mod", "(", "cls", ")", ":", "if", "isinstance", "(", "cls", ",", "(", "type", ",", "types", ".", "FunctionType", ")", ")", ":", "ret", "=", "cls", ".", "__module__", "else", ":", "ret", "=", "cls", ".", "__class__", ".", "__module__", "...
Returns the string identifying the module that cls is defined in.
[ "Returns", "the", "string", "identifying", "the", "module", "that", "cls", "is", "defined", "in", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L315-L323
mbodenhamer/syn
syn/base_utils/py.py
this_module
def this_module(npop=1): '''Returns the module object of the module this function is called from ''' stack = inspect.stack() st = stack[npop] frame = st[0] return inspect.getmodule(frame)
python
def this_module(npop=1): '''Returns the module object of the module this function is called from ''' stack = inspect.stack() st = stack[npop] frame = st[0] return inspect.getmodule(frame)
[ "def", "this_module", "(", "npop", "=", "1", ")", ":", "stack", "=", "inspect", ".", "stack", "(", ")", "st", "=", "stack", "[", "npop", "]", "frame", "=", "st", "[", "0", "]", "return", "inspect", ".", "getmodule", "(", "frame", ")" ]
Returns the module object of the module this function is called from
[ "Returns", "the", "module", "object", "of", "the", "module", "this", "function", "is", "called", "from" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L333-L339
mbodenhamer/syn
syn/base_utils/py.py
assert_equivalent
def assert_equivalent(o1, o2): '''Asserts that o1 and o2 are distinct, yet equivalent objects ''' if not (isinstance(o1, type) and isinstance(o2, type)): assert o1 is not o2 assert o1 == o2 assert o2 == o1
python
def assert_equivalent(o1, o2): '''Asserts that o1 and o2 are distinct, yet equivalent objects ''' if not (isinstance(o1, type) and isinstance(o2, type)): assert o1 is not o2 assert o1 == o2 assert o2 == o1
[ "def", "assert_equivalent", "(", "o1", ",", "o2", ")", ":", "if", "not", "(", "isinstance", "(", "o1", ",", "type", ")", "and", "isinstance", "(", "o2", ",", "type", ")", ")", ":", "assert", "o1", "is", "not", "o2", "assert", "o1", "==", "o2", "a...
Asserts that o1 and o2 are distinct, yet equivalent objects
[ "Asserts", "that", "o1", "and", "o2", "are", "distinct", "yet", "equivalent", "objects" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L421-L427
mbodenhamer/syn
syn/base_utils/py.py
assert_inequivalent
def assert_inequivalent(o1, o2): '''Asserts that o1 and o2 are distinct and inequivalent objects ''' if not (isinstance(o1, type) and isinstance(o2, type)): assert o1 is not o2 assert not o1 == o2 and o1 != o2 assert not o2 == o1 and o2 != o1
python
def assert_inequivalent(o1, o2): '''Asserts that o1 and o2 are distinct and inequivalent objects ''' if not (isinstance(o1, type) and isinstance(o2, type)): assert o1 is not o2 assert not o1 == o2 and o1 != o2 assert not o2 == o1 and o2 != o1
[ "def", "assert_inequivalent", "(", "o1", ",", "o2", ")", ":", "if", "not", "(", "isinstance", "(", "o1", ",", "type", ")", "and", "isinstance", "(", "o2", ",", "type", ")", ")", ":", "assert", "o1", "is", "not", "o2", "assert", "not", "o1", "==", ...
Asserts that o1 and o2 are distinct and inequivalent objects
[ "Asserts", "that", "o1", "and", "o2", "are", "distinct", "and", "inequivalent", "objects" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L429-L435
mbodenhamer/syn
syn/base_utils/py.py
assert_type_equivalent
def assert_type_equivalent(o1, o2): '''Asserts that o1 and o2 are distinct, yet equivalent objects of the same type ''' assert o1 == o2 assert o2 == o1 assert type(o1) is type(o2)
python
def assert_type_equivalent(o1, o2): '''Asserts that o1 and o2 are distinct, yet equivalent objects of the same type ''' assert o1 == o2 assert o2 == o1 assert type(o1) is type(o2)
[ "def", "assert_type_equivalent", "(", "o1", ",", "o2", ")", ":", "assert", "o1", "==", "o2", "assert", "o2", "==", "o1", "assert", "type", "(", "o1", ")", "is", "type", "(", "o2", ")" ]
Asserts that o1 and o2 are distinct, yet equivalent objects of the same type
[ "Asserts", "that", "o1", "and", "o2", "are", "distinct", "yet", "equivalent", "objects", "of", "the", "same", "type" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L437-L442
mbodenhamer/syn
syn/base_utils/py.py
assert_deepcopy_idempotent
def assert_deepcopy_idempotent(obj): '''Assert that obj does not change (w.r.t. ==) under repeated deepcopies ''' from copy import deepcopy obj1 = deepcopy(obj) obj2 = deepcopy(obj1) obj3 = deepcopy(obj2) assert_equivalent(obj, obj1) assert_equivalent(obj, obj2) assert_equivalent(obj...
python
def assert_deepcopy_idempotent(obj): '''Assert that obj does not change (w.r.t. ==) under repeated deepcopies ''' from copy import deepcopy obj1 = deepcopy(obj) obj2 = deepcopy(obj1) obj3 = deepcopy(obj2) assert_equivalent(obj, obj1) assert_equivalent(obj, obj2) assert_equivalent(obj...
[ "def", "assert_deepcopy_idempotent", "(", "obj", ")", ":", "from", "copy", "import", "deepcopy", "obj1", "=", "deepcopy", "(", "obj", ")", "obj2", "=", "deepcopy", "(", "obj1", ")", "obj3", "=", "deepcopy", "(", "obj2", ")", "assert_equivalent", "(", "obj"...
Assert that obj does not change (w.r.t. ==) under repeated deepcopies
[ "Assert", "that", "obj", "does", "not", "change", "(", "w", ".", "r", ".", "t", ".", "==", ")", "under", "repeated", "deepcopies" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L444-L454
mbodenhamer/syn
syn/base_utils/py.py
assert_pickle_idempotent
def assert_pickle_idempotent(obj): '''Assert that obj does not change (w.r.t. ==) under repeated picklings ''' from six.moves.cPickle import dumps, loads obj1 = loads(dumps(obj)) obj2 = loads(dumps(obj1)) obj3 = loads(dumps(obj2)) assert_equivalent(obj, obj1) assert_equivalent(obj, obj2)...
python
def assert_pickle_idempotent(obj): '''Assert that obj does not change (w.r.t. ==) under repeated picklings ''' from six.moves.cPickle import dumps, loads obj1 = loads(dumps(obj)) obj2 = loads(dumps(obj1)) obj3 = loads(dumps(obj2)) assert_equivalent(obj, obj1) assert_equivalent(obj, obj2)...
[ "def", "assert_pickle_idempotent", "(", "obj", ")", ":", "from", "six", ".", "moves", ".", "cPickle", "import", "dumps", ",", "loads", "obj1", "=", "loads", "(", "dumps", "(", "obj", ")", ")", "obj2", "=", "loads", "(", "dumps", "(", "obj1", ")", ")"...
Assert that obj does not change (w.r.t. ==) under repeated picklings
[ "Assert", "that", "obj", "does", "not", "change", "(", "w", ".", "r", ".", "t", ".", "==", ")", "under", "repeated", "picklings" ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L456-L466
mbodenhamer/syn
syn/base_utils/py.py
elog
def elog(exc, func, args=None, kwargs=None, str=str, pretty=True, name=''): '''For logging exception-raising function invocations during randomized unit tests. ''' from .str import safe_str args = args if args else () kwargs = kwargs if kwargs else {} name = '{}.{}'.format(get_mod(func), name) ...
python
def elog(exc, func, args=None, kwargs=None, str=str, pretty=True, name=''): '''For logging exception-raising function invocations during randomized unit tests. ''' from .str import safe_str args = args if args else () kwargs = kwargs if kwargs else {} name = '{}.{}'.format(get_mod(func), name) ...
[ "def", "elog", "(", "exc", ",", "func", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "str", "=", "str", ",", "pretty", "=", "True", ",", "name", "=", "''", ")", ":", "from", ".", "str", "import", "safe_str", "args", "=", "args", "...
For logging exception-raising function invocations during randomized unit tests.
[ "For", "logging", "exception", "-", "raising", "function", "invocations", "during", "randomized", "unit", "tests", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/base_utils/py.py#L468-L490
colab/colab-superarchives-plugin
src/colab_superarchives/management/commands/message.py
get_charset
def get_charset(message, default='ASCII'): """Get the message charset""" charset = message.get_content_charset() if not charset: charset = message.get_charset() if not charset: charset = default try: codecs.lookup(charset) except LookupError: charset = default...
python
def get_charset(message, default='ASCII'): """Get the message charset""" charset = message.get_content_charset() if not charset: charset = message.get_charset() if not charset: charset = default try: codecs.lookup(charset) except LookupError: charset = default...
[ "def", "get_charset", "(", "message", ",", "default", "=", "'ASCII'", ")", ":", "charset", "=", "message", ".", "get_content_charset", "(", ")", "if", "not", "charset", ":", "charset", "=", "message", ".", "get_charset", "(", ")", "if", "not", "charset", ...
Get the message charset
[ "Get", "the", "message", "charset" ]
train
https://github.com/colab/colab-superarchives-plugin/blob/fe588a1d4fac874ccad2063ee19a857028a22721/src/colab_superarchives/management/commands/message.py#L13-L29
colab/colab-superarchives-plugin
src/colab_superarchives/management/commands/message.py
Message.get_body
def get_body(self): """Get the body of the email message""" if self.is_multipart(): # get the plain text version only text_parts = [part for part in typed_subpart_iterator(self, 'text', ...
python
def get_body(self): """Get the body of the email message""" if self.is_multipart(): # get the plain text version only text_parts = [part for part in typed_subpart_iterator(self, 'text', ...
[ "def", "get_body", "(", "self", ")", ":", "if", "self", ".", "is_multipart", "(", ")", ":", "# get the plain text version only", "text_parts", "=", "[", "part", "for", "part", "in", "typed_subpart_iterator", "(", "self", ",", "'text'", ",", "'plain'", ")", "...
Get the body of the email message
[ "Get", "the", "body", "of", "the", "email", "message" ]
train
https://github.com/colab/colab-superarchives-plugin/blob/fe588a1d4fac874ccad2063ee19a857028a22721/src/colab_superarchives/management/commands/message.py#L56-L79
johnwlockwood/cooperative
examples/blocking.py
do_some_expensive_things
def do_some_expensive_things(number): """ Perform one expensive computation cooperatively with any other iterator passed into twisted's cooperate, then use it's result to pass into the second computation. :param number: :return: """ result = yield batch_accumulate(1000, expensive(numb...
python
def do_some_expensive_things(number): """ Perform one expensive computation cooperatively with any other iterator passed into twisted's cooperate, then use it's result to pass into the second computation. :param number: :return: """ result = yield batch_accumulate(1000, expensive(numb...
[ "def", "do_some_expensive_things", "(", "number", ")", ":", "result", "=", "yield", "batch_accumulate", "(", "1000", ",", "expensive", "(", "number", ")", ")", "total", "=", "reduce", "(", "add", ",", "result", ",", "0", ")", "log", ".", "msg", "(", "\...
Perform one expensive computation cooperatively with any other iterator passed into twisted's cooperate, then use it's result to pass into the second computation. :param number: :return:
[ "Perform", "one", "expensive", "computation", "cooperatively", "with", "any", "other", "iterator", "passed", "into", "twisted", "s", "cooperate", "then", "use", "it", "s", "result", "to", "pass", "into", "the", "second", "computation", "." ]
train
https://github.com/johnwlockwood/cooperative/blob/bec25451a6d2b06260be809b72cfd6287c75da39/examples/blocking.py#L28-L44
Akhail/Tebless
tebless/widgets/window.py
Window.listen
def listen(self): """Blocking call on widgets. """ while self._listen: key = u'' key = self.term.inkey(timeout=0.2) try: if key.code == KEY_ENTER: self.on_enter(key=key) elif key.code in (KEY_DOWN, KEY_UP): ...
python
def listen(self): """Blocking call on widgets. """ while self._listen: key = u'' key = self.term.inkey(timeout=0.2) try: if key.code == KEY_ENTER: self.on_enter(key=key) elif key.code in (KEY_DOWN, KEY_UP): ...
[ "def", "listen", "(", "self", ")", ":", "while", "self", ".", "_listen", ":", "key", "=", "u''", "key", "=", "self", ".", "term", ".", "inkey", "(", "timeout", "=", "0.2", ")", "try", ":", "if", "key", ".", "code", "==", "KEY_ENTER", ":", "self",...
Blocking call on widgets.
[ "Blocking", "call", "on", "widgets", "." ]
train
https://github.com/Akhail/Tebless/blob/369ff76f06e7a0b6d04fabc287fa6c4095e158d4/tebless/widgets/window.py#L81-L98
Akhail/Tebless
tebless/widgets/window.py
Window.add
def add(self, widget, *args, **kwargs): """Insert new element. Usage: window.add(widget, **{ 'prop1': val, 'prop2': val2 }) """ ins_widget = widget(*args, **kwargs) self.__iadd__(ins_widget) return ins_widget
python
def add(self, widget, *args, **kwargs): """Insert new element. Usage: window.add(widget, **{ 'prop1': val, 'prop2': val2 }) """ ins_widget = widget(*args, **kwargs) self.__iadd__(ins_widget) return ins_widget
[ "def", "add", "(", "self", ",", "widget", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ins_widget", "=", "widget", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "__iadd__", "(", "ins_widget", ")", "return", "ins_widget" ]
Insert new element. Usage: window.add(widget, **{ 'prop1': val, 'prop2': val2 })
[ "Insert", "new", "element", "." ]
train
https://github.com/Akhail/Tebless/blob/369ff76f06e7a0b6d04fabc287fa6c4095e158d4/tebless/widgets/window.py#L100-L112
emory-libraries/eulcommon
eulcommon/searchutil/__init__.py
search_terms
def search_terms(q): '''Takes a search string and parses it into a list of keywords and phrases.''' tokens = parse_search_terms(q) # iterate through all the tokens and make a list of token values # (which are the actual words and phrases) values = [] for t in tokens: # word/phrase ...
python
def search_terms(q): '''Takes a search string and parses it into a list of keywords and phrases.''' tokens = parse_search_terms(q) # iterate through all the tokens and make a list of token values # (which are the actual words and phrases) values = [] for t in tokens: # word/phrase ...
[ "def", "search_terms", "(", "q", ")", ":", "tokens", "=", "parse_search_terms", "(", "q", ")", "# iterate through all the tokens and make a list of token values", "# (which are the actual words and phrases)", "values", "=", "[", "]", "for", "t", "in", "tokens", ":", "# ...
Takes a search string and parses it into a list of keywords and phrases.
[ "Takes", "a", "search", "string", "and", "parses", "it", "into", "a", "list", "of", "keywords", "and", "phrases", "." ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/searchutil/__init__.py#L129-L150
emory-libraries/eulcommon
eulcommon/searchutil/__init__.py
pages_to_show
def pages_to_show(paginator, page, page_labels=None): """Generate a dictionary of pages to show around the current page. Show 3 numbers on either side of the specified page, or more if close to end or beginning of available pages. :param paginator: django :class:`~django.core.paginator.Paginator`, ...
python
def pages_to_show(paginator, page, page_labels=None): """Generate a dictionary of pages to show around the current page. Show 3 numbers on either side of the specified page, or more if close to end or beginning of available pages. :param paginator: django :class:`~django.core.paginator.Paginator`, ...
[ "def", "pages_to_show", "(", "paginator", ",", "page", ",", "page_labels", "=", "None", ")", ":", "show_pages", "=", "{", "}", "# FIXME; do we need OrderedDict here ?", "if", "page_labels", "is", "None", ":", "page_labels", "=", "{", "}", "def", "get_page_label"...
Generate a dictionary of pages to show around the current page. Show 3 numbers on either side of the specified page, or more if close to end or beginning of available pages. :param paginator: django :class:`~django.core.paginator.Paginator`, populated with objects :param page: number of the cur...
[ "Generate", "a", "dictionary", "of", "pages", "to", "show", "around", "the", "current", "page", ".", "Show", "3", "numbers", "on", "either", "side", "of", "the", "specified", "page", "or", "more", "if", "close", "to", "end", "or", "beginning", "of", "ava...
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/searchutil/__init__.py#L153-L191
fogcitymarathoner/s3_mysql_backup
s3_mysql_backup/scripts/backup_dir.py
backup
def backup(): """ zips into db_backups_dir and uploads to bucket_name/s3_folder fab -f ./fabfile.py backup_dbs """ args = parser.parse_args() s3_backup_dir( args.datadir, args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name, args.zip_back...
python
def backup(): """ zips into db_backups_dir and uploads to bucket_name/s3_folder fab -f ./fabfile.py backup_dbs """ args = parser.parse_args() s3_backup_dir( args.datadir, args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name, args.zip_back...
[ "def", "backup", "(", ")", ":", "args", "=", "parser", ".", "parse_args", "(", ")", "s3_backup_dir", "(", "args", ".", "datadir", ",", "args", ".", "aws_access_key_id", ",", "args", ".", "aws_secret_access_key", ",", "args", ".", "bucket_name", ",", "args"...
zips into db_backups_dir and uploads to bucket_name/s3_folder fab -f ./fabfile.py backup_dbs
[ "zips", "into", "db_backups_dir", "and", "uploads", "to", "bucket_name", "/", "s3_folder", "fab", "-", "f", ".", "/", "fabfile", ".", "py", "backup_dbs" ]
train
https://github.com/fogcitymarathoner/s3_mysql_backup/blob/8a0fb3e51a7b873eb4287d4954548a0dbab0e734/s3_mysql_backup/scripts/backup_dir.py#L22-L35
micbou/flake8-ycm
flake8_ycm.py
Indentation
def Indentation( logical_line, previous_logical, indent_level, previous_indent_level ): """Use two spaces per indentation level.""" comment = '' if logical_line else ' (comment)' if indent_level % 2: code = 'YCM111' if logical_line else 'YCM114' message =...
python
def Indentation( logical_line, previous_logical, indent_level, previous_indent_level ): """Use two spaces per indentation level.""" comment = '' if logical_line else ' (comment)' if indent_level % 2: code = 'YCM111' if logical_line else 'YCM114' message =...
[ "def", "Indentation", "(", "logical_line", ",", "previous_logical", ",", "indent_level", ",", "previous_indent_level", ")", ":", "comment", "=", "''", "if", "logical_line", "else", "' (comment)'", "if", "indent_level", "%", "2", ":", "code", "=", "'YCM111'", "if...
Use two spaces per indentation level.
[ "Use", "two", "spaces", "per", "indentation", "level", "." ]
train
https://github.com/micbou/flake8-ycm/blob/60eb837751260f28db44b51a1641ea8743c1c497/flake8_ycm.py#L35-L50
micbou/flake8-ycm
flake8_ycm.py
SpacesInsideBrackets
def SpacesInsideBrackets( logical_line, tokens ): """Require spaces inside parentheses, square brackets, and braces for non-empty content.""" for index in range( len( tokens ) ): _, prev_text, _, prev_end, _ = ( tokens[ index - 1 ] if index - 1 >= 0 else ( None, None, None...
python
def SpacesInsideBrackets( logical_line, tokens ): """Require spaces inside parentheses, square brackets, and braces for non-empty content.""" for index in range( len( tokens ) ): _, prev_text, _, prev_end, _ = ( tokens[ index - 1 ] if index - 1 >= 0 else ( None, None, None...
[ "def", "SpacesInsideBrackets", "(", "logical_line", ",", "tokens", ")", ":", "for", "index", "in", "range", "(", "len", "(", "tokens", ")", ")", ":", "_", ",", "prev_text", ",", "_", ",", "prev_end", ",", "_", "=", "(", "tokens", "[", "index", "-", ...
Require spaces inside parentheses, square brackets, and braces for non-empty content.
[ "Require", "spaces", "inside", "parentheses", "square", "brackets", "and", "braces", "for", "non", "-", "empty", "content", "." ]
train
https://github.com/micbou/flake8-ycm/blob/60eb837751260f28db44b51a1641ea8743c1c497/flake8_ycm.py#L57-L89
chairbender/fantasy-football-auction
fantasy_football_auction/owner.py
Owner.buy
def buy(self, player, cost): """ indicate that the player was bought at the specified cost :param Player player: player to buy :param int cost: cost to pay :raises InsufficientFundsError: if owner doesn't have the money :raises NoValidRosterSlotError: if owner doesn't h...
python
def buy(self, player, cost): """ indicate that the player was bought at the specified cost :param Player player: player to buy :param int cost: cost to pay :raises InsufficientFundsError: if owner doesn't have the money :raises NoValidRosterSlotError: if owner doesn't h...
[ "def", "buy", "(", "self", ",", "player", ",", "cost", ")", ":", "if", "cost", ">", "self", ".", "max_bid", "(", ")", ":", "raise", "InsufficientFundsError", "(", ")", "elif", "not", "any", "(", "roster_slot", ".", "accepts", "(", "player", ")", "and...
indicate that the player was bought at the specified cost :param Player player: player to buy :param int cost: cost to pay :raises InsufficientFundsError: if owner doesn't have the money :raises NoValidRosterSlotError: if owner doesn't have a slot this player could fill :raises...
[ "indicate", "that", "the", "player", "was", "bought", "at", "the", "specified", "cost" ]
train
https://github.com/chairbender/fantasy-football-auction/blob/f54868691ea37691c378b0a05b6b3280c2cbba11/fantasy_football_auction/owner.py#L132-L153
sarenji/pyrc
pyrc/threads.py
JobThread.run
def run(self): """Keep running this thread until it's stopped""" while not self._finished.isSet(): self._func(self._reference) self._finished.wait(self._func._interval / 1000.0)
python
def run(self): """Keep running this thread until it's stopped""" while not self._finished.isSet(): self._func(self._reference) self._finished.wait(self._func._interval / 1000.0)
[ "def", "run", "(", "self", ")", ":", "while", "not", "self", ".", "_finished", ".", "isSet", "(", ")", ":", "self", ".", "_func", "(", "self", ".", "_reference", ")", "self", ".", "_finished", ".", "wait", "(", "self", ".", "_func", ".", "_interval...
Keep running this thread until it's stopped
[ "Keep", "running", "this", "thread", "until", "it", "s", "stopped" ]
train
https://github.com/sarenji/pyrc/blob/5e8377ddcda6e0ef4ba7d66cf400e243b1fb8f68/pyrc/threads.py#L16-L20
kankiri/pabiana
pabiana/zmqs/area.py
Area.subscribe
def subscribe(self, clock_name: str=None, clock_slots: Iterable[str]=None, subscriptions: Dict[str, Any]={}): """Subscribes this Area to the given Areas and optionally given Slots. Must be called before the Area is run. Args: clock_name: The name of the Area that is used as synchronizing Clock. clock_slots: ...
python
def subscribe(self, clock_name: str=None, clock_slots: Iterable[str]=None, subscriptions: Dict[str, Any]={}): """Subscribes this Area to the given Areas and optionally given Slots. Must be called before the Area is run. Args: clock_name: The name of the Area that is used as synchronizing Clock. clock_slots: ...
[ "def", "subscribe", "(", "self", ",", "clock_name", ":", "str", "=", "None", ",", "clock_slots", ":", "Iterable", "[", "str", "]", "=", "None", ",", "subscriptions", ":", "Dict", "[", "str", ",", "Any", "]", "=", "{", "}", ")", ":", "for", "area", ...
Subscribes this Area to the given Areas and optionally given Slots. Must be called before the Area is run. Args: clock_name: The name of the Area that is used as synchronizing Clock. clock_slots: The slots of the Clock relevant to this Area. subscriptions: A dictionary containing the relevant Areas names as...
[ "Subscribes", "this", "Area", "to", "the", "given", "Areas", "and", "optionally", "given", "Slots", ".", "Must", "be", "called", "before", "the", "Area", "is", "run", "." ]
train
https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/pabiana/zmqs/area.py#L52-L68
drcloud/magiclog
magiclog.py
logger
def logger(ref=0): """Finds a module logger. If the argument passed is a module, find the logger for that module using the modules' name; if it's a string, finds a logger of that name; if an integer, walks the stack to the module at that height. The logger is always extended with a ``.configure()`...
python
def logger(ref=0): """Finds a module logger. If the argument passed is a module, find the logger for that module using the modules' name; if it's a string, finds a logger of that name; if an integer, walks the stack to the module at that height. The logger is always extended with a ``.configure()`...
[ "def", "logger", "(", "ref", "=", "0", ")", ":", "if", "inspect", ".", "ismodule", "(", "ref", ")", ":", "return", "extend", "(", "logging", ".", "getLogger", "(", "ref", ".", "__name__", ")", ")", "if", "isinstance", "(", "ref", ",", "basestring", ...
Finds a module logger. If the argument passed is a module, find the logger for that module using the modules' name; if it's a string, finds a logger of that name; if an integer, walks the stack to the module at that height. The logger is always extended with a ``.configure()`` method allowing its ...
[ "Finds", "a", "module", "logger", "." ]
train
https://github.com/drcloud/magiclog/blob/f045a68f9d3eff946c0a0d3147edff0ec0c0b344/magiclog.py#L21-L36
drcloud/magiclog
magiclog.py
configure
def configure(logger=None, **kwargs): """Configures a logger, according to the following rules: * With no options set, enables ``INFO`` level on stderr if stderr is a TTY; otherwise enables ``INFO`` level to Syslog. * With ``syslog=`` and/or ``stderr=``, configures as specified. * With ``level=...
python
def configure(logger=None, **kwargs): """Configures a logger, according to the following rules: * With no options set, enables ``INFO`` level on stderr if stderr is a TTY; otherwise enables ``INFO`` level to Syslog. * With ``syslog=`` and/or ``stderr=``, configures as specified. * With ``level=...
[ "def", "configure", "(", "logger", "=", "None", ",", "*", "*", "kwargs", ")", ":", "configuration", "=", "Configuration", ".", "auto", "(", "*", "*", "kwargs", ")", "if", "logger", "is", "None", ":", "logger", "=", "logging", ".", "getLogger", "(", "...
Configures a logger, according to the following rules: * With no options set, enables ``INFO`` level on stderr if stderr is a TTY; otherwise enables ``INFO`` level to Syslog. * With ``syslog=`` and/or ``stderr=``, configures as specified. * With ``level=``, enables either Syslog or stderr logging a...
[ "Configures", "a", "logger", "according", "to", "the", "following", "rules", ":" ]
train
https://github.com/drcloud/magiclog/blob/f045a68f9d3eff946c0a0d3147edff0ec0c0b344/magiclog.py#L39-L53
drcloud/magiclog
magiclog.py
Configuration.auto
def auto(cls, syslog=None, stderr=None, level=None, extended=None, server=None): """Tries to guess a sound logging configuration. """ level = norm_level(level) or logging.INFO if syslog is None and stderr is None: if sys.stderr.isatty() or syslog_path() is None: ...
python
def auto(cls, syslog=None, stderr=None, level=None, extended=None, server=None): """Tries to guess a sound logging configuration. """ level = norm_level(level) or logging.INFO if syslog is None and stderr is None: if sys.stderr.isatty() or syslog_path() is None: ...
[ "def", "auto", "(", "cls", ",", "syslog", "=", "None", ",", "stderr", "=", "None", ",", "level", "=", "None", ",", "extended", "=", "None", ",", "server", "=", "None", ")", ":", "level", "=", "norm_level", "(", "level", ")", "or", "logging", ".", ...
Tries to guess a sound logging configuration.
[ "Tries", "to", "guess", "a", "sound", "logging", "configuration", "." ]
train
https://github.com/drcloud/magiclog/blob/f045a68f9d3eff946c0a0d3147edff0ec0c0b344/magiclog.py#L68-L83
drcloud/magiclog
magiclog.py
Formatter.format
def format(self, rec): """ :type rec: logging.LogRecord """ t = self.formatTime(rec, self.datefmt) func = '' if rec.funcName == '<module>' else ' %s()' % rec.funcName left_header_data = (t, rec.msecs, rec.name, func, rec.lineno) left_header = '%s.%03d %s%s @ %d' %...
python
def format(self, rec): """ :type rec: logging.LogRecord """ t = self.formatTime(rec, self.datefmt) func = '' if rec.funcName == '<module>' else ' %s()' % rec.funcName left_header_data = (t, rec.msecs, rec.name, func, rec.lineno) left_header = '%s.%03d %s%s @ %d' %...
[ "def", "format", "(", "self", ",", "rec", ")", ":", "t", "=", "self", ".", "formatTime", "(", "rec", ",", "self", ".", "datefmt", ")", "func", "=", "''", "if", "rec", ".", "funcName", "==", "'<module>'", "else", "' %s()'", "%", "rec", ".", "funcNam...
:type rec: logging.LogRecord
[ ":", "type", "rec", ":", "logging", ".", "LogRecord" ]
train
https://github.com/drcloud/magiclog/blob/f045a68f9d3eff946c0a0d3147edff0ec0c0b344/magiclog.py#L194-L217
Othernet-Project/bottle-fdsend
fdsend/sendfile.py
send_file
def send_file(fd, filename=None, size=None, timestamp=None, ctype=None, charset=CHARSET, attachment=False, wrapper=DEFAULT_WRAPPER): """ Send a file represented by file object This function constcuts a HTTPResponse object that uses a file descriptor as response body. The file descriptor is su...
python
def send_file(fd, filename=None, size=None, timestamp=None, ctype=None, charset=CHARSET, attachment=False, wrapper=DEFAULT_WRAPPER): """ Send a file represented by file object This function constcuts a HTTPResponse object that uses a file descriptor as response body. The file descriptor is su...
[ "def", "send_file", "(", "fd", ",", "filename", "=", "None", ",", "size", "=", "None", ",", "timestamp", "=", "None", ",", "ctype", "=", "None", ",", "charset", "=", "CHARSET", ",", "attachment", "=", "False", ",", "wrapper", "=", "DEFAULT_WRAPPER", ")...
Send a file represented by file object This function constcuts a HTTPResponse object that uses a file descriptor as response body. The file descriptor is suppled as ``fd`` argument and it must have a ``read()`` method. ``ValueError`` is raised when this is not the case. It supports `byte serving`_ usin...
[ "Send", "a", "file", "represented", "by", "file", "object" ]
train
https://github.com/Othernet-Project/bottle-fdsend/blob/5ff27e605e8cf878e24c71c1446dcf5c8caf4898/fdsend/sendfile.py#L36-L156
maxfischer2781/chainlet
chainlet/primitives/linker.py
LinkPrimitives.convert
def convert(self, element): """Convert an element to a chainlink""" if isinstance(element, self.base_link_type): return element for converter in self.converters: link = converter(element) if link is not NotImplemented: return link raise...
python
def convert(self, element): """Convert an element to a chainlink""" if isinstance(element, self.base_link_type): return element for converter in self.converters: link = converter(element) if link is not NotImplemented: return link raise...
[ "def", "convert", "(", "self", ",", "element", ")", ":", "if", "isinstance", "(", "element", ",", "self", ".", "base_link_type", ")", ":", "return", "element", "for", "converter", "in", "self", ".", "converters", ":", "link", "=", "converter", "(", "elem...
Convert an element to a chainlink
[ "Convert", "an", "element", "to", "a", "chainlink" ]
train
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/primitives/linker.py#L39-L47
dossier/dossier.label
dossier/label/combined_store.py
CombinedLabelStore.get_related_coref_relationships
def get_related_coref_relationships(self, content_id, min_strength=None): '''Follow coreference relationships to get full related graph. :rtype: dict mapping related identifier to list of documents coref to that identifier. ''' related_labels = self.rel_label_store.get_related( ...
python
def get_related_coref_relationships(self, content_id, min_strength=None): '''Follow coreference relationships to get full related graph. :rtype: dict mapping related identifier to list of documents coref to that identifier. ''' related_labels = self.rel_label_store.get_related( ...
[ "def", "get_related_coref_relationships", "(", "self", ",", "content_id", ",", "min_strength", "=", "None", ")", ":", "related_labels", "=", "self", ".", "rel_label_store", ".", "get_related", "(", "content_id", ",", "min_strength", "=", "min_strength", ")", "rela...
Follow coreference relationships to get full related graph. :rtype: dict mapping related identifier to list of documents coref to that identifier.
[ "Follow", "coreference", "relationships", "to", "get", "full", "related", "graph", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/combined_store.py#L23-L38
dossier/dossier.label
dossier/label/combined_store.py
CombinedLabelStore.get_related_flat
def get_related_flat(self, content_id, min_strength=None): '''Follow coreference relationships to get full related graph. This differs from ``get_related_coref_relationships`` in that it returns a flat list of all identifiers found through the coreference layer of indirection. ...
python
def get_related_flat(self, content_id, min_strength=None): '''Follow coreference relationships to get full related graph. This differs from ``get_related_coref_relationships`` in that it returns a flat list of all identifiers found through the coreference layer of indirection. ...
[ "def", "get_related_flat", "(", "self", ",", "content_id", ",", "min_strength", "=", "None", ")", ":", "rel_id_to_idents", "=", "self", ".", "get_related_coref_relationships", "(", "content_id", ",", "min_strength", "=", "min_strength", ")", "flat_list", "=", "[",...
Follow coreference relationships to get full related graph. This differs from ``get_related_coref_relationships`` in that it returns a flat list of all identifiers found through the coreference layer of indirection. :rtype: list of identifiers
[ "Follow", "coreference", "relationships", "to", "get", "full", "related", "graph", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/combined_store.py#L40-L54
ronaldguillen/wave
wave/views.py
get_view_name
def get_view_name(view_cls, suffix=None): """ Given a view class, return a textual name to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_NAME_FUNCTION` setting. """ name = view_cls.__name__ name = formatting....
python
def get_view_name(view_cls, suffix=None): """ Given a view class, return a textual name to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_NAME_FUNCTION` setting. """ name = view_cls.__name__ name = formatting....
[ "def", "get_view_name", "(", "view_cls", ",", "suffix", "=", "None", ")", ":", "name", "=", "view_cls", ".", "__name__", "name", "=", "formatting", ".", "remove_trailing_string", "(", "name", ",", "'View'", ")", "name", "=", "formatting", ".", "remove_traili...
Given a view class, return a textual name to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_NAME_FUNCTION` setting.
[ "Given", "a", "view", "class", "return", "a", "textual", "name", "to", "represent", "the", "view", ".", "This", "name", "is", "used", "in", "the", "browsable", "API", "and", "in", "OPTIONS", "responses", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L24-L38
ronaldguillen/wave
wave/views.py
get_view_description
def get_view_description(view_cls, html=False): """ Given a view class, return a textual description to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_DESCRIPTION_FUNCTION` setting. """ description = view_cls.__do...
python
def get_view_description(view_cls, html=False): """ Given a view class, return a textual description to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_DESCRIPTION_FUNCTION` setting. """ description = view_cls.__do...
[ "def", "get_view_description", "(", "view_cls", ",", "html", "=", "False", ")", ":", "description", "=", "view_cls", ".", "__doc__", "or", "''", "description", "=", "formatting", ".", "dedent", "(", "smart_text", "(", "description", ")", ")", "if", "html", ...
Given a view class, return a textual description to represent the view. This name is used in the browsable API, and in OPTIONS responses. This function is the default for the `VIEW_DESCRIPTION_FUNCTION` setting.
[ "Given", "a", "view", "class", "return", "a", "textual", "description", "to", "represent", "the", "view", ".", "This", "name", "is", "used", "in", "the", "browsable", "API", "and", "in", "OPTIONS", "responses", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L41-L52
ronaldguillen/wave
wave/views.py
exception_handler
def exception_handler(exc, context): """ Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's built-in `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a ...
python
def exception_handler(exc, context): """ Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's built-in `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a ...
[ "def", "exception_handler", "(", "exc", ",", "context", ")", ":", "if", "isinstance", "(", "exc", ",", "exceptions", ".", "APIException", ")", ":", "headers", "=", "{", "}", "if", "getattr", "(", "exc", ",", "'auth_header'", ",", "None", ")", ":", "hea...
Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's built-in `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a 500 error to be raised.
[ "Returns", "the", "response", "that", "should", "be", "used", "for", "any", "given", "exception", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L55-L95
ronaldguillen/wave
wave/views.py
RestView.as_view
def as_view(cls, **initkwargs): """ Store the original class on the view function. This allows us to discover information about the view when we do URL reverse lookups. Used for breadcrumb generation. """ if isinstance(getattr(cls, 'queryset', None), models.query.QueryS...
python
def as_view(cls, **initkwargs): """ Store the original class on the view function. This allows us to discover information about the view when we do URL reverse lookups. Used for breadcrumb generation. """ if isinstance(getattr(cls, 'queryset', None), models.query.QueryS...
[ "def", "as_view", "(", "cls", ",", "*", "*", "initkwargs", ")", ":", "if", "isinstance", "(", "getattr", "(", "cls", ",", "'queryset'", ",", "None", ")", ",", "models", ".", "query", ".", "QuerySet", ")", ":", "def", "force_evaluation", "(", ")", ":"...
Store the original class on the view function. This allows us to discover information about the view when we do URL reverse lookups. Used for breadcrumb generation.
[ "Store", "the", "original", "class", "on", "the", "view", "function", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L114-L136
ronaldguillen/wave
wave/views.py
RestView.permission_denied
def permission_denied(self, request, message=None): """ If request is not permitted, determine what kind of exception to raise. """ if not request.successful_authenticator: raise exceptions.NotAuthenticated() raise exceptions.PermissionDenied(detail=message)
python
def permission_denied(self, request, message=None): """ If request is not permitted, determine what kind of exception to raise. """ if not request.successful_authenticator: raise exceptions.NotAuthenticated() raise exceptions.PermissionDenied(detail=message)
[ "def", "permission_denied", "(", "self", ",", "request", ",", "message", "=", "None", ")", ":", "if", "not", "request", ".", "successful_authenticator", ":", "raise", "exceptions", ".", "NotAuthenticated", "(", ")", "raise", "exceptions", ".", "PermissionDenied"...
If request is not permitted, determine what kind of exception to raise.
[ "If", "request", "is", "not", "permitted", "determine", "what", "kind", "of", "exception", "to", "raise", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L161-L167
ronaldguillen/wave
wave/views.py
RestView.get_view_name
def get_view_name(self): """ Return the view name, as used in OPTIONS responses and in the browsable API. """ func = self.settings.VIEW_NAME_FUNCTION return func(self.__class__, getattr(self, 'suffix', None))
python
def get_view_name(self): """ Return the view name, as used in OPTIONS responses and in the browsable API. """ func = self.settings.VIEW_NAME_FUNCTION return func(self.__class__, getattr(self, 'suffix', None))
[ "def", "get_view_name", "(", "self", ")", ":", "func", "=", "self", ".", "settings", ".", "VIEW_NAME_FUNCTION", "return", "func", "(", "self", ".", "__class__", ",", "getattr", "(", "self", ",", "'suffix'", ",", "None", ")", ")" ]
Return the view name, as used in OPTIONS responses and in the browsable API.
[ "Return", "the", "view", "name", "as", "used", "in", "OPTIONS", "responses", "and", "in", "the", "browsable", "API", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L223-L229
ronaldguillen/wave
wave/views.py
RestView.get_view_description
def get_view_description(self, html=False): """ Return some descriptive text for the view, as used in OPTIONS responses and in the browsable API. """ func = self.settings.VIEW_DESCRIPTION_FUNCTION return func(self.__class__, html)
python
def get_view_description(self, html=False): """ Return some descriptive text for the view, as used in OPTIONS responses and in the browsable API. """ func = self.settings.VIEW_DESCRIPTION_FUNCTION return func(self.__class__, html)
[ "def", "get_view_description", "(", "self", ",", "html", "=", "False", ")", ":", "func", "=", "self", ".", "settings", ".", "VIEW_DESCRIPTION_FUNCTION", "return", "func", "(", "self", ".", "__class__", ",", "html", ")" ]
Return some descriptive text for the view, as used in OPTIONS responses and in the browsable API.
[ "Return", "some", "descriptive", "text", "for", "the", "view", "as", "used", "in", "OPTIONS", "responses", "and", "in", "the", "browsable", "API", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L231-L237
ronaldguillen/wave
wave/views.py
RestView.get_format_suffix
def get_format_suffix(self, **kwargs): """ Determine if the request includes a '.json' style format suffix """ if self.settings.FORMAT_SUFFIX_KWARG: return kwargs.get(self.settings.FORMAT_SUFFIX_KWARG)
python
def get_format_suffix(self, **kwargs): """ Determine if the request includes a '.json' style format suffix """ if self.settings.FORMAT_SUFFIX_KWARG: return kwargs.get(self.settings.FORMAT_SUFFIX_KWARG)
[ "def", "get_format_suffix", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "settings", ".", "FORMAT_SUFFIX_KWARG", ":", "return", "kwargs", ".", "get", "(", "self", ".", "settings", ".", "FORMAT_SUFFIX_KWARG", ")" ]
Determine if the request includes a '.json' style format suffix
[ "Determine", "if", "the", "request", "includes", "a", ".", "json", "style", "format", "suffix" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L241-L246
ronaldguillen/wave
wave/views.py
RestView.get_content_negotiator
def get_content_negotiator(self): """ Instantiate and return the content negotiation class to use. """ if not getattr(self, '_negotiator', None): self._negotiator = self.content_negotiation_class() return self._negotiator
python
def get_content_negotiator(self): """ Instantiate and return the content negotiation class to use. """ if not getattr(self, '_negotiator', None): self._negotiator = self.content_negotiation_class() return self._negotiator
[ "def", "get_content_negotiator", "(", "self", ")", ":", "if", "not", "getattr", "(", "self", ",", "'_negotiator'", ",", "None", ")", ":", "self", ".", "_negotiator", "=", "self", ".", "content_negotiation_class", "(", ")", "return", "self", ".", "_negotiator...
Instantiate and return the content negotiation class to use.
[ "Instantiate", "and", "return", "the", "content", "negotiation", "class", "to", "use", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L278-L284
ronaldguillen/wave
wave/views.py
RestView.perform_content_negotiation
def perform_content_negotiation(self, request, force=False): """ Determine which renderer and media type to use render the response. """ renderers = self.get_renderers() conneg = self.get_content_negotiator() try: return conneg.select_renderer(request, render...
python
def perform_content_negotiation(self, request, force=False): """ Determine which renderer and media type to use render the response. """ renderers = self.get_renderers() conneg = self.get_content_negotiator() try: return conneg.select_renderer(request, render...
[ "def", "perform_content_negotiation", "(", "self", ",", "request", ",", "force", "=", "False", ")", ":", "renderers", "=", "self", ".", "get_renderers", "(", ")", "conneg", "=", "self", ".", "get_content_negotiator", "(", ")", "try", ":", "return", "conneg",...
Determine which renderer and media type to use render the response.
[ "Determine", "which", "renderer", "and", "media", "type", "to", "use", "render", "the", "response", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L288-L300
ronaldguillen/wave
wave/views.py
RestView.check_throttles
def check_throttles(self, request): """ Check if request should be throttled. Raises an appropriate exception if the request is throttled. """ for throttle in self.get_throttles(): if not throttle.allow_request(request, self): self.throttled(request, t...
python
def check_throttles(self, request): """ Check if request should be throttled. Raises an appropriate exception if the request is throttled. """ for throttle in self.get_throttles(): if not throttle.allow_request(request, self): self.throttled(request, t...
[ "def", "check_throttles", "(", "self", ",", "request", ")", ":", "for", "throttle", "in", "self", ".", "get_throttles", "(", ")", ":", "if", "not", "throttle", ".", "allow_request", "(", "request", ",", "self", ")", ":", "self", ".", "throttled", "(", ...
Check if request should be throttled. Raises an appropriate exception if the request is throttled.
[ "Check", "if", "request", "should", "be", "throttled", ".", "Raises", "an", "appropriate", "exception", "if", "the", "request", "is", "throttled", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L334-L341
ronaldguillen/wave
wave/views.py
RestView.determine_version
def determine_version(self, request, *args, **kwargs): """ If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) """ if self.versioning_class is None: return (None, None) schem...
python
def determine_version(self, request, *args, **kwargs): """ If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) """ if self.versioning_class is None: return (None, None) schem...
[ "def", "determine_version", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "versioning_class", "is", "None", ":", "return", "(", "None", ",", "None", ")", "scheme", "=", "self", ".", "versioning_cla...
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
[ "If", "versioning", "is", "being", "used", "then", "determine", "any", "API", "version", "for", "the", "incoming", "request", ".", "Returns", "a", "two", "-", "tuple", "of", "(", "version", "versioning_scheme", ")" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L343-L351
ronaldguillen/wave
wave/views.py
RestView.initialize_request
def initialize_request(self, request, *args, **kwargs): """ Returns the initial request object. """ parser_context = self.get_parser_context(request) return Request( request, parsers=self.get_parsers(), authenticators=self.get_authenticators()...
python
def initialize_request(self, request, *args, **kwargs): """ Returns the initial request object. """ parser_context = self.get_parser_context(request) return Request( request, parsers=self.get_parsers(), authenticators=self.get_authenticators()...
[ "def", "initialize_request", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "parser_context", "=", "self", ".", "get_parser_context", "(", "request", ")", "return", "Request", "(", "request", ",", "parsers", "=", "self", ...
Returns the initial request object.
[ "Returns", "the", "initial", "request", "object", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L355-L367
ronaldguillen/wave
wave/views.py
RestView.initial
def initial(self, request, *args, **kwargs): """ Runs anything that needs to occur prior to calling the method handler. """ self.format_kwarg = self.get_format_suffix(**kwargs) # Ensure that the incoming request is permitted self.perform_authentication(request) s...
python
def initial(self, request, *args, **kwargs): """ Runs anything that needs to occur prior to calling the method handler. """ self.format_kwarg = self.get_format_suffix(**kwargs) # Ensure that the incoming request is permitted self.perform_authentication(request) s...
[ "def", "initial", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "format_kwarg", "=", "self", ".", "get_format_suffix", "(", "*", "*", "kwargs", ")", "# Ensure that the incoming request is permitted", "self", "...
Runs anything that needs to occur prior to calling the method handler.
[ "Runs", "anything", "that", "needs", "to", "occur", "prior", "to", "calling", "the", "method", "handler", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L369-L386
ronaldguillen/wave
wave/views.py
RestView.finalize_response
def finalize_response(self, request, response, *args, **kwargs): """ Returns the final response object. """ # Make the error obvious if a proper response is not returned assert isinstance(response, HttpResponseBase), ( 'Expected a `Response`, `HttpResponse` or `HttpSt...
python
def finalize_response(self, request, response, *args, **kwargs): """ Returns the final response object. """ # Make the error obvious if a proper response is not returned assert isinstance(response, HttpResponseBase), ( 'Expected a `Response`, `HttpResponse` or `HttpSt...
[ "def", "finalize_response", "(", "self", ",", "request", ",", "response", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Make the error obvious if a proper response is not returned", "assert", "isinstance", "(", "response", ",", "HttpResponseBase", ")", ","...
Returns the final response object.
[ "Returns", "the", "final", "response", "object", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L388-L411
ronaldguillen/wave
wave/views.py
RestView.handle_exception
def handle_exception(self, exc): """ Handle any exception that occurs, by returning an appropriate response, or re-raising the error. """ if isinstance(exc, (exceptions.NotAuthenticated, exceptions.AuthenticationFailed)): # WWW-Authenticate...
python
def handle_exception(self, exc): """ Handle any exception that occurs, by returning an appropriate response, or re-raising the error. """ if isinstance(exc, (exceptions.NotAuthenticated, exceptions.AuthenticationFailed)): # WWW-Authenticate...
[ "def", "handle_exception", "(", "self", ",", "exc", ")", ":", "if", "isinstance", "(", "exc", ",", "(", "exceptions", ".", "NotAuthenticated", ",", "exceptions", ".", "AuthenticationFailed", ")", ")", ":", "# WWW-Authenticate header for 401 responses, else coerce to 4...
Handle any exception that occurs, by returning an appropriate response, or re-raising the error.
[ "Handle", "any", "exception", "that", "occurs", "by", "returning", "an", "appropriate", "response", "or", "re", "-", "raising", "the", "error", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L413-L437
ronaldguillen/wave
wave/views.py
RestView.dispatch
def dispatch(self, request, *args, **kwargs): """ `.dispatch()` is pretty much the same as Django's regular dispatch, but with extra hooks for startup, finalize, and exception handling. """ self.args = args self.kwargs = kwargs request = self.initialize_request(re...
python
def dispatch(self, request, *args, **kwargs): """ `.dispatch()` is pretty much the same as Django's regular dispatch, but with extra hooks for startup, finalize, and exception handling. """ self.args = args self.kwargs = kwargs request = self.initialize_request(re...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "args", "=", "args", "self", ".", "kwargs", "=", "kwargs", "request", "=", "self", ".", "initialize_request", "(", "request", ",", "*", ...
`.dispatch()` is pretty much the same as Django's regular dispatch, but with extra hooks for startup, finalize, and exception handling.
[ ".", "dispatch", "()", "is", "pretty", "much", "the", "same", "as", "Django", "s", "regular", "dispatch", "but", "with", "extra", "hooks", "for", "startup", "finalize", "and", "exception", "handling", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L442-L469
ronaldguillen/wave
wave/views.py
RestView.options
def options(self, request, *args, **kwargs): """ Handler method for HTTP 'OPTIONS' request. """ if self.metadata_class is None: return self.http_method_not_allowed(request, *args, **kwargs) data = self.metadata_class().determine_metadata(request, self) return ...
python
def options(self, request, *args, **kwargs): """ Handler method for HTTP 'OPTIONS' request. """ if self.metadata_class is None: return self.http_method_not_allowed(request, *args, **kwargs) data = self.metadata_class().determine_metadata(request, self) return ...
[ "def", "options", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "metadata_class", "is", "None", ":", "return", "self", ".", "http_method_not_allowed", "(", "request", ",", "*", "args", ",", "*", ...
Handler method for HTTP 'OPTIONS' request.
[ "Handler", "method", "for", "HTTP", "OPTIONS", "request", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L471-L478
rfk/regobj
regobj.py
Key.get_subkey
def get_subkey(self,name): """Retreive the subkey with the specified name. If the named subkey is not found, AttributeError is raised; this is for consistency with the attribute-based access notation. """ subkey = Key(name,self) try: hkey = subkey.hkey ...
python
def get_subkey(self,name): """Retreive the subkey with the specified name. If the named subkey is not found, AttributeError is raised; this is for consistency with the attribute-based access notation. """ subkey = Key(name,self) try: hkey = subkey.hkey ...
[ "def", "get_subkey", "(", "self", ",", "name", ")", ":", "subkey", "=", "Key", "(", "name", ",", "self", ")", "try", ":", "hkey", "=", "subkey", ".", "hkey", "except", "WindowsError", ":", "raise", "AttributeError", "(", "\"subkey '%s' does not exist\"", "...
Retreive the subkey with the specified name. If the named subkey is not found, AttributeError is raised; this is for consistency with the attribute-based access notation.
[ "Retreive", "the", "subkey", "with", "the", "specified", "name", "." ]
train
https://github.com/rfk/regobj/blob/7edd46be28aa3e1427be263911e111c4ca2dfa4f/regobj.py#L241-L252
rfk/regobj
regobj.py
Key.set_subkey
def set_subkey(self,name,value=None): """Create the named subkey and set its value. There are several different ways to specify the new contents of the named subkey: * if 'value' is the Key class, a subclass thereof, or None, then the subkey is created but not populated w...
python
def set_subkey(self,name,value=None): """Create the named subkey and set its value. There are several different ways to specify the new contents of the named subkey: * if 'value' is the Key class, a subclass thereof, or None, then the subkey is created but not populated w...
[ "def", "set_subkey", "(", "self", ",", "name", ",", "value", "=", "None", ")", ":", "self", ".", "sam", "|=", "KEY_CREATE_SUB_KEY", "subkey", "=", "Key", "(", "name", ",", "self", ")", "try", ":", "subkey", "=", "self", ".", "get_subkey", "(", "name"...
Create the named subkey and set its value. There are several different ways to specify the new contents of the named subkey: * if 'value' is the Key class, a subclass thereof, or None, then the subkey is created but not populated with any data. * if 'value' is a key ins...
[ "Create", "the", "named", "subkey", "and", "set", "its", "value", "." ]
train
https://github.com/rfk/regobj/blob/7edd46be28aa3e1427be263911e111c4ca2dfa4f/regobj.py#L254-L301
rfk/regobj
regobj.py
Key.del_subkey
def del_subkey(self,name): """Delete the named subkey, and any values or keys it contains.""" self.sam |= KEY_WRITE subkey = self.get_subkey(name) subkey.clear() _winreg.DeleteKey(subkey.parent.hkey,subkey.name)
python
def del_subkey(self,name): """Delete the named subkey, and any values or keys it contains.""" self.sam |= KEY_WRITE subkey = self.get_subkey(name) subkey.clear() _winreg.DeleteKey(subkey.parent.hkey,subkey.name)
[ "def", "del_subkey", "(", "self", ",", "name", ")", ":", "self", ".", "sam", "|=", "KEY_WRITE", "subkey", "=", "self", ".", "get_subkey", "(", "name", ")", "subkey", ".", "clear", "(", ")", "_winreg", ".", "DeleteKey", "(", "subkey", ".", "parent", "...
Delete the named subkey, and any values or keys it contains.
[ "Delete", "the", "named", "subkey", "and", "any", "values", "or", "keys", "it", "contains", "." ]
train
https://github.com/rfk/regobj/blob/7edd46be28aa3e1427be263911e111c4ca2dfa4f/regobj.py#L303-L308
rfk/regobj
regobj.py
Key.clear
def clear(self): """Remove all subkeys and values from this key.""" self.sam |= KEY_WRITE for v in list(self.values()): del self[v.name] for k in list(self.subkeys()): self.del_subkey(k.name)
python
def clear(self): """Remove all subkeys and values from this key.""" self.sam |= KEY_WRITE for v in list(self.values()): del self[v.name] for k in list(self.subkeys()): self.del_subkey(k.name)
[ "def", "clear", "(", "self", ")", ":", "self", ".", "sam", "|=", "KEY_WRITE", "for", "v", "in", "list", "(", "self", ".", "values", "(", ")", ")", ":", "del", "self", "[", "v", ".", "name", "]", "for", "k", "in", "list", "(", "self", ".", "su...
Remove all subkeys and values from this key.
[ "Remove", "all", "subkeys", "and", "values", "from", "this", "key", "." ]
train
https://github.com/rfk/regobj/blob/7edd46be28aa3e1427be263911e111c4ca2dfa4f/regobj.py#L426-L432
urbn/Caesium
caesium/document.py
AsyncRevisionStackManager.publish
def publish(self): """ Iterate over the scheduler collections and apply any actions found """ try: for collection in self.settings.get("scheduler").get("collections"): yield self.publish_for_collection(collection) except Exception as ex: ...
python
def publish(self): """ Iterate over the scheduler collections and apply any actions found """ try: for collection in self.settings.get("scheduler").get("collections"): yield self.publish_for_collection(collection) except Exception as ex: ...
[ "def", "publish", "(", "self", ")", ":", "try", ":", "for", "collection", "in", "self", ".", "settings", ".", "get", "(", "\"scheduler\"", ")", ".", "get", "(", "\"collections\"", ")", ":", "yield", "self", ".", "publish_for_collection", "(", "collection",...
Iterate over the scheduler collections and apply any actions found
[ "Iterate", "over", "the", "scheduler", "collections", "and", "apply", "any", "actions", "found" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L36-L45
urbn/Caesium
caesium/document.py
AsyncRevisionStackManager.set_all_revisions_to_in_process
def set_all_revisions_to_in_process(self, ids): """ Set all revisions found to in process, so that other threads will not pick them up. :param list ids: """ predicate = { "_id" : { "$in" : [ ObjectId(id) for id in ids ] } } ...
python
def set_all_revisions_to_in_process(self, ids): """ Set all revisions found to in process, so that other threads will not pick them up. :param list ids: """ predicate = { "_id" : { "$in" : [ ObjectId(id) for id in ids ] } } ...
[ "def", "set_all_revisions_to_in_process", "(", "self", ",", "ids", ")", ":", "predicate", "=", "{", "\"_id\"", ":", "{", "\"$in\"", ":", "[", "ObjectId", "(", "id", ")", "for", "id", "in", "ids", "]", "}", "}", "set", "=", "{", "\"$set\"", ":", "{", ...
Set all revisions found to in process, so that other threads will not pick them up. :param list ids:
[ "Set", "all", "revisions", "found", "to", "in", "process", "so", "that", "other", "threads", "will", "not", "pick", "them", "up", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L48-L63
urbn/Caesium
caesium/document.py
AsyncRevisionStackManager.__get_pending_revisions
def __get_pending_revisions(self): """ Get all the pending revisions after the current time :return: A list of revisions :rtype: list """ dttime = time.mktime(datetime.datetime.now().timetuple()) changes = yield self.revisions.find({ "toa" : { ...
python
def __get_pending_revisions(self): """ Get all the pending revisions after the current time :return: A list of revisions :rtype: list """ dttime = time.mktime(datetime.datetime.now().timetuple()) changes = yield self.revisions.find({ "toa" : { ...
[ "def", "__get_pending_revisions", "(", "self", ")", ":", "dttime", "=", "time", ".", "mktime", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "timetuple", "(", ")", ")", "changes", "=", "yield", "self", ".", "revisions", ".", "find", "(",...
Get all the pending revisions after the current time :return: A list of revisions :rtype: list
[ "Get", "all", "the", "pending", "revisions", "after", "the", "current", "time" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L67-L86
urbn/Caesium
caesium/document.py
AsyncRevisionStackManager.publish_for_collection
def publish_for_collection(self, collection_name): """ Run the publishing operations for a given collection :param str collection_name: """ self.revisions = BaseAsyncMotorDocument("%s_revisions" % collection_name, self.settings) changes = yield self.__get_pending_revisi...
python
def publish_for_collection(self, collection_name): """ Run the publishing operations for a given collection :param str collection_name: """ self.revisions = BaseAsyncMotorDocument("%s_revisions" % collection_name, self.settings) changes = yield self.__get_pending_revisi...
[ "def", "publish_for_collection", "(", "self", ",", "collection_name", ")", ":", "self", ".", "revisions", "=", "BaseAsyncMotorDocument", "(", "\"%s_revisions\"", "%", "collection_name", ",", "self", ".", "settings", ")", "changes", "=", "yield", "self", ".", "__...
Run the publishing operations for a given collection :param str collection_name:
[ "Run", "the", "publishing", "operations", "for", "a", "given", "collection" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L89-L118
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__update_action
def __update_action(self, revision): """Update a master document and revision history document :param dict revision: The revision dictionary """ patch = revision.get("patch") if patch.get("_id"): del patch["_id"] update_response = yield self.collection.patc...
python
def __update_action(self, revision): """Update a master document and revision history document :param dict revision: The revision dictionary """ patch = revision.get("patch") if patch.get("_id"): del patch["_id"] update_response = yield self.collection.patc...
[ "def", "__update_action", "(", "self", ",", "revision", ")", ":", "patch", "=", "revision", ".", "get", "(", "\"patch\"", ")", "if", "patch", ".", "get", "(", "\"_id\"", ")", ":", "del", "patch", "[", "\"_id\"", "]", "update_response", "=", "yield", "s...
Update a master document and revision history document :param dict revision: The revision dictionary
[ "Update", "a", "master", "document", "and", "revision", "history", "document" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L181-L194
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__insert_action
def __insert_action(self, revision): """ Handle the insert action type. Creates new document to be created in this collection. This allows you to stage a creation of an object :param dict revision: The revision dictionary """ revision["patch"]["_id"] = ObjectI...
python
def __insert_action(self, revision): """ Handle the insert action type. Creates new document to be created in this collection. This allows you to stage a creation of an object :param dict revision: The revision dictionary """ revision["patch"]["_id"] = ObjectI...
[ "def", "__insert_action", "(", "self", ",", "revision", ")", ":", "revision", "[", "\"patch\"", "]", "[", "\"_id\"", "]", "=", "ObjectId", "(", "revision", ".", "get", "(", "\"master_id\"", ")", ")", "insert_response", "=", "yield", "self", ".", "collectio...
Handle the insert action type. Creates new document to be created in this collection. This allows you to stage a creation of an object :param dict revision: The revision dictionary
[ "Handle", "the", "insert", "action", "type", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L197-L213
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__delete_action
def __delete_action(self, revision): """ Handle a delete action to a partiular master id via the revision. :param dict revision: :return: """ delete_response = yield self.collection.delete(revision.get("master_id")) if delete_response.get("n") == 0: r...
python
def __delete_action(self, revision): """ Handle a delete action to a partiular master id via the revision. :param dict revision: :return: """ delete_response = yield self.collection.delete(revision.get("master_id")) if delete_response.get("n") == 0: r...
[ "def", "__delete_action", "(", "self", ",", "revision", ")", ":", "delete_response", "=", "yield", "self", ".", "collection", ".", "delete", "(", "revision", ".", "get", "(", "\"master_id\"", ")", ")", "if", "delete_response", ".", "get", "(", "\"n\"", ")"...
Handle a delete action to a partiular master id via the revision. :param dict revision: :return:
[ "Handle", "a", "delete", "action", "to", "a", "partiular", "master", "id", "via", "the", "revision", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L216-L225
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.pop
def pop(self): """Pop the top revision off the stack back onto the collection at the given id. This method applies the action. Note: This assumes you don't have two revisions scheduled closer than a single scheduling cycle. """ revisions = yield self.list() if len(revisions) >...
python
def pop(self): """Pop the top revision off the stack back onto the collection at the given id. This method applies the action. Note: This assumes you don't have two revisions scheduled closer than a single scheduling cycle. """ revisions = yield self.list() if len(revisions) >...
[ "def", "pop", "(", "self", ")", ":", "revisions", "=", "yield", "self", ".", "list", "(", ")", "if", "len", "(", "revisions", ")", ">", "0", ":", "revision", "=", "revisions", "[", "0", "]", "# Update type action", "if", "revision", ".", "get", "(", ...
Pop the top revision off the stack back onto the collection at the given id. This method applies the action. Note: This assumes you don't have two revisions scheduled closer than a single scheduling cycle.
[ "Pop", "the", "top", "revision", "off", "the", "stack", "back", "onto", "the", "collection", "at", "the", "given", "id", ".", "This", "method", "applies", "the", "action", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L228-L285
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__make_patch_storeable
def __make_patch_storeable(self, patch): """Replace all dots with pipes in key names, mongo doesn't like to store keys with dots. :param dict patch: The patch that needs to be made storeable and applied in the future """ new_patch = {} for key in patch: new_patch[key...
python
def __make_patch_storeable(self, patch): """Replace all dots with pipes in key names, mongo doesn't like to store keys with dots. :param dict patch: The patch that needs to be made storeable and applied in the future """ new_patch = {} for key in patch: new_patch[key...
[ "def", "__make_patch_storeable", "(", "self", ",", "patch", ")", ":", "new_patch", "=", "{", "}", "for", "key", "in", "patch", ":", "new_patch", "[", "key", ".", "replace", "(", "\".\"", ",", "\"|\"", ")", "]", "=", "patch", "[", "key", "]", "return"...
Replace all dots with pipes in key names, mongo doesn't like to store keys with dots. :param dict patch: The patch that needs to be made storeable and applied in the future
[ "Replace", "all", "dots", "with", "pipes", "in", "key", "names", "mongo", "doesn", "t", "like", "to", "store", "keys", "with", "dots", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L287-L296
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__make_storeable_patch_patchable
def __make_storeable_patch_patchable(self, patch): """Replace all pipes with dots, transform back into the a namespace path. This is done before the $set query is applied to the document :param dict patch: The patch that is to be prepared to be applied """ new_patch = {} ...
python
def __make_storeable_patch_patchable(self, patch): """Replace all pipes with dots, transform back into the a namespace path. This is done before the $set query is applied to the document :param dict patch: The patch that is to be prepared to be applied """ new_patch = {} ...
[ "def", "__make_storeable_patch_patchable", "(", "self", ",", "patch", ")", ":", "new_patch", "=", "{", "}", "for", "key", "in", "patch", ":", "new_patch", "[", "key", ".", "replace", "(", "\"|\"", ",", "\".\"", ")", "]", "=", "patch", "[", "key", "]", ...
Replace all pipes with dots, transform back into the a namespace path. This is done before the $set query is applied to the document :param dict patch: The patch that is to be prepared to be applied
[ "Replace", "all", "pipes", "with", "dots", "transform", "back", "into", "the", "a", "namespace", "path", ".", "This", "is", "done", "before", "the", "$set", "query", "is", "applied", "to", "the", "document" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L298-L309
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.push
def push(self, patch=None, toa=None, meta=None): """Push a change on to the revision stack for this ObjectId. Pushing onto the stack is how you get revisions to be staged and scheduled for some future time. :param dict patch: None Denotes Delete :param int toa: Time of action :...
python
def push(self, patch=None, toa=None, meta=None): """Push a change on to the revision stack for this ObjectId. Pushing onto the stack is how you get revisions to be staged and scheduled for some future time. :param dict patch: None Denotes Delete :param int toa: Time of action :...
[ "def", "push", "(", "self", ",", "patch", "=", "None", ",", "toa", "=", "None", ",", "meta", "=", "None", ")", ":", "if", "not", "meta", ":", "meta", "=", "{", "}", "if", "not", "toa", ":", "toa", "=", "time", ".", "mktime", "(", "datetime", ...
Push a change on to the revision stack for this ObjectId. Pushing onto the stack is how you get revisions to be staged and scheduled for some future time. :param dict patch: None Denotes Delete :param int toa: Time of action :param dict meta: The meta data for this action
[ "Push", "a", "change", "on", "to", "the", "revision", "stack", "for", "this", "ObjectId", ".", "Pushing", "onto", "the", "stack", "is", "how", "you", "get", "revisions", "to", "be", "staged", "and", "scheduled", "for", "some", "future", "time", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L312-L370
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.list
def list(self, toa=None, show_history=False): """Return all revisions for this stack :param int toa: The time of action as a UTC timestamp :param bool show_history: Whether to show historical revisions """ if not toa: toa = time.mktime(datetime.datetime.now().timetup...
python
def list(self, toa=None, show_history=False): """Return all revisions for this stack :param int toa: The time of action as a UTC timestamp :param bool show_history: Whether to show historical revisions """ if not toa: toa = time.mktime(datetime.datetime.now().timetup...
[ "def", "list", "(", "self", ",", "toa", "=", "None", ",", "show_history", "=", "False", ")", ":", "if", "not", "toa", ":", "toa", "=", "time", ".", "mktime", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "timetuple", "(", ")", ")",...
Return all revisions for this stack :param int toa: The time of action as a UTC timestamp :param bool show_history: Whether to show historical revisions
[ "Return", "all", "revisions", "for", "this", "stack" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L373-L395
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack._lazy_migration
def _lazy_migration(self, patch=None, meta=None, toa=None): """ Handle when a revision scheduling is turned onto a collection that was previously not scheduleable. This method will create the first revision for each object before its every used in the context of scheduling. :param dict ...
python
def _lazy_migration(self, patch=None, meta=None, toa=None): """ Handle when a revision scheduling is turned onto a collection that was previously not scheduleable. This method will create the first revision for each object before its every used in the context of scheduling. :param dict ...
[ "def", "_lazy_migration", "(", "self", ",", "patch", "=", "None", ",", "meta", "=", "None", ",", "toa", "=", "None", ")", ":", "objects", "=", "yield", "self", ".", "revisions", ".", "find", "(", "{", "\"master_id\"", ":", "self", ".", "master_id", "...
Handle when a revision scheduling is turned onto a collection that was previously not scheduleable. This method will create the first revision for each object before its every used in the context of scheduling. :param dict patch: The patch that should be used :param dict meta: Meta data for thi...
[ "Handle", "when", "a", "revision", "scheduling", "is", "turned", "onto", "a", "collection", "that", "was", "previously", "not", "scheduleable", ".", "This", "method", "will", "create", "the", "first", "revision", "for", "each", "object", "before", "its", "ever...
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L399-L451
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.__create_preview_object_base
def __create_preview_object_base(self, dct): """ The starting point for a preview of a future object. This is the object which will have future revisions iterated and applied to. :param dict dct: The starting object dictionary :return: The preview object id :rtype: str ...
python
def __create_preview_object_base(self, dct): """ The starting point for a preview of a future object. This is the object which will have future revisions iterated and applied to. :param dict dct: The starting object dictionary :return: The preview object id :rtype: str ...
[ "def", "__create_preview_object_base", "(", "self", ",", "dct", ")", ":", "if", "dct", ".", "get", "(", "\"_id\"", ")", ":", "del", "dct", "[", "\"_id\"", "]", "preview_object_id", "=", "yield", "self", ".", "previews", ".", "insert", "(", "dct", ")", ...
The starting point for a preview of a future object. This is the object which will have future revisions iterated and applied to. :param dict dct: The starting object dictionary :return: The preview object id :rtype: str
[ "The", "starting", "point", "for", "a", "preview", "of", "a", "future", "object", ".", "This", "is", "the", "object", "which", "will", "have", "future", "revisions", "iterated", "and", "applied", "to", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L454-L469
urbn/Caesium
caesium/document.py
AsyncSchedulableDocumentRevisionStack.preview
def preview(self, revision_id): """Get an ephemeral preview of a revision with all revisions applied between it and the current state :param str revision_id: The ID of the revision state you want to preview the master id at. :return: A snapshot of a future state of the object :rtype: di...
python
def preview(self, revision_id): """Get an ephemeral preview of a revision with all revisions applied between it and the current state :param str revision_id: The ID of the revision state you want to preview the master id at. :return: A snapshot of a future state of the object :rtype: di...
[ "def", "preview", "(", "self", ",", "revision_id", ")", ":", "target_revision", "=", "yield", "self", ".", "revisions", ".", "find_one_by_id", "(", "revision_id", ")", "if", "isinstance", "(", "target_revision", ".", "get", "(", "\"snapshot\"", ")", ",", "di...
Get an ephemeral preview of a revision with all revisions applied between it and the current state :param str revision_id: The ID of the revision state you want to preview the master id at. :return: A snapshot of a future state of the object :rtype: dict
[ "Get", "an", "ephemeral", "preview", "of", "a", "revision", "with", "all", "revisions", "applied", "between", "it", "and", "the", "current", "state" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L472-L540
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.insert
def insert(self, dct, toa=None, comment=""): """Create a document :param dict dct: :param toa toa: Optional time of action, triggers this to be handled as a future insert action for a new document :param str comment: A comment :rtype str: :returns string bson id: ...
python
def insert(self, dct, toa=None, comment=""): """Create a document :param dict dct: :param toa toa: Optional time of action, triggers this to be handled as a future insert action for a new document :param str comment: A comment :rtype str: :returns string bson id: ...
[ "def", "insert", "(", "self", ",", "dct", ",", "toa", "=", "None", ",", "comment", "=", "\"\"", ")", ":", "if", "self", ".", "schema", ":", "jsonschema", ".", "validate", "(", "dct", ",", "self", ".", "schema", ")", "bson_obj", "=", "yield", "self"...
Create a document :param dict dct: :param toa toa: Optional time of action, triggers this to be handled as a future insert action for a new document :param str comment: A comment :rtype str: :returns string bson id:
[ "Create", "a", "document" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L583-L597
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.upsert
def upsert(self, _id, dct, attribute="_id"): """Update or Insert a new document :param str _id: The document id :param dict dct: The dictionary to set on the document :param str attribute: The attribute to query for to find the object to set this data on :returns: JSON Mongo cli...
python
def upsert(self, _id, dct, attribute="_id"): """Update or Insert a new document :param str _id: The document id :param dict dct: The dictionary to set on the document :param str attribute: The attribute to query for to find the object to set this data on :returns: JSON Mongo cli...
[ "def", "upsert", "(", "self", ",", "_id", ",", "dct", ",", "attribute", "=", "\"_id\"", ")", ":", "mongo_response", "=", "yield", "self", ".", "update", "(", "_id", ",", "dct", ",", "upsert", "=", "True", ",", "attribute", "=", "attribute", ")", "rai...
Update or Insert a new document :param str _id: The document id :param dict dct: The dictionary to set on the document :param str attribute: The attribute to query for to find the object to set this data on :returns: JSON Mongo client response including the "n" key to show number of obj...
[ "Update", "or", "Insert", "a", "new", "document" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L600-L611
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.update
def update(self, predicate_value, dct, upsert=False, attribute="_id"): """Update an existing document :param predicate_value: The value of the predicate :param dict dct: The dictionary to update with :param bool upsert: Whether this is an upsert action :param str attribute: The ...
python
def update(self, predicate_value, dct, upsert=False, attribute="_id"): """Update an existing document :param predicate_value: The value of the predicate :param dict dct: The dictionary to update with :param bool upsert: Whether this is an upsert action :param str attribute: The ...
[ "def", "update", "(", "self", ",", "predicate_value", ",", "dct", ",", "upsert", "=", "False", ",", "attribute", "=", "\"_id\"", ")", ":", "if", "self", ".", "schema", ":", "jsonschema", ".", "validate", "(", "dct", ",", "self", ".", "schema", ")", "...
Update an existing document :param predicate_value: The value of the predicate :param dict dct: The dictionary to update with :param bool upsert: Whether this is an upsert action :param str attribute: The attribute to query for to find the object to set this data ond :returns: J...
[ "Update", "an", "existing", "document" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L614-L636
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.patch
def patch(self, predicate_value, attrs, predicate_attribute="_id"): """Update an existing document via a $set query, this will apply only these attributes. :param predicate_value: The value of the predicate :param dict attrs: The dictionary to apply to this object :param str predicate_a...
python
def patch(self, predicate_value, attrs, predicate_attribute="_id"): """Update an existing document via a $set query, this will apply only these attributes. :param predicate_value: The value of the predicate :param dict attrs: The dictionary to apply to this object :param str predicate_a...
[ "def", "patch", "(", "self", ",", "predicate_value", ",", "attrs", ",", "predicate_attribute", "=", "\"_id\"", ")", ":", "if", "predicate_attribute", "==", "\"_id\"", "and", "not", "isinstance", "(", "predicate_value", ",", "ObjectId", ")", ":", "predicate_value...
Update an existing document via a $set query, this will apply only these attributes. :param predicate_value: The value of the predicate :param dict attrs: The dictionary to apply to this object :param str predicate_attribute: The attribute to query for to find the object to set this data ond ...
[ "Update", "an", "existing", "document", "via", "a", "$set", "query", "this", "will", "apply", "only", "these", "attributes", "." ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L640-L663
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.delete
def delete(self, _id): """Delete a document or create a DELETE revision :param str _id: The ID of the document to be deleted :returns: JSON Mongo client response including the "n" key to show number of objects effected """ mongo_response = yield self.collection.remove({"_id": Ob...
python
def delete(self, _id): """Delete a document or create a DELETE revision :param str _id: The ID of the document to be deleted :returns: JSON Mongo client response including the "n" key to show number of objects effected """ mongo_response = yield self.collection.remove({"_id": Ob...
[ "def", "delete", "(", "self", ",", "_id", ")", ":", "mongo_response", "=", "yield", "self", ".", "collection", ".", "remove", "(", "{", "\"_id\"", ":", "ObjectId", "(", "_id", ")", "}", ")", "raise", "Return", "(", "mongo_response", ")" ]
Delete a document or create a DELETE revision :param str _id: The ID of the document to be deleted :returns: JSON Mongo client response including the "n" key to show number of objects effected
[ "Delete", "a", "document", "or", "create", "a", "DELETE", "revision" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L666-L674
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.find_one
def find_one(self, query): """Find one wrapper with conversion to dictionary :param dict query: A Mongo query """ mongo_response = yield self.collection.find_one(query) raise Return(self._obj_cursor_to_dictionary(mongo_response))
python
def find_one(self, query): """Find one wrapper with conversion to dictionary :param dict query: A Mongo query """ mongo_response = yield self.collection.find_one(query) raise Return(self._obj_cursor_to_dictionary(mongo_response))
[ "def", "find_one", "(", "self", ",", "query", ")", ":", "mongo_response", "=", "yield", "self", ".", "collection", ".", "find_one", "(", "query", ")", "raise", "Return", "(", "self", ".", "_obj_cursor_to_dictionary", "(", "mongo_response", ")", ")" ]
Find one wrapper with conversion to dictionary :param dict query: A Mongo query
[ "Find", "one", "wrapper", "with", "conversion", "to", "dictionary" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L677-L683
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.find
def find(self, query, orderby=None, order_by_direction=1, page=0, limit=0): """Find a document by any criteria :param dict query: The query to perform :param str orderby: The attribute to order results by :param int order_by_direction: 1 or -1 :param int page: The page to return...
python
def find(self, query, orderby=None, order_by_direction=1, page=0, limit=0): """Find a document by any criteria :param dict query: The query to perform :param str orderby: The attribute to order results by :param int order_by_direction: 1 or -1 :param int page: The page to return...
[ "def", "find", "(", "self", ",", "query", ",", "orderby", "=", "None", ",", "order_by_direction", "=", "1", ",", "page", "=", "0", ",", "limit", "=", "0", ")", ":", "cursor", "=", "self", ".", "collection", ".", "find", "(", "query", ")", "if", "...
Find a document by any criteria :param dict query: The query to perform :param str orderby: The attribute to order results by :param int order_by_direction: 1 or -1 :param int page: The page to return :param int limit: Number of results per page :returns: A list of resul...
[ "Find", "a", "document", "by", "any", "criteria" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L686-L710
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.find_one_by_id
def find_one_by_id(self, _id): """ Find a single document by id :param str _id: BSON string repreentation of the Id :return: a signle object :rtype: dict """ document = (yield self.collection.find_one({"_id": ObjectId(_id)})) raise Return(self._obj_curso...
python
def find_one_by_id(self, _id): """ Find a single document by id :param str _id: BSON string repreentation of the Id :return: a signle object :rtype: dict """ document = (yield self.collection.find_one({"_id": ObjectId(_id)})) raise Return(self._obj_curso...
[ "def", "find_one_by_id", "(", "self", ",", "_id", ")", ":", "document", "=", "(", "yield", "self", ".", "collection", ".", "find_one", "(", "{", "\"_id\"", ":", "ObjectId", "(", "_id", ")", "}", ")", ")", "raise", "Return", "(", "self", ".", "_obj_cu...
Find a single document by id :param str _id: BSON string repreentation of the Id :return: a signle object :rtype: dict
[ "Find", "a", "single", "document", "by", "id" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L713-L723
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.create_index
def create_index(self, index, index_type=GEO2D): """Create an index on a given attribute :param str index: Attribute to set index on :param str index_type: See PyMongo index types for further information, defaults to GEO2D index. """ self.logger.info("Adding %s index to stores o...
python
def create_index(self, index, index_type=GEO2D): """Create an index on a given attribute :param str index: Attribute to set index on :param str index_type: See PyMongo index types for further information, defaults to GEO2D index. """ self.logger.info("Adding %s index to stores o...
[ "def", "create_index", "(", "self", ",", "index", ",", "index_type", "=", "GEO2D", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Adding %s index to stores on attribute: %s\"", "%", "(", "index_type", ",", "index", ")", ")", "yield", "self", ".", "col...
Create an index on a given attribute :param str index: Attribute to set index on :param str index_type: See PyMongo index types for further information, defaults to GEO2D index.
[ "Create", "an", "index", "on", "a", "given", "attribute" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L726-L733
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument.location_based_search
def location_based_search(self, lng, lat, distance, unit="miles", attribute_map=None, page=0, limit=50): """Search based on location and other attribute filters :param long lng: Longitude parameter :param long lat: Latitude parameter :param int distance: The radius of the query ...
python
def location_based_search(self, lng, lat, distance, unit="miles", attribute_map=None, page=0, limit=50): """Search based on location and other attribute filters :param long lng: Longitude parameter :param long lat: Latitude parameter :param int distance: The radius of the query ...
[ "def", "location_based_search", "(", "self", ",", "lng", ",", "lat", ",", "distance", ",", "unit", "=", "\"miles\"", ",", "attribute_map", "=", "None", ",", "page", "=", "0", ",", "limit", "=", "50", ")", ":", "#Determine what type of radian conversion you wan...
Search based on location and other attribute filters :param long lng: Longitude parameter :param long lat: Latitude parameter :param int distance: The radius of the query :param str unit: The unit of measure for the query, defaults to miles :param dict attribute_map: Additional ...
[ "Search", "based", "on", "location", "and", "other", "attribute", "filters" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L736-L770
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument._dictionary_to_cursor
def _dictionary_to_cursor(self, obj): """ Take a raw dictionary representation and adapt it back to a proper mongo document dictionary :param dict obj: The object to adapt :return: a mongo document with complex types for storage in mongo :rtype: dict """ if obj.ge...
python
def _dictionary_to_cursor(self, obj): """ Take a raw dictionary representation and adapt it back to a proper mongo document dictionary :param dict obj: The object to adapt :return: a mongo document with complex types for storage in mongo :rtype: dict """ if obj.ge...
[ "def", "_dictionary_to_cursor", "(", "self", ",", "obj", ")", ":", "if", "obj", ".", "get", "(", "\"id\"", ")", ":", "obj", "[", "\"_id\"", "]", "=", "ObjectId", "(", "obj", ".", "get", "(", "\"id\"", ")", ")", "del", "obj", "[", "\"id\"", "]", "...
Take a raw dictionary representation and adapt it back to a proper mongo document dictionary :param dict obj: The object to adapt :return: a mongo document with complex types for storage in mongo :rtype: dict
[ "Take", "a", "raw", "dictionary", "representation", "and", "adapt", "it", "back", "to", "a", "proper", "mongo", "document", "dictionary", ":", "param", "dict", "obj", ":", "The", "object", "to", "adapt", ":", "return", ":", "a", "mongo", "document", "with"...
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L772-L786
urbn/Caesium
caesium/document.py
BaseAsyncMotorDocument._obj_cursor_to_dictionary
def _obj_cursor_to_dictionary(self, cursor): """Handle conversion of pymongo cursor into a JSON object formatted for UI consumption :param dict cursor: a mongo document that should be converted to primitive types for the client code :returns: a primitive dictionary :rtype: dict ...
python
def _obj_cursor_to_dictionary(self, cursor): """Handle conversion of pymongo cursor into a JSON object formatted for UI consumption :param dict cursor: a mongo document that should be converted to primitive types for the client code :returns: a primitive dictionary :rtype: dict ...
[ "def", "_obj_cursor_to_dictionary", "(", "self", ",", "cursor", ")", ":", "if", "not", "cursor", ":", "return", "cursor", "cursor", "=", "json", ".", "loads", "(", "json", ".", "dumps", "(", "cursor", ",", "cls", "=", "BSONEncoder", ")", ")", "if", "cu...
Handle conversion of pymongo cursor into a JSON object formatted for UI consumption :param dict cursor: a mongo document that should be converted to primitive types for the client code :returns: a primitive dictionary :rtype: dict
[ "Handle", "conversion", "of", "pymongo", "cursor", "into", "a", "JSON", "object", "formatted", "for", "UI", "consumption" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L788-L804
urbn/Caesium
caesium/document.py
BSONEncoder.default
def default(self, obj, **kwargs): """Handles the adapting of special types from mongo""" if isinstance(obj, datetime.datetime): return time.mktime(obj.timetuple()) if isinstance(obj, Timestamp): return obj.time if isinstance(obj, ObjectId): return ob...
python
def default(self, obj, **kwargs): """Handles the adapting of special types from mongo""" if isinstance(obj, datetime.datetime): return time.mktime(obj.timetuple()) if isinstance(obj, Timestamp): return obj.time if isinstance(obj, ObjectId): return ob...
[ "def", "default", "(", "self", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ".", "datetime", ")", ":", "return", "time", ".", "mktime", "(", "obj", ".", "timetuple", "(", ")", ")", "if", "isinstanc...
Handles the adapting of special types from mongo
[ "Handles", "the", "adapting", "of", "special", "types", "from", "mongo" ]
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L813-L824
lumpywizard/check_email_status
check_email_status/resolvers.py
PyDNSMXResolver.get_mx_records
def get_mx_records(domain): """ Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord] """ DNS.DiscoverNameServers() request = DNS.Request() response = request.req(name=domain, qtype=DNS.Type.MX) mx_rec...
python
def get_mx_records(domain): """ Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord] """ DNS.DiscoverNameServers() request = DNS.Request() response = request.req(name=domain, qtype=DNS.Type.MX) mx_rec...
[ "def", "get_mx_records", "(", "domain", ")", ":", "DNS", ".", "DiscoverNameServers", "(", ")", "request", "=", "DNS", ".", "Request", "(", ")", "response", "=", "request", ".", "req", "(", "name", "=", "domain", ",", "qtype", "=", "DNS", ".", "Type", ...
Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord]
[ "Gets", "an", "array", "of", "MXRecords", "associated", "to", "the", "domain", "specified", "." ]
train
https://github.com/lumpywizard/check_email_status/blob/3a4c5dc42ada61325d5d9baad9e2b1b78084ee2f/check_email_status/resolvers.py#L40-L56
lumpywizard/check_email_status
check_email_status/resolvers.py
DNSPythonMXResolver.get_mx_records
def get_mx_records(domain): """ Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord] """ import dns.resolver response = dns.resolver.query(domain, 'MX') mx_records = [] for answer in response.answers:...
python
def get_mx_records(domain): """ Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord] """ import dns.resolver response = dns.resolver.query(domain, 'MX') mx_records = [] for answer in response.answers:...
[ "def", "get_mx_records", "(", "domain", ")", ":", "import", "dns", ".", "resolver", "response", "=", "dns", ".", "resolver", ".", "query", "(", "domain", ",", "'MX'", ")", "mx_records", "=", "[", "]", "for", "answer", "in", "response", ".", "answers", ...
Gets an array of MXRecords associated to the domain specified. :param domain: :return: [MXRecord]
[ "Gets", "an", "array", "of", "MXRecords", "associated", "to", "the", "domain", "specified", "." ]
train
https://github.com/lumpywizard/check_email_status/blob/3a4c5dc42ada61325d5d9baad9e2b1b78084ee2f/check_email_status/resolvers.py#L61-L76