id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
250,500 | praekelt/jmbo-show | show/templatetags/show_tags.py | get_relation_by_type_list | def get_relation_by_type_list(parser, token):
"""Gets list of relations from object identified by a content type.
Syntax::
{% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %}
"""
tokens = token.contents.split()
if len(tokens) not in (6,... | python | def get_relation_by_type_list(parser, token):
"""Gets list of relations from object identified by a content type.
Syntax::
{% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %}
"""
tokens = token.contents.split()
if len(tokens) not in (6,... | [
"def",
"get_relation_by_type_list",
"(",
"parser",
",",
"token",
")",
":",
"tokens",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"if",
"len",
"(",
"tokens",
")",
"not",
"in",
"(",
"6",
",",
"7",
")",
":",
"raise",
"template",
".",
"Templat... | Gets list of relations from object identified by a content type.
Syntax::
{% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %} | [
"Gets",
"list",
"of",
"relations",
"from",
"object",
"identified",
"by",
"a",
"content",
"type",
"."
] | 9e10b1722647945db70c4af6b6d8b0506a0dd683 | https://github.com/praekelt/jmbo-show/blob/9e10b1722647945db70c4af6b6d8b0506a0dd683/show/templatetags/show_tags.py#L8-L37 |
250,501 | unionbilling/union-python | union/models.py | BaseModel.filter | def filter(cls, **items):
'''
Returns multiple Union objects with search params
'''
client = cls._new_api_client(subpath='/search')
items_dict = dict((k, v) for k, v in list(items.items()))
json_data = json.dumps(items_dict, sort_keys=True, indent=4)
return client... | python | def filter(cls, **items):
'''
Returns multiple Union objects with search params
'''
client = cls._new_api_client(subpath='/search')
items_dict = dict((k, v) for k, v in list(items.items()))
json_data = json.dumps(items_dict, sort_keys=True, indent=4)
return client... | [
"def",
"filter",
"(",
"cls",
",",
"*",
"*",
"items",
")",
":",
"client",
"=",
"cls",
".",
"_new_api_client",
"(",
"subpath",
"=",
"'/search'",
")",
"items_dict",
"=",
"dict",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"list",
"(",
... | Returns multiple Union objects with search params | [
"Returns",
"multiple",
"Union",
"objects",
"with",
"search",
"params"
] | 551e4fc1a0b395b632781d80527a3660a7c67c0c | https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L44-L51 |
250,502 | unionbilling/union-python | union/models.py | BaseModel.get | def get(cls, id):
'''
Look up one Union object
'''
client = cls._new_api_client()
return client.make_request(cls, 'get', url_params={'id': id}) | python | def get(cls, id):
'''
Look up one Union object
'''
client = cls._new_api_client()
return client.make_request(cls, 'get', url_params={'id': id}) | [
"def",
"get",
"(",
"cls",
",",
"id",
")",
":",
"client",
"=",
"cls",
".",
"_new_api_client",
"(",
")",
"return",
"client",
".",
"make_request",
"(",
"cls",
",",
"'get'",
",",
"url_params",
"=",
"{",
"'id'",
":",
"id",
"}",
")"
] | Look up one Union object | [
"Look",
"up",
"one",
"Union",
"object"
] | 551e4fc1a0b395b632781d80527a3660a7c67c0c | https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L54-L59 |
250,503 | unionbilling/union-python | union/models.py | BaseModel.save | def save(self):
'''
Save an instance of a Union object
'''
client = self._new_api_client()
params = {'id': self.id} if hasattr(self, 'id') else {}
action = 'patch' if hasattr(self, 'id') else 'post'
saved_model = client.make_request(self, action, url_params=param... | python | def save(self):
'''
Save an instance of a Union object
'''
client = self._new_api_client()
params = {'id': self.id} if hasattr(self, 'id') else {}
action = 'patch' if hasattr(self, 'id') else 'post'
saved_model = client.make_request(self, action, url_params=param... | [
"def",
"save",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"_new_api_client",
"(",
")",
"params",
"=",
"{",
"'id'",
":",
"self",
".",
"id",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'id'",
")",
"else",
"{",
"}",
"action",
"=",
"'patch'",
"i... | Save an instance of a Union object | [
"Save",
"an",
"instance",
"of",
"a",
"Union",
"object"
] | 551e4fc1a0b395b632781d80527a3660a7c67c0c | https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L61-L69 |
250,504 | unionbilling/union-python | union/models.py | BaseModel.delete | def delete(cls, id):
'''
Destroy a Union object
'''
client = cls._new_api_client()
return client.make_request(cls, 'delete', url_params={'id': id}) | python | def delete(cls, id):
'''
Destroy a Union object
'''
client = cls._new_api_client()
return client.make_request(cls, 'delete', url_params={'id': id}) | [
"def",
"delete",
"(",
"cls",
",",
"id",
")",
":",
"client",
"=",
"cls",
".",
"_new_api_client",
"(",
")",
"return",
"client",
".",
"make_request",
"(",
"cls",
",",
"'delete'",
",",
"url_params",
"=",
"{",
"'id'",
":",
"id",
"}",
")"
] | Destroy a Union object | [
"Destroy",
"a",
"Union",
"object"
] | 551e4fc1a0b395b632781d80527a3660a7c67c0c | https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L72-L77 |
250,505 | b3j0f/conf | b3j0f/conf/configurable/core.py | applyconfiguration | def applyconfiguration(targets, conf=None, *args, **kwargs):
"""Apply configuration on input targets.
If targets are not annotated by a Configurable, a new one is instanciated.
:param Iterable targets: targets to configurate.
:param tuple args: applyconfiguration var args.
:param dict kwargs: appl... | python | def applyconfiguration(targets, conf=None, *args, **kwargs):
"""Apply configuration on input targets.
If targets are not annotated by a Configurable, a new one is instanciated.
:param Iterable targets: targets to configurate.
:param tuple args: applyconfiguration var args.
:param dict kwargs: appl... | [
"def",
"applyconfiguration",
"(",
"targets",
",",
"conf",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"[",
"]",
"for",
"target",
"in",
"targets",
":",
"configurables",
"=",
"Configurable",
".",
"get_annotations",
"(",... | Apply configuration on input targets.
If targets are not annotated by a Configurable, a new one is instanciated.
:param Iterable targets: targets to configurate.
:param tuple args: applyconfiguration var args.
:param dict kwargs: applyconfiguration keywords.
:return: configured targets.
:rtype... | [
"Apply",
"configuration",
"on",
"input",
"targets",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L883-L911 |
250,506 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.getcallparams | def getcallparams(
self, target, conf=None, args=None, kwargs=None, exec_ctx=None
):
"""Get target call parameters.
:param list args: target call arguments.
:param dict kwargs: target call keywords.
:return: args, kwargs
:rtype: tuple"""
if args is None:... | python | def getcallparams(
self, target, conf=None, args=None, kwargs=None, exec_ctx=None
):
"""Get target call parameters.
:param list args: target call arguments.
:param dict kwargs: target call keywords.
:return: args, kwargs
:rtype: tuple"""
if args is None:... | [
"def",
"getcallparams",
"(",
"self",
",",
"target",
",",
"conf",
"=",
"None",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"exec_ctx",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"[",
"]",
"if",
"kwargs",
"i... | Get target call parameters.
:param list args: target call arguments.
:param dict kwargs: target call keywords.
:return: args, kwargs
:rtype: tuple | [
"Get",
"target",
"call",
"parameters",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L304-L372 |
250,507 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.modules | def modules(self, value):
"""Change required modules.
Reload modules given in the value.
:param list value: new modules to use."""
modules = [module.__name__ for module in self.loadmodules(value)]
self._modules = [
module for module in self._modules + modules
... | python | def modules(self, value):
"""Change required modules.
Reload modules given in the value.
:param list value: new modules to use."""
modules = [module.__name__ for module in self.loadmodules(value)]
self._modules = [
module for module in self._modules + modules
... | [
"def",
"modules",
"(",
"self",
",",
"value",
")",
":",
"modules",
"=",
"[",
"module",
".",
"__name__",
"for",
"module",
"in",
"self",
".",
"loadmodules",
"(",
"value",
")",
"]",
"self",
".",
"_modules",
"=",
"[",
"module",
"for",
"module",
"in",
"sel... | Change required modules.
Reload modules given in the value.
:param list value: new modules to use. | [
"Change",
"required",
"modules",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L424-L436 |
250,508 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.conf | def conf(self, value):
"""Change of configuration.
:param value: new configuration to use.
:type value: Category or Configuration
"""
self._conf = self._toconf(value)
if self.autoconf:
self.applyconfiguration() | python | def conf(self, value):
"""Change of configuration.
:param value: new configuration to use.
:type value: Category or Configuration
"""
self._conf = self._toconf(value)
if self.autoconf:
self.applyconfiguration() | [
"def",
"conf",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_conf",
"=",
"self",
".",
"_toconf",
"(",
"value",
")",
"if",
"self",
".",
"autoconf",
":",
"self",
".",
"applyconfiguration",
"(",
")"
] | Change of configuration.
:param value: new configuration to use.
:type value: Category or Configuration | [
"Change",
"of",
"configuration",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L448-L458 |
250,509 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable._toconf | def _toconf(self, conf):
"""Convert input parameter to a Configuration.
:param conf: configuration to convert to a Configuration object.
:type conf: Configuration, Category or Parameter.
:rtype: Configuration"""
result = conf
if result is None:
result = Co... | python | def _toconf(self, conf):
"""Convert input parameter to a Configuration.
:param conf: configuration to convert to a Configuration object.
:type conf: Configuration, Category or Parameter.
:rtype: Configuration"""
result = conf
if result is None:
result = Co... | [
"def",
"_toconf",
"(",
"self",
",",
"conf",
")",
":",
"result",
"=",
"conf",
"if",
"result",
"is",
"None",
":",
"result",
"=",
"Configuration",
"(",
")",
"elif",
"isinstance",
"(",
"result",
",",
"Category",
")",
":",
"result",
"=",
"configuration",
"(... | Convert input parameter to a Configuration.
:param conf: configuration to convert to a Configuration object.
:type conf: Configuration, Category or Parameter.
:rtype: Configuration | [
"Convert",
"input",
"parameter",
"to",
"a",
"Configuration",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L460-L482 |
250,510 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.paths | def paths(self, value):
"""Change of paths in adding it in watching list."""
if value is None:
value = ()
elif isinstance(value, string_types):
value = (value, )
self._paths = tuple(value)
if self.autoconf:
self.applyconfiguration() | python | def paths(self, value):
"""Change of paths in adding it in watching list."""
if value is None:
value = ()
elif isinstance(value, string_types):
value = (value, )
self._paths = tuple(value)
if self.autoconf:
self.applyconfiguration() | [
"def",
"paths",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"value",
"=",
"(",
")",
"elif",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
"value",
"=",
"(",
"value",
",",
")",
"self",
".",
"_paths",
"=",
"t... | Change of paths in adding it in watching list. | [
"Change",
"of",
"paths",
"in",
"adding",
"it",
"in",
"watching",
"list",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L495-L507 |
250,511 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.getconf | def getconf(
self, conf=None, paths=None, drivers=None, logger=None, modules=None
):
"""Get a configuration from paths.
:param conf: conf to update. Default this conf.
:type conf: Configuration, Category or Parameter
:param str(s) paths: list of conf files. Default this ... | python | def getconf(
self, conf=None, paths=None, drivers=None, logger=None, modules=None
):
"""Get a configuration from paths.
:param conf: conf to update. Default this conf.
:type conf: Configuration, Category or Parameter
:param str(s) paths: list of conf files. Default this ... | [
"def",
"getconf",
"(",
"self",
",",
"conf",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"drivers",
"=",
"None",
",",
"logger",
"=",
"None",
",",
"modules",
"=",
"None",
")",
":",
"result",
"=",
"None",
"self",
".",
"loadmodules",
"(",
"modules",
"... | Get a configuration from paths.
:param conf: conf to update. Default this conf.
:type conf: Configuration, Category or Parameter
:param str(s) paths: list of conf files. Default this paths.
:param Logger logger: logger to use for logging info/error messages.
:param list drivers:... | [
"Get",
"a",
"configuration",
"from",
"paths",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L581-L649 |
250,512 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable.configure | def configure(
self, conf=None, targets=None, logger=None, callconf=False,
keepstate=None, modules=None
):
"""Apply input conf on targets objects.
Specialization of this method is done in the _configure method.
:param conf: configuration model to configure. Default ... | python | def configure(
self, conf=None, targets=None, logger=None, callconf=False,
keepstate=None, modules=None
):
"""Apply input conf on targets objects.
Specialization of this method is done in the _configure method.
:param conf: configuration model to configure. Default ... | [
"def",
"configure",
"(",
"self",
",",
"conf",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"logger",
"=",
"None",
",",
"callconf",
"=",
"False",
",",
"keepstate",
"=",
"None",
",",
"modules",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"self"... | Apply input conf on targets objects.
Specialization of this method is done in the _configure method.
:param conf: configuration model to configure. Default is this conf.
:type conf: Configuration, Category or Parameter
:param Iterable targets: objects to configure. self targets by defa... | [
"Apply",
"input",
"conf",
"on",
"targets",
"objects",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L651-L711 |
250,513 | b3j0f/conf | b3j0f/conf/configurable/core.py | Configurable._configure | def _configure(
self, target, conf=None, logger=None, callconf=None, keepstate=None,
modules=None
):
"""Configure this class with input conf only if auto_conf or
configure is true.
This method should be overriden for specific conf
:param target: object to co... | python | def _configure(
self, target, conf=None, logger=None, callconf=None, keepstate=None,
modules=None
):
"""Configure this class with input conf only if auto_conf or
configure is true.
This method should be overriden for specific conf
:param target: object to co... | [
"def",
"_configure",
"(",
"self",
",",
"target",
",",
"conf",
"=",
"None",
",",
"logger",
"=",
"None",
",",
"callconf",
"=",
"None",
",",
"keepstate",
"=",
"None",
",",
"modules",
"=",
"None",
")",
":",
"result",
"=",
"target",
"self",
".",
"loadmodu... | Configure this class with input conf only if auto_conf or
configure is true.
This method should be overriden for specific conf
:param target: object to configure. self targets by default.
:param Configuration conf: configuration model to configure. Default is
this conf.
... | [
"Configure",
"this",
"class",
"with",
"input",
"conf",
"only",
"if",
"auto_conf",
"or",
"configure",
"is",
"true",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L713-L825 |
250,514 | qzmfranklin/easyshell | easycompleter/python_default.py | Completer.find_matches | def find_matches(self, text):
"""Return candidates matching the text."""
if self.use_main_ns:
self.namespace = __main__.__dict__
if "." in text:
return self.attr_matches(text)
else:
return self.global_matches(text) | python | def find_matches(self, text):
"""Return candidates matching the text."""
if self.use_main_ns:
self.namespace = __main__.__dict__
if "." in text:
return self.attr_matches(text)
else:
return self.global_matches(text) | [
"def",
"find_matches",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"use_main_ns",
":",
"self",
".",
"namespace",
"=",
"__main__",
".",
"__dict__",
"if",
"\".\"",
"in",
"text",
":",
"return",
"self",
".",
"attr_matches",
"(",
"text",
")",
"el... | Return candidates matching the text. | [
"Return",
"candidates",
"matching",
"the",
"text",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easycompleter/python_default.py#L64-L72 |
250,515 | amaas-fintech/amaas-utils-python | amaasutils/case.py | dict_camel_to_snake_case | def dict_camel_to_snake_case(camel_dict, convert_keys=True, convert_subkeys=False):
"""
Recursively convert camelCased keys for a camelCased dict into snake_cased keys
:param camel_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether t... | python | def dict_camel_to_snake_case(camel_dict, convert_keys=True, convert_subkeys=False):
"""
Recursively convert camelCased keys for a camelCased dict into snake_cased keys
:param camel_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether t... | [
"def",
"dict_camel_to_snake_case",
"(",
"camel_dict",
",",
"convert_keys",
"=",
"True",
",",
"convert_subkeys",
"=",
"False",
")",
":",
"converted",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"camel_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstan... | Recursively convert camelCased keys for a camelCased dict into snake_cased keys
:param camel_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether to also convert the subkeys, in case they are named properties of the dict
:return: | [
"Recursively",
"convert",
"camelCased",
"keys",
"for",
"a",
"camelCased",
"dict",
"into",
"snake_cased",
"keys"
] | 5aa64ca65ce0c77b513482d943345d94c9ae58e8 | https://github.com/amaas-fintech/amaas-utils-python/blob/5aa64ca65ce0c77b513482d943345d94c9ae58e8/amaasutils/case.py#L7-L33 |
250,516 | amaas-fintech/amaas-utils-python | amaasutils/case.py | dict_snake_to_camel_case | def dict_snake_to_camel_case(snake_dict, convert_keys=True, convert_subkeys=False):
"""
Recursively convert a snake_cased dict into a camelCased dict
:param snake_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether to also convert the... | python | def dict_snake_to_camel_case(snake_dict, convert_keys=True, convert_subkeys=False):
"""
Recursively convert a snake_cased dict into a camelCased dict
:param snake_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether to also convert the... | [
"def",
"dict_snake_to_camel_case",
"(",
"snake_dict",
",",
"convert_keys",
"=",
"True",
",",
"convert_subkeys",
"=",
"False",
")",
":",
"converted",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"snake_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstan... | Recursively convert a snake_cased dict into a camelCased dict
:param snake_dict: Dictionary to convert
:param convert_keys: Whether the key should be converted
:param convert_subkeys: Whether to also convert the subkeys, in case they are named properties of the dict
:return: | [
"Recursively",
"convert",
"a",
"snake_cased",
"dict",
"into",
"a",
"camelCased",
"dict"
] | 5aa64ca65ce0c77b513482d943345d94c9ae58e8 | https://github.com/amaas-fintech/amaas-utils-python/blob/5aa64ca65ce0c77b513482d943345d94c9ae58e8/amaasutils/case.py#L36-L62 |
250,517 | shaunduncan/helga-dubstep | helga_dubstep.py | dubstep | def dubstep(client, channel, nick, message, matches):
"""
Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps
"""
now = time.time()
if dubstep._last and (now - dubstep._last) > WUB_TIMEOUT:
dubstep._counts[channel] = 0
dubstep._last = now
if d... | python | def dubstep(client, channel, nick, message, matches):
"""
Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps
"""
now = time.time()
if dubstep._last and (now - dubstep._last) > WUB_TIMEOUT:
dubstep._counts[channel] = 0
dubstep._last = now
if d... | [
"def",
"dubstep",
"(",
"client",
",",
"channel",
",",
"nick",
",",
"message",
",",
"matches",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"dubstep",
".",
"_last",
"and",
"(",
"now",
"-",
"dubstep",
".",
"_last",
")",
">",
"WUB_TIMEOU... | Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps | [
"Dubstep",
"can",
"be",
"described",
"as",
"a",
"rapid",
"succession",
"of",
"wub",
"wubs",
"wow",
"wows",
"and",
"yep",
"yep",
"yep",
"yeps"
] | 32e5eb79c22c9c8f8a5a0496a7fdd9134881bed5 | https://github.com/shaunduncan/helga-dubstep/blob/32e5eb79c22c9c8f8a5a0496a7fdd9134881bed5/helga_dubstep.py#L14-L29 |
250,518 | jtpaasch/simplygithub | simplygithub/internals/trees.py | get_tree | def get_tree(profile, sha, recursive=True):
"""Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
... | python | def get_tree(profile, sha, recursive=True):
"""Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
... | [
"def",
"get_tree",
"(",
"profile",
",",
"sha",
",",
"recursive",
"=",
"True",
")",
":",
"resource",
"=",
"\"/trees/\"",
"+",
"sha",
"if",
"recursive",
":",
"resource",
"+=",
"\"?recursive=1\"",
"data",
"=",
"api",
".",
"get_request",
"(",
"profile",
",",
... | Fetch a tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
The SHA of the tree to fetch.
recursive... | [
"Fetch",
"a",
"tree",
"."
] | b77506275ec276ce90879bf1ea9299a79448b903 | https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/trees.py#L15-L41 |
250,519 | jtpaasch/simplygithub | simplygithub/internals/trees.py | create_tree | def create_tree(profile, tree):
"""Create a new tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
tree
A l... | python | def create_tree(profile, tree):
"""Create a new tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
tree
A l... | [
"def",
"create_tree",
"(",
"profile",
",",
"tree",
")",
":",
"resource",
"=",
"\"/trees\"",
"payload",
"=",
"{",
"\"tree\"",
":",
"tree",
"}",
"data",
"=",
"api",
".",
"post_request",
"(",
"profile",
",",
"resource",
",",
"payload",
")",
"return",
"prepa... | Create a new tree.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
tree
A list of blob objects (each with a path, ... | [
"Create",
"a",
"new",
"tree",
"."
] | b77506275ec276ce90879bf1ea9299a79448b903 | https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/trees.py#L44-L65 |
250,520 | mushkevych/synergy_odm | odm/document.py | BaseDocument.validate | def validate(self):
"""Ensure that all fields' values are valid and that non-nullable fields are present. """
for field_name, field_obj in self._fields.items():
value = field_obj.__get__(self, self.__class__)
if value is None and field_obj.null is False:
raise Va... | python | def validate(self):
"""Ensure that all fields' values are valid and that non-nullable fields are present. """
for field_name, field_obj in self._fields.items():
value = field_obj.__get__(self, self.__class__)
if value is None and field_obj.null is False:
raise Va... | [
"def",
"validate",
"(",
"self",
")",
":",
"for",
"field_name",
",",
"field_obj",
"in",
"self",
".",
"_fields",
".",
"items",
"(",
")",
":",
"value",
"=",
"field_obj",
".",
"__get__",
"(",
"self",
",",
"self",
".",
"__class__",
")",
"if",
"value",
"is... | Ensure that all fields' values are valid and that non-nullable fields are present. | [
"Ensure",
"that",
"all",
"fields",
"values",
"are",
"valid",
"and",
"that",
"non",
"-",
"nullable",
"fields",
"are",
"present",
"."
] | 3a5ac37333fc6391478564ef653a4be38e332f68 | https://github.com/mushkevych/synergy_odm/blob/3a5ac37333fc6391478564ef653a4be38e332f68/odm/document.py#L141-L155 |
250,521 | mushkevych/synergy_odm | odm/document.py | BaseDocument.to_json | def to_json(self):
"""Converts given document to JSON dict. """
json_data = dict()
for field_name, field_obj in self._fields.items():
if isinstance(field_obj, NestedDocumentField):
nested_document = field_obj.__get__(self, self.__class__)
value = None... | python | def to_json(self):
"""Converts given document to JSON dict. """
json_data = dict()
for field_name, field_obj in self._fields.items():
if isinstance(field_obj, NestedDocumentField):
nested_document = field_obj.__get__(self, self.__class__)
value = None... | [
"def",
"to_json",
"(",
"self",
")",
":",
"json_data",
"=",
"dict",
"(",
")",
"for",
"field_name",
",",
"field_obj",
"in",
"self",
".",
"_fields",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"field_obj",
",",
"NestedDocumentField",
")",
":",
"... | Converts given document to JSON dict. | [
"Converts",
"given",
"document",
"to",
"JSON",
"dict",
"."
] | 3a5ac37333fc6391478564ef653a4be38e332f68 | https://github.com/mushkevych/synergy_odm/blob/3a5ac37333fc6391478564ef653a4be38e332f68/odm/document.py#L157-L178 |
250,522 | mushkevych/synergy_odm | odm/document.py | BaseDocument.from_json | def from_json(cls, json_data):
""" Converts json data to a new document instance"""
new_instance = cls()
for field_name, field_obj in cls._get_fields().items():
if isinstance(field_obj, NestedDocumentField):
if field_name in json_data:
nested_field... | python | def from_json(cls, json_data):
""" Converts json data to a new document instance"""
new_instance = cls()
for field_name, field_obj in cls._get_fields().items():
if isinstance(field_obj, NestedDocumentField):
if field_name in json_data:
nested_field... | [
"def",
"from_json",
"(",
"cls",
",",
"json_data",
")",
":",
"new_instance",
"=",
"cls",
"(",
")",
"for",
"field_name",
",",
"field_obj",
"in",
"cls",
".",
"_get_fields",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"field_obj",
",",
... | Converts json data to a new document instance | [
"Converts",
"json",
"data",
"to",
"a",
"new",
"document",
"instance"
] | 3a5ac37333fc6391478564ef653a4be38e332f68 | https://github.com/mushkevych/synergy_odm/blob/3a5ac37333fc6391478564ef653a4be38e332f68/odm/document.py#L208-L229 |
250,523 | cirruscluster/cirruscluster | cirruscluster/ext/ansible/runner/action_plugins/template.py | ActionModule.run | def run(self, conn, tmp, module_name, module_args, inject):
''' handler for template operations '''
if not self.runner.is_playbook:
raise errors.AnsibleError("in current versions of ansible, templates are only usable in playbooks")
# load up options
options = utils.parse_k... | python | def run(self, conn, tmp, module_name, module_args, inject):
''' handler for template operations '''
if not self.runner.is_playbook:
raise errors.AnsibleError("in current versions of ansible, templates are only usable in playbooks")
# load up options
options = utils.parse_k... | [
"def",
"run",
"(",
"self",
",",
"conn",
",",
"tmp",
",",
"module_name",
",",
"module_args",
",",
"inject",
")",
":",
"if",
"not",
"self",
".",
"runner",
".",
"is_playbook",
":",
"raise",
"errors",
".",
"AnsibleError",
"(",
"\"in current versions of ansible, ... | handler for template operations | [
"handler",
"for",
"template",
"operations"
] | 977409929dd81322d886425cdced10608117d5d7 | https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/template.py#L29-L80 |
250,524 | shaypal5/utilitime | utilitime/dateint/dateint.py | decompose_dateint | def decompose_dateint(dateint):
"""Decomposes the given dateint into its year, month and day components.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
year : int
The year component of the given datein... | python | def decompose_dateint(dateint):
"""Decomposes the given dateint into its year, month and day components.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
year : int
The year component of the given datein... | [
"def",
"decompose_dateint",
"(",
"dateint",
")",
":",
"year",
"=",
"int",
"(",
"dateint",
"/",
"10000",
")",
"leftover",
"=",
"dateint",
"-",
"year",
"*",
"10000",
"month",
"=",
"int",
"(",
"leftover",
"/",
"100",
")",
"day",
"=",
"leftover",
"-",
"m... | Decomposes the given dateint into its year, month and day components.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
year : int
The year component of the given dateint.
month : int
The month co... | [
"Decomposes",
"the",
"given",
"dateint",
"into",
"its",
"year",
"month",
"and",
"day",
"components",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L16-L37 |
250,525 | shaypal5/utilitime | utilitime/dateint/dateint.py | dateint_to_datetime | def dateint_to_datetime(dateint):
"""Converts the given dateint to a datetime object, in local timezone.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
datetime.datetime
A timezone-unaware datetime obj... | python | def dateint_to_datetime(dateint):
"""Converts the given dateint to a datetime object, in local timezone.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
datetime.datetime
A timezone-unaware datetime obj... | [
"def",
"dateint_to_datetime",
"(",
"dateint",
")",
":",
"if",
"len",
"(",
"str",
"(",
"dateint",
")",
")",
"!=",
"8",
":",
"raise",
"ValueError",
"(",
"'Dateints must have exactly 8 digits; the first four representing '",
"'the year, the next two the months, and the last tw... | Converts the given dateint to a datetime object, in local timezone.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
datetime.datetime
A timezone-unaware datetime object representing the start of the given
... | [
"Converts",
"the",
"given",
"dateint",
"to",
"a",
"datetime",
"object",
"in",
"local",
"timezone",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L114-L133 |
250,526 | shaypal5/utilitime | utilitime/dateint/dateint.py | dateint_to_weekday | def dateint_to_weekday(dateint, first_day='Monday'):
"""Returns the weekday of the given dateint.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of the week.
Returns
---... | python | def dateint_to_weekday(dateint, first_day='Monday'):
"""Returns the weekday of the given dateint.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of the week.
Returns
---... | [
"def",
"dateint_to_weekday",
"(",
"dateint",
",",
"first_day",
"=",
"'Monday'",
")",
":",
"weekday_ix",
"=",
"dateint_to_datetime",
"(",
"dateint",
")",
".",
"weekday",
"(",
")",
"return",
"(",
"weekday_ix",
"-",
"WEEKDAYS",
".",
"index",
"(",
"first_day",
"... | Returns the weekday of the given dateint.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of the week.
Returns
-------
int
The weekday of the given dateint, when ... | [
"Returns",
"the",
"weekday",
"of",
"the",
"given",
"dateint",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L136-L166 |
250,527 | shaypal5/utilitime | utilitime/dateint/dateint.py | shift_dateint | def shift_dateint(dateint, day_shift):
"""Shifts the given dateint by the given amount of days.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
days : int
The number of days to shift the given dateint by. A negative number
... | python | def shift_dateint(dateint, day_shift):
"""Shifts the given dateint by the given amount of days.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
days : int
The number of days to shift the given dateint by. A negative number
... | [
"def",
"shift_dateint",
"(",
"dateint",
",",
"day_shift",
")",
":",
"dtime",
"=",
"dateint_to_datetime",
"(",
"dateint",
")",
"delta",
"=",
"timedelta",
"(",
"days",
"=",
"abs",
"(",
"day_shift",
")",
")",
"if",
"day_shift",
">",
"0",
":",
"dtime",
"=",
... | Shifts the given dateint by the given amount of days.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
days : int
The number of days to shift the given dateint by. A negative number
shifts the dateint backwards.
Returns... | [
"Shifts",
"the",
"given",
"dateint",
"by",
"the",
"given",
"amount",
"of",
"days",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L194-L226 |
250,528 | shaypal5/utilitime | utilitime/dateint/dateint.py | dateint_range | def dateint_range(first_dateint, last_dateint):
"""Returns all dateints in the given dateint range.
Arguments
---------
first_dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
last_dateint : int
An integer object decipting a specific calendaric day;... | python | def dateint_range(first_dateint, last_dateint):
"""Returns all dateints in the given dateint range.
Arguments
---------
first_dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
last_dateint : int
An integer object decipting a specific calendaric day;... | [
"def",
"dateint_range",
"(",
"first_dateint",
",",
"last_dateint",
")",
":",
"first_datetime",
"=",
"dateint_to_datetime",
"(",
"first_dateint",
")",
"last_datetime",
"=",
"dateint_to_datetime",
"(",
"last_dateint",
")",
"delta",
"=",
"last_datetime",
"-",
"first_date... | Returns all dateints in the given dateint range.
Arguments
---------
first_dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
last_dateint : int
An integer object decipting a specific calendaric day; e.g. 20170108.
Returns
-------
iterable
... | [
"Returns",
"all",
"dateints",
"in",
"the",
"given",
"dateint",
"range",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L229-L262 |
250,529 | shaypal5/utilitime | utilitime/dateint/dateint.py | dateint_week_by_dateint | def dateint_week_by_dateint(dateint, first_day='Monday'):
"""Return a dateint range of the week the given dateint belongs to.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of th... | python | def dateint_week_by_dateint(dateint, first_day='Monday'):
"""Return a dateint range of the week the given dateint belongs to.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of th... | [
"def",
"dateint_week_by_dateint",
"(",
"dateint",
",",
"first_day",
"=",
"'Monday'",
")",
":",
"weekday_ix",
"=",
"dateint_to_weekday",
"(",
"dateint",
",",
"first_day",
")",
"first_day_dateint",
"=",
"shift_dateint",
"(",
"dateint",
",",
"-",
"weekday_ix",
")",
... | Return a dateint range of the week the given dateint belongs to.
Arguments
---------
dateint : int
An integer object decipting a specific calendaric day; e.g. 20161225.
first_day : str, default 'Monday'
The first day of the week.
Returns
-------
iterable
An iterable... | [
"Return",
"a",
"dateint",
"range",
"of",
"the",
"week",
"the",
"given",
"dateint",
"belongs",
"to",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L270-L289 |
250,530 | shaypal5/utilitime | utilitime/dateint/dateint.py | dateint_difference | def dateint_difference(dateint1, dateint2):
"""Return the difference between two dateints in days.
Arguments
---------
dateint1 : int
An integer object decipting a specific calendaric day; e.g. 20161225.
dateint2 : int
An integer object decipting a specific calendaric day; e.g. 2016... | python | def dateint_difference(dateint1, dateint2):
"""Return the difference between two dateints in days.
Arguments
---------
dateint1 : int
An integer object decipting a specific calendaric day; e.g. 20161225.
dateint2 : int
An integer object decipting a specific calendaric day; e.g. 2016... | [
"def",
"dateint_difference",
"(",
"dateint1",
",",
"dateint2",
")",
":",
"dt1",
"=",
"dateint_to_datetime",
"(",
"dateint1",
")",
"dt2",
"=",
"dateint_to_datetime",
"(",
"dateint2",
")",
"delta",
"=",
"dt1",
"-",
"dt2",
"return",
"abs",
"(",
"delta",
".",
... | Return the difference between two dateints in days.
Arguments
---------
dateint1 : int
An integer object decipting a specific calendaric day; e.g. 20161225.
dateint2 : int
An integer object decipting a specific calendaric day; e.g. 20161225.
Returns
-------
int
The ... | [
"Return",
"the",
"difference",
"between",
"two",
"dateints",
"in",
"days",
"."
] | 554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609 | https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/dateint/dateint.py#L292-L310 |
250,531 | riordan/py-copyfile | copyfile/copyfile.py | copyFile | def copyFile(src, dest):
"""Copies a source file to a destination whose path may not yet exist.
Keyword arguments:
src -- Source path to a file (string)
dest -- Path for destination file (also a string)
"""
#Src Exists?
try:
if os.path.isfile(src):
dpath, dfile = os.path... | python | def copyFile(src, dest):
"""Copies a source file to a destination whose path may not yet exist.
Keyword arguments:
src -- Source path to a file (string)
dest -- Path for destination file (also a string)
"""
#Src Exists?
try:
if os.path.isfile(src):
dpath, dfile = os.path... | [
"def",
"copyFile",
"(",
"src",
",",
"dest",
")",
":",
"#Src Exists?",
"try",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"src",
")",
":",
"dpath",
",",
"dfile",
"=",
"os",
".",
"path",
".",
"split",
"(",
"dest",
")",
"if",
"not",
"os",
".... | Copies a source file to a destination whose path may not yet exist.
Keyword arguments:
src -- Source path to a file (string)
dest -- Path for destination file (also a string) | [
"Copies",
"a",
"source",
"file",
"to",
"a",
"destination",
"whose",
"path",
"may",
"not",
"yet",
"exist",
"."
] | ea7c45de8ac8e6f3a8a9dc0deee87f8f882a8e79 | https://github.com/riordan/py-copyfile/blob/ea7c45de8ac8e6f3a8a9dc0deee87f8f882a8e79/copyfile/copyfile.py#L19-L45 |
250,532 | xtrementl/focus | focus/plugin/modules/notify.py | _terminal_notifier | def _terminal_notifier(title, message):
""" Shows user notification message via `terminal-notifier` command.
`title`
Notification title.
`message`
Notification message.
"""
try:
paths = common.extract_app_paths(['terminal-notifier'])
except ValueErro... | python | def _terminal_notifier(title, message):
""" Shows user notification message via `terminal-notifier` command.
`title`
Notification title.
`message`
Notification message.
"""
try:
paths = common.extract_app_paths(['terminal-notifier'])
except ValueErro... | [
"def",
"_terminal_notifier",
"(",
"title",
",",
"message",
")",
":",
"try",
":",
"paths",
"=",
"common",
".",
"extract_app_paths",
"(",
"[",
"'terminal-notifier'",
"]",
")",
"except",
"ValueError",
":",
"pass",
"common",
".",
"shell_process",
"(",
"[",
"path... | Shows user notification message via `terminal-notifier` command.
`title`
Notification title.
`message`
Notification message. | [
"Shows",
"user",
"notification",
"message",
"via",
"terminal",
"-",
"notifier",
"command",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/notify.py#L12-L26 |
250,533 | xtrementl/focus | focus/plugin/modules/notify.py | _growlnotify | def _growlnotify(title, message):
""" Shows growl notification message via `growlnotify` command.
`title`
Notification title.
`message`
Notification message.
"""
try:
paths = common.extract_app_paths(['growlnotify'])
except ValueError:
return... | python | def _growlnotify(title, message):
""" Shows growl notification message via `growlnotify` command.
`title`
Notification title.
`message`
Notification message.
"""
try:
paths = common.extract_app_paths(['growlnotify'])
except ValueError:
return... | [
"def",
"_growlnotify",
"(",
"title",
",",
"message",
")",
":",
"try",
":",
"paths",
"=",
"common",
".",
"extract_app_paths",
"(",
"[",
"'growlnotify'",
"]",
")",
"except",
"ValueError",
":",
"return",
"common",
".",
"shell_process",
"(",
"[",
"paths",
"[",... | Shows growl notification message via `growlnotify` command.
`title`
Notification title.
`message`
Notification message. | [
"Shows",
"growl",
"notification",
"message",
"via",
"growlnotify",
"command",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/notify.py#L29-L43 |
250,534 | xtrementl/focus | focus/plugin/modules/notify.py | _dbus_notify | def _dbus_notify(title, message):
""" Shows system notification message via dbus.
`title`
Notification title.
`message`
Notification message.
"""
try:
# fetch main account manager interface
bus = dbus.SessionBus()
obj = bus.get_object('or... | python | def _dbus_notify(title, message):
""" Shows system notification message via dbus.
`title`
Notification title.
`message`
Notification message.
"""
try:
# fetch main account manager interface
bus = dbus.SessionBus()
obj = bus.get_object('or... | [
"def",
"_dbus_notify",
"(",
"title",
",",
"message",
")",
":",
"try",
":",
"# fetch main account manager interface",
"bus",
"=",
"dbus",
".",
"SessionBus",
"(",
")",
"obj",
"=",
"bus",
".",
"get_object",
"(",
"'org.freedesktop.Notifications'",
",",
"'/org/freedesk... | Shows system notification message via dbus.
`title`
Notification title.
`message`
Notification message. | [
"Shows",
"system",
"notification",
"message",
"via",
"dbus",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/notify.py#L67-L89 |
250,535 | xtrementl/focus | focus/plugin/modules/notify.py | Notify._notify | def _notify(self, task, message):
""" Shows system notification message according to system requirements.
`message`
Status message.
"""
if self.notify_func:
message = common.to_utf8(message.strip())
title = common.to_utf8(u'Focus ({0})'.f... | python | def _notify(self, task, message):
""" Shows system notification message according to system requirements.
`message`
Status message.
"""
if self.notify_func:
message = common.to_utf8(message.strip())
title = common.to_utf8(u'Focus ({0})'.f... | [
"def",
"_notify",
"(",
"self",
",",
"task",
",",
"message",
")",
":",
"if",
"self",
".",
"notify_func",
":",
"message",
"=",
"common",
".",
"to_utf8",
"(",
"message",
".",
"strip",
"(",
")",
")",
"title",
"=",
"common",
".",
"to_utf8",
"(",
"u'Focus ... | Shows system notification message according to system requirements.
`message`
Status message. | [
"Shows",
"system",
"notification",
"message",
"according",
"to",
"system",
"requirements",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/notify.py#L154-L164 |
250,536 | xtrementl/focus | focus/plugin/modules/notify.py | Notify.parse_option | def parse_option(self, option, block_name, message):
""" Parse show, end_show, and timer_show options.
"""
if option == 'show':
option = 'start_' + option
key = option.split('_', 1)[0]
self.messages[key] = message | python | def parse_option(self, option, block_name, message):
""" Parse show, end_show, and timer_show options.
"""
if option == 'show':
option = 'start_' + option
key = option.split('_', 1)[0]
self.messages[key] = message | [
"def",
"parse_option",
"(",
"self",
",",
"option",
",",
"block_name",
",",
"message",
")",
":",
"if",
"option",
"==",
"'show'",
":",
"option",
"=",
"'start_'",
"+",
"option",
"key",
"=",
"option",
".",
"split",
"(",
"'_'",
",",
"1",
")",
"[",
"0",
... | Parse show, end_show, and timer_show options. | [
"Parse",
"show",
"end_show",
"and",
"timer_show",
"options",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/notify.py#L166-L174 |
250,537 | minhhoit/yacms | yacms/forms/page_processors.py | format_value | def format_value(value):
"""
Convert a list into a comma separated string, for displaying
select multiple values in emails.
"""
if isinstance(value, list):
value = ", ".join([v.strip() for v in value])
return value | python | def format_value(value):
"""
Convert a list into a comma separated string, for displaying
select multiple values in emails.
"""
if isinstance(value, list):
value = ", ".join([v.strip() for v in value])
return value | [
"def",
"format_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"\", \"",
".",
"join",
"(",
"[",
"v",
".",
"strip",
"(",
")",
"for",
"v",
"in",
"value",
"]",
")",
"return",
"value"
] | Convert a list into a comma separated string, for displaying
select multiple values in emails. | [
"Convert",
"a",
"list",
"into",
"a",
"comma",
"separated",
"string",
"for",
"displaying",
"select",
"multiple",
"values",
"in",
"emails",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/page_processors.py#L15-L22 |
250,538 | minhhoit/yacms | yacms/forms/page_processors.py | form_processor | def form_processor(request, page):
"""
Display a built form and handle submission.
"""
form = FormForForm(page.form, RequestContext(request),
request.POST or None, request.FILES or None)
if form.is_valid():
url = page.get_absolute_url() + "?sent=1"
if is_spam(r... | python | def form_processor(request, page):
"""
Display a built form and handle submission.
"""
form = FormForForm(page.form, RequestContext(request),
request.POST or None, request.FILES or None)
if form.is_valid():
url = page.get_absolute_url() + "?sent=1"
if is_spam(r... | [
"def",
"form_processor",
"(",
"request",
",",
"page",
")",
":",
"form",
"=",
"FormForForm",
"(",
"page",
".",
"form",
",",
"RequestContext",
"(",
"request",
")",
",",
"request",
".",
"POST",
"or",
"None",
",",
"request",
".",
"FILES",
"or",
"None",
")"... | Display a built form and handle submission. | [
"Display",
"a",
"built",
"form",
"and",
"handle",
"submission",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/page_processors.py#L26-L68 |
250,539 | ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/browser/viewlets.py | SharingViewlet.visible | def visible(self):
"""
Only shown on the sharing view
"""
context_state = api.content.get_view(context=self.context,
request=self.request,
name="plone_context_state")
url = context_state.cur... | python | def visible(self):
"""
Only shown on the sharing view
"""
context_state = api.content.get_view(context=self.context,
request=self.request,
name="plone_context_state")
url = context_state.cur... | [
"def",
"visible",
"(",
"self",
")",
":",
"context_state",
"=",
"api",
".",
"content",
".",
"get_view",
"(",
"context",
"=",
"self",
".",
"context",
",",
"request",
"=",
"self",
".",
"request",
",",
"name",
"=",
"\"plone_context_state\"",
")",
"url",
"=",... | Only shown on the sharing view | [
"Only",
"shown",
"on",
"the",
"sharing",
"view"
] | a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba | https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/viewlets.py#L49-L57 |
250,540 | ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/browser/viewlets.py | SharingViewlet.active_participant_policy | def active_participant_policy(self):
""" Get the title of the current participation policy """
key = self.context.participant_policy
policy = PARTICIPANT_POLICY.get(key)
return policy['title'] | python | def active_participant_policy(self):
""" Get the title of the current participation policy """
key = self.context.participant_policy
policy = PARTICIPANT_POLICY.get(key)
return policy['title'] | [
"def",
"active_participant_policy",
"(",
"self",
")",
":",
"key",
"=",
"self",
".",
"context",
".",
"participant_policy",
"policy",
"=",
"PARTICIPANT_POLICY",
".",
"get",
"(",
"key",
")",
"return",
"policy",
"[",
"'title'",
"]"
] | Get the title of the current participation policy | [
"Get",
"the",
"title",
"of",
"the",
"current",
"participation",
"policy"
] | a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba | https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/viewlets.py#L59-L63 |
250,541 | fstab50/metal | metal/script_utils.py | json_integrity_multilevel | def json_integrity_multilevel(d1, d2):
""" still under development """
keys = [x for x in d2]
for key in keys:
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
intersect_keys = d1_keys.intersection(d2_keys)
added = d1_keys - d2_keys
removed = d2_keys - d1_keys
... | python | def json_integrity_multilevel(d1, d2):
""" still under development """
keys = [x for x in d2]
for key in keys:
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
intersect_keys = d1_keys.intersection(d2_keys)
added = d1_keys - d2_keys
removed = d2_keys - d1_keys
... | [
"def",
"json_integrity_multilevel",
"(",
"d1",
",",
"d2",
")",
":",
"keys",
"=",
"[",
"x",
"for",
"x",
"in",
"d2",
"]",
"for",
"key",
"in",
"keys",
":",
"d1_keys",
"=",
"set",
"(",
"d1",
".",
"keys",
"(",
")",
")",
"d2_keys",
"=",
"set",
"(",
"... | still under development | [
"still",
"under",
"development"
] | 0488bbdd516a508909267cc44191f632e21156ba | https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/script_utils.py#L364-L388 |
250,542 | fstab50/metal | metal/script_utils.py | read_local_config | def read_local_config(cfg):
""" Parses local config file for override values
Args:
:local_file (str): filename of local config file
Returns:
dict object of values contained in local config file
"""
try:
if os.path.exists(cfg):
config = import_file_object(cfg)
... | python | def read_local_config(cfg):
""" Parses local config file for override values
Args:
:local_file (str): filename of local config file
Returns:
dict object of values contained in local config file
"""
try:
if os.path.exists(cfg):
config = import_file_object(cfg)
... | [
"def",
"read_local_config",
"(",
"cfg",
")",
":",
"try",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cfg",
")",
":",
"config",
"=",
"import_file_object",
"(",
"cfg",
")",
"return",
"config",
"else",
":",
"logger",
".",
"warning",
"(",
"'%s: loca... | Parses local config file for override values
Args:
:local_file (str): filename of local config file
Returns:
dict object of values contained in local config file | [
"Parses",
"local",
"config",
"file",
"for",
"override",
"values"
] | 0488bbdd516a508909267cc44191f632e21156ba | https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/script_utils.py#L391-L412 |
250,543 | minhhoit/yacms | yacms/twitter/admin.py | TweetableAdminMixin.formfield_for_dbfield | def formfield_for_dbfield(self, db_field, **kwargs):
"""
Adds the "Send to Twitter" checkbox after the "status" field,
provided by any ``Displayable`` models. The approach here is
quite a hack, however the sane approach of using a custom
form with a boolean field defined, and the... | python | def formfield_for_dbfield(self, db_field, **kwargs):
"""
Adds the "Send to Twitter" checkbox after the "status" field,
provided by any ``Displayable`` models. The approach here is
quite a hack, however the sane approach of using a custom
form with a boolean field defined, and the... | [
"def",
"formfield_for_dbfield",
"(",
"self",
",",
"db_field",
",",
"*",
"*",
"kwargs",
")",
":",
"formfield",
"=",
"super",
"(",
"TweetableAdminMixin",
",",
"self",
")",
".",
"formfield_for_dbfield",
"(",
"db_field",
",",
"*",
"*",
"kwargs",
")",
"if",
"Ap... | Adds the "Send to Twitter" checkbox after the "status" field,
provided by any ``Displayable`` models. The approach here is
quite a hack, however the sane approach of using a custom
form with a boolean field defined, and then adding it to the
formssets attribute of the admin class fell ap... | [
"Adds",
"the",
"Send",
"to",
"Twitter",
"checkbox",
"after",
"the",
"status",
"field",
"provided",
"by",
"any",
"Displayable",
"models",
".",
"The",
"approach",
"here",
"is",
"quite",
"a",
"hack",
"however",
"the",
"sane",
"approach",
"of",
"using",
"a",
"... | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/twitter/admin.py#L31-L50 |
250,544 | lizardsystem/tags2sdists | tags2sdists/utils.py | command | def command(cmd):
"""Execute command and raise an exception upon an error.
>>> 'README' in command('ls')
True
>>> command('nonexistingcommand') #doctest: +ELLIPSIS
Traceback (most recent call last):
...
SdistCreationError
"""
status, out = commands.getstatusoutput(cmd)... | python | def command(cmd):
"""Execute command and raise an exception upon an error.
>>> 'README' in command('ls')
True
>>> command('nonexistingcommand') #doctest: +ELLIPSIS
Traceback (most recent call last):
...
SdistCreationError
"""
status, out = commands.getstatusoutput(cmd)... | [
"def",
"command",
"(",
"cmd",
")",
":",
"status",
",",
"out",
"=",
"commands",
".",
"getstatusoutput",
"(",
"cmd",
")",
"if",
"status",
"is",
"not",
"0",
":",
"logger",
".",
"error",
"(",
"\"Something went wrong:\"",
")",
"logger",
".",
"error",
"(",
"... | Execute command and raise an exception upon an error.
>>> 'README' in command('ls')
True
>>> command('nonexistingcommand') #doctest: +ELLIPSIS
Traceback (most recent call last):
...
SdistCreationError | [
"Execute",
"command",
"and",
"raise",
"an",
"exception",
"upon",
"an",
"error",
"."
] | 72f3c664940133e3238fca4d87edcc36b9775e48 | https://github.com/lizardsystem/tags2sdists/blob/72f3c664940133e3238fca4d87edcc36b9775e48/tags2sdists/utils.py#L12-L28 |
250,545 | Sean1708/HipPy | hippy/lexer.py | tokenize_number | def tokenize_number(val, line):
"""Parse val correctly into int or float."""
try:
num = int(val)
typ = TokenType.int
except ValueError:
num = float(val)
typ = TokenType.float
return {'type': typ, 'value': num, 'line': line} | python | def tokenize_number(val, line):
"""Parse val correctly into int or float."""
try:
num = int(val)
typ = TokenType.int
except ValueError:
num = float(val)
typ = TokenType.float
return {'type': typ, 'value': num, 'line': line} | [
"def",
"tokenize_number",
"(",
"val",
",",
"line",
")",
":",
"try",
":",
"num",
"=",
"int",
"(",
"val",
")",
"typ",
"=",
"TokenType",
".",
"int",
"except",
"ValueError",
":",
"num",
"=",
"float",
"(",
"val",
")",
"typ",
"=",
"TokenType",
".",
"floa... | Parse val correctly into int or float. | [
"Parse",
"val",
"correctly",
"into",
"int",
"or",
"float",
"."
] | d0ea8fb1e417f1fedaa8e215e3d420b90c4de691 | https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/lexer.py#L43-L52 |
250,546 | jmgilman/Neolib | neolib/shop/UserShop.py | UserShop.loadHistory | def loadHistory(self):
""" Loads the shop sale history
Raises
parseException
"""
pg = self.usr.getPage("http://www.neopets.com/market.phtml?type=sales")\
try:
rows = pg.find("b", text = "Date").parent.parent.parent.find_all("tr")
... | python | def loadHistory(self):
""" Loads the shop sale history
Raises
parseException
"""
pg = self.usr.getPage("http://www.neopets.com/market.phtml?type=sales")\
try:
rows = pg.find("b", text = "Date").parent.parent.parent.find_all("tr")
... | [
"def",
"loadHistory",
"(",
"self",
")",
":",
"pg",
"=",
"self",
".",
"usr",
".",
"getPage",
"(",
"\"http://www.neopets.com/market.phtml?type=sales\"",
")",
"try",
":",
"rows",
"=",
"pg",
".",
"find",
"(",
"\"b\"",
",",
"text",
"=",
"\"Date\"",
")",
".",
... | Loads the shop sale history
Raises
parseException | [
"Loads",
"the",
"shop",
"sale",
"history",
"Raises",
"parseException"
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/shop/UserShop.py#L132-L163 |
250,547 | port-zero/mite | mite/mite.py | Mite.edit_entry | def edit_entry(self, id_, **kwargs):
"""
Edits a time entry by ID. Takes the same data as `create_entry`, but
requires an ID to work. It also takes a `force` parameter that, when set
to True, allows administrators to edit locked entries.
"""
data = self._wrap_dict("time_e... | python | def edit_entry(self, id_, **kwargs):
"""
Edits a time entry by ID. Takes the same data as `create_entry`, but
requires an ID to work. It also takes a `force` parameter that, when set
to True, allows administrators to edit locked entries.
"""
data = self._wrap_dict("time_e... | [
"def",
"edit_entry",
"(",
"self",
",",
"id_",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_wrap_dict",
"(",
"\"time_entry\"",
",",
"kwargs",
")",
"return",
"self",
".",
"patch",
"(",
"\"/time_entries/{}.json\"",
".",
"format",
"(",
"id_... | Edits a time entry by ID. Takes the same data as `create_entry`, but
requires an ID to work. It also takes a `force` parameter that, when set
to True, allows administrators to edit locked entries. | [
"Edits",
"a",
"time",
"entry",
"by",
"ID",
".",
"Takes",
"the",
"same",
"data",
"as",
"create_entry",
"but",
"requires",
"an",
"ID",
"to",
"work",
".",
"It",
"also",
"takes",
"a",
"force",
"parameter",
"that",
"when",
"set",
"to",
"True",
"allows",
"ad... | b5fa941f60bf43e04ef654ed580ed7ef91211c22 | https://github.com/port-zero/mite/blob/b5fa941f60bf43e04ef654ed580ed7ef91211c22/mite/mite.py#L154-L162 |
250,548 | port-zero/mite | mite/mite.py | Mite.start_tracker | def start_tracker(self, id_, **kwargs):
"""
Starts a tracker for the time entry identified by `id_`.
"""
data = None
if kwargs:
data = self._wrap_dict("tracker",
self._wrap_dict("tracking_time_entry", kwargs))
return self.patch("/tracker/{}.jso... | python | def start_tracker(self, id_, **kwargs):
"""
Starts a tracker for the time entry identified by `id_`.
"""
data = None
if kwargs:
data = self._wrap_dict("tracker",
self._wrap_dict("tracking_time_entry", kwargs))
return self.patch("/tracker/{}.jso... | [
"def",
"start_tracker",
"(",
"self",
",",
"id_",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"None",
"if",
"kwargs",
":",
"data",
"=",
"self",
".",
"_wrap_dict",
"(",
"\"tracker\"",
",",
"self",
".",
"_wrap_dict",
"(",
"\"tracking_time_entry\"",
",",... | Starts a tracker for the time entry identified by `id_`. | [
"Starts",
"a",
"tracker",
"for",
"the",
"time",
"entry",
"identified",
"by",
"id_",
"."
] | b5fa941f60bf43e04ef654ed580ed7ef91211c22 | https://github.com/port-zero/mite/blob/b5fa941f60bf43e04ef654ed580ed7ef91211c22/mite/mite.py#L176-L184 |
250,549 | port-zero/mite | mite/mite.py | Mite.edit_customer | def edit_customer(self, id_, **kwargs):
"""
Edits a customer by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("custom... | python | def edit_customer(self, id_, **kwargs):
"""
Edits a customer by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("custom... | [
"def",
"edit_customer",
"(",
"self",
",",
"id_",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_wrap_dict",
"(",
"\"customer\"",
",",
"kwargs",
")",
"return",
"self",
".",
"patch",
"(",
"\"/customers/{}.json\"",
".",
"format",
"(",
"id_",... | Edits a customer by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True. | [
"Edits",
"a",
"customer",
"by",
"ID",
".",
"All",
"fields",
"available",
"at",
"creation",
"can",
"be",
"updated",
"as",
"well",
".",
"If",
"you",
"want",
"to",
"update",
"hourly",
"rates",
"retroactively",
"set",
"the",
"argument",
"update_hourly_rate_on_time... | b5fa941f60bf43e04ef654ed580ed7ef91211c22 | https://github.com/port-zero/mite/blob/b5fa941f60bf43e04ef654ed580ed7ef91211c22/mite/mite.py#L239-L246 |
250,550 | port-zero/mite | mite/mite.py | Mite.edit_project | def edit_project(self, id_, **kwargs):
"""
Edits a project by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("project"... | python | def edit_project(self, id_, **kwargs):
"""
Edits a project by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("project"... | [
"def",
"edit_project",
"(",
"self",
",",
"id_",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_wrap_dict",
"(",
"\"project\"",
",",
"kwargs",
")",
"return",
"self",
".",
"patch",
"(",
"\"/projects/{}.json\"",
".",
"format",
"(",
"id_",
... | Edits a project by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True. | [
"Edits",
"a",
"project",
"by",
"ID",
".",
"All",
"fields",
"available",
"at",
"creation",
"can",
"be",
"updated",
"as",
"well",
".",
"If",
"you",
"want",
"to",
"update",
"hourly",
"rates",
"retroactively",
"set",
"the",
"argument",
"update_hourly_rate_on_time_... | b5fa941f60bf43e04ef654ed580ed7ef91211c22 | https://github.com/port-zero/mite/blob/b5fa941f60bf43e04ef654ed580ed7ef91211c22/mite/mite.py#L286-L293 |
250,551 | port-zero/mite | mite/mite.py | Mite.edit_service | def edit_service(self, id_, **kwargs):
"""
Edits a service by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("service"... | python | def edit_service(self, id_, **kwargs):
"""
Edits a service by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True.
"""
data = self._wrap_dict("service"... | [
"def",
"edit_service",
"(",
"self",
",",
"id_",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_wrap_dict",
"(",
"\"service\"",
",",
"kwargs",
")",
"return",
"self",
".",
"patch",
"(",
"\"/services/{}.json\"",
".",
"format",
"(",
"id_",
... | Edits a service by ID. All fields available at creation can be updated
as well. If you want to update hourly rates retroactively, set the
argument `update_hourly_rate_on_time_entries` to True. | [
"Edits",
"a",
"service",
"by",
"ID",
".",
"All",
"fields",
"available",
"at",
"creation",
"can",
"be",
"updated",
"as",
"well",
".",
"If",
"you",
"want",
"to",
"update",
"hourly",
"rates",
"retroactively",
"set",
"the",
"argument",
"update_hourly_rate_on_time_... | b5fa941f60bf43e04ef654ed580ed7ef91211c22 | https://github.com/port-zero/mite/blob/b5fa941f60bf43e04ef654ed580ed7ef91211c22/mite/mite.py#L331-L338 |
250,552 | naphatkrit/easyci | easyci/history.py | get_committed_signatures | def get_committed_signatures(vcs):
"""Get the list of committed signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures
"""
committed_path = _get_committed_history_path(vcs)
known_signatures = []
if os.path.exists(committed_path):
w... | python | def get_committed_signatures(vcs):
"""Get the list of committed signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures
"""
committed_path = _get_committed_history_path(vcs)
known_signatures = []
if os.path.exists(committed_path):
w... | [
"def",
"get_committed_signatures",
"(",
"vcs",
")",
":",
"committed_path",
"=",
"_get_committed_history_path",
"(",
"vcs",
")",
"known_signatures",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"committed_path",
")",
":",
"with",
"open",
"(",
"... | Get the list of committed signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures | [
"Get",
"the",
"list",
"of",
"committed",
"signatures"
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/history.py#L40-L54 |
250,553 | naphatkrit/easyci | easyci/history.py | get_staged_signatures | def get_staged_signatures(vcs):
"""Get the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures
"""
staged_path = _get_staged_history_path(vcs)
known_signatures = []
if os.path.exists(staged_path):
with open(staged... | python | def get_staged_signatures(vcs):
"""Get the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures
"""
staged_path = _get_staged_history_path(vcs)
known_signatures = []
if os.path.exists(staged_path):
with open(staged... | [
"def",
"get_staged_signatures",
"(",
"vcs",
")",
":",
"staged_path",
"=",
"_get_staged_history_path",
"(",
"vcs",
")",
"known_signatures",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"staged_path",
")",
":",
"with",
"open",
"(",
"staged_path"... | Get the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
Returns:
list(basestring) - list of signatures | [
"Get",
"the",
"list",
"of",
"staged",
"signatures"
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/history.py#L57-L71 |
250,554 | naphatkrit/easyci | easyci/history.py | commit_signature | def commit_signature(vcs, user_config, signature):
"""Add `signature` to the list of committed signatures
The signature must already be staged
Args:
vcs (easyci.vcs.base.Vcs)
user_config (dict)
signature (basestring)
Raises:
NotStagedError
AlreadyCommittedError... | python | def commit_signature(vcs, user_config, signature):
"""Add `signature` to the list of committed signatures
The signature must already be staged
Args:
vcs (easyci.vcs.base.Vcs)
user_config (dict)
signature (basestring)
Raises:
NotStagedError
AlreadyCommittedError... | [
"def",
"commit_signature",
"(",
"vcs",
",",
"user_config",
",",
"signature",
")",
":",
"if",
"signature",
"not",
"in",
"get_staged_signatures",
"(",
"vcs",
")",
":",
"raise",
"NotStagedError",
"evidence_path",
"=",
"_get_committed_history_path",
"(",
"vcs",
")",
... | Add `signature` to the list of committed signatures
The signature must already be staged
Args:
vcs (easyci.vcs.base.Vcs)
user_config (dict)
signature (basestring)
Raises:
NotStagedError
AlreadyCommittedError | [
"Add",
"signature",
"to",
"the",
"list",
"of",
"committed",
"signatures"
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/history.py#L74-L98 |
250,555 | naphatkrit/easyci | easyci/history.py | stage_signature | def stage_signature(vcs, signature):
"""Add `signature` to the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
AlreadyStagedError
"""
evidence_path = _get_staged_history_path(vcs)
staged = get_staged_signatures(vcs)
if signat... | python | def stage_signature(vcs, signature):
"""Add `signature` to the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
AlreadyStagedError
"""
evidence_path = _get_staged_history_path(vcs)
staged = get_staged_signatures(vcs)
if signat... | [
"def",
"stage_signature",
"(",
"vcs",
",",
"signature",
")",
":",
"evidence_path",
"=",
"_get_staged_history_path",
"(",
"vcs",
")",
"staged",
"=",
"get_staged_signatures",
"(",
"vcs",
")",
"if",
"signature",
"in",
"staged",
":",
"raise",
"AlreadyStagedError",
"... | Add `signature` to the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
AlreadyStagedError | [
"Add",
"signature",
"to",
"the",
"list",
"of",
"staged",
"signatures"
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/history.py#L101-L118 |
250,556 | naphatkrit/easyci | easyci/history.py | unstage_signature | def unstage_signature(vcs, signature):
"""Remove `signature` from the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
NotStagedError
"""
evidence_path = _get_staged_history_path(vcs)
staged = get_staged_signatures(vcs)
if sig... | python | def unstage_signature(vcs, signature):
"""Remove `signature` from the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
NotStagedError
"""
evidence_path = _get_staged_history_path(vcs)
staged = get_staged_signatures(vcs)
if sig... | [
"def",
"unstage_signature",
"(",
"vcs",
",",
"signature",
")",
":",
"evidence_path",
"=",
"_get_staged_history_path",
"(",
"vcs",
")",
"staged",
"=",
"get_staged_signatures",
"(",
"vcs",
")",
"if",
"signature",
"not",
"in",
"staged",
":",
"raise",
"NotStagedErro... | Remove `signature` from the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
NotStagedError | [
"Remove",
"signature",
"from",
"the",
"list",
"of",
"staged",
"signatures"
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/history.py#L121-L138 |
250,557 | MacHu-GWU/windtalker-project | windtalker/files.py | get_decrpyted_path | def get_decrpyted_path(encrypted_path, surfix=default_surfix):
"""
Find the original path of encrypted file or dir.
Example:
- file: ``${home}/test-encrypted.txt`` -> ``${home}/test.txt``
- dir: ``${home}/Documents-encrypted`` -> ``${home}/Documents``
"""
surfix_reversed = surfix[::-1]
... | python | def get_decrpyted_path(encrypted_path, surfix=default_surfix):
"""
Find the original path of encrypted file or dir.
Example:
- file: ``${home}/test-encrypted.txt`` -> ``${home}/test.txt``
- dir: ``${home}/Documents-encrypted`` -> ``${home}/Documents``
"""
surfix_reversed = surfix[::-1]
... | [
"def",
"get_decrpyted_path",
"(",
"encrypted_path",
",",
"surfix",
"=",
"default_surfix",
")",
":",
"surfix_reversed",
"=",
"surfix",
"[",
":",
":",
"-",
"1",
"]",
"p",
"=",
"Path",
"(",
"encrypted_path",
")",
".",
"absolute",
"(",
")",
"fname",
"=",
"p"... | Find the original path of encrypted file or dir.
Example:
- file: ``${home}/test-encrypted.txt`` -> ``${home}/test.txt``
- dir: ``${home}/Documents-encrypted`` -> ``${home}/Documents`` | [
"Find",
"the",
"original",
"path",
"of",
"encrypted",
"file",
"or",
"dir",
"."
] | 1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce | https://github.com/MacHu-GWU/windtalker-project/blob/1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce/windtalker/files.py#L26-L42 |
250,558 | MacHu-GWU/windtalker-project | windtalker/files.py | transform | def transform(src, dst, converter,
overwrite=False, stream=True, chunksize=1024**2, **kwargs):
"""
A file stream transform IO utility function.
:param src: original file path
:param dst: destination file path
:param converter: binary content converter function
:param overwrite: de... | python | def transform(src, dst, converter,
overwrite=False, stream=True, chunksize=1024**2, **kwargs):
"""
A file stream transform IO utility function.
:param src: original file path
:param dst: destination file path
:param converter: binary content converter function
:param overwrite: de... | [
"def",
"transform",
"(",
"src",
",",
"dst",
",",
"converter",
",",
"overwrite",
"=",
"False",
",",
"stream",
"=",
"True",
",",
"chunksize",
"=",
"1024",
"**",
"2",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"overwrite",
":",
"# pragma: no cover",
... | A file stream transform IO utility function.
:param src: original file path
:param dst: destination file path
:param converter: binary content converter function
:param overwrite: default False,
:param stream: default True, if True, use stream IO mode, chunksize has to
be specified.
:para... | [
"A",
"file",
"stream",
"transform",
"IO",
"utility",
"function",
"."
] | 1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce | https://github.com/MacHu-GWU/windtalker-project/blob/1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce/windtalker/files.py#L45-L79 |
250,559 | billyoverton/tweetqueue | tweetqueue/TweetList.py | TweetList.append | def append(self, tweet):
"""Add a tweet to the end of the list."""
c = self.connection.cursor()
last_tweet = c.execute("SELECT tweet from tweetlist where label='last_tweet'").next()[0]
c.execute("INSERT INTO tweets(message, previous_tweet, next_tweet) VALUES (?,?,NULL)", (tweet, last_... | python | def append(self, tweet):
"""Add a tweet to the end of the list."""
c = self.connection.cursor()
last_tweet = c.execute("SELECT tweet from tweetlist where label='last_tweet'").next()[0]
c.execute("INSERT INTO tweets(message, previous_tweet, next_tweet) VALUES (?,?,NULL)", (tweet, last_... | [
"def",
"append",
"(",
"self",
",",
"tweet",
")",
":",
"c",
"=",
"self",
".",
"connection",
".",
"cursor",
"(",
")",
"last_tweet",
"=",
"c",
".",
"execute",
"(",
"\"SELECT tweet from tweetlist where label='last_tweet'\"",
")",
".",
"next",
"(",
")",
"[",
"0... | Add a tweet to the end of the list. | [
"Add",
"a",
"tweet",
"to",
"the",
"end",
"of",
"the",
"list",
"."
] | e54972a0137ea2a21b2357b81408d9d4c92fdd61 | https://github.com/billyoverton/tweetqueue/blob/e54972a0137ea2a21b2357b81408d9d4c92fdd61/tweetqueue/TweetList.py#L57-L78 |
250,560 | billyoverton/tweetqueue | tweetqueue/TweetList.py | TweetList.pop | def pop(self):
"""Return first tweet in the list."""
c = self.connection.cursor()
first_tweet_id = c.execute("SELECT tweet from tweetlist where label='first_tweet'").next()[0]
if first_tweet_id is None:
# No tweets are in the list, so return None
return None
... | python | def pop(self):
"""Return first tweet in the list."""
c = self.connection.cursor()
first_tweet_id = c.execute("SELECT tweet from tweetlist where label='first_tweet'").next()[0]
if first_tweet_id is None:
# No tweets are in the list, so return None
return None
... | [
"def",
"pop",
"(",
"self",
")",
":",
"c",
"=",
"self",
".",
"connection",
".",
"cursor",
"(",
")",
"first_tweet_id",
"=",
"c",
".",
"execute",
"(",
"\"SELECT tweet from tweetlist where label='first_tweet'\"",
")",
".",
"next",
"(",
")",
"[",
"0",
"]",
"if"... | Return first tweet in the list. | [
"Return",
"first",
"tweet",
"in",
"the",
"list",
"."
] | e54972a0137ea2a21b2357b81408d9d4c92fdd61 | https://github.com/billyoverton/tweetqueue/blob/e54972a0137ea2a21b2357b81408d9d4c92fdd61/tweetqueue/TweetList.py#L81-L108 |
250,561 | billyoverton/tweetqueue | tweetqueue/TweetList.py | TweetList.peek | def peek(self):
"""Peeks at the first of the list without removing it."""
c = self.connection.cursor()
first_tweet_id = c.execute("SELECT tweet from tweetlist where label='first_tweet'").next()[0]
if first_tweet_id is None:
# No tweets are in the list, so return None
... | python | def peek(self):
"""Peeks at the first of the list without removing it."""
c = self.connection.cursor()
first_tweet_id = c.execute("SELECT tweet from tweetlist where label='first_tweet'").next()[0]
if first_tweet_id is None:
# No tweets are in the list, so return None
... | [
"def",
"peek",
"(",
"self",
")",
":",
"c",
"=",
"self",
".",
"connection",
".",
"cursor",
"(",
")",
"first_tweet_id",
"=",
"c",
".",
"execute",
"(",
"\"SELECT tweet from tweetlist where label='first_tweet'\"",
")",
".",
"next",
"(",
")",
"[",
"0",
"]",
"if... | Peeks at the first of the list without removing it. | [
"Peeks",
"at",
"the",
"first",
"of",
"the",
"list",
"without",
"removing",
"it",
"."
] | e54972a0137ea2a21b2357b81408d9d4c92fdd61 | https://github.com/billyoverton/tweetqueue/blob/e54972a0137ea2a21b2357b81408d9d4c92fdd61/tweetqueue/TweetList.py#L110-L121 |
250,562 | billyoverton/tweetqueue | tweetqueue/TweetList.py | TweetList.delete | def delete(self, tweet_id):
"""Deletes a tweet from the list with the given id"""
c = self.connection.cursor()
try:
tweet = c.execute("SELECT id, message, previous_tweet, next_tweet from tweets WHERE id=?", (tweet_id,)).next()
except StopIteration:
raise ValueErr... | python | def delete(self, tweet_id):
"""Deletes a tweet from the list with the given id"""
c = self.connection.cursor()
try:
tweet = c.execute("SELECT id, message, previous_tweet, next_tweet from tweets WHERE id=?", (tweet_id,)).next()
except StopIteration:
raise ValueErr... | [
"def",
"delete",
"(",
"self",
",",
"tweet_id",
")",
":",
"c",
"=",
"self",
".",
"connection",
".",
"cursor",
"(",
")",
"try",
":",
"tweet",
"=",
"c",
".",
"execute",
"(",
"\"SELECT id, message, previous_tweet, next_tweet from tweets WHERE id=?\"",
",",
"(",
"t... | Deletes a tweet from the list with the given id | [
"Deletes",
"a",
"tweet",
"from",
"the",
"list",
"with",
"the",
"given",
"id"
] | e54972a0137ea2a21b2357b81408d9d4c92fdd61 | https://github.com/billyoverton/tweetqueue/blob/e54972a0137ea2a21b2357b81408d9d4c92fdd61/tweetqueue/TweetList.py#L130-L152 |
250,563 | scdoshi/django-bits | bits/models.py | usetz_now | def usetz_now():
"""Determine current time depending on USE_TZ setting.
Affects Django 1.4 and above only. if `USE_TZ = True`, then returns
current time according to timezone, else returns current UTC time.
"""
USE_TZ = getattr(settings, 'USE_TZ', False)
if USE_TZ and DJANGO_VERSION >= '1.4':
... | python | def usetz_now():
"""Determine current time depending on USE_TZ setting.
Affects Django 1.4 and above only. if `USE_TZ = True`, then returns
current time according to timezone, else returns current UTC time.
"""
USE_TZ = getattr(settings, 'USE_TZ', False)
if USE_TZ and DJANGO_VERSION >= '1.4':
... | [
"def",
"usetz_now",
"(",
")",
":",
"USE_TZ",
"=",
"getattr",
"(",
"settings",
",",
"'USE_TZ'",
",",
"False",
")",
"if",
"USE_TZ",
"and",
"DJANGO_VERSION",
">=",
"'1.4'",
":",
"return",
"now",
"(",
")",
"else",
":",
"return",
"datetime",
".",
"utcnow",
... | Determine current time depending on USE_TZ setting.
Affects Django 1.4 and above only. if `USE_TZ = True`, then returns
current time according to timezone, else returns current UTC time. | [
"Determine",
"current",
"time",
"depending",
"on",
"USE_TZ",
"setting",
"."
] | 0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f | https://github.com/scdoshi/django-bits/blob/0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f/bits/models.py#L25-L36 |
250,564 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | CommentModerator._get_delta | def _get_delta(self, now, then):
"""
Internal helper which will return a ``datetime.timedelta``
representing the time between ``now`` and ``then``. Assumes
``now`` is a ``datetime.date`` or ``datetime.datetime`` later
than ``then``.
If ``now`` and ``then`` are not of the... | python | def _get_delta(self, now, then):
"""
Internal helper which will return a ``datetime.timedelta``
representing the time between ``now`` and ``then``. Assumes
``now`` is a ``datetime.date`` or ``datetime.datetime`` later
than ``then``.
If ``now`` and ``then`` are not of the... | [
"def",
"_get_delta",
"(",
"self",
",",
"now",
",",
"then",
")",
":",
"if",
"now",
".",
"__class__",
"is",
"not",
"then",
".",
"__class__",
":",
"now",
"=",
"datetime",
".",
"date",
"(",
"now",
".",
"year",
",",
"now",
".",
"month",
",",
"now",
".... | Internal helper which will return a ``datetime.timedelta``
representing the time between ``now`` and ``then``. Assumes
``now`` is a ``datetime.date`` or ``datetime.datetime`` later
than ``then``.
If ``now`` and ``then`` are not of the same type due to one of
them being a ``datet... | [
"Internal",
"helper",
"which",
"will",
"return",
"a",
"datetime",
".",
"timedelta",
"representing",
"the",
"time",
"between",
"now",
"and",
"then",
".",
"Assumes",
"now",
"is",
"a",
"datetime",
".",
"date",
"or",
"datetime",
".",
"datetime",
"later",
"than",... | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L179-L197 |
250,565 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | Moderator.connect | def connect(self):
"""
Hook up the moderation methods to pre- and post-save signals
from the comment models.
"""
signals.comment_will_be_posted.connect(self.pre_save_moderation, sender=comments.get_model())
signals.comment_was_posted.connect(self.post_save_moderation, se... | python | def connect(self):
"""
Hook up the moderation methods to pre- and post-save signals
from the comment models.
"""
signals.comment_will_be_posted.connect(self.pre_save_moderation, sender=comments.get_model())
signals.comment_was_posted.connect(self.post_save_moderation, se... | [
"def",
"connect",
"(",
"self",
")",
":",
"signals",
".",
"comment_will_be_posted",
".",
"connect",
"(",
"self",
".",
"pre_save_moderation",
",",
"sender",
"=",
"comments",
".",
"get_model",
"(",
")",
")",
"signals",
".",
"comment_was_posted",
".",
"connect",
... | Hook up the moderation methods to pre- and post-save signals
from the comment models. | [
"Hook",
"up",
"the",
"moderation",
"methods",
"to",
"pre",
"-",
"and",
"post",
"-",
"save",
"signals",
"from",
"the",
"comment",
"models",
"."
] | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L285-L292 |
250,566 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | Moderator.register | def register(self, model_or_iterable, moderation_class):
"""
Register a model or a list of models for comment moderation,
using a particular moderation class.
Raise ``AlreadyModerated`` if any of the models are already
registered.
"""
if isinstance(model_or_iter... | python | def register(self, model_or_iterable, moderation_class):
"""
Register a model or a list of models for comment moderation,
using a particular moderation class.
Raise ``AlreadyModerated`` if any of the models are already
registered.
"""
if isinstance(model_or_iter... | [
"def",
"register",
"(",
"self",
",",
"model_or_iterable",
",",
"moderation_class",
")",
":",
"if",
"isinstance",
"(",
"model_or_iterable",
",",
"ModelBase",
")",
":",
"model_or_iterable",
"=",
"[",
"model_or_iterable",
"]",
"for",
"model",
"in",
"model_or_iterable... | Register a model or a list of models for comment moderation,
using a particular moderation class.
Raise ``AlreadyModerated`` if any of the models are already
registered. | [
"Register",
"a",
"model",
"or",
"a",
"list",
"of",
"models",
"for",
"comment",
"moderation",
"using",
"a",
"particular",
"moderation",
"class",
"."
] | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L294-L310 |
250,567 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | Moderator.unregister | def unregister(self, model_or_iterable):
"""
Remove a model or a list of models from the list of models
whose comments will be moderated.
Raise ``NotModerated`` if any of the models are not currently
registered for moderation.
"""
if isinstance(model_or_iterable... | python | def unregister(self, model_or_iterable):
"""
Remove a model or a list of models from the list of models
whose comments will be moderated.
Raise ``NotModerated`` if any of the models are not currently
registered for moderation.
"""
if isinstance(model_or_iterable... | [
"def",
"unregister",
"(",
"self",
",",
"model_or_iterable",
")",
":",
"if",
"isinstance",
"(",
"model_or_iterable",
",",
"ModelBase",
")",
":",
"model_or_iterable",
"=",
"[",
"model_or_iterable",
"]",
"for",
"model",
"in",
"model_or_iterable",
":",
"if",
"model"... | Remove a model or a list of models from the list of models
whose comments will be moderated.
Raise ``NotModerated`` if any of the models are not currently
registered for moderation. | [
"Remove",
"a",
"model",
"or",
"a",
"list",
"of",
"models",
"from",
"the",
"list",
"of",
"models",
"whose",
"comments",
"will",
"be",
"moderated",
"."
] | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L312-L326 |
250,568 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | Moderator.pre_save_moderation | def pre_save_moderation(self, sender, comment, request, **kwargs):
"""
Apply any necessary pre-save moderation steps to new
comments.
"""
model = comment.content_type.model_class()
if model not in self._registry:
return
content_object = comment.conten... | python | def pre_save_moderation(self, sender, comment, request, **kwargs):
"""
Apply any necessary pre-save moderation steps to new
comments.
"""
model = comment.content_type.model_class()
if model not in self._registry:
return
content_object = comment.conten... | [
"def",
"pre_save_moderation",
"(",
"self",
",",
"sender",
",",
"comment",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"comment",
".",
"content_type",
".",
"model_class",
"(",
")",
"if",
"model",
"not",
"in",
"self",
".",
"_registry",... | Apply any necessary pre-save moderation steps to new
comments. | [
"Apply",
"any",
"necessary",
"pre",
"-",
"save",
"moderation",
"steps",
"to",
"new",
"comments",
"."
] | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L328-L345 |
250,569 | tBaxter/tango-comments | build/lib/tango_comments/moderation.py | Moderator.post_save_moderation | def post_save_moderation(self, sender, comment, request, **kwargs):
"""
Apply any necessary post-save moderation steps to new
comments.
"""
model = comment.content_type.model_class()
if model not in self._registry:
return
self._registry[model].email(c... | python | def post_save_moderation(self, sender, comment, request, **kwargs):
"""
Apply any necessary post-save moderation steps to new
comments.
"""
model = comment.content_type.model_class()
if model not in self._registry:
return
self._registry[model].email(c... | [
"def",
"post_save_moderation",
"(",
"self",
",",
"sender",
",",
"comment",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"comment",
".",
"content_type",
".",
"model_class",
"(",
")",
"if",
"model",
"not",
"in",
"self",
".",
"_registry"... | Apply any necessary post-save moderation steps to new
comments. | [
"Apply",
"any",
"necessary",
"post",
"-",
"save",
"moderation",
"steps",
"to",
"new",
"comments",
"."
] | 1fd335c6fc9e81bba158e42e1483f1a149622ab4 | https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/moderation.py#L347-L356 |
250,570 | pjuren/pyokit | src/pyokit/scripts/fdr.py | main | def main(args):
"""
main entry point for the FDR script.
:param args: the arguments for this script, as a list of string. Should
already have had things like the script name stripped. That
is, if there are no args provided, this should be an empty
list.
"""
# get ... | python | def main(args):
"""
main entry point for the FDR script.
:param args: the arguments for this script, as a list of string. Should
already have had things like the script name stripped. That
is, if there are no args provided, this should be an empty
list.
"""
# get ... | [
"def",
"main",
"(",
"args",
")",
":",
"# get options and arguments",
"ui",
"=",
"getUI",
"(",
"args",
")",
"if",
"ui",
".",
"optionIsSet",
"(",
"\"test\"",
")",
":",
"# just run unit tests",
"unittest",
".",
"main",
"(",
"argv",
"=",
"[",
"sys",
".",
"ar... | main entry point for the FDR script.
:param args: the arguments for this script, as a list of string. Should
already have had things like the script name stripped. That
is, if there are no args provided, this should be an empty
list. | [
"main",
"entry",
"point",
"for",
"the",
"FDR",
"script",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/fdr.py#L182-L226 |
250,571 | pjuren/pyokit | src/pyokit/scripts/fdr.py | DataTable.load | def load(self, in_fh, header=False, delimit=None, verbose=False):
"""
Load this data_table from a stream or file.
Blank lines in the file are skipped. Any existing values in this dataTable
object are cleared before loading the new ones.
:param in_fh: load from this stream. Can also be a string,... | python | def load(self, in_fh, header=False, delimit=None, verbose=False):
"""
Load this data_table from a stream or file.
Blank lines in the file are skipped. Any existing values in this dataTable
object are cleared before loading the new ones.
:param in_fh: load from this stream. Can also be a string,... | [
"def",
"load",
"(",
"self",
",",
"in_fh",
",",
"header",
"=",
"False",
",",
"delimit",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"self",
".",
"clear",
"(",
")",
"if",
"verbose",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"getting in... | Load this data_table from a stream or file.
Blank lines in the file are skipped. Any existing values in this dataTable
object are cleared before loading the new ones.
:param in_fh: load from this stream. Can also be a string, in which case
we treat it as a filename and attempt to l... | [
"Load",
"this",
"data_table",
"from",
"a",
"stream",
"or",
"file",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/fdr.py#L66-L103 |
250,572 | pjuren/pyokit | src/pyokit/scripts/fdr.py | DataTable.write | def write(self, strm, delim, verbose=False):
"""
Write this data frame to a stream or file.
:param strm: stream to write to; can also be a string, in which case we
treat it as a filename and to open that file for writing
to.
:param delim: delimiter to us... | python | def write(self, strm, delim, verbose=False):
"""
Write this data frame to a stream or file.
:param strm: stream to write to; can also be a string, in which case we
treat it as a filename and to open that file for writing
to.
:param delim: delimiter to us... | [
"def",
"write",
"(",
"self",
",",
"strm",
",",
"delim",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"outputing...\\n\"",
")",
"# figure out whether we need to open a file or not",
"out_strm",
"=",
"s... | Write this data frame to a stream or file.
:param strm: stream to write to; can also be a string, in which case we
treat it as a filename and to open that file for writing
to.
:param delim: delimiter to use between columns.
:param verbose: if True, output p... | [
"Write",
"this",
"data",
"frame",
"to",
"a",
"stream",
"or",
"file",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/fdr.py#L105-L131 |
250,573 | solocompt/plugs-filter | plugs_filter/filtersets.py | Meta.attach_core_filters | def attach_core_filters(cls):
"""
Attach core filters to filterset
"""
opts = cls._meta
base_filters = cls.base_filters.copy()
cls.base_filters.clear()
for name, filter_ in six.iteritems(base_filters):
if isinstance(filter_, AutoFilters):
... | python | def attach_core_filters(cls):
"""
Attach core filters to filterset
"""
opts = cls._meta
base_filters = cls.base_filters.copy()
cls.base_filters.clear()
for name, filter_ in six.iteritems(base_filters):
if isinstance(filter_, AutoFilters):
... | [
"def",
"attach_core_filters",
"(",
"cls",
")",
":",
"opts",
"=",
"cls",
".",
"_meta",
"base_filters",
"=",
"cls",
".",
"base_filters",
".",
"copy",
"(",
")",
"cls",
".",
"base_filters",
".",
"clear",
"(",
")",
"for",
"name",
",",
"filter_",
"in",
"six"... | Attach core filters to filterset | [
"Attach",
"core",
"filters",
"to",
"filterset"
] | cb34c7d662d3f96c07c10b3ed0a34bafef78b52c | https://github.com/solocompt/plugs-filter/blob/cb34c7d662d3f96c07c10b3ed0a34bafef78b52c/plugs_filter/filtersets.py#L35-L54 |
250,574 | zerc/django-vest | django_vest/decorators.py | only_for | def only_for(theme, redirect_to='/', raise_error=None):
""" Decorator for restrict access to views according by list of themes.
Params:
* ``theme`` - string or list of themes where decorated view must be
* ``redirect_to`` - url or name of url pattern for redirect
if CURRENT_THEME n... | python | def only_for(theme, redirect_to='/', raise_error=None):
""" Decorator for restrict access to views according by list of themes.
Params:
* ``theme`` - string or list of themes where decorated view must be
* ``redirect_to`` - url or name of url pattern for redirect
if CURRENT_THEME n... | [
"def",
"only_for",
"(",
"theme",
",",
"redirect_to",
"=",
"'/'",
",",
"raise_error",
"=",
"None",
")",
":",
"def",
"check_theme",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"theme",
",",
"six",
".",
"string_types",
... | Decorator for restrict access to views according by list of themes.
Params:
* ``theme`` - string or list of themes where decorated view must be
* ``redirect_to`` - url or name of url pattern for redirect
if CURRENT_THEME not in themes
* ``raise_error`` - error class for raising... | [
"Decorator",
"for",
"restrict",
"access",
"to",
"views",
"according",
"by",
"list",
"of",
"themes",
"."
] | 39dbd0cd4de59ad8f5d06d1cc4d5fbcd210ab764 | https://github.com/zerc/django-vest/blob/39dbd0cd4de59ad8f5d06d1cc4d5fbcd210ab764/django_vest/decorators.py#L70-L108 |
250,575 | heikomuller/sco-datastore | scodata/experiment.py | DefaultExperimentManager.from_dict | def from_dict(self, document):
"""Create experiment object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
ExperimentHandle
Handle for experiment object
"... | python | def from_dict(self, document):
"""Create experiment object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
ExperimentHandle
Handle for experiment object
"... | [
"def",
"from_dict",
"(",
"self",
",",
"document",
")",
":",
"identifier",
"=",
"str",
"(",
"document",
"[",
"'_id'",
"]",
")",
"active",
"=",
"document",
"[",
"'active'",
"]",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"document... | Create experiment object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
ExperimentHandle
Handle for experiment object | [
"Create",
"experiment",
"object",
"from",
"JSON",
"document",
"retrieved",
"from",
"database",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/experiment.py#L153-L181 |
250,576 | heikomuller/sco-datastore | scodata/experiment.py | DefaultExperimentManager.list_objects | def list_objects(self, query=None, limit=-1, offset=-1):
"""List of all experiments in the database. Overrides the super class
method to allow the returned object's property lists to be extended
with the run count.
Parameters
----------
query : Dictionary
Fil... | python | def list_objects(self, query=None, limit=-1, offset=-1):
"""List of all experiments in the database. Overrides the super class
method to allow the returned object's property lists to be extended
with the run count.
Parameters
----------
query : Dictionary
Fil... | [
"def",
"list_objects",
"(",
"self",
",",
"query",
"=",
"None",
",",
"limit",
"=",
"-",
"1",
",",
"offset",
"=",
"-",
"1",
")",
":",
"# Call super class method to get the object listing",
"result",
"=",
"super",
"(",
"DefaultExperimentManager",
",",
"self",
")"... | List of all experiments in the database. Overrides the super class
method to allow the returned object's property lists to be extended
with the run count.
Parameters
----------
query : Dictionary
Filter objects by property-value pairs defined by dictionary.
l... | [
"List",
"of",
"all",
"experiments",
"in",
"the",
"database",
".",
"Overrides",
"the",
"super",
"class",
"method",
"to",
"allow",
"the",
"returned",
"object",
"s",
"property",
"lists",
"to",
"be",
"extended",
"with",
"the",
"run",
"count",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/experiment.py#L183-L224 |
250,577 | heikomuller/sco-datastore | scodata/experiment.py | DefaultExperimentManager.update_fmri_data | def update_fmri_data(self, identifier, fmri_data_id):
"""Associate the fMRI object with the identified experiment.
Parameters
----------
identifier : string
Unique experiment object identifier
fmri_data_id : string
Unique fMRI data object identifier
... | python | def update_fmri_data(self, identifier, fmri_data_id):
"""Associate the fMRI object with the identified experiment.
Parameters
----------
identifier : string
Unique experiment object identifier
fmri_data_id : string
Unique fMRI data object identifier
... | [
"def",
"update_fmri_data",
"(",
"self",
",",
"identifier",
",",
"fmri_data_id",
")",
":",
"# Get experiment to ensure that it exists",
"experiment",
"=",
"self",
".",
"get_object",
"(",
"identifier",
")",
"if",
"experiment",
"is",
"None",
":",
"return",
"None",
"#... | Associate the fMRI object with the identified experiment.
Parameters
----------
identifier : string
Unique experiment object identifier
fmri_data_id : string
Unique fMRI data object identifier
Returns
-------
ExperimentHandle
... | [
"Associate",
"the",
"fMRI",
"object",
"with",
"the",
"identified",
"experiment",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/experiment.py#L249-L273 |
250,578 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | config | def config():
"""
Load system configuration
@rtype: ConfigParser
"""
cfg = ConfigParser()
cfg.read(os.path.join(os.path.dirname(os.path.realpath(ips_vagrant.__file__)), 'config/ipsv.conf'))
return cfg | python | def config():
"""
Load system configuration
@rtype: ConfigParser
"""
cfg = ConfigParser()
cfg.read(os.path.join(os.path.dirname(os.path.realpath(ips_vagrant.__file__)), 'config/ipsv.conf'))
return cfg | [
"def",
"config",
"(",
")",
":",
"cfg",
"=",
"ConfigParser",
"(",
")",
"cfg",
".",
"read",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"ips_vagrant",
".",
"__file__",
"... | Load system configuration
@rtype: ConfigParser | [
"Load",
"system",
"configuration"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L12-L19 |
250,579 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | choice | def choice(opts, default=1, text='Please make a choice.'):
"""
Prompt the user to select an option
@param opts: List of tuples containing options in (key, value) format - value is optional
@type opts: list of tuple
@param text: Prompt text
@type text: str
"""
opts_len = len... | python | def choice(opts, default=1, text='Please make a choice.'):
"""
Prompt the user to select an option
@param opts: List of tuples containing options in (key, value) format - value is optional
@type opts: list of tuple
@param text: Prompt text
@type text: str
"""
opts_len = len... | [
"def",
"choice",
"(",
"opts",
",",
"default",
"=",
"1",
",",
"text",
"=",
"'Please make a choice.'",
")",
":",
"opts_len",
"=",
"len",
"(",
"opts",
")",
"opts_enum",
"=",
"enumerate",
"(",
"opts",
",",
"1",
")",
"opts",
"=",
"list",
"(",
"opts",
")",... | Prompt the user to select an option
@param opts: List of tuples containing options in (key, value) format - value is optional
@type opts: list of tuple
@param text: Prompt text
@type text: str | [
"Prompt",
"the",
"user",
"to",
"select",
"an",
"option"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L22-L40 |
250,580 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | styled_status | def styled_status(enabled, bold=True):
"""
Generate a styled status string
@param enabled: Enabled / Disabled boolean
@type enabled: bool
@param bold: Display status in bold format
@type bold: bool
@rtype: str
"""
return click.style('Enabled' if enabled else '... | python | def styled_status(enabled, bold=True):
"""
Generate a styled status string
@param enabled: Enabled / Disabled boolean
@type enabled: bool
@param bold: Display status in bold format
@type bold: bool
@rtype: str
"""
return click.style('Enabled' if enabled else '... | [
"def",
"styled_status",
"(",
"enabled",
",",
"bold",
"=",
"True",
")",
":",
"return",
"click",
".",
"style",
"(",
"'Enabled'",
"if",
"enabled",
"else",
"'Disabled'",
",",
"'green'",
"if",
"enabled",
"else",
"'red'",
",",
"bold",
"=",
"bold",
")"
] | Generate a styled status string
@param enabled: Enabled / Disabled boolean
@type enabled: bool
@param bold: Display status in bold format
@type bold: bool
@rtype: str | [
"Generate",
"a",
"styled",
"status",
"string"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L43-L52 |
250,581 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | domain_parse | def domain_parse(url):
"""
urlparse wrapper for user input
@type url: str
@rtype: urlparse.ParseResult
"""
url = url.lower()
if not url.startswith('http://') and not url.startswith('https://'):
url = '{schema}{host}'.format(schema='http://', host=url)
url = urlparse(url)
... | python | def domain_parse(url):
"""
urlparse wrapper for user input
@type url: str
@rtype: urlparse.ParseResult
"""
url = url.lower()
if not url.startswith('http://') and not url.startswith('https://'):
url = '{schema}{host}'.format(schema='http://', host=url)
url = urlparse(url)
... | [
"def",
"domain_parse",
"(",
"url",
")",
":",
"url",
"=",
"url",
".",
"lower",
"(",
")",
"if",
"not",
"url",
".",
"startswith",
"(",
"'http://'",
")",
"and",
"not",
"url",
".",
"startswith",
"(",
"'https://'",
")",
":",
"url",
"=",
"'{schema}{host}'",
... | urlparse wrapper for user input
@type url: str
@rtype: urlparse.ParseResult | [
"urlparse",
"wrapper",
"for",
"user",
"input"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L55-L70 |
250,582 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | http_session | def http_session(cookies=None):
"""
Generate a Requests session
@param cookies: Cookies to load. None loads the app default CookieJar. False disables cookie loading.
@type cookies: dict, cookielib.LWPCookieJar, None or False
@rtype requests.Session
"""
session = requests.Session()
... | python | def http_session(cookies=None):
"""
Generate a Requests session
@param cookies: Cookies to load. None loads the app default CookieJar. False disables cookie loading.
@type cookies: dict, cookielib.LWPCookieJar, None or False
@rtype requests.Session
"""
session = requests.Session()
... | [
"def",
"http_session",
"(",
"cookies",
"=",
"None",
")",
":",
"session",
"=",
"requests",
".",
"Session",
"(",
")",
"if",
"cookies",
"is",
"not",
"False",
":",
"session",
".",
"cookies",
".",
"update",
"(",
"cookies",
"or",
"cookiejar",
"(",
")",
")",
... | Generate a Requests session
@param cookies: Cookies to load. None loads the app default CookieJar. False disables cookie loading.
@type cookies: dict, cookielib.LWPCookieJar, None or False
@rtype requests.Session | [
"Generate",
"a",
"Requests",
"session"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L73-L85 |
250,583 | FujiMakoto/IPS-Vagrant | ips_vagrant/common/__init__.py | cookiejar | def cookiejar(name='session'):
"""
Ready the CookieJar, loading a saved session if available
@rtype: cookielib.LWPCookieJar
"""
log = logging.getLogger('ipsv.common.cookiejar')
spath = os.path.join(config().get('Paths', 'Data'), '{n}.txt'.format(n=name))
cj = cookielib.LWPCookieJar(spath)
... | python | def cookiejar(name='session'):
"""
Ready the CookieJar, loading a saved session if available
@rtype: cookielib.LWPCookieJar
"""
log = logging.getLogger('ipsv.common.cookiejar')
spath = os.path.join(config().get('Paths', 'Data'), '{n}.txt'.format(n=name))
cj = cookielib.LWPCookieJar(spath)
... | [
"def",
"cookiejar",
"(",
"name",
"=",
"'session'",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'ipsv.common.cookiejar'",
")",
"spath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config",
"(",
")",
".",
"get",
"(",
"'Paths'",
",",
"'Data'",... | Ready the CookieJar, loading a saved session if available
@rtype: cookielib.LWPCookieJar | [
"Ready",
"the",
"CookieJar",
"loading",
"a",
"saved",
"session",
"if",
"available"
] | 7b1d6d095034dd8befb026d9315ecc6494d52269 | https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/common/__init__.py#L88-L104 |
250,584 | OpenVolunteeringPlatform/django-ovp-organizations | ovp_organizations/emails.py | OrganizationMail.sendUserInvitationRevoked | def sendUserInvitationRevoked(self, context={}):
"""
Sent when user is invitation is revoked
"""
organization, invited, invitator = context['invite'].organization, context['invite'].invited, context['invite'].invitator
# invited user email
self.__init__(organization, async_mail=self.async_mail, ... | python | def sendUserInvitationRevoked(self, context={}):
"""
Sent when user is invitation is revoked
"""
organization, invited, invitator = context['invite'].organization, context['invite'].invited, context['invite'].invitator
# invited user email
self.__init__(organization, async_mail=self.async_mail, ... | [
"def",
"sendUserInvitationRevoked",
"(",
"self",
",",
"context",
"=",
"{",
"}",
")",
":",
"organization",
",",
"invited",
",",
"invitator",
"=",
"context",
"[",
"'invite'",
"]",
".",
"organization",
",",
"context",
"[",
"'invite'",
"]",
".",
"invited",
","... | Sent when user is invitation is revoked | [
"Sent",
"when",
"user",
"is",
"invitation",
"is",
"revoked"
] | 7c60024684024b604eb19a02d119adab547ed0d1 | https://github.com/OpenVolunteeringPlatform/django-ovp-organizations/blob/7c60024684024b604eb19a02d119adab547ed0d1/ovp_organizations/emails.py#L50-L67 |
250,585 | OpenVolunteeringPlatform/django-ovp-organizations | ovp_organizations/emails.py | OrganizationMail.sendUserLeft | def sendUserLeft(self, context={}):
"""
Sent when user leaves organization
"""
self.__init__(context['organization'], async_mail=self.async_mail, override_receiver=context['user'].email, locale=context['user'].locale)
self.sendEmail('userLeft-toUser', 'You have left an organization', context)
s... | python | def sendUserLeft(self, context={}):
"""
Sent when user leaves organization
"""
self.__init__(context['organization'], async_mail=self.async_mail, override_receiver=context['user'].email, locale=context['user'].locale)
self.sendEmail('userLeft-toUser', 'You have left an organization', context)
s... | [
"def",
"sendUserLeft",
"(",
"self",
",",
"context",
"=",
"{",
"}",
")",
":",
"self",
".",
"__init__",
"(",
"context",
"[",
"'organization'",
"]",
",",
"async_mail",
"=",
"self",
".",
"async_mail",
",",
"override_receiver",
"=",
"context",
"[",
"'user'",
... | Sent when user leaves organization | [
"Sent",
"when",
"user",
"leaves",
"organization"
] | 7c60024684024b604eb19a02d119adab547ed0d1 | https://github.com/OpenVolunteeringPlatform/django-ovp-organizations/blob/7c60024684024b604eb19a02d119adab547ed0d1/ovp_organizations/emails.py#L70-L78 |
250,586 | AshleySetter/qplots | qplots/qplots/qplots.py | dynamic_zoom_plot | def dynamic_zoom_plot(x, y, N, RegionStartSize=1000):
"""
plots 2 time traces, the top is the downsampled time trace
the bottom is the full time trace.
"""
x_lowres = x[::N]
y_lowres = y[::N]
ax1 = _plt.subplot2grid((2, 1), (0, 0), colspan=1)
ax2 = _plt.subplot2grid((2, 1), (1... | python | def dynamic_zoom_plot(x, y, N, RegionStartSize=1000):
"""
plots 2 time traces, the top is the downsampled time trace
the bottom is the full time trace.
"""
x_lowres = x[::N]
y_lowres = y[::N]
ax1 = _plt.subplot2grid((2, 1), (0, 0), colspan=1)
ax2 = _plt.subplot2grid((2, 1), (1... | [
"def",
"dynamic_zoom_plot",
"(",
"x",
",",
"y",
",",
"N",
",",
"RegionStartSize",
"=",
"1000",
")",
":",
"x_lowres",
"=",
"x",
"[",
":",
":",
"N",
"]",
"y_lowres",
"=",
"y",
"[",
":",
":",
"N",
"]",
"ax1",
"=",
"_plt",
".",
"subplot2grid",
"(",
... | plots 2 time traces, the top is the downsampled time trace
the bottom is the full time trace. | [
"plots",
"2",
"time",
"traces",
"the",
"top",
"is",
"the",
"downsampled",
"time",
"trace",
"the",
"bottom",
"is",
"the",
"full",
"time",
"trace",
"."
] | 780ca98e6c08bee612d2c3db37e27e38be5ddec3 | https://github.com/AshleySetter/qplots/blob/780ca98e6c08bee612d2c3db37e27e38be5ddec3/qplots/qplots/qplots.py#L211-L272 |
250,587 | ionrock/rdo | rdo/config.py | find_config | def find_config(fname='.rdo.conf', start=None):
"""Go up until you find an rdo config.
"""
start = start or os.getcwd()
config_file = os.path.join(start, fname)
if os.path.isfile(config_file):
return config_file
parent, _ = os.path.split(start)
if parent == start:
raise Exce... | python | def find_config(fname='.rdo.conf', start=None):
"""Go up until you find an rdo config.
"""
start = start or os.getcwd()
config_file = os.path.join(start, fname)
if os.path.isfile(config_file):
return config_file
parent, _ = os.path.split(start)
if parent == start:
raise Exce... | [
"def",
"find_config",
"(",
"fname",
"=",
"'.rdo.conf'",
",",
"start",
"=",
"None",
")",
":",
"start",
"=",
"start",
"or",
"os",
".",
"getcwd",
"(",
")",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"start",
",",
"fname",
")",
"if",
"os"... | Go up until you find an rdo config. | [
"Go",
"up",
"until",
"you",
"find",
"an",
"rdo",
"config",
"."
] | 1c58abdf67d69e832cadc8088b62093d2b8ca75f | https://github.com/ionrock/rdo/blob/1c58abdf67d69e832cadc8088b62093d2b8ca75f/rdo/config.py#L13-L25 |
250,588 | ludeeus/pyruter | pyruter/cli.py | departure | def departure(stop, destination):
"""Get departure information."""
from pyruter.api import Departures
async def get_departures():
"""Get departure information."""
async with aiohttp.ClientSession() as session:
data = Departures(LOOP, stop, destination, session)
await... | python | def departure(stop, destination):
"""Get departure information."""
from pyruter.api import Departures
async def get_departures():
"""Get departure information."""
async with aiohttp.ClientSession() as session:
data = Departures(LOOP, stop, destination, session)
await... | [
"def",
"departure",
"(",
"stop",
",",
"destination",
")",
":",
"from",
"pyruter",
".",
"api",
"import",
"Departures",
"async",
"def",
"get_departures",
"(",
")",
":",
"\"\"\"Get departure information.\"\"\"",
"async",
"with",
"aiohttp",
".",
"ClientSession",
"(",
... | Get departure information. | [
"Get",
"departure",
"information",
"."
] | 415d8b9c8bfd48caa82c1a1201bfd3beb670a117 | https://github.com/ludeeus/pyruter/blob/415d8b9c8bfd48caa82c1a1201bfd3beb670a117/pyruter/cli.py#L18-L28 |
250,589 | ludeeus/pyruter | pyruter/cli.py | destinations | def destinations(stop):
"""Get destination information."""
from pyruter.api import Departures
async def get_destinations():
"""Get departure information."""
async with aiohttp.ClientSession() as session:
data = Departures(LOOP, stop, session=session)
result = await d... | python | def destinations(stop):
"""Get destination information."""
from pyruter.api import Departures
async def get_destinations():
"""Get departure information."""
async with aiohttp.ClientSession() as session:
data = Departures(LOOP, stop, session=session)
result = await d... | [
"def",
"destinations",
"(",
"stop",
")",
":",
"from",
"pyruter",
".",
"api",
"import",
"Departures",
"async",
"def",
"get_destinations",
"(",
")",
":",
"\"\"\"Get departure information.\"\"\"",
"async",
"with",
"aiohttp",
".",
"ClientSession",
"(",
")",
"as",
"s... | Get destination information. | [
"Get",
"destination",
"information",
"."
] | 415d8b9c8bfd48caa82c1a1201bfd3beb670a117 | https://github.com/ludeeus/pyruter/blob/415d8b9c8bfd48caa82c1a1201bfd3beb670a117/pyruter/cli.py#L34-L45 |
250,590 | dansackett/django-toolset | django_toolset/decorators.py | authenticated_redirect | def authenticated_redirect(view_func=None, path=None):
"""
Decorator for an already authenticated user that we don't want to serve a
view to. Instead we send them to the dashboard by default or a specified
path.
Usage:
@authenticated_redirect
@authenticated_redirect()
@auth... | python | def authenticated_redirect(view_func=None, path=None):
"""
Decorator for an already authenticated user that we don't want to serve a
view to. Instead we send them to the dashboard by default or a specified
path.
Usage:
@authenticated_redirect
@authenticated_redirect()
@auth... | [
"def",
"authenticated_redirect",
"(",
"view_func",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"default_path",
"=",
"getattr",
"(",
"settings",
",",
"'DEFAULT_AUTHENTICATED_PATH'",
",",
"'dashboard'",
")",
"if",
"view_func",
"is",
"None",
":",
"return",
"... | Decorator for an already authenticated user that we don't want to serve a
view to. Instead we send them to the dashboard by default or a specified
path.
Usage:
@authenticated_redirect
@authenticated_redirect()
@authenticated_redirect(path='home') | [
"Decorator",
"for",
"an",
"already",
"authenticated",
"user",
"that",
"we",
"don",
"t",
"want",
"to",
"serve",
"a",
"view",
"to",
".",
"Instead",
"we",
"send",
"them",
"to",
"the",
"dashboard",
"by",
"default",
"or",
"a",
"specified",
"path",
"."
] | a28cc19e32cf41130e848c268d26c1858a7cf26a | https://github.com/dansackett/django-toolset/blob/a28cc19e32cf41130e848c268d26c1858a7cf26a/django_toolset/decorators.py#L7-L35 |
250,591 | andsor/pyggcq | ggcq/ggcq.py | Queue.process | def process(self, job_id):
"""
Process a job by the queue
"""
self._logger.info(
'{:.2f}: Process job {}'.format(self._env.now, job_id)
)
# log time of commencement of service
self._observer.notify_service(time=self._env.now, job_id=job_id)
... | python | def process(self, job_id):
"""
Process a job by the queue
"""
self._logger.info(
'{:.2f}: Process job {}'.format(self._env.now, job_id)
)
# log time of commencement of service
self._observer.notify_service(time=self._env.now, job_id=job_id)
... | [
"def",
"process",
"(",
"self",
",",
"job_id",
")",
":",
"self",
".",
"_logger",
".",
"info",
"(",
"'{:.2f}: Process job {}'",
".",
"format",
"(",
"self",
".",
"_env",
".",
"now",
",",
"job_id",
")",
")",
"# log time of commencement of service",
"self",
".",
... | Process a job by the queue | [
"Process",
"a",
"job",
"by",
"the",
"queue"
] | 672b10bdeaa79d82cb4a1bf50169196334b162de | https://github.com/andsor/pyggcq/blob/672b10bdeaa79d82cb4a1bf50169196334b162de/ggcq/ggcq.py#L141-L206 |
250,592 | andsor/pyggcq | ggcq/ggcq.py | Source.generate | def generate(self):
"""
Source generates jobs according to the interarrival time distribution
"""
inter_arrival_time = 0.0
while True:
# wait for next job to arrive
try:
yield self._env.timeout(inter_arrival_time)
except TypeEr... | python | def generate(self):
"""
Source generates jobs according to the interarrival time distribution
"""
inter_arrival_time = 0.0
while True:
# wait for next job to arrive
try:
yield self._env.timeout(inter_arrival_time)
except TypeEr... | [
"def",
"generate",
"(",
"self",
")",
":",
"inter_arrival_time",
"=",
"0.0",
"while",
"True",
":",
"# wait for next job to arrive",
"try",
":",
"yield",
"self",
".",
"_env",
".",
"timeout",
"(",
"inter_arrival_time",
")",
"except",
"TypeError",
":",
"# error: arr... | Source generates jobs according to the interarrival time distribution | [
"Source",
"generates",
"jobs",
"according",
"to",
"the",
"interarrival",
"time",
"distribution"
] | 672b10bdeaa79d82cb4a1bf50169196334b162de | https://github.com/andsor/pyggcq/blob/672b10bdeaa79d82cb4a1bf50169196334b162de/ggcq/ggcq.py#L227-L280 |
250,593 | awsroadhouse/roadhouse | roadhouse/parser.py | Rule.parse | def parse(cls, rule_string):
"""
returns a list of rules
a single line may yield multiple rules
"""
result = parser.parseString(rule_string)
rules = []
# breakout port ranges into multple rules
kwargs = {}
kwargs['address'] = result.ip_and_mask o... | python | def parse(cls, rule_string):
"""
returns a list of rules
a single line may yield multiple rules
"""
result = parser.parseString(rule_string)
rules = []
# breakout port ranges into multple rules
kwargs = {}
kwargs['address'] = result.ip_and_mask o... | [
"def",
"parse",
"(",
"cls",
",",
"rule_string",
")",
":",
"result",
"=",
"parser",
".",
"parseString",
"(",
"rule_string",
")",
"rules",
"=",
"[",
"]",
"# breakout port ranges into multple rules",
"kwargs",
"=",
"{",
"}",
"kwargs",
"[",
"'address'",
"]",
"="... | returns a list of rules
a single line may yield multiple rules | [
"returns",
"a",
"list",
"of",
"rules",
"a",
"single",
"line",
"may",
"yield",
"multiple",
"rules"
] | d7c2c316fc20a04b8cae3357996c0ce4f51d44ea | https://github.com/awsroadhouse/roadhouse/blob/d7c2c316fc20a04b8cae3357996c0ce4f51d44ea/roadhouse/parser.py#L64-L82 |
250,594 | stuaxo/mnd | mnd/handler.py | MNDFunction.bind_to | def bind_to(self, argspec, dispatcher):
"""
Add our function to dispatcher
"""
self.bound_to[argspec.key].add((argspec, dispatcher))
dispatcher.bind(self.f, argspec) | python | def bind_to(self, argspec, dispatcher):
"""
Add our function to dispatcher
"""
self.bound_to[argspec.key].add((argspec, dispatcher))
dispatcher.bind(self.f, argspec) | [
"def",
"bind_to",
"(",
"self",
",",
"argspec",
",",
"dispatcher",
")",
":",
"self",
".",
"bound_to",
"[",
"argspec",
".",
"key",
"]",
".",
"add",
"(",
"(",
"argspec",
",",
"dispatcher",
")",
")",
"dispatcher",
".",
"bind",
"(",
"self",
".",
"f",
",... | Add our function to dispatcher | [
"Add",
"our",
"function",
"to",
"dispatcher"
] | 0eb30155d310fa1e550cb9efd6486816b9231d27 | https://github.com/stuaxo/mnd/blob/0eb30155d310fa1e550cb9efd6486816b9231d27/mnd/handler.py#L72-L77 |
250,595 | stuaxo/mnd | mnd/handler.py | MNDFunction.unbind | def unbind(self):
"""
Unbind from dispatchers and target function.
:return: set of tuples containing [argspec, dispatcher]
"""
args_dispatchers = set()
f = self._wf()
if f is not None:
for ad_list in self.bound_to.values():
args_dispat... | python | def unbind(self):
"""
Unbind from dispatchers and target function.
:return: set of tuples containing [argspec, dispatcher]
"""
args_dispatchers = set()
f = self._wf()
if f is not None:
for ad_list in self.bound_to.values():
args_dispat... | [
"def",
"unbind",
"(",
"self",
")",
":",
"args_dispatchers",
"=",
"set",
"(",
")",
"f",
"=",
"self",
".",
"_wf",
"(",
")",
"if",
"f",
"is",
"not",
"None",
":",
"for",
"ad_list",
"in",
"self",
".",
"bound_to",
".",
"values",
"(",
")",
":",
"args_di... | Unbind from dispatchers and target function.
:return: set of tuples containing [argspec, dispatcher] | [
"Unbind",
"from",
"dispatchers",
"and",
"target",
"function",
"."
] | 0eb30155d310fa1e550cb9efd6486816b9231d27 | https://github.com/stuaxo/mnd/blob/0eb30155d310fa1e550cb9efd6486816b9231d27/mnd/handler.py#L83-L98 |
250,596 | carlosp420/primer-designer | primer_designer/designer.py | PrimerDesigner.insert_taxon_in_new_fasta_file | def insert_taxon_in_new_fasta_file(self, aln):
"""primer4clades infers the codon usage table from the taxon names in the
sequences.
These names need to be enclosed by square brackets and be
present in the description of the FASTA sequence. The position is not
important. I will i... | python | def insert_taxon_in_new_fasta_file(self, aln):
"""primer4clades infers the codon usage table from the taxon names in the
sequences.
These names need to be enclosed by square brackets and be
present in the description of the FASTA sequence. The position is not
important. I will i... | [
"def",
"insert_taxon_in_new_fasta_file",
"(",
"self",
",",
"aln",
")",
":",
"new_seq_records",
"=",
"[",
"]",
"for",
"seq_record",
"in",
"SeqIO",
".",
"parse",
"(",
"aln",
",",
"'fasta'",
")",
":",
"new_seq_record_id",
"=",
"\"[{0}] {1}\"",
".",
"format",
"(... | primer4clades infers the codon usage table from the taxon names in the
sequences.
These names need to be enclosed by square brackets and be
present in the description of the FASTA sequence. The position is not
important. I will insert the names in the description in a new FASTA
... | [
"primer4clades",
"infers",
"the",
"codon",
"usage",
"table",
"from",
"the",
"taxon",
"names",
"in",
"the",
"sequences",
"."
] | 586cb7fecf41fedbffe6563c8b79a3156c6066ae | https://github.com/carlosp420/primer-designer/blob/586cb7fecf41fedbffe6563c8b79a3156c6066ae/primer_designer/designer.py#L155-L176 |
250,597 | carlosp420/primer-designer | primer_designer/designer.py | PrimerDesigner.group_primers | def group_primers(self, my_list):
"""Group elements in list by certain number 'n'"""
new_list = []
n = 2
for i in range(0, len(my_list), n):
grouped_primers = my_list[i:i + n]
forward_primer = grouped_primers[0].split(" ")
reverse_primer = grouped_prim... | python | def group_primers(self, my_list):
"""Group elements in list by certain number 'n'"""
new_list = []
n = 2
for i in range(0, len(my_list), n):
grouped_primers = my_list[i:i + n]
forward_primer = grouped_primers[0].split(" ")
reverse_primer = grouped_prim... | [
"def",
"group_primers",
"(",
"self",
",",
"my_list",
")",
":",
"new_list",
"=",
"[",
"]",
"n",
"=",
"2",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"my_list",
")",
",",
"n",
")",
":",
"grouped_primers",
"=",
"my_list",
"[",
"i",
":",
... | Group elements in list by certain number 'n | [
"Group",
"elements",
"in",
"list",
"by",
"certain",
"number",
"n"
] | 586cb7fecf41fedbffe6563c8b79a3156c6066ae | https://github.com/carlosp420/primer-designer/blob/586cb7fecf41fedbffe6563c8b79a3156c6066ae/primer_designer/designer.py#L241-L252 |
250,598 | carlosp420/primer-designer | primer_designer/designer.py | PrimerDesigner.choose_best_amplicon | def choose_best_amplicon(self, amplicon_tuples):
"""Iterates over amplicon tuples and returns the one with highest quality
and amplicon length.
"""
quality = 0
amplicon_length = 0
best_amplicon = None
for amplicon in amplicon_tuples:
if int(amplicon[4... | python | def choose_best_amplicon(self, amplicon_tuples):
"""Iterates over amplicon tuples and returns the one with highest quality
and amplicon length.
"""
quality = 0
amplicon_length = 0
best_amplicon = None
for amplicon in amplicon_tuples:
if int(amplicon[4... | [
"def",
"choose_best_amplicon",
"(",
"self",
",",
"amplicon_tuples",
")",
":",
"quality",
"=",
"0",
"amplicon_length",
"=",
"0",
"best_amplicon",
"=",
"None",
"for",
"amplicon",
"in",
"amplicon_tuples",
":",
"if",
"int",
"(",
"amplicon",
"[",
"4",
"]",
")",
... | Iterates over amplicon tuples and returns the one with highest quality
and amplicon length. | [
"Iterates",
"over",
"amplicon",
"tuples",
"and",
"returns",
"the",
"one",
"with",
"highest",
"quality",
"and",
"amplicon",
"length",
"."
] | 586cb7fecf41fedbffe6563c8b79a3156c6066ae | https://github.com/carlosp420/primer-designer/blob/586cb7fecf41fedbffe6563c8b79a3156c6066ae/primer_designer/designer.py#L254-L268 |
250,599 | jaraco/jaraco.context | jaraco/context.py | run | def run():
"""
Run a command in the context of the system dependencies.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'--deps-def',
default=data_lines_from_file("system deps.txt")
+ data_lines_from_file("build deps.txt"),
help="A file specifying the dependencies (one per line)",
type=data_l... | python | def run():
"""
Run a command in the context of the system dependencies.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'--deps-def',
default=data_lines_from_file("system deps.txt")
+ data_lines_from_file("build deps.txt"),
help="A file specifying the dependencies (one per line)",
type=data_l... | [
"def",
"run",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--deps-def'",
",",
"default",
"=",
"data_lines_from_file",
"(",
"\"system deps.txt\"",
")",
"+",
"data_lines_from_file",
"(",
"\"build ... | Run a command in the context of the system dependencies. | [
"Run",
"a",
"command",
"in",
"the",
"context",
"of",
"the",
"system",
"dependencies",
"."
] | 105f81a6204d3a9fbb848675d62be4ef185f36f2 | https://github.com/jaraco/jaraco.context/blob/105f81a6204d3a9fbb848675d62be4ef185f36f2/jaraco/context.py#L61-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.