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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,800 | matgrioni/betacode | betacode/conv.py | beta_to_uni | def beta_to_uni(text, strict=False):
"""
Converts the given text from betacode to unicode.
Args:
text: The beta code text to convert. All of this text must be betacode.
strict: Flag to allow for flexible diacritic order on input.
Returns:
The converted text.
"""
# Check if the requ... | python | def beta_to_uni(text, strict=False):
"""
Converts the given text from betacode to unicode.
Args:
text: The beta code text to convert. All of this text must be betacode.
strict: Flag to allow for flexible diacritic order on input.
Returns:
The converted text.
"""
# Check if the requ... | [
"def",
"beta_to_uni",
"(",
"text",
",",
"strict",
"=",
"False",
")",
":",
"# Check if the requested configuration for conversion already has a trie",
"# stored otherwise convert it.",
"param_key",
"=",
"(",
"strict",
",",
")",
"try",
":",
"t",
"=",
"_BETA_CONVERSION_TRIES... | Converts the given text from betacode to unicode.
Args:
text: The beta code text to convert. All of this text must be betacode.
strict: Flag to allow for flexible diacritic order on input.
Returns:
The converted text. | [
"Converts",
"the",
"given",
"text",
"from",
"betacode",
"to",
"unicode",
"."
] | 2f8b439c0de9cdf451b0b390161752cac9879137 | https://github.com/matgrioni/betacode/blob/2f8b439c0de9cdf451b0b390161752cac9879137/betacode/conv.py#L97-L147 |
37,801 | matgrioni/betacode | betacode/conv.py | uni_to_beta | def uni_to_beta(text):
"""
Convert unicode text to a betacode equivalent.
This method can handle tónos or oxeîa characters in the input.
Args:
text: The text to convert to betacode. This text does not have to all be
Greek polytonic text, and only Greek characters will be converted. Note
... | python | def uni_to_beta(text):
"""
Convert unicode text to a betacode equivalent.
This method can handle tónos or oxeîa characters in the input.
Args:
text: The text to convert to betacode. This text does not have to all be
Greek polytonic text, and only Greek characters will be converted. Note
... | [
"def",
"uni_to_beta",
"(",
"text",
")",
":",
"u",
"=",
"_UNICODE_MAP",
"transform",
"=",
"[",
"]",
"for",
"ch",
"in",
"text",
":",
"try",
":",
"conv",
"=",
"u",
"[",
"ch",
"]",
"except",
"KeyError",
":",
"conv",
"=",
"ch",
"transform",
".",
"append... | Convert unicode text to a betacode equivalent.
This method can handle tónos or oxeîa characters in the input.
Args:
text: The text to convert to betacode. This text does not have to all be
Greek polytonic text, and only Greek characters will be converted. Note
that in this case, you cannot... | [
"Convert",
"unicode",
"text",
"to",
"a",
"betacode",
"equivalent",
"."
] | 2f8b439c0de9cdf451b0b390161752cac9879137 | https://github.com/matgrioni/betacode/blob/2f8b439c0de9cdf451b0b390161752cac9879137/betacode/conv.py#L149-L176 |
37,802 | toumorokoshi/sprinter | sprinter/lib/dependencytree.py | DependencyTree.__calculate_order | def __calculate_order(self, node_dict):
"""
Determine a valid ordering of the nodes in which a node is not called before all of it's dependencies.
Raise an error if there is a cycle, or nodes are missing.
"""
if len(node_dict.keys()) != len(set(node_dict.keys())):
ra... | python | def __calculate_order(self, node_dict):
"""
Determine a valid ordering of the nodes in which a node is not called before all of it's dependencies.
Raise an error if there is a cycle, or nodes are missing.
"""
if len(node_dict.keys()) != len(set(node_dict.keys())):
ra... | [
"def",
"__calculate_order",
"(",
"self",
",",
"node_dict",
")",
":",
"if",
"len",
"(",
"node_dict",
".",
"keys",
"(",
")",
")",
"!=",
"len",
"(",
"set",
"(",
"node_dict",
".",
"keys",
"(",
")",
")",
")",
":",
"raise",
"DependencyTreeException",
"(",
... | Determine a valid ordering of the nodes in which a node is not called before all of it's dependencies.
Raise an error if there is a cycle, or nodes are missing. | [
"Determine",
"a",
"valid",
"ordering",
"of",
"the",
"nodes",
"in",
"which",
"a",
"node",
"is",
"not",
"called",
"before",
"all",
"of",
"it",
"s",
"dependencies",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/dependencytree.py#L24-L53 |
37,803 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | warn_import_error | def warn_import_error(type_of_obj_support: str, caught: ImportError):
"""
Utility method to print a warning message about failed import of some modules
:param type_of_obj_support:
:param caught:
:return:
"""
msg = StringIO()
msg.writelines('Import Error while trying to add support for '... | python | def warn_import_error(type_of_obj_support: str, caught: ImportError):
"""
Utility method to print a warning message about failed import of some modules
:param type_of_obj_support:
:param caught:
:return:
"""
msg = StringIO()
msg.writelines('Import Error while trying to add support for '... | [
"def",
"warn_import_error",
"(",
"type_of_obj_support",
":",
"str",
",",
"caught",
":",
"ImportError",
")",
":",
"msg",
"=",
"StringIO",
"(",
")",
"msg",
".",
"writelines",
"(",
"'Import Error while trying to add support for '",
"+",
"type_of_obj_support",
"+",
"'. ... | Utility method to print a warning message about failed import of some modules
:param type_of_obj_support:
:param caught:
:return: | [
"Utility",
"method",
"to",
"print",
"a",
"warning",
"message",
"about",
"failed",
"import",
"of",
"some",
"modules"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L33-L46 |
37,804 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | create_parser_options | def create_parser_options(lazy_mfcollection_parsing: bool = False) -> Dict[str, Dict[str, Any]]:
"""
Utility method to create a default options structure with the lazy parsing inside
:param lazy_mfcollection_parsing:
:return: the options structure filled with lazyparsing option (for the MultifileCollec... | python | def create_parser_options(lazy_mfcollection_parsing: bool = False) -> Dict[str, Dict[str, Any]]:
"""
Utility method to create a default options structure with the lazy parsing inside
:param lazy_mfcollection_parsing:
:return: the options structure filled with lazyparsing option (for the MultifileCollec... | [
"def",
"create_parser_options",
"(",
"lazy_mfcollection_parsing",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"MultifileCollectionParser",
".",
"__name__",
":",
"{",
"'lazy_pars... | Utility method to create a default options structure with the lazy parsing inside
:param lazy_mfcollection_parsing:
:return: the options structure filled with lazyparsing option (for the MultifileCollectionParser) | [
"Utility",
"method",
"to",
"create",
"a",
"default",
"options",
"structure",
"with",
"the",
"lazy",
"parsing",
"inside"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L49-L56 |
37,805 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | register_default_plugins | def register_default_plugins(root_parser: ParserRegistryWithConverters):
"""
Utility method to register all default plugins on the given parser+converter registry
:param root_parser:
:return:
"""
# -------------------- CORE ---------------------------
try:
# -- primitive types
... | python | def register_default_plugins(root_parser: ParserRegistryWithConverters):
"""
Utility method to register all default plugins on the given parser+converter registry
:param root_parser:
:return:
"""
# -------------------- CORE ---------------------------
try:
# -- primitive types
... | [
"def",
"register_default_plugins",
"(",
"root_parser",
":",
"ParserRegistryWithConverters",
")",
":",
"# -------------------- CORE ---------------------------",
"try",
":",
"# -- primitive types",
"from",
"parsyfiles",
".",
"plugins_base",
".",
"support_for_primitive_types",
"imp... | Utility method to register all default plugins on the given parser+converter registry
:param root_parser:
:return: | [
"Utility",
"method",
"to",
"register",
"all",
"default",
"plugins",
"on",
"the",
"given",
"parser",
"+",
"converter",
"registry"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L75-L145 |
37,806 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | RootParser.parse_collection | def parse_collection(self, item_file_prefix: str, base_item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> Dict[str, T]:
"""
Main method to parse a collectio... | python | def parse_collection(self, item_file_prefix: str, base_item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> Dict[str, T]:
"""
Main method to parse a collectio... | [
"def",
"parse_collection",
"(",
"self",
",",
"item_file_prefix",
":",
"str",
",",
"base_item_type",
":",
"Type",
"[",
"T",
"]",
",",
"item_name_for_log",
":",
"str",
"=",
"None",
",",
"file_mapping_conf",
":",
"FileMappingConfiguration",
"=",
"None",
",",
"opt... | Main method to parse a collection of items of type 'base_item_type'.
:param item_file_prefix:
:param base_item_type:
:param item_name_for_log:
:param file_mapping_conf:
:param options:
:return: | [
"Main",
"method",
"to",
"parse",
"a",
"collection",
"of",
"items",
"of",
"type",
"base_item_type",
"."
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L226-L251 |
37,807 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | RootParser.parse_item | def parse_item(self, location: str, item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None, options: Dict[str, Dict[str, Any]] = None) -> T:
"""
Main method to parse an item of type item_type
:param location:
:param item_... | python | def parse_item(self, location: str, item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None, options: Dict[str, Dict[str, Any]] = None) -> T:
"""
Main method to parse an item of type item_type
:param location:
:param item_... | [
"def",
"parse_item",
"(",
"self",
",",
"location",
":",
"str",
",",
"item_type",
":",
"Type",
"[",
"T",
"]",
",",
"item_name_for_log",
":",
"str",
"=",
"None",
",",
"file_mapping_conf",
":",
"FileMappingConfiguration",
"=",
"None",
",",
"options",
":",
"Di... | Main method to parse an item of type item_type
:param location:
:param item_type:
:param item_name_for_log:
:param file_mapping_conf:
:param options:
:return: | [
"Main",
"method",
"to",
"parse",
"an",
"item",
"of",
"type",
"item_type"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L253-L276 |
37,808 | smarie/python-parsyfiles | parsyfiles/parsing_fw.py | RootParser._parse__item | def _parse__item(self, item_type: Type[T], item_file_prefix: str,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> T:
"""
Common parsing steps to parse an item
:param item_type:
:param item_file_p... | python | def _parse__item(self, item_type: Type[T], item_file_prefix: str,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> T:
"""
Common parsing steps to parse an item
:param item_type:
:param item_file_p... | [
"def",
"_parse__item",
"(",
"self",
",",
"item_type",
":",
"Type",
"[",
"T",
"]",
",",
"item_file_prefix",
":",
"str",
",",
"file_mapping_conf",
":",
"FileMappingConfiguration",
"=",
"None",
",",
"options",
":",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",... | Common parsing steps to parse an item
:param item_type:
:param item_file_prefix:
:param file_mapping_conf:
:param options:
:return: | [
"Common",
"parsing",
"steps",
"to",
"parse",
"an",
"item"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_fw.py#L278-L310 |
37,809 | bniemczyk/automata | automata/fuzzystring.py | FuzzyStringUtility.SpamsumDistance | def SpamsumDistance(ssA, ssB):
'''
returns the spamsum distance between ssA and ssB
if they use a different block size, assume maximum distance
otherwise returns the LevDistance
'''
mA = re.match('^(\d+)[:](.*)$', ssA)
mB = re.match('^(\d+)[:](.*)$', ssB)
if mA == None or mB == None:
... | python | def SpamsumDistance(ssA, ssB):
'''
returns the spamsum distance between ssA and ssB
if they use a different block size, assume maximum distance
otherwise returns the LevDistance
'''
mA = re.match('^(\d+)[:](.*)$', ssA)
mB = re.match('^(\d+)[:](.*)$', ssB)
if mA == None or mB == None:
... | [
"def",
"SpamsumDistance",
"(",
"ssA",
",",
"ssB",
")",
":",
"mA",
"=",
"re",
".",
"match",
"(",
"'^(\\d+)[:](.*)$'",
",",
"ssA",
")",
"mB",
"=",
"re",
".",
"match",
"(",
"'^(\\d+)[:](.*)$'",
",",
"ssB",
")",
"if",
"mA",
"==",
"None",
"or",
"mB",
"=... | returns the spamsum distance between ssA and ssB
if they use a different block size, assume maximum distance
otherwise returns the LevDistance | [
"returns",
"the",
"spamsum",
"distance",
"between",
"ssA",
"and",
"ssB",
"if",
"they",
"use",
"a",
"different",
"block",
"size",
"assume",
"maximum",
"distance",
"otherwise",
"returns",
"the",
"LevDistance"
] | b4e21ba8b881f2cb1a07a813a4011209a3f1e017 | https://github.com/bniemczyk/automata/blob/b4e21ba8b881f2cb1a07a813a4011209a3f1e017/automata/fuzzystring.py#L49-L64 |
37,810 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/train/TrainingSet.py | TrainingSet.add_image | def add_image(self, image_path, annotations):
"""Adds an image and its bounding boxes to the current list of files
The bounding boxes are automatically estimated based on the given annotations.
**Parameters:**
``image_path`` : str
The file name of the image, including its full path
``annot... | python | def add_image(self, image_path, annotations):
"""Adds an image and its bounding boxes to the current list of files
The bounding boxes are automatically estimated based on the given annotations.
**Parameters:**
``image_path`` : str
The file name of the image, including its full path
``annot... | [
"def",
"add_image",
"(",
"self",
",",
"image_path",
",",
"annotations",
")",
":",
"self",
".",
"image_paths",
".",
"append",
"(",
"image_path",
")",
"self",
".",
"bounding_boxes",
".",
"append",
"(",
"[",
"bounding_box_from_annotation",
"(",
"*",
"*",
"a",
... | Adds an image and its bounding boxes to the current list of files
The bounding boxes are automatically estimated based on the given annotations.
**Parameters:**
``image_path`` : str
The file name of the image, including its full path
``annotations`` : [dict]
A list of annotations, i.e., ... | [
"Adds",
"an",
"image",
"and",
"its",
"bounding",
"boxes",
"to",
"the",
"current",
"list",
"of",
"files"
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L47-L61 |
37,811 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/train/TrainingSet.py | TrainingSet.save | def save(self, list_file):
"""Saves the current list of annotations to the given file.
**Parameters:**
``list_file`` : str
The name of a list file to write the currently stored list into
"""
bob.io.base.create_directories_safe(os.path.dirname(list_file))
with open(list_file, 'w') as f:
... | python | def save(self, list_file):
"""Saves the current list of annotations to the given file.
**Parameters:**
``list_file`` : str
The name of a list file to write the currently stored list into
"""
bob.io.base.create_directories_safe(os.path.dirname(list_file))
with open(list_file, 'w') as f:
... | [
"def",
"save",
"(",
"self",
",",
"list_file",
")",
":",
"bob",
".",
"io",
".",
"base",
".",
"create_directories_safe",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"list_file",
")",
")",
"with",
"open",
"(",
"list_file",
",",
"'w'",
")",
"as",
"f",
... | Saves the current list of annotations to the given file.
**Parameters:**
``list_file`` : str
The name of a list file to write the currently stored list into | [
"Saves",
"the",
"current",
"list",
"of",
"annotations",
"to",
"the",
"given",
"file",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L79-L93 |
37,812 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/train/TrainingSet.py | TrainingSet._feature_file | def _feature_file(self, parallel = None, index = None):
"""Returns the name of an intermediate file for storing features."""
if index is None:
index = 0 if parallel is None or "SGE_TASK_ID" not in os.environ else int(os.environ["SGE_TASK_ID"])
return os.path.join(self.feature_directory, "Features_%02d... | python | def _feature_file(self, parallel = None, index = None):
"""Returns the name of an intermediate file for storing features."""
if index is None:
index = 0 if parallel is None or "SGE_TASK_ID" not in os.environ else int(os.environ["SGE_TASK_ID"])
return os.path.join(self.feature_directory, "Features_%02d... | [
"def",
"_feature_file",
"(",
"self",
",",
"parallel",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"index",
"=",
"0",
"if",
"parallel",
"is",
"None",
"or",
"\"SGE_TASK_ID\"",
"not",
"in",
"os",
".",
"environ",
"... | Returns the name of an intermediate file for storing features. | [
"Returns",
"the",
"name",
"of",
"an",
"intermediate",
"file",
"for",
"storing",
"features",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L146-L150 |
37,813 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.get | def get(self, param, default=EMPTY):
"""
Returns the nparam value, and returns the default if it doesn't exist.
If default is none, an exception will be raised instead.
the returned parameter will have been specialized against the global context
"""
if not self.has(param... | python | def get(self, param, default=EMPTY):
"""
Returns the nparam value, and returns the default if it doesn't exist.
If default is none, an exception will be raised instead.
the returned parameter will have been specialized against the global context
"""
if not self.has(param... | [
"def",
"get",
"(",
"self",
",",
"param",
",",
"default",
"=",
"EMPTY",
")",
":",
"if",
"not",
"self",
".",
"has",
"(",
"param",
")",
":",
"if",
"default",
"is",
"not",
"EMPTY",
":",
"return",
"default",
"raise",
"ParamNotFoundException",
"(",
"\"value ... | Returns the nparam value, and returns the default if it doesn't exist.
If default is none, an exception will be raised instead.
the returned parameter will have been specialized against the global context | [
"Returns",
"the",
"nparam",
"value",
"and",
"returns",
"the",
"default",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"default",
"is",
"none",
"an",
"exception",
"will",
"be",
"raised",
"instead",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L27-L68 |
37,814 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.set | def set(self, param, value):
""" sets the param to the value provided """
self.raw_dict[param] = value
self.manifest.set(self.feature_name, param, value) | python | def set(self, param, value):
""" sets the param to the value provided """
self.raw_dict[param] = value
self.manifest.set(self.feature_name, param, value) | [
"def",
"set",
"(",
"self",
",",
"param",
",",
"value",
")",
":",
"self",
".",
"raw_dict",
"[",
"param",
"]",
"=",
"value",
"self",
".",
"manifest",
".",
"set",
"(",
"self",
".",
"feature_name",
",",
"param",
",",
"value",
")"
] | sets the param to the value provided | [
"sets",
"the",
"param",
"to",
"the",
"value",
"provided"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L74-L77 |
37,815 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.remove | def remove(self, param):
""" Remove a parameter from the manifest """
if self.has(param):
del(self.raw_dict[param])
self.manifest.remove_option(self.feature_name, param) | python | def remove(self, param):
""" Remove a parameter from the manifest """
if self.has(param):
del(self.raw_dict[param])
self.manifest.remove_option(self.feature_name, param) | [
"def",
"remove",
"(",
"self",
",",
"param",
")",
":",
"if",
"self",
".",
"has",
"(",
"param",
")",
":",
"del",
"(",
"self",
".",
"raw_dict",
"[",
"param",
"]",
")",
"self",
".",
"manifest",
".",
"remove_option",
"(",
"self",
".",
"feature_name",
",... | Remove a parameter from the manifest | [
"Remove",
"a",
"parameter",
"from",
"the",
"manifest"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L79-L83 |
37,816 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.set_if_empty | def set_if_empty(self, param, default):
""" Set the parameter to the default if it doesn't exist """
if not self.has(param):
self.set(param, default) | python | def set_if_empty(self, param, default):
""" Set the parameter to the default if it doesn't exist """
if not self.has(param):
self.set(param, default) | [
"def",
"set_if_empty",
"(",
"self",
",",
"param",
",",
"default",
")",
":",
"if",
"not",
"self",
".",
"has",
"(",
"param",
")",
":",
"self",
".",
"set",
"(",
"param",
",",
"default",
")"
] | Set the parameter to the default if it doesn't exist | [
"Set",
"the",
"parameter",
"to",
"the",
"default",
"if",
"it",
"doesn",
"t",
"exist"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L92-L95 |
37,817 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.to_dict | def to_dict(self):
""" Returns the context, fully specialized, as a dictionary """
return dict((k, str(self.get(k))) for k in self.raw_dict) | python | def to_dict(self):
""" Returns the context, fully specialized, as a dictionary """
return dict((k, str(self.get(k))) for k in self.raw_dict) | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"(",
"k",
",",
"str",
"(",
"self",
".",
"get",
"(",
"k",
")",
")",
")",
"for",
"k",
"in",
"self",
".",
"raw_dict",
")"
] | Returns the context, fully specialized, as a dictionary | [
"Returns",
"the",
"context",
"fully",
"specialized",
"as",
"a",
"dictionary"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L97-L99 |
37,818 | toumorokoshi/sprinter | sprinter/core/featureconfig.py | FeatureConfig.write_to_manifest | def write_to_manifest(self):
""" Overwrites the section of the manifest with the featureconfig's value """
self.manifest.remove_section(self.feature_name)
self.manifest.add_section(self.feature_name)
for k, v in self.raw_dict.items():
self.manifest.set(self.feature_name, k, v... | python | def write_to_manifest(self):
""" Overwrites the section of the manifest with the featureconfig's value """
self.manifest.remove_section(self.feature_name)
self.manifest.add_section(self.feature_name)
for k, v in self.raw_dict.items():
self.manifest.set(self.feature_name, k, v... | [
"def",
"write_to_manifest",
"(",
"self",
")",
":",
"self",
".",
"manifest",
".",
"remove_section",
"(",
"self",
".",
"feature_name",
")",
"self",
".",
"manifest",
".",
"add_section",
"(",
"self",
".",
"feature_name",
")",
"for",
"k",
",",
"v",
"in",
"sel... | Overwrites the section of the manifest with the featureconfig's value | [
"Overwrites",
"the",
"section",
"of",
"the",
"manifest",
"with",
"the",
"featureconfig",
"s",
"value"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/featureconfig.py#L101-L106 |
37,819 | Chilipp/psy-simple | psy_simple/plotters.py | round_to_05 | def round_to_05(n, exp=None, mode='s'):
"""
Round to the next 0.5-value.
This function applies the round function `func` to round `n` to the
next 0.5-value with respect to its exponent with base 10 (i.e.
1.3e-4 will be rounded to 1.5e-4) if `exp` is None or with respect
to the given exponent in... | python | def round_to_05(n, exp=None, mode='s'):
"""
Round to the next 0.5-value.
This function applies the round function `func` to round `n` to the
next 0.5-value with respect to its exponent with base 10 (i.e.
1.3e-4 will be rounded to 1.5e-4) if `exp` is None or with respect
to the given exponent in... | [
"def",
"round_to_05",
"(",
"n",
",",
"exp",
"=",
"None",
",",
"mode",
"=",
"'s'",
")",
":",
"n",
"=",
"np",
".",
"asarray",
"(",
"n",
")",
"if",
"exp",
"is",
"None",
":",
"exp",
"=",
"np",
".",
"floor",
"(",
"np",
".",
"log10",
"(",
"np",
"... | Round to the next 0.5-value.
This function applies the round function `func` to round `n` to the
next 0.5-value with respect to its exponent with base 10 (i.e.
1.3e-4 will be rounded to 1.5e-4) if `exp` is None or with respect
to the given exponent in `exp`.
Parameters
----------
n: numpy.... | [
"Round",
"to",
"the",
"next",
"0",
".",
"5",
"-",
"value",
"."
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L41-L93 |
37,820 | Chilipp/psy-simple | psy_simple/plotters.py | convert_radian | def convert_radian(coord, *variables):
"""Convert the given coordinate from radian to degree
Parameters
----------
coord: xr.Variable
The variable to transform
``*variables``
The variables that are on the same unit.
Returns
-------
xr.Variable
The transformed va... | python | def convert_radian(coord, *variables):
"""Convert the given coordinate from radian to degree
Parameters
----------
coord: xr.Variable
The variable to transform
``*variables``
The variables that are on the same unit.
Returns
-------
xr.Variable
The transformed va... | [
"def",
"convert_radian",
"(",
"coord",
",",
"*",
"variables",
")",
":",
"if",
"any",
"(",
"v",
".",
"attrs",
".",
"get",
"(",
"'units'",
")",
"==",
"'radian'",
"for",
"v",
"in",
"variables",
")",
":",
"return",
"coord",
"*",
"180.",
"/",
"np",
".",... | Convert the given coordinate from radian to degree
Parameters
----------
coord: xr.Variable
The variable to transform
``*variables``
The variables that are on the same unit.
Returns
-------
xr.Variable
The transformed variable if one of the given `variables` has uni... | [
"Convert",
"the",
"given",
"coordinate",
"from",
"radian",
"to",
"degree"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L96-L113 |
37,821 | Chilipp/psy-simple | psy_simple/plotters.py | AlternativeXCoord.replace_coord | def replace_coord(self, i):
"""Replace the coordinate for the data array at the given position
Parameters
----------
i: int
The number of the data array in the raw data (if the raw data is
not an interactive list, use 0)
Returns
xarray.DataArray
... | python | def replace_coord(self, i):
"""Replace the coordinate for the data array at the given position
Parameters
----------
i: int
The number of the data array in the raw data (if the raw data is
not an interactive list, use 0)
Returns
xarray.DataArray
... | [
"def",
"replace_coord",
"(",
"self",
",",
"i",
")",
":",
"da",
"=",
"next",
"(",
"islice",
"(",
"self",
".",
"data_iterator",
",",
"i",
",",
"i",
"+",
"1",
")",
")",
"name",
",",
"coord",
"=",
"self",
".",
"get_alternative_coord",
"(",
"da",
",",
... | Replace the coordinate for the data array at the given position
Parameters
----------
i: int
The number of the data array in the raw data (if the raw data is
not an interactive list, use 0)
Returns
xarray.DataArray
The data array with the rep... | [
"Replace",
"the",
"coordinate",
"for",
"the",
"data",
"array",
"at",
"the",
"given",
"position"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L201-L219 |
37,822 | Chilipp/psy-simple | psy_simple/plotters.py | AxisColor.value2pickle | def value2pickle(self):
"""Return the current axis colors"""
return {key: s.get_edgecolor() for key, s in self.ax.spines.items()} | python | def value2pickle(self):
"""Return the current axis colors"""
return {key: s.get_edgecolor() for key, s in self.ax.spines.items()} | [
"def",
"value2pickle",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"s",
".",
"get_edgecolor",
"(",
")",
"for",
"key",
",",
"s",
"in",
"self",
".",
"ax",
".",
"spines",
".",
"items",
"(",
")",
"}"
] | Return the current axis colors | [
"Return",
"the",
"current",
"axis",
"colors"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L296-L298 |
37,823 | Chilipp/psy-simple | psy_simple/plotters.py | TickLabels.set_default_formatters | def set_default_formatters(self, which=None):
"""Sets the default formatters that is used for updating to None
Parameters
----------
which: {None, 'minor', 'major'}
Specify which locator shall be set"""
if which is None or which == 'minor':
self.default_f... | python | def set_default_formatters(self, which=None):
"""Sets the default formatters that is used for updating to None
Parameters
----------
which: {None, 'minor', 'major'}
Specify which locator shall be set"""
if which is None or which == 'minor':
self.default_f... | [
"def",
"set_default_formatters",
"(",
"self",
",",
"which",
"=",
"None",
")",
":",
"if",
"which",
"is",
"None",
"or",
"which",
"==",
"'minor'",
":",
"self",
".",
"default_formatters",
"[",
"'minor'",
"]",
"=",
"self",
".",
"axis",
".",
"get_minor_formatter... | Sets the default formatters that is used for updating to None
Parameters
----------
which: {None, 'minor', 'major'}
Specify which locator shall be set | [
"Sets",
"the",
"default",
"formatters",
"that",
"is",
"used",
"for",
"updating",
"to",
"None"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L879-L889 |
37,824 | Chilipp/psy-simple | psy_simple/plotters.py | LinePlot.plotted_data | def plotted_data(self):
"""The data that is shown to the user"""
return InteractiveList(
[arr for arr, val in zip(self.iter_data,
cycle(slist(self.value)))
if val is not None]) | python | def plotted_data(self):
"""The data that is shown to the user"""
return InteractiveList(
[arr for arr, val in zip(self.iter_data,
cycle(slist(self.value)))
if val is not None]) | [
"def",
"plotted_data",
"(",
"self",
")",
":",
"return",
"InteractiveList",
"(",
"[",
"arr",
"for",
"arr",
",",
"val",
"in",
"zip",
"(",
"self",
".",
"iter_data",
",",
"cycle",
"(",
"slist",
"(",
"self",
".",
"value",
")",
")",
")",
"if",
"val",
"is... | The data that is shown to the user | [
"The",
"data",
"that",
"is",
"shown",
"to",
"the",
"user"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L1746-L1751 |
37,825 | Chilipp/psy-simple | psy_simple/plotters.py | CbarOptions.axis | def axis(self):
"""axis of the colorbar with the ticks. Will be overwritten during
update process."""
return getattr(
self.colorbar.ax, self.axis_locations[self.position] + 'axis') | python | def axis(self):
"""axis of the colorbar with the ticks. Will be overwritten during
update process."""
return getattr(
self.colorbar.ax, self.axis_locations[self.position] + 'axis') | [
"def",
"axis",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"colorbar",
".",
"ax",
",",
"self",
".",
"axis_locations",
"[",
"self",
".",
"position",
"]",
"+",
"'axis'",
")"
] | axis of the colorbar with the ticks. Will be overwritten during
update process. | [
"axis",
"of",
"the",
"colorbar",
"with",
"the",
"ticks",
".",
"Will",
"be",
"overwritten",
"during",
"update",
"process",
"."
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L3913-L3917 |
37,826 | Chilipp/psy-simple | psy_simple/plotters.py | CTickLabels.default_formatters | def default_formatters(self):
"""Default locator of the axis of the colorbars"""
if self._default_formatters:
return self._default_formatters
else:
self.set_default_formatters()
return self._default_formatters | python | def default_formatters(self):
"""Default locator of the axis of the colorbars"""
if self._default_formatters:
return self._default_formatters
else:
self.set_default_formatters()
return self._default_formatters | [
"def",
"default_formatters",
"(",
"self",
")",
":",
"if",
"self",
".",
"_default_formatters",
":",
"return",
"self",
".",
"_default_formatters",
"else",
":",
"self",
".",
"set_default_formatters",
"(",
")",
"return",
"self",
".",
"_default_formatters"
] | Default locator of the axis of the colorbars | [
"Default",
"locator",
"of",
"the",
"axis",
"of",
"the",
"colorbars"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L4050-L4056 |
37,827 | Chilipp/psy-simple | psy_simple/plotters.py | VectorPlot.get_xyz_2d | def get_xyz_2d(self, xcoord, x, ycoord, y, u, v):
"""Get closest x, y and z for the given `x` and `y` in `data` for
2d coords"""
xy = xcoord.values.ravel() + 1j * ycoord.values.ravel()
dist = np.abs(xy - (x + 1j * y))
imin = np.nanargmin(dist)
xy_min = xy[imin]
re... | python | def get_xyz_2d(self, xcoord, x, ycoord, y, u, v):
"""Get closest x, y and z for the given `x` and `y` in `data` for
2d coords"""
xy = xcoord.values.ravel() + 1j * ycoord.values.ravel()
dist = np.abs(xy - (x + 1j * y))
imin = np.nanargmin(dist)
xy_min = xy[imin]
re... | [
"def",
"get_xyz_2d",
"(",
"self",
",",
"xcoord",
",",
"x",
",",
"ycoord",
",",
"y",
",",
"u",
",",
"v",
")",
":",
"xy",
"=",
"xcoord",
".",
"values",
".",
"ravel",
"(",
")",
"+",
"1j",
"*",
"ycoord",
".",
"values",
".",
"ravel",
"(",
")",
"di... | Get closest x, y and z for the given `x` and `y` in `data` for
2d coords | [
"Get",
"closest",
"x",
"y",
"and",
"z",
"for",
"the",
"given",
"x",
"and",
"y",
"in",
"data",
"for",
"2d",
"coords"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L4605-L4613 |
37,828 | Chilipp/psy-simple | psy_simple/plotters.py | NormedHist2D.hist2d | def hist2d(self, da, **kwargs):
"""Make the two dimensional histogram
Parameters
----------
da: xarray.DataArray
The data source"""
if self.value is None or self.value == 'counts':
normed = False
else:
normed = True
y = da.valu... | python | def hist2d(self, da, **kwargs):
"""Make the two dimensional histogram
Parameters
----------
da: xarray.DataArray
The data source"""
if self.value is None or self.value == 'counts':
normed = False
else:
normed = True
y = da.valu... | [
"def",
"hist2d",
"(",
"self",
",",
"da",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"value",
"is",
"None",
"or",
"self",
".",
"value",
"==",
"'counts'",
":",
"normed",
"=",
"False",
"else",
":",
"normed",
"=",
"True",
"y",
"=",
"da",
... | Make the two dimensional histogram
Parameters
----------
da: xarray.DataArray
The data source | [
"Make",
"the",
"two",
"dimensional",
"histogram"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L5122-L5139 |
37,829 | Chilipp/psy-simple | psy_simple/plotters.py | PointDensity._statsmodels_bivariate_kde | def _statsmodels_bivariate_kde(self, x, y, bws, xsize, ysize, xyranges):
"""Compute a bivariate kde using statsmodels.
This function is mainly motivated through
seaborn.distributions._statsmodels_bivariate_kde"""
import statsmodels.nonparametric.api as smnp
for i, (coord, bw) in ... | python | def _statsmodels_bivariate_kde(self, x, y, bws, xsize, ysize, xyranges):
"""Compute a bivariate kde using statsmodels.
This function is mainly motivated through
seaborn.distributions._statsmodels_bivariate_kde"""
import statsmodels.nonparametric.api as smnp
for i, (coord, bw) in ... | [
"def",
"_statsmodels_bivariate_kde",
"(",
"self",
",",
"x",
",",
"y",
",",
"bws",
",",
"xsize",
",",
"ysize",
",",
"xyranges",
")",
":",
"import",
"statsmodels",
".",
"nonparametric",
".",
"api",
"as",
"smnp",
"for",
"i",
",",
"(",
"coord",
",",
"bw",
... | Compute a bivariate kde using statsmodels.
This function is mainly motivated through
seaborn.distributions._statsmodels_bivariate_kde | [
"Compute",
"a",
"bivariate",
"kde",
"using",
"statsmodels",
".",
"This",
"function",
"is",
"mainly",
"motivated",
"through",
"seaborn",
".",
"distributions",
".",
"_statsmodels_bivariate_kde"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L5210-L5224 |
37,830 | memphis-iis/GLUDB | gludb/versioning.py | append_diff_hist | def append_diff_hist(diff, diff_hist=list()):
"""Given a diff as generated by record_diff, append a diff record to the
list of diff_hist records."""
diff, diff_hist = _norm_json_params(diff, diff_hist)
if not diff_hist:
diff_hist = list()
diff_hist.append({'diff': diff, 'diff_date': now_fi... | python | def append_diff_hist(diff, diff_hist=list()):
"""Given a diff as generated by record_diff, append a diff record to the
list of diff_hist records."""
diff, diff_hist = _norm_json_params(diff, diff_hist)
if not diff_hist:
diff_hist = list()
diff_hist.append({'diff': diff, 'diff_date': now_fi... | [
"def",
"append_diff_hist",
"(",
"diff",
",",
"diff_hist",
"=",
"list",
"(",
")",
")",
":",
"diff",
",",
"diff_hist",
"=",
"_norm_json_params",
"(",
"diff",
",",
"diff_hist",
")",
"if",
"not",
"diff_hist",
":",
"diff_hist",
"=",
"list",
"(",
")",
"diff_hi... | Given a diff as generated by record_diff, append a diff record to the
list of diff_hist records. | [
"Given",
"a",
"diff",
"as",
"generated",
"by",
"record_diff",
"append",
"a",
"diff",
"record",
"to",
"the",
"list",
"of",
"diff_hist",
"records",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/versioning.py#L55-L64 |
37,831 | studionow/pybrightcove | pybrightcove/video.py | Video._find_video | def _find_video(self):
"""
Lookup and populate ``pybrightcove.video.Video`` object given a video
id or reference_id.
"""
data = None
if self.id:
data = self.connection.get_item(
'find_video_by_id', video_id=self.id)
elif self.reference_... | python | def _find_video(self):
"""
Lookup and populate ``pybrightcove.video.Video`` object given a video
id or reference_id.
"""
data = None
if self.id:
data = self.connection.get_item(
'find_video_by_id', video_id=self.id)
elif self.reference_... | [
"def",
"_find_video",
"(",
"self",
")",
":",
"data",
"=",
"None",
"if",
"self",
".",
"id",
":",
"data",
"=",
"self",
".",
"connection",
".",
"get_item",
"(",
"'find_video_by_id'",
",",
"video_id",
"=",
"self",
".",
"id",
")",
"elif",
"self",
".",
"re... | Lookup and populate ``pybrightcove.video.Video`` object given a video
id or reference_id. | [
"Lookup",
"and",
"populate",
"pybrightcove",
".",
"video",
".",
"Video",
"object",
"given",
"a",
"video",
"id",
"or",
"reference_id",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L297-L311 |
37,832 | studionow/pybrightcove | pybrightcove/video.py | Video.to_xml | def to_xml(self):
# pylint: disable=R0912
"""
Converts object into an XML string.
"""
xml = ''
for asset in self.assets:
xml += '<asset filename="%s" ' % \
os.path.basename(asset['filename'])
xml += ' refid="%(refid)s"' % asset
... | python | def to_xml(self):
# pylint: disable=R0912
"""
Converts object into an XML string.
"""
xml = ''
for asset in self.assets:
xml += '<asset filename="%s" ' % \
os.path.basename(asset['filename'])
xml += ' refid="%(refid)s"' % asset
... | [
"def",
"to_xml",
"(",
"self",
")",
":",
"# pylint: disable=R0912",
"xml",
"=",
"''",
"for",
"asset",
"in",
"self",
".",
"assets",
":",
"xml",
"+=",
"'<asset filename=\"%s\" '",
"%",
"os",
".",
"path",
".",
"basename",
"(",
"asset",
"[",
"'filename'",
"]",
... | Converts object into an XML string. | [
"Converts",
"object",
"into",
"an",
"XML",
"string",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L345-L410 |
37,833 | studionow/pybrightcove | pybrightcove/video.py | Video._load | def _load(self, data):
"""
Deserialize a dictionary of data into a ``pybrightcove.video.Video``
object.
"""
self.raw_data = data
self.creation_date = _convert_tstamp(data['creationDate'])
self.economics = data['economics']
self.id = data['id']
self... | python | def _load(self, data):
"""
Deserialize a dictionary of data into a ``pybrightcove.video.Video``
object.
"""
self.raw_data = data
self.creation_date = _convert_tstamp(data['creationDate'])
self.economics = data['economics']
self.id = data['id']
self... | [
"def",
"_load",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"raw_data",
"=",
"data",
"self",
".",
"creation_date",
"=",
"_convert_tstamp",
"(",
"data",
"[",
"'creationDate'",
"]",
")",
"self",
".",
"economics",
"=",
"data",
"[",
"'economics'",
"]",
... | Deserialize a dictionary of data into a ``pybrightcove.video.Video``
object. | [
"Deserialize",
"a",
"dictionary",
"of",
"data",
"into",
"a",
"pybrightcove",
".",
"video",
".",
"Video",
"object",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L412-L438 |
37,834 | studionow/pybrightcove | pybrightcove/video.py | Video.get_custom_metadata | def get_custom_metadata(self):
"""
Fetches custom metadta for an already exisiting Video.
"""
if self.id is not None:
data = self.connection.get_item(
'find_video_by_id',
video_id=self.id,
video_fields="customFields"
... | python | def get_custom_metadata(self):
"""
Fetches custom metadta for an already exisiting Video.
"""
if self.id is not None:
data = self.connection.get_item(
'find_video_by_id',
video_id=self.id,
video_fields="customFields"
... | [
"def",
"get_custom_metadata",
"(",
"self",
")",
":",
"if",
"self",
".",
"id",
"is",
"not",
"None",
":",
"data",
"=",
"self",
".",
"connection",
".",
"get_item",
"(",
"'find_video_by_id'",
",",
"video_id",
"=",
"self",
".",
"id",
",",
"video_fields",
"=",... | Fetches custom metadta for an already exisiting Video. | [
"Fetches",
"custom",
"metadta",
"for",
"an",
"already",
"exisiting",
"Video",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L472-L485 |
37,835 | studionow/pybrightcove | pybrightcove/video.py | Video.add_custom_metadata | def add_custom_metadata(self, key, value, meta_type=None):
"""
Add custom metadata to the Video. meta_type is required for XML API.
"""
self.metadata.append({'key': key, 'value': value, 'type': meta_type}) | python | def add_custom_metadata(self, key, value, meta_type=None):
"""
Add custom metadata to the Video. meta_type is required for XML API.
"""
self.metadata.append({'key': key, 'value': value, 'type': meta_type}) | [
"def",
"add_custom_metadata",
"(",
"self",
",",
"key",
",",
"value",
",",
"meta_type",
"=",
"None",
")",
":",
"self",
".",
"metadata",
".",
"append",
"(",
"{",
"'key'",
":",
"key",
",",
"'value'",
":",
"value",
",",
"'type'",
":",
"meta_type",
"}",
"... | Add custom metadata to the Video. meta_type is required for XML API. | [
"Add",
"custom",
"metadata",
"to",
"the",
"Video",
".",
"meta_type",
"is",
"required",
"for",
"XML",
"API",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L487-L491 |
37,836 | studionow/pybrightcove | pybrightcove/video.py | Video.add_asset | def add_asset(self, filename, asset_type, display_name,
encoding_rate=None, frame_width=None, frame_height=None,
encode_to=None, encode_multiple=False,
h264_preserve_as_rendition=False, h264_no_processing=False):
"""
Add an asset to the Video object.
"""
m = hashl... | python | def add_asset(self, filename, asset_type, display_name,
encoding_rate=None, frame_width=None, frame_height=None,
encode_to=None, encode_multiple=False,
h264_preserve_as_rendition=False, h264_no_processing=False):
"""
Add an asset to the Video object.
"""
m = hashl... | [
"def",
"add_asset",
"(",
"self",
",",
"filename",
",",
"asset_type",
",",
"display_name",
",",
"encoding_rate",
"=",
"None",
",",
"frame_width",
"=",
"None",
",",
"frame_height",
"=",
"None",
",",
"encode_to",
"=",
"None",
",",
"encode_multiple",
"=",
"False... | Add an asset to the Video object. | [
"Add",
"an",
"asset",
"to",
"the",
"Video",
"object",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L493-L535 |
37,837 | studionow/pybrightcove | pybrightcove/video.py | Video.save | def save(self, create_multiple_renditions=True,
preserve_source_rendition=True,
encode_to=enums.EncodeToEnum.FLV):
"""
Creates or updates the video
"""
if is_ftp_connection(self.connection) and len(self.assets) > 0:
self.connection.post(xml=self.to_xml(), asse... | python | def save(self, create_multiple_renditions=True,
preserve_source_rendition=True,
encode_to=enums.EncodeToEnum.FLV):
"""
Creates or updates the video
"""
if is_ftp_connection(self.connection) and len(self.assets) > 0:
self.connection.post(xml=self.to_xml(), asse... | [
"def",
"save",
"(",
"self",
",",
"create_multiple_renditions",
"=",
"True",
",",
"preserve_source_rendition",
"=",
"True",
",",
"encode_to",
"=",
"enums",
".",
"EncodeToEnum",
".",
"FLV",
")",
":",
"if",
"is_ftp_connection",
"(",
"self",
".",
"connection",
")"... | Creates or updates the video | [
"Creates",
"or",
"updates",
"the",
"video"
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L537-L557 |
37,838 | studionow/pybrightcove | pybrightcove/video.py | Video.delete | def delete(self, cascade=False, delete_shares=False):
"""
Deletes the video.
"""
if self.id:
self.connection.post('delete_video', video_id=self.id,
cascade=cascade, delete_shares=delete_shares)
self.id = None | python | def delete(self, cascade=False, delete_shares=False):
"""
Deletes the video.
"""
if self.id:
self.connection.post('delete_video', video_id=self.id,
cascade=cascade, delete_shares=delete_shares)
self.id = None | [
"def",
"delete",
"(",
"self",
",",
"cascade",
"=",
"False",
",",
"delete_shares",
"=",
"False",
")",
":",
"if",
"self",
".",
"id",
":",
"self",
".",
"connection",
".",
"post",
"(",
"'delete_video'",
",",
"video_id",
"=",
"self",
".",
"id",
",",
"casc... | Deletes the video. | [
"Deletes",
"the",
"video",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L559-L566 |
37,839 | studionow/pybrightcove | pybrightcove/video.py | Video.get_upload_status | def get_upload_status(self):
"""
Get the status of the video that has been uploaded.
"""
if self.id:
return self.connection.post('get_upload_status', video_id=self.id) | python | def get_upload_status(self):
"""
Get the status of the video that has been uploaded.
"""
if self.id:
return self.connection.post('get_upload_status', video_id=self.id) | [
"def",
"get_upload_status",
"(",
"self",
")",
":",
"if",
"self",
".",
"id",
":",
"return",
"self",
".",
"connection",
".",
"post",
"(",
"'get_upload_status'",
",",
"video_id",
"=",
"self",
".",
"id",
")"
] | Get the status of the video that has been uploaded. | [
"Get",
"the",
"status",
"of",
"the",
"video",
"that",
"has",
"been",
"uploaded",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L568-L573 |
37,840 | studionow/pybrightcove | pybrightcove/video.py | Video.share | def share(self, accounts):
"""
Create a share
"""
if not isinstance(accounts, (list, tuple)):
msg = "Video.share expects an iterable argument"
raise exceptions.PyBrightcoveError(msg)
raise exceptions.PyBrightcoveError("Not yet implemented") | python | def share(self, accounts):
"""
Create a share
"""
if not isinstance(accounts, (list, tuple)):
msg = "Video.share expects an iterable argument"
raise exceptions.PyBrightcoveError(msg)
raise exceptions.PyBrightcoveError("Not yet implemented") | [
"def",
"share",
"(",
"self",
",",
"accounts",
")",
":",
"if",
"not",
"isinstance",
"(",
"accounts",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"msg",
"=",
"\"Video.share expects an iterable argument\"",
"raise",
"exceptions",
".",
"PyBrightcoveError",
"(",... | Create a share | [
"Create",
"a",
"share"
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L575-L582 |
37,841 | studionow/pybrightcove | pybrightcove/video.py | Video.set_image | def set_image(self, image, filename=None, resize=False):
"""
Set the poster or thumbnail of a this Vidoe.
"""
if self.id:
data = self.connection.post('add_image', filename,
video_id=self.id, image=image.to_dict(), resize=resize)
if data:
... | python | def set_image(self, image, filename=None, resize=False):
"""
Set the poster or thumbnail of a this Vidoe.
"""
if self.id:
data = self.connection.post('add_image', filename,
video_id=self.id, image=image.to_dict(), resize=resize)
if data:
... | [
"def",
"set_image",
"(",
"self",
",",
"image",
",",
"filename",
"=",
"None",
",",
"resize",
"=",
"False",
")",
":",
"if",
"self",
".",
"id",
":",
"data",
"=",
"self",
".",
"connection",
".",
"post",
"(",
"'add_image'",
",",
"filename",
",",
"video_id... | Set the poster or thumbnail of a this Vidoe. | [
"Set",
"the",
"poster",
"or",
"thumbnail",
"of",
"a",
"this",
"Vidoe",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L584-L592 |
37,842 | studionow/pybrightcove | pybrightcove/video.py | Video.find_related | def find_related(self, _connection=None, page_size=100, page_number=0):
"""
List all videos that are related to this one.
"""
if self.id:
return connection.ItemResultSet('find_related_videos',
Video, _connection, page_size, page_number, None, None,
... | python | def find_related(self, _connection=None, page_size=100, page_number=0):
"""
List all videos that are related to this one.
"""
if self.id:
return connection.ItemResultSet('find_related_videos',
Video, _connection, page_size, page_number, None, None,
... | [
"def",
"find_related",
"(",
"self",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
")",
":",
"if",
"self",
".",
"id",
":",
"return",
"connection",
".",
"ItemResultSet",
"(",
"'find_related_videos'",
",",
"Video... | List all videos that are related to this one. | [
"List",
"all",
"videos",
"that",
"are",
"related",
"to",
"this",
"one",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L594-L601 |
37,843 | studionow/pybrightcove | pybrightcove/video.py | Video.delete_video | def delete_video(video_id, cascade=False, delete_shares=False,
_connection=None):
"""
Delete the video represented by the ``video_id`` parameter.
"""
c = _connection
if not c:
c = connection.APIConnection()
c.post('delete_video', video_id=video_id, cas... | python | def delete_video(video_id, cascade=False, delete_shares=False,
_connection=None):
"""
Delete the video represented by the ``video_id`` parameter.
"""
c = _connection
if not c:
c = connection.APIConnection()
c.post('delete_video', video_id=video_id, cas... | [
"def",
"delete_video",
"(",
"video_id",
",",
"cascade",
"=",
"False",
",",
"delete_shares",
"=",
"False",
",",
"_connection",
"=",
"None",
")",
":",
"c",
"=",
"_connection",
"if",
"not",
"c",
":",
"c",
"=",
"connection",
".",
"APIConnection",
"(",
")",
... | Delete the video represented by the ``video_id`` parameter. | [
"Delete",
"the",
"video",
"represented",
"by",
"the",
"video_id",
"parameter",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L611-L620 |
37,844 | studionow/pybrightcove | pybrightcove/video.py | Video.get_status | def get_status(video_id, _connection=None):
"""
Get the status of a video given the ``video_id`` parameter.
"""
c = _connection
if not c:
c = connection.APIConnection()
return c.post('get_upload_status', video_id=video_id) | python | def get_status(video_id, _connection=None):
"""
Get the status of a video given the ``video_id`` parameter.
"""
c = _connection
if not c:
c = connection.APIConnection()
return c.post('get_upload_status', video_id=video_id) | [
"def",
"get_status",
"(",
"video_id",
",",
"_connection",
"=",
"None",
")",
":",
"c",
"=",
"_connection",
"if",
"not",
"c",
":",
"c",
"=",
"connection",
".",
"APIConnection",
"(",
")",
"return",
"c",
".",
"post",
"(",
"'get_upload_status'",
",",
"video_i... | Get the status of a video given the ``video_id`` parameter. | [
"Get",
"the",
"status",
"of",
"a",
"video",
"given",
"the",
"video_id",
"parameter",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L623-L630 |
37,845 | studionow/pybrightcove | pybrightcove/video.py | Video.activate | def activate(video_id, _connection=None):
"""
Mark a video as Active
"""
c = _connection
if not c:
c = connection.APIConnection()
data = c.post('update_video', video={
'id': video_id,
'itemState': enums.ItemStateEnum.ACTIVE})
re... | python | def activate(video_id, _connection=None):
"""
Mark a video as Active
"""
c = _connection
if not c:
c = connection.APIConnection()
data = c.post('update_video', video={
'id': video_id,
'itemState': enums.ItemStateEnum.ACTIVE})
re... | [
"def",
"activate",
"(",
"video_id",
",",
"_connection",
"=",
"None",
")",
":",
"c",
"=",
"_connection",
"if",
"not",
"c",
":",
"c",
"=",
"connection",
".",
"APIConnection",
"(",
")",
"data",
"=",
"c",
".",
"post",
"(",
"'update_video'",
",",
"video",
... | Mark a video as Active | [
"Mark",
"a",
"video",
"as",
"Active"
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L633-L643 |
37,846 | studionow/pybrightcove | pybrightcove/video.py | Video.find_modified | def find_modified(since, filter_list=None, _connection=None, page_size=25,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos modified since a certain date.
"""
filters = []
if filter_list is not None:
... | python | def find_modified(since, filter_list=None, _connection=None, page_size=25,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos modified since a certain date.
"""
filters = []
if filter_list is not None:
... | [
"def",
"find_modified",
"(",
"since",
",",
"filter_list",
"=",
"None",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"25",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
... | List all videos modified since a certain date. | [
"List",
"all",
"videos",
"modified",
"since",
"a",
"certain",
"date",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L646-L661 |
37,847 | studionow/pybrightcove | pybrightcove/video.py | Video.find_all | def find_all(_connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos.
"""
return connection.ItemResultSet('find_all_videos', Video,
_connection, page_size, page_number, sort_by, sort_orde... | python | def find_all(_connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos.
"""
return connection.ItemResultSet('find_all_videos', Video,
_connection, page_size, page_number, sort_by, sort_orde... | [
"def",
"find_all",
"(",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
")",
":",
"return",
"connection"... | List all videos. | [
"List",
"all",
"videos",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L664-L670 |
37,848 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_tags | def find_by_tags(and_tags=None, or_tags=None, _connection=None,
page_size=100, page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List videos given a certain set of tags.
"""
err = None
if not and_tags and not or_tags:
... | python | def find_by_tags(and_tags=None, or_tags=None, _connection=None,
page_size=100, page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List videos given a certain set of tags.
"""
err = None
if not and_tags and not or_tags:
... | [
"def",
"find_by_tags",
"(",
"and_tags",
"=",
"None",
",",
"or_tags",
"=",
"None",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"... | List videos given a certain set of tags. | [
"List",
"videos",
"given",
"a",
"certain",
"set",
"of",
"tags",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L673-L698 |
37,849 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_text | def find_by_text(text, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List videos that match the ``text`` in title or description.
"""
return connection.ItemResultSet('find_videos_by_text',
Vide... | python | def find_by_text(text, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List videos that match the ``text`` in title or description.
"""
return connection.ItemResultSet('find_videos_by_text',
Vide... | [
"def",
"find_by_text",
"(",
"text",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
")",
":",
"re... | List videos that match the ``text`` in title or description. | [
"List",
"videos",
"that",
"match",
"the",
"text",
"in",
"title",
"or",
"description",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L701-L708 |
37,850 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_campaign | def find_by_campaign(campaign_id, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos for a given campaign.
"""
return connection.ItemResultSet(
'find_videos_by_campaign_id', ... | python | def find_by_campaign(campaign_id, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos for a given campaign.
"""
return connection.ItemResultSet(
'find_videos_by_campaign_id', ... | [
"def",
"find_by_campaign",
"(",
"campaign_id",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
")",
... | List all videos for a given campaign. | [
"List",
"all",
"videos",
"for",
"a",
"given",
"campaign",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L711-L719 |
37,851 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_user | def find_by_user(user_id, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos uploaded by a certain user.
"""
return connection.ItemResultSet('find_videos_by_user_id',
Video, _connect... | python | def find_by_user(user_id, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos uploaded by a certain user.
"""
return connection.ItemResultSet('find_videos_by_user_id',
Video, _connect... | [
"def",
"find_by_user",
"(",
"user_id",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
")",
":",
... | List all videos uploaded by a certain user. | [
"List",
"all",
"videos",
"uploaded",
"by",
"a",
"certain",
"user",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L722-L729 |
37,852 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_reference_ids | def find_by_reference_ids(reference_ids, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of reference ids
"""
if not isinstance(reference_ids, (list, tuple)):
... | python | def find_by_reference_ids(reference_ids, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of reference ids
"""
if not isinstance(reference_ids, (list, tuple)):
... | [
"def",
"find_by_reference_ids",
"(",
"reference_ids",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
... | List all videos identified by a list of reference ids | [
"List",
"all",
"videos",
"identified",
"by",
"a",
"list",
"of",
"reference",
"ids"
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L732-L744 |
37,853 | studionow/pybrightcove | pybrightcove/video.py | Video.find_by_ids | def find_by_ids(ids, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of Brightcove video ids
"""
if not isinstance(ids, (list, tuple)):
err = "Video.find_by_i... | python | def find_by_ids(ids, _connection=None, page_size=100, page_number=0,
sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of Brightcove video ids
"""
if not isinstance(ids, (list, tuple)):
err = "Video.find_by_i... | [
"def",
"find_by_ids",
"(",
"ids",
",",
"_connection",
"=",
"None",
",",
"page_size",
"=",
"100",
",",
"page_number",
"=",
"0",
",",
"sort_by",
"=",
"enums",
".",
"DEFAULT_SORT_BY",
",",
"sort_order",
"=",
"enums",
".",
"DEFAULT_SORT_ORDER",
")",
":",
"if",... | List all videos identified by a list of Brightcove video ids | [
"List",
"all",
"videos",
"identified",
"by",
"a",
"list",
"of",
"Brightcove",
"video",
"ids"
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L747-L758 |
37,854 | bmcfee/presets | presets/__init__.py | Preset.__wrap | def __wrap(self, func):
'''This decorator overrides the default arguments of a function.
For each keyword argument in the function, the decorator first checks
if the argument has been overridden by the caller, and uses that value instead if so.
If not, the decorator consults the Preset... | python | def __wrap(self, func):
'''This decorator overrides the default arguments of a function.
For each keyword argument in the function, the decorator first checks
if the argument has been overridden by the caller, and uses that value instead if so.
If not, the decorator consults the Preset... | [
"def",
"__wrap",
"(",
"self",
",",
"func",
")",
":",
"def",
"deffunc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''The decorated function'''",
"# Get the list of function arguments",
"if",
"hasattr",
"(",
"inspect",
",",
"'signature'",
")",
":",
... | This decorator overrides the default arguments of a function.
For each keyword argument in the function, the decorator first checks
if the argument has been overridden by the caller, and uses that value instead if so.
If not, the decorator consults the Preset object for an override value.
... | [
"This",
"decorator",
"overrides",
"the",
"default",
"arguments",
"of",
"a",
"function",
"."
] | 07d81fa10d87ab71ef0a8b587d3f36df2829d4a5 | https://github.com/bmcfee/presets/blob/07d81fa10d87ab71ef0a8b587d3f36df2829d4a5/presets/__init__.py#L56-L101 |
37,855 | StarlitGhost/pyhedrals | pyhedrals/pyhedrals.py | DiceParser._sumDiceRolls | def _sumDiceRolls(self, rollList):
"""convert from dice roll structure to a single integer result"""
if isinstance(rollList, RollList):
self.rolls.append(rollList)
return rollList.sum()
else:
return rollList | python | def _sumDiceRolls(self, rollList):
"""convert from dice roll structure to a single integer result"""
if isinstance(rollList, RollList):
self.rolls.append(rollList)
return rollList.sum()
else:
return rollList | [
"def",
"_sumDiceRolls",
"(",
"self",
",",
"rollList",
")",
":",
"if",
"isinstance",
"(",
"rollList",
",",
"RollList",
")",
":",
"self",
".",
"rolls",
".",
"append",
"(",
"rollList",
")",
"return",
"rollList",
".",
"sum",
"(",
")",
"else",
":",
"return"... | convert from dice roll structure to a single integer result | [
"convert",
"from",
"dice",
"roll",
"structure",
"to",
"a",
"single",
"integer",
"result"
] | 74b3a48ecc2b73a27ded913e4152273cd5ba9cc7 | https://github.com/StarlitGhost/pyhedrals/blob/74b3a48ecc2b73a27ded913e4152273cd5ba9cc7/pyhedrals/pyhedrals.py#L442-L448 |
37,856 | mdickinson/refcycle | refcycle/annotations.py | annotated_references | def annotated_references(obj):
"""
Return known information about references held by the given object.
Returns a mapping from referents to lists of descriptions. Note that there
may be more than one edge leading to any particular referent; hence the
need for a list. Descriptions are currently str... | python | def annotated_references(obj):
"""
Return known information about references held by the given object.
Returns a mapping from referents to lists of descriptions. Note that there
may be more than one edge leading to any particular referent; hence the
need for a list. Descriptions are currently str... | [
"def",
"annotated_references",
"(",
"obj",
")",
":",
"references",
"=",
"KeyTransformDict",
"(",
"transform",
"=",
"id",
",",
"default_factory",
"=",
"list",
")",
"for",
"type_",
"in",
"type",
"(",
"obj",
")",
".",
"__mro__",
":",
"if",
"type_",
"in",
"t... | Return known information about references held by the given object.
Returns a mapping from referents to lists of descriptions. Note that there
may be more than one edge leading to any particular referent; hence the
need for a list. Descriptions are currently strings. | [
"Return",
"known",
"information",
"about",
"references",
"held",
"by",
"the",
"given",
"object",
"."
] | 627fad74c74efc601209c96405f8118cd99b2241 | https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/annotations.py#L134-L153 |
37,857 | mdickinson/refcycle | refcycle/annotations.py | object_annotation | def object_annotation(obj):
"""
Return a string to be used for Graphviz nodes. The string
should be short but as informative as possible.
"""
# For basic types, use the repr.
if isinstance(obj, BASE_TYPES):
return repr(obj)
if type(obj).__name__ == 'function':
return "funct... | python | def object_annotation(obj):
"""
Return a string to be used for Graphviz nodes. The string
should be short but as informative as possible.
"""
# For basic types, use the repr.
if isinstance(obj, BASE_TYPES):
return repr(obj)
if type(obj).__name__ == 'function':
return "funct... | [
"def",
"object_annotation",
"(",
"obj",
")",
":",
"# For basic types, use the repr.",
"if",
"isinstance",
"(",
"obj",
",",
"BASE_TYPES",
")",
":",
"return",
"repr",
"(",
"obj",
")",
"if",
"type",
"(",
"obj",
")",
".",
"__name__",
"==",
"'function'",
":",
"... | Return a string to be used for Graphviz nodes. The string
should be short but as informative as possible. | [
"Return",
"a",
"string",
"to",
"be",
"used",
"for",
"Graphviz",
"nodes",
".",
"The",
"string",
"should",
"be",
"short",
"but",
"as",
"informative",
"as",
"possible",
"."
] | 627fad74c74efc601209c96405f8118cd99b2241 | https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/annotations.py#L165-L228 |
37,858 | wheeler-microfluidics/dmf-control-board-firmware | site_scons/site_tools/disttar/disttar.py | disttar | def disttar(target, source, env):
"""tar archive builder"""
import tarfile
env_dict = env.Dictionary()
if env_dict.get("DISTTAR_FORMAT") in ["gz", "bz2"]:
tar_format = env_dict["DISTTAR_FORMAT"]
else:
tar_format = ""
# split the target ... | python | def disttar(target, source, env):
"""tar archive builder"""
import tarfile
env_dict = env.Dictionary()
if env_dict.get("DISTTAR_FORMAT") in ["gz", "bz2"]:
tar_format = env_dict["DISTTAR_FORMAT"]
else:
tar_format = ""
# split the target ... | [
"def",
"disttar",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"import",
"tarfile",
"env_dict",
"=",
"env",
".",
"Dictionary",
"(",
")",
"if",
"env_dict",
".",
"get",
"(",
"\"DISTTAR_FORMAT\"",
")",
"in",
"[",
"\"gz\"",
",",
"\"bz2\"",
"]",
":",... | tar archive builder | [
"tar",
"archive",
"builder"
] | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/site_scons/site_tools/disttar/disttar.py#L79-L113 |
37,859 | wheeler-microfluidics/dmf-control-board-firmware | site_scons/site_tools/disttar/disttar.py | disttar_suffix | def disttar_suffix(env, sources):
"""tar archive suffix generator"""
env_dict = env.Dictionary()
if env_dict.has_key("DISTTAR_FORMAT") and env_dict["DISTTAR_FORMAT"] in ["gz", "bz2"]:
return ".tar." + env_dict["DISTTAR_FORMAT"]
else:
return ".tar" | python | def disttar_suffix(env, sources):
"""tar archive suffix generator"""
env_dict = env.Dictionary()
if env_dict.has_key("DISTTAR_FORMAT") and env_dict["DISTTAR_FORMAT"] in ["gz", "bz2"]:
return ".tar." + env_dict["DISTTAR_FORMAT"]
else:
return ".tar" | [
"def",
"disttar_suffix",
"(",
"env",
",",
"sources",
")",
":",
"env_dict",
"=",
"env",
".",
"Dictionary",
"(",
")",
"if",
"env_dict",
".",
"has_key",
"(",
"\"DISTTAR_FORMAT\"",
")",
"and",
"env_dict",
"[",
"\"DISTTAR_FORMAT\"",
"]",
"in",
"[",
"\"gz\"",
",... | tar archive suffix generator | [
"tar",
"archive",
"suffix",
"generator"
] | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/site_scons/site_tools/disttar/disttar.py#L115-L122 |
37,860 | wheeler-microfluidics/dmf-control-board-firmware | site_scons/site_tools/disttar/disttar.py | generate | def generate(env):
"""
Add builders and construction variables for the DistTar builder.
"""
disttar_action=SCons.Action.Action(disttar, disttar_string)
env['BUILDERS']['DistTar'] = Builder(
action=disttar_action
, emitter=disttar_emitter
, suffix = disttar_suffi... | python | def generate(env):
"""
Add builders and construction variables for the DistTar builder.
"""
disttar_action=SCons.Action.Action(disttar, disttar_string)
env['BUILDERS']['DistTar'] = Builder(
action=disttar_action
, emitter=disttar_emitter
, suffix = disttar_suffi... | [
"def",
"generate",
"(",
"env",
")",
":",
"disttar_action",
"=",
"SCons",
".",
"Action",
".",
"Action",
"(",
"disttar",
",",
"disttar_string",
")",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'DistTar'",
"]",
"=",
"Builder",
"(",
"action",
"=",
"disttar_action",
... | Add builders and construction variables for the DistTar builder. | [
"Add",
"builders",
"and",
"construction",
"variables",
"for",
"the",
"DistTar",
"builder",
"."
] | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/site_scons/site_tools/disttar/disttar.py#L124-L139 |
37,861 | memphis-iis/GLUDB | gludb/backends/postgresql.py | Backend.find_one | def find_one(self, cls, id):
"""Find single keyed row - as per the gludb spec."""
found = self.find_by_index(cls, 'id', id)
return found[0] if found else None | python | def find_one(self, cls, id):
"""Find single keyed row - as per the gludb spec."""
found = self.find_by_index(cls, 'id', id)
return found[0] if found else None | [
"def",
"find_one",
"(",
"self",
",",
"cls",
",",
"id",
")",
":",
"found",
"=",
"self",
".",
"find_by_index",
"(",
"cls",
",",
"'id'",
",",
"id",
")",
"return",
"found",
"[",
"0",
"]",
"if",
"found",
"else",
"None"
] | Find single keyed row - as per the gludb spec. | [
"Find",
"single",
"keyed",
"row",
"-",
"as",
"per",
"the",
"gludb",
"spec",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/postgresql.py#L64-L67 |
37,862 | memphis-iis/GLUDB | gludb/backends/postgresql.py | Backend.save | def save(self, obj):
"""Save current instance - as per the gludb spec."""
cur = self._conn().cursor()
tabname = obj.__class__.get_table_name()
index_names = obj.__class__.index_names() or []
col_names = ['id', 'value'] + index_names
value_holders = ['%s'] * len(col_nam... | python | def save(self, obj):
"""Save current instance - as per the gludb spec."""
cur = self._conn().cursor()
tabname = obj.__class__.get_table_name()
index_names = obj.__class__.index_names() or []
col_names = ['id', 'value'] + index_names
value_holders = ['%s'] * len(col_nam... | [
"def",
"save",
"(",
"self",
",",
"obj",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
"(",
")",
".",
"cursor",
"(",
")",
"tabname",
"=",
"obj",
".",
"__class__",
".",
"get_table_name",
"(",
")",
"index_names",
"=",
"obj",
".",
"__class__",
".",
"inde... | Save current instance - as per the gludb spec. | [
"Save",
"current",
"instance",
"-",
"as",
"per",
"the",
"gludb",
"spec",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/postgresql.py#L96-L126 |
37,863 | toumorokoshi/sprinter | sprinter/lib/request.py | authenticated_get | def authenticated_get(username, password, url, verify=True):
"""
Perform an authorized query to the url, and return the result
"""
try:
response = requests.get(url, auth=(username, password), verify=verify)
if response.status_code == 401:
raise BadCredentialsException(
... | python | def authenticated_get(username, password, url, verify=True):
"""
Perform an authorized query to the url, and return the result
"""
try:
response = requests.get(url, auth=(username, password), verify=verify)
if response.status_code == 401:
raise BadCredentialsException(
... | [
"def",
"authenticated_get",
"(",
"username",
",",
"password",
",",
"url",
",",
"verify",
"=",
"True",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"auth",
"=",
"(",
"username",
",",
"password",
")",
",",
"verify",
"... | Perform an authorized query to the url, and return the result | [
"Perform",
"an",
"authorized",
"query",
"to",
"the",
"url",
"and",
"return",
"the",
"result"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/request.py#L19-L31 |
37,864 | toumorokoshi/sprinter | sprinter/lib/request.py | cleaned_request | def cleaned_request(request_type, *args, **kwargs):
""" Perform a cleaned requests request """
s = requests.Session()
# this removes netrc checking
s.trust_env = False
return s.request(request_type, *args, **kwargs) | python | def cleaned_request(request_type, *args, **kwargs):
""" Perform a cleaned requests request """
s = requests.Session()
# this removes netrc checking
s.trust_env = False
return s.request(request_type, *args, **kwargs) | [
"def",
"cleaned_request",
"(",
"request_type",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"requests",
".",
"Session",
"(",
")",
"# this removes netrc checking",
"s",
".",
"trust_env",
"=",
"False",
"return",
"s",
".",
"request",
"(",
... | Perform a cleaned requests request | [
"Perform",
"a",
"cleaned",
"requests",
"request"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/request.py#L34-L39 |
37,865 | toumorokoshi/sprinter | sprinter/lib/request.py | download_to_bytesio | def download_to_bytesio(url):
""" Return a bytesio object with a download bar """
logger.info("Downloading url: {0}".format(url))
r = cleaned_request('get', url, stream=True)
stream = io.BytesIO()
total_length = int(r.headers.get('content-length'))
for chunk in progress.bar(r.iter_content(chunk_... | python | def download_to_bytesio(url):
""" Return a bytesio object with a download bar """
logger.info("Downloading url: {0}".format(url))
r = cleaned_request('get', url, stream=True)
stream = io.BytesIO()
total_length = int(r.headers.get('content-length'))
for chunk in progress.bar(r.iter_content(chunk_... | [
"def",
"download_to_bytesio",
"(",
"url",
")",
":",
"logger",
".",
"info",
"(",
"\"Downloading url: {0}\"",
".",
"format",
"(",
"url",
")",
")",
"r",
"=",
"cleaned_request",
"(",
"'get'",
",",
"url",
",",
"stream",
"=",
"True",
")",
"stream",
"=",
"io",
... | Return a bytesio object with a download bar | [
"Return",
"a",
"bytesio",
"object",
"with",
"a",
"download",
"bar"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/request.py#L42-L52 |
37,866 | ponty/entrypoint2 | entrypoint2/examples/hello.py | add | def add(one, two=4, three=False):
''' This function adds two number.
:param one: first number to add
:param two: second number to add
:rtype: int
'''
s = str(int(one) + int(two))
logging.debug('logging sum from hello.py:' + s)
print 'printing sum from hello.py:', s
return s | python | def add(one, two=4, three=False):
''' This function adds two number.
:param one: first number to add
:param two: second number to add
:rtype: int
'''
s = str(int(one) + int(two))
logging.debug('logging sum from hello.py:' + s)
print 'printing sum from hello.py:', s
return s | [
"def",
"add",
"(",
"one",
",",
"two",
"=",
"4",
",",
"three",
"=",
"False",
")",
":",
"s",
"=",
"str",
"(",
"int",
"(",
"one",
")",
"+",
"int",
"(",
"two",
")",
")",
"logging",
".",
"debug",
"(",
"'logging sum from hello.py:'",
"+",
"s",
")",
"... | This function adds two number.
:param one: first number to add
:param two: second number to add
:rtype: int | [
"This",
"function",
"adds",
"two",
"number",
"."
] | d355dd1a6e0cabdd6751fc2f6016aee20755d332 | https://github.com/ponty/entrypoint2/blob/d355dd1a6e0cabdd6751fc2f6016aee20755d332/entrypoint2/examples/hello.py#L8-L20 |
37,867 | inveniosoftware/invenio-queues | invenio_queues/queue.py | Queue.queue | def queue(self):
"""Message queue queue."""
with self.connection_pool.acquire(block=True) as conn:
return Q(
self.routing_key,
exchange=self.exchange,
routing_key=self.routing_key
)(conn) | python | def queue(self):
"""Message queue queue."""
with self.connection_pool.acquire(block=True) as conn:
return Q(
self.routing_key,
exchange=self.exchange,
routing_key=self.routing_key
)(conn) | [
"def",
"queue",
"(",
"self",
")",
":",
"with",
"self",
".",
"connection_pool",
".",
"acquire",
"(",
"block",
"=",
"True",
")",
"as",
"conn",
":",
"return",
"Q",
"(",
"self",
".",
"routing_key",
",",
"exchange",
"=",
"self",
".",
"exchange",
",",
"rou... | Message queue queue. | [
"Message",
"queue",
"queue",
"."
] | 1dd9112d7c5fe72a428c86f21f6d02cdb0595921 | https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L55-L62 |
37,868 | inveniosoftware/invenio-queues | invenio_queues/queue.py | Queue.exists | def exists(self):
"""Test if this queue exists in the AMQP store.
Note: This doesn't work with redis as declaring queues has not effect
except creating the exchange.
:returns: True if the queue exists, else False.
:rtype: bool
"""
try:
queue = self.q... | python | def exists(self):
"""Test if this queue exists in the AMQP store.
Note: This doesn't work with redis as declaring queues has not effect
except creating the exchange.
:returns: True if the queue exists, else False.
:rtype: bool
"""
try:
queue = self.q... | [
"def",
"exists",
"(",
"self",
")",
":",
"try",
":",
"queue",
"=",
"self",
".",
"queue",
"queue",
".",
"queue_declare",
"(",
"passive",
"=",
"True",
")",
"except",
"NotFound",
":",
"return",
"False",
"except",
"ChannelError",
"as",
"e",
":",
"if",
"e",
... | Test if this queue exists in the AMQP store.
Note: This doesn't work with redis as declaring queues has not effect
except creating the exchange.
:returns: True if the queue exists, else False.
:rtype: bool | [
"Test",
"if",
"this",
"queue",
"exists",
"in",
"the",
"AMQP",
"store",
"."
] | 1dd9112d7c5fe72a428c86f21f6d02cdb0595921 | https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L65-L83 |
37,869 | inveniosoftware/invenio-queues | invenio_queues/queue.py | Queue.create_consumer | def create_consumer(self):
"""Context manager that yields an instance of ``Consumer``."""
with self.connection_pool.acquire(block=True) as conn:
yield self.consumer(conn) | python | def create_consumer(self):
"""Context manager that yields an instance of ``Consumer``."""
with self.connection_pool.acquire(block=True) as conn:
yield self.consumer(conn) | [
"def",
"create_consumer",
"(",
"self",
")",
":",
"with",
"self",
".",
"connection_pool",
".",
"acquire",
"(",
"block",
"=",
"True",
")",
"as",
"conn",
":",
"yield",
"self",
".",
"consumer",
"(",
"conn",
")"
] | Context manager that yields an instance of ``Consumer``. | [
"Context",
"manager",
"that",
"yields",
"an",
"instance",
"of",
"Consumer",
"."
] | 1dd9112d7c5fe72a428c86f21f6d02cdb0595921 | https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L114-L117 |
37,870 | inveniosoftware/invenio-queues | invenio_queues/queue.py | Queue.publish | def publish(self, events):
"""Publish events."""
assert len(events) > 0
with self.create_producer() as producer:
for event in events:
producer.publish(event) | python | def publish(self, events):
"""Publish events."""
assert len(events) > 0
with self.create_producer() as producer:
for event in events:
producer.publish(event) | [
"def",
"publish",
"(",
"self",
",",
"events",
")",
":",
"assert",
"len",
"(",
"events",
")",
">",
"0",
"with",
"self",
".",
"create_producer",
"(",
")",
"as",
"producer",
":",
"for",
"event",
"in",
"events",
":",
"producer",
".",
"publish",
"(",
"eve... | Publish events. | [
"Publish",
"events",
"."
] | 1dd9112d7c5fe72a428c86f21f6d02cdb0595921 | https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L119-L124 |
37,871 | inveniosoftware/invenio-queues | invenio_queues/queue.py | Queue.consume | def consume(self, payload=True):
"""Consume events."""
with self.create_consumer() as consumer:
for msg in consumer.iterqueue():
yield msg.payload if payload else msg | python | def consume(self, payload=True):
"""Consume events."""
with self.create_consumer() as consumer:
for msg in consumer.iterqueue():
yield msg.payload if payload else msg | [
"def",
"consume",
"(",
"self",
",",
"payload",
"=",
"True",
")",
":",
"with",
"self",
".",
"create_consumer",
"(",
")",
"as",
"consumer",
":",
"for",
"msg",
"in",
"consumer",
".",
"iterqueue",
"(",
")",
":",
"yield",
"msg",
".",
"payload",
"if",
"pay... | Consume events. | [
"Consume",
"events",
"."
] | 1dd9112d7c5fe72a428c86f21f6d02cdb0595921 | https://github.com/inveniosoftware/invenio-queues/blob/1dd9112d7c5fe72a428c86f21f6d02cdb0595921/invenio_queues/queue.py#L126-L130 |
37,872 | praekelt/django-profile | profile/forms.py | ProfileForm.get_initial | def get_initial(self, *args, **kwargs):
"""
Gathers initial form values from user and profile objects
suitable for using as form's initial data.
"""
initial = {}
for field in self.fields:
value = None
if hasattr(self.user, field):
v... | python | def get_initial(self, *args, **kwargs):
"""
Gathers initial form values from user and profile objects
suitable for using as form's initial data.
"""
initial = {}
for field in self.fields:
value = None
if hasattr(self.user, field):
v... | [
"def",
"get_initial",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"initial",
"=",
"{",
"}",
"for",
"field",
"in",
"self",
".",
"fields",
":",
"value",
"=",
"None",
"if",
"hasattr",
"(",
"self",
".",
"user",
",",
"field",
")"... | Gathers initial form values from user and profile objects
suitable for using as form's initial data. | [
"Gathers",
"initial",
"form",
"values",
"from",
"user",
"and",
"profile",
"objects",
"suitable",
"for",
"using",
"as",
"form",
"s",
"initial",
"data",
"."
] | 52a3d3f7e776742c5333f8fab67b5af3cdbc878b | https://github.com/praekelt/django-profile/blob/52a3d3f7e776742c5333f8fab67b5af3cdbc878b/profile/forms.py#L126-L159 |
37,873 | praekelt/django-profile | profile/forms.py | ProfileForm.save | def save(self, *args, **kwargs):
"""
This method should be called when is_valid is true to save
relevant fields to user and profile models.
"""
for key, value in self.cleaned_data.items():
if value != None:
if hasattr(self.user, key):
... | python | def save(self, *args, **kwargs):
"""
This method should be called when is_valid is true to save
relevant fields to user and profile models.
"""
for key, value in self.cleaned_data.items():
if value != None:
if hasattr(self.user, key):
... | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"cleaned_data",
".",
"items",
"(",
")",
":",
"if",
"value",
"!=",
"None",
":",
"if",
"hasattr",
"(",
"self",
".",
"u... | This method should be called when is_valid is true to save
relevant fields to user and profile models. | [
"This",
"method",
"should",
"be",
"called",
"when",
"is_valid",
"is",
"true",
"to",
"save",
"relevant",
"fields",
"to",
"user",
"and",
"profile",
"models",
"."
] | 52a3d3f7e776742c5333f8fab67b5af3cdbc878b | https://github.com/praekelt/django-profile/blob/52a3d3f7e776742c5333f8fab67b5af3cdbc878b/profile/forms.py#L161-L184 |
37,874 | praekelt/django-profile | profile/forms.py | ProfileForm.clean_username | def clean_username(self):
"""
Validate that the username is alphanumeric and is not already
in use. Don't fail if users username is provided.
"""
user = None
try:
user = User.objects.get(username__iexact=self.\
cleaned_data['username'])
... | python | def clean_username(self):
"""
Validate that the username is alphanumeric and is not already
in use. Don't fail if users username is provided.
"""
user = None
try:
user = User.objects.get(username__iexact=self.\
cleaned_data['username'])
... | [
"def",
"clean_username",
"(",
"self",
")",
":",
"user",
"=",
"None",
"try",
":",
"user",
"=",
"User",
".",
"objects",
".",
"get",
"(",
"username__iexact",
"=",
"self",
".",
"cleaned_data",
"[",
"'username'",
"]",
")",
"except",
"User",
".",
"DoesNotExist... | Validate that the username is alphanumeric and is not already
in use. Don't fail if users username is provided. | [
"Validate",
"that",
"the",
"username",
"is",
"alphanumeric",
"and",
"is",
"not",
"already",
"in",
"use",
".",
"Don",
"t",
"fail",
"if",
"users",
"username",
"is",
"provided",
"."
] | 52a3d3f7e776742c5333f8fab67b5af3cdbc878b | https://github.com/praekelt/django-profile/blob/52a3d3f7e776742c5333f8fab67b5af3cdbc878b/profile/forms.py#L186-L203 |
37,875 | studionow/pybrightcove | pybrightcove/http_core.py | HttpRequest.add_body_part | def add_body_part(self, key, data, mime_type, size=None):
"""Adds data to the HTTP request body.
If more than one part is added, this is assumed to be a mime-multipart
request. This method is designed to create MIME 1.0 requests as specified
in RFC 1341.
Args:
data: str or a file-like obj... | python | def add_body_part(self, key, data, mime_type, size=None):
"""Adds data to the HTTP request body.
If more than one part is added, this is assumed to be a mime-multipart
request. This method is designed to create MIME 1.0 requests as specified
in RFC 1341.
Args:
data: str or a file-like obj... | [
"def",
"add_body_part",
"(",
"self",
",",
"key",
",",
"data",
",",
"mime_type",
",",
"size",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"size",
"=",
"len",
"(",
"data",
")",
"if",
"hasattr",
"(",
"data",
",",
"\... | Adds data to the HTTP request body.
If more than one part is added, this is assumed to be a mime-multipart
request. This method is designed to create MIME 1.0 requests as specified
in RFC 1341.
Args:
data: str or a file-like object containing a part of the request body.
mime_type: str T... | [
"Adds",
"data",
"to",
"the",
"HTTP",
"request",
"body",
".",
"If",
"more",
"than",
"one",
"part",
"is",
"added",
"this",
"is",
"assumed",
"to",
"be",
"a",
"mime",
"-",
"multipart",
"request",
".",
"This",
"method",
"is",
"designed",
"to",
"create",
"MI... | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/http_core.py#L89-L130 |
37,876 | studionow/pybrightcove | pybrightcove/http_core.py | HttpRequest._copy | def _copy(self):
"""Creates a deep copy of this request."""
copied_uri = Uri(self.uri.scheme, self.uri.host, self.uri.port,
self.uri.path, self.uri.query.copy())
new_request = HttpRequest(uri=copied_uri, method=self.method,
headers=self.headers.copy())
... | python | def _copy(self):
"""Creates a deep copy of this request."""
copied_uri = Uri(self.uri.scheme, self.uri.host, self.uri.port,
self.uri.path, self.uri.query.copy())
new_request = HttpRequest(uri=copied_uri, method=self.method,
headers=self.headers.copy())
... | [
"def",
"_copy",
"(",
"self",
")",
":",
"copied_uri",
"=",
"Uri",
"(",
"self",
".",
"uri",
".",
"scheme",
",",
"self",
".",
"uri",
".",
"host",
",",
"self",
".",
"uri",
".",
"port",
",",
"self",
".",
"uri",
".",
"path",
",",
"self",
".",
"uri",
... | Creates a deep copy of this request. | [
"Creates",
"a",
"deep",
"copy",
"of",
"this",
"request",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/http_core.py#L138-L145 |
37,877 | studionow/pybrightcove | pybrightcove/http_core.py | Uri._get_relative_path | def _get_relative_path(self):
"""Returns the path with the query parameters escaped and appended."""
param_string = self._get_query_string()
if self.path is None:
path = '/'
else:
path = self.path
if param_string:
return '?'.join([path, param_string])
else:
return path | python | def _get_relative_path(self):
"""Returns the path with the query parameters escaped and appended."""
param_string = self._get_query_string()
if self.path is None:
path = '/'
else:
path = self.path
if param_string:
return '?'.join([path, param_string])
else:
return path | [
"def",
"_get_relative_path",
"(",
"self",
")",
":",
"param_string",
"=",
"self",
".",
"_get_query_string",
"(",
")",
"if",
"self",
".",
"path",
"is",
"None",
":",
"path",
"=",
"'/'",
"else",
":",
"path",
"=",
"self",
".",
"path",
"if",
"param_string",
... | Returns the path with the query parameters escaped and appended. | [
"Returns",
"the",
"path",
"with",
"the",
"query",
"parameters",
"escaped",
"and",
"appended",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/http_core.py#L194-L204 |
37,878 | studionow/pybrightcove | pybrightcove/http_core.py | Uri.modify_request | def modify_request(self, http_request=None):
"""Sets HTTP request components based on the URI."""
if http_request is None:
http_request = HttpRequest()
if http_request.uri is None:
http_request.uri = Uri()
# Determine the correct scheme.
if self.scheme:
http_request.uri.scheme = se... | python | def modify_request(self, http_request=None):
"""Sets HTTP request components based on the URI."""
if http_request is None:
http_request = HttpRequest()
if http_request.uri is None:
http_request.uri = Uri()
# Determine the correct scheme.
if self.scheme:
http_request.uri.scheme = se... | [
"def",
"modify_request",
"(",
"self",
",",
"http_request",
"=",
"None",
")",
":",
"if",
"http_request",
"is",
"None",
":",
"http_request",
"=",
"HttpRequest",
"(",
")",
"if",
"http_request",
".",
"uri",
"is",
"None",
":",
"http_request",
".",
"uri",
"=",
... | Sets HTTP request components based on the URI. | [
"Sets",
"HTTP",
"request",
"components",
"based",
"on",
"the",
"URI",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/http_core.py#L226-L244 |
37,879 | studionow/pybrightcove | pybrightcove/http_core.py | Uri.parse_uri | def parse_uri(uri_string):
"""Creates a Uri object which corresponds to the URI string.
This method can accept partial URIs, but it will leave missing
members of the Uri unset.
"""
parts = urlparse.urlparse(uri_string)
uri = Uri()
if parts[0]:
uri.scheme = parts[0]
if parts[1]:
... | python | def parse_uri(uri_string):
"""Creates a Uri object which corresponds to the URI string.
This method can accept partial URIs, but it will leave missing
members of the Uri unset.
"""
parts = urlparse.urlparse(uri_string)
uri = Uri()
if parts[0]:
uri.scheme = parts[0]
if parts[1]:
... | [
"def",
"parse_uri",
"(",
"uri_string",
")",
":",
"parts",
"=",
"urlparse",
".",
"urlparse",
"(",
"uri_string",
")",
"uri",
"=",
"Uri",
"(",
")",
"if",
"parts",
"[",
"0",
"]",
":",
"uri",
".",
"scheme",
"=",
"parts",
"[",
"0",
"]",
"if",
"parts",
... | Creates a Uri object which corresponds to the URI string.
This method can accept partial URIs, but it will leave missing
members of the Uri unset. | [
"Creates",
"a",
"Uri",
"object",
"which",
"corresponds",
"to",
"the",
"URI",
"string",
".",
"This",
"method",
"can",
"accept",
"partial",
"URIs",
"but",
"it",
"will",
"leave",
"missing",
"members",
"of",
"the",
"Uri",
"unset",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/http_core.py#L248-L275 |
37,880 | NiklasRosenstein-Python/nr-deprecated | nr/strex.py | Scanner.next | def next(self):
" Move on to the next character in the text. "
char = self.char
if char == '\n':
self.lineno += 1
self.colno = 0
else:
self.colno += 1
self.index += 1
return self.char | python | def next(self):
" Move on to the next character in the text. "
char = self.char
if char == '\n':
self.lineno += 1
self.colno = 0
else:
self.colno += 1
self.index += 1
return self.char | [
"def",
"next",
"(",
"self",
")",
":",
"char",
"=",
"self",
".",
"char",
"if",
"char",
"==",
"'\\n'",
":",
"self",
".",
"lineno",
"+=",
"1",
"self",
".",
"colno",
"=",
"0",
"else",
":",
"self",
".",
"colno",
"+=",
"1",
"self",
".",
"index",
"+="... | Move on to the next character in the text. | [
"Move",
"on",
"to",
"the",
"next",
"character",
"in",
"the",
"text",
"."
] | f9f8b89ea1b084841a8ab65784eaf68852686b2a | https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/strex.py#L188-L198 |
37,881 | NiklasRosenstein-Python/nr-deprecated | nr/strex.py | Scanner.readline | def readline(self):
" Reads a full line from the scanner and returns it. "
start = end = self.index
while end < len(self.text):
if self.text[end] == '\n':
end += 1
break
end += 1
result = self.text[start:end]
self.index = end
if result.endswith('\n'):
self.coln... | python | def readline(self):
" Reads a full line from the scanner and returns it. "
start = end = self.index
while end < len(self.text):
if self.text[end] == '\n':
end += 1
break
end += 1
result = self.text[start:end]
self.index = end
if result.endswith('\n'):
self.coln... | [
"def",
"readline",
"(",
"self",
")",
":",
"start",
"=",
"end",
"=",
"self",
".",
"index",
"while",
"end",
"<",
"len",
"(",
"self",
".",
"text",
")",
":",
"if",
"self",
".",
"text",
"[",
"end",
"]",
"==",
"'\\n'",
":",
"end",
"+=",
"1",
"break",... | Reads a full line from the scanner and returns it. | [
"Reads",
"a",
"full",
"line",
"from",
"the",
"scanner",
"and",
"returns",
"it",
"."
] | f9f8b89ea1b084841a8ab65784eaf68852686b2a | https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/strex.py#L200-L216 |
37,882 | NiklasRosenstein-Python/nr-deprecated | nr/strex.py | Lexer.accept | def accept(self, *names, **kwargs):
"""
Extracts a token of one of the specified rule names and doesn't error if
unsuccessful. Skippable tokens might still be skipped by this method.
# Arguments
names (str): One or more token names that are accepted.
kwargs: Additional keyword arguments for #ne... | python | def accept(self, *names, **kwargs):
"""
Extracts a token of one of the specified rule names and doesn't error if
unsuccessful. Skippable tokens might still be skipped by this method.
# Arguments
names (str): One or more token names that are accepted.
kwargs: Additional keyword arguments for #ne... | [
"def",
"accept",
"(",
"self",
",",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"next",
"(",
"*",
"names",
",",
"as_accept",
"=",
"True",
",",
"*",
"*",
"kwargs",
")"
] | Extracts a token of one of the specified rule names and doesn't error if
unsuccessful. Skippable tokens might still be skipped by this method.
# Arguments
names (str): One or more token names that are accepted.
kwargs: Additional keyword arguments for #next().
# Raises
ValueError: if a rule wi... | [
"Extracts",
"a",
"token",
"of",
"one",
"of",
"the",
"specified",
"rule",
"names",
"and",
"doesn",
"t",
"error",
"if",
"unsuccessful",
".",
"Skippable",
"tokens",
"might",
"still",
"be",
"skipped",
"by",
"this",
"method",
"."
] | f9f8b89ea1b084841a8ab65784eaf68852686b2a | https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/strex.py#L352-L365 |
37,883 | satori-ng/hooker | hooker/event_list.py | EventList.append | def append(self, event, help=""):
"""Creates a new event. `event` may be iterable or string
Args:
event (str): Name of event to declare
Kwrgs:
help (str): Help string for the event
Raises:
TypeError
**Please** describe the event and its cal... | python | def append(self, event, help=""):
"""Creates a new event. `event` may be iterable or string
Args:
event (str): Name of event to declare
Kwrgs:
help (str): Help string for the event
Raises:
TypeError
**Please** describe the event and its cal... | [
"def",
"append",
"(",
"self",
",",
"event",
",",
"help",
"=",
"\"\"",
")",
":",
"if",
"isinstance",
"(",
"event",
",",
"str",
")",
":",
"self",
".",
"_events",
"[",
"event",
"]",
"=",
"HookList",
"(",
"is_waterfall",
"=",
"self",
".",
"is_waterfall",... | Creates a new event. `event` may be iterable or string
Args:
event (str): Name of event to declare
Kwrgs:
help (str): Help string for the event
Raises:
TypeError
**Please** describe the event and its calling arguments in the help
string. | [
"Creates",
"a",
"new",
"event",
".",
"event",
"may",
"be",
"iterable",
"or",
"string"
] | 8ef1fffe1537f06313799d1e5e6f7acc4ab405b4 | https://github.com/satori-ng/hooker/blob/8ef1fffe1537f06313799d1e5e6f7acc4ab405b4/hooker/event_list.py#L16-L44 |
37,884 | satori-ng/hooker | hooker/event_list.py | EventList.hook | def hook(self, function, event, dependencies):
"""Tries to load the hook to the event
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
... | python | def hook(self, function, event, dependencies):
"""Tries to load the hook to the event
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
... | [
"def",
"hook",
"(",
"self",
",",
"function",
",",
"event",
",",
"dependencies",
")",
":",
"# Hooks all events (recursively)",
"if",
"event",
"is",
"None",
":",
"for",
"e",
"in",
"self",
".",
"_events",
".",
"keys",
"(",
")",
":",
"self",
".",
"hook",
"... | Tries to load the hook to the event
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
Raises:
NameError
Note that th... | [
"Tries",
"to",
"load",
"the",
"hook",
"to",
"the",
"event"
] | 8ef1fffe1537f06313799d1e5e6f7acc4ab405b4 | https://github.com/satori-ng/hooker/blob/8ef1fffe1537f06313799d1e5e6f7acc4ab405b4/hooker/event_list.py#L46-L84 |
37,885 | jessamynsmith/paragres | paragres/command.py | Command.print_message | def print_message(self, message, verbosity_needed=1):
""" Prints the message, if verbosity is high enough. """
if self.args.verbosity >= verbosity_needed:
print(message) | python | def print_message(self, message, verbosity_needed=1):
""" Prints the message, if verbosity is high enough. """
if self.args.verbosity >= verbosity_needed:
print(message) | [
"def",
"print_message",
"(",
"self",
",",
"message",
",",
"verbosity_needed",
"=",
"1",
")",
":",
"if",
"self",
".",
"args",
".",
"verbosity",
">=",
"verbosity_needed",
":",
"print",
"(",
"message",
")"
] | Prints the message, if verbosity is high enough. | [
"Prints",
"the",
"message",
"if",
"verbosity",
"is",
"high",
"enough",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L52-L55 |
37,886 | jessamynsmith/paragres | paragres/command.py | Command.error | def error(self, message, code=1):
""" Prints the error, and exits with the given code. """
sys.stderr.write(message)
sys.exit(code) | python | def error(self, message, code=1):
""" Prints the error, and exits with the given code. """
sys.stderr.write(message)
sys.exit(code) | [
"def",
"error",
"(",
"self",
",",
"message",
",",
"code",
"=",
"1",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"message",
")",
"sys",
".",
"exit",
"(",
"code",
")"
] | Prints the error, and exits with the given code. | [
"Prints",
"the",
"error",
"and",
"exits",
"with",
"the",
"given",
"code",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L57-L60 |
37,887 | jessamynsmith/paragres | paragres/command.py | Command.parse_db_settings | def parse_db_settings(self, settings):
""" Parse out database settings from filename or DJANGO_SETTINGS_MODULE. """
if settings == 'DJANGO_SETTINGS_MODULE':
django_settings = os.environ.get('DJANGO_SETTINGS_MODULE')
self.print_message("Getting settings file from DJANGO_SETTINGS_M... | python | def parse_db_settings(self, settings):
""" Parse out database settings from filename or DJANGO_SETTINGS_MODULE. """
if settings == 'DJANGO_SETTINGS_MODULE':
django_settings = os.environ.get('DJANGO_SETTINGS_MODULE')
self.print_message("Getting settings file from DJANGO_SETTINGS_M... | [
"def",
"parse_db_settings",
"(",
"self",
",",
"settings",
")",
":",
"if",
"settings",
"==",
"'DJANGO_SETTINGS_MODULE'",
":",
"django_settings",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'DJANGO_SETTINGS_MODULE'",
")",
"self",
".",
"print_message",
"(",
"\"Get... | Parse out database settings from filename or DJANGO_SETTINGS_MODULE. | [
"Parse",
"out",
"database",
"settings",
"from",
"filename",
"or",
"DJANGO_SETTINGS_MODULE",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L62-L82 |
37,888 | jessamynsmith/paragres | paragres/command.py | Command.initialize_db_args | def initialize_db_args(self, settings, db_key):
""" Initialize connection arguments for postgres commands. """
self.print_message("Initializing database settings for %s" % db_key, verbosity_needed=2)
db_member = self.databases[db_key]
db_name = settings.get('NAME')
if db_name a... | python | def initialize_db_args(self, settings, db_key):
""" Initialize connection arguments for postgres commands. """
self.print_message("Initializing database settings for %s" % db_key, verbosity_needed=2)
db_member = self.databases[db_key]
db_name = settings.get('NAME')
if db_name a... | [
"def",
"initialize_db_args",
"(",
"self",
",",
"settings",
",",
"db_key",
")",
":",
"self",
".",
"print_message",
"(",
"\"Initializing database settings for %s\"",
"%",
"db_key",
",",
"verbosity_needed",
"=",
"2",
")",
"db_member",
"=",
"self",
".",
"databases",
... | Initialize connection arguments for postgres commands. | [
"Initialize",
"connection",
"arguments",
"for",
"postgres",
"commands",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L84-L103 |
37,889 | jessamynsmith/paragres | paragres/command.py | Command.download_file | def download_file(self, url, filename):
""" Download file from url to filename. """
self.print_message("Downloading to file '%s' from URL '%s'" % (filename, url))
try:
db_file = urllib2.urlopen(url)
with open(filename, 'wb') as output:
output.write(db_file... | python | def download_file(self, url, filename):
""" Download file from url to filename. """
self.print_message("Downloading to file '%s' from URL '%s'" % (filename, url))
try:
db_file = urllib2.urlopen(url)
with open(filename, 'wb') as output:
output.write(db_file... | [
"def",
"download_file",
"(",
"self",
",",
"url",
",",
"filename",
")",
":",
"self",
".",
"print_message",
"(",
"\"Downloading to file '%s' from URL '%s'\"",
"%",
"(",
"filename",
",",
"url",
")",
")",
"try",
":",
"db_file",
"=",
"urllib2",
".",
"urlopen",
"(... | Download file from url to filename. | [
"Download",
"file",
"from",
"url",
"to",
"filename",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L115-L125 |
37,890 | jessamynsmith/paragres | paragres/command.py | Command.unzip_file_if_necessary | def unzip_file_if_necessary(self, source_file):
""" Unzip file if zipped. """
if source_file.endswith(".gz"):
self.print_message("Decompressing '%s'" % source_file)
subprocess.check_call(["gunzip", "--force", source_file])
source_file = source_file[:-len(".gz")]
... | python | def unzip_file_if_necessary(self, source_file):
""" Unzip file if zipped. """
if source_file.endswith(".gz"):
self.print_message("Decompressing '%s'" % source_file)
subprocess.check_call(["gunzip", "--force", source_file])
source_file = source_file[:-len(".gz")]
... | [
"def",
"unzip_file_if_necessary",
"(",
"self",
",",
"source_file",
")",
":",
"if",
"source_file",
".",
"endswith",
"(",
"\".gz\"",
")",
":",
"self",
".",
"print_message",
"(",
"\"Decompressing '%s'\"",
"%",
"source_file",
")",
"subprocess",
".",
"check_call",
"(... | Unzip file if zipped. | [
"Unzip",
"file",
"if",
"zipped",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L127-L133 |
37,891 | jessamynsmith/paragres | paragres/command.py | Command.download_file_from_url | def download_file_from_url(self, source_app, url):
""" Download file from source app or url, and return local filename. """
if source_app:
source_name = source_app
else:
source_name = urlparse.urlparse(url).netloc.replace('.', '_')
filename = self.create_file_nam... | python | def download_file_from_url(self, source_app, url):
""" Download file from source app or url, and return local filename. """
if source_app:
source_name = source_app
else:
source_name = urlparse.urlparse(url).netloc.replace('.', '_')
filename = self.create_file_nam... | [
"def",
"download_file_from_url",
"(",
"self",
",",
"source_app",
",",
"url",
")",
":",
"if",
"source_app",
":",
"source_name",
"=",
"source_app",
"else",
":",
"source_name",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
".",
"netloc",
".",
"replace",
... | Download file from source app or url, and return local filename. | [
"Download",
"file",
"from",
"source",
"app",
"or",
"url",
"and",
"return",
"local",
"filename",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L135-L144 |
37,892 | jessamynsmith/paragres | paragres/command.py | Command.dump_database | def dump_database(self):
""" Create dumpfile from postgres database, and return filename. """
db_file = self.create_file_name(self.databases['source']['name'])
self.print_message("Dumping postgres database '%s' to file '%s'"
% (self.databases['source']['name'], db_file... | python | def dump_database(self):
""" Create dumpfile from postgres database, and return filename. """
db_file = self.create_file_name(self.databases['source']['name'])
self.print_message("Dumping postgres database '%s' to file '%s'"
% (self.databases['source']['name'], db_file... | [
"def",
"dump_database",
"(",
"self",
")",
":",
"db_file",
"=",
"self",
".",
"create_file_name",
"(",
"self",
".",
"databases",
"[",
"'source'",
"]",
"[",
"'name'",
"]",
")",
"self",
".",
"print_message",
"(",
"\"Dumping postgres database '%s' to file '%s'\"",
"%... | Create dumpfile from postgres database, and return filename. | [
"Create",
"dumpfile",
"from",
"postgres",
"database",
"and",
"return",
"filename",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L146-L162 |
37,893 | jessamynsmith/paragres | paragres/command.py | Command.drop_database | def drop_database(self):
""" Drop postgres database. """
self.print_message("Dropping database '%s'" % self.databases['destination']['name'])
self.export_pgpassword('destination')
args = [
"dropdb",
"--if-exists",
self.databases['destination']['name'],... | python | def drop_database(self):
""" Drop postgres database. """
self.print_message("Dropping database '%s'" % self.databases['destination']['name'])
self.export_pgpassword('destination')
args = [
"dropdb",
"--if-exists",
self.databases['destination']['name'],... | [
"def",
"drop_database",
"(",
"self",
")",
":",
"self",
".",
"print_message",
"(",
"\"Dropping database '%s'\"",
"%",
"self",
".",
"databases",
"[",
"'destination'",
"]",
"[",
"'name'",
"]",
")",
"self",
".",
"export_pgpassword",
"(",
"'destination'",
")",
"arg... | Drop postgres database. | [
"Drop",
"postgres",
"database",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L164-L174 |
37,894 | jessamynsmith/paragres | paragres/command.py | Command.create_database | def create_database(self):
""" Create postgres database. """
self.print_message("Creating database '%s'" % self.databases['destination']['name'])
self.export_pgpassword('destination')
args = [
"createdb",
self.databases['destination']['name'],
]
ar... | python | def create_database(self):
""" Create postgres database. """
self.print_message("Creating database '%s'" % self.databases['destination']['name'])
self.export_pgpassword('destination')
args = [
"createdb",
self.databases['destination']['name'],
]
ar... | [
"def",
"create_database",
"(",
"self",
")",
":",
"self",
".",
"print_message",
"(",
"\"Creating database '%s'\"",
"%",
"self",
".",
"databases",
"[",
"'destination'",
"]",
"[",
"'name'",
"]",
")",
"self",
".",
"export_pgpassword",
"(",
"'destination'",
")",
"a... | Create postgres database. | [
"Create",
"postgres",
"database",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L176-L188 |
37,895 | jessamynsmith/paragres | paragres/command.py | Command.replace_postgres_db | def replace_postgres_db(self, file_url):
""" Replace postgres database with database from specified source. """
self.print_message("Replacing postgres database")
if file_url:
self.print_message("Sourcing data from online backup file '%s'" % file_url)
source_file = self.d... | python | def replace_postgres_db(self, file_url):
""" Replace postgres database with database from specified source. """
self.print_message("Replacing postgres database")
if file_url:
self.print_message("Sourcing data from online backup file '%s'" % file_url)
source_file = self.d... | [
"def",
"replace_postgres_db",
"(",
"self",
",",
"file_url",
")",
":",
"self",
".",
"print_message",
"(",
"\"Replacing postgres database\"",
")",
"if",
"file_url",
":",
"self",
".",
"print_message",
"(",
"\"Sourcing data from online backup file '%s'\"",
"%",
"file_url",
... | Replace postgres database with database from specified source. | [
"Replace",
"postgres",
"database",
"with",
"database",
"from",
"specified",
"source",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L190-L220 |
37,896 | jessamynsmith/paragres | paragres/command.py | Command.capture_heroku_database | def capture_heroku_database(self):
""" Capture Heroku database backup. """
self.print_message("Capturing database backup for app '%s'" % self.args.source_app)
args = [
"heroku",
"pg:backups:capture",
"--app=%s" % self.args.source_app,
]
if self... | python | def capture_heroku_database(self):
""" Capture Heroku database backup. """
self.print_message("Capturing database backup for app '%s'" % self.args.source_app)
args = [
"heroku",
"pg:backups:capture",
"--app=%s" % self.args.source_app,
]
if self... | [
"def",
"capture_heroku_database",
"(",
"self",
")",
":",
"self",
".",
"print_message",
"(",
"\"Capturing database backup for app '%s'\"",
"%",
"self",
".",
"args",
".",
"source_app",
")",
"args",
"=",
"[",
"\"heroku\"",
",",
"\"pg:backups:capture\"",
",",
"\"--app=%... | Capture Heroku database backup. | [
"Capture",
"Heroku",
"database",
"backup",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L238-L253 |
37,897 | jessamynsmith/paragres | paragres/command.py | Command.reset_heroku_database | def reset_heroku_database(self):
""" Reset Heroku database. """
self.print_message("Resetting database for app '%s'" % self.args.destination_app)
args = [
"heroku",
"pg:reset",
"--app=%s" % self.args.destination_app,
"DATABASE_URL",
]
... | python | def reset_heroku_database(self):
""" Reset Heroku database. """
self.print_message("Resetting database for app '%s'" % self.args.destination_app)
args = [
"heroku",
"pg:reset",
"--app=%s" % self.args.destination_app,
"DATABASE_URL",
]
... | [
"def",
"reset_heroku_database",
"(",
"self",
")",
":",
"self",
".",
"print_message",
"(",
"\"Resetting database for app '%s'\"",
"%",
"self",
".",
"args",
".",
"destination_app",
")",
"args",
"=",
"[",
"\"heroku\"",
",",
"\"pg:reset\"",
",",
"\"--app=%s\"",
"%",
... | Reset Heroku database. | [
"Reset",
"Heroku",
"database",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L255-L264 |
37,898 | jessamynsmith/paragres | paragres/command.py | Command.replace_heroku_db | def replace_heroku_db(self, file_url):
""" Replace Heroku database with database from specified source. """
self.print_message("Replacing database for Heroku app '%s'" % self.args.destination_app)
self.reset_heroku_database()
if file_url:
self.print_message("Restoring from ... | python | def replace_heroku_db(self, file_url):
""" Replace Heroku database with database from specified source. """
self.print_message("Replacing database for Heroku app '%s'" % self.args.destination_app)
self.reset_heroku_database()
if file_url:
self.print_message("Restoring from ... | [
"def",
"replace_heroku_db",
"(",
"self",
",",
"file_url",
")",
":",
"self",
".",
"print_message",
"(",
"\"Replacing database for Heroku app '%s'\"",
"%",
"self",
".",
"args",
".",
"destination_app",
")",
"self",
".",
"reset_heroku_database",
"(",
")",
"if",
"file_... | Replace Heroku database with database from specified source. | [
"Replace",
"Heroku",
"database",
"with",
"database",
"from",
"specified",
"source",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L266-L307 |
37,899 | jessamynsmith/paragres | paragres/command.py | Command.run | def run(self):
""" Replace a database with the data from the specified source. """
self.print_message("\nBeginning database replacement process.\n")
if self.args.source_settings:
settings = self.parse_db_settings(self.args.source_settings)
self.initialize_db_args(setting... | python | def run(self):
""" Replace a database with the data from the specified source. """
self.print_message("\nBeginning database replacement process.\n")
if self.args.source_settings:
settings = self.parse_db_settings(self.args.source_settings)
self.initialize_db_args(setting... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"print_message",
"(",
"\"\\nBeginning database replacement process.\\n\"",
")",
"if",
"self",
".",
"args",
".",
"source_settings",
":",
"settings",
"=",
"self",
".",
"parse_db_settings",
"(",
"self",
".",
"args",... | Replace a database with the data from the specified source. | [
"Replace",
"a",
"database",
"with",
"the",
"data",
"from",
"the",
"specified",
"source",
"."
] | 4e068cbfcafbe8f1b010741d38fb65d40de2c6aa | https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L309-L335 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.