repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
suds-community/suds | suds/mx/literal.py | Typed.encode | def encode(self, node, content):
"""
Add (SOAP) encoding information if needed.
The encoding information is added only if the resolved type is derived
by extension. Furthermore, the xsi:type value is qualified by namespace
only if the content (tag) and referenced type are in dif... | python | def encode(self, node, content):
"""
Add (SOAP) encoding information if needed.
The encoding information is added only if the resolved type is derived
by extension. Furthermore, the xsi:type value is qualified by namespace
only if the content (tag) and referenced type are in dif... | [
"def",
"encode",
"(",
"self",
",",
"node",
",",
"content",
")",
":",
"if",
"content",
".",
"type",
".",
"any",
"(",
")",
":",
"return",
"if",
"not",
"content",
".",
"real",
".",
"extension",
"(",
")",
":",
"return",
"if",
"content",
".",
"type",
... | Add (SOAP) encoding information if needed.
The encoding information is added only if the resolved type is derived
by extension. Furthermore, the xsi:type value is qualified by namespace
only if the content (tag) and referenced type are in different
namespaces. | [
"Add",
"(",
"SOAP",
")",
"encoding",
"information",
"if",
"needed",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/mx/literal.py#L185-L205 |
suds-community/suds | suds/mx/literal.py | Typed.skip | def skip(self, content):
"""
Get whether to skip this I{content}.
Should be skipped when the content is optional and value is either None
or an empty list.
@param content: Content to skip.
@type content: L{Object}
@return: True if content is to be skipped.
... | python | def skip(self, content):
"""
Get whether to skip this I{content}.
Should be skipped when the content is optional and value is either None
or an empty list.
@param content: Content to skip.
@type content: L{Object}
@return: True if content is to be skipped.
... | [
"def",
"skip",
"(",
"self",
",",
"content",
")",
":",
"if",
"self",
".",
"optional",
"(",
"content",
")",
":",
"v",
"=",
"content",
".",
"value",
"if",
"v",
"is",
"None",
":",
"return",
"True",
"if",
"isinstance",
"(",
"v",
",",
"(",
"list",
",",... | Get whether to skip this I{content}.
Should be skipped when the content is optional and value is either None
or an empty list.
@param content: Content to skip.
@type content: L{Object}
@return: True if content is to be skipped.
@rtype: bool | [
"Get",
"whether",
"to",
"skip",
"this",
"I",
"{",
"content",
"}",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/mx/literal.py#L207-L226 |
suds-community/suds | tools/suds_devel/egg.py | _detect_eggs_in_folder | def _detect_eggs_in_folder(folder):
"""
Detect egg distributions located in the given folder.
Only direct folder content is considered and subfolders are not searched
recursively.
"""
eggs = {}
for x in os.listdir(folder):
zip = x.endswith(_zip_ext)
if zip:
... | python | def _detect_eggs_in_folder(folder):
"""
Detect egg distributions located in the given folder.
Only direct folder content is considered and subfolders are not searched
recursively.
"""
eggs = {}
for x in os.listdir(folder):
zip = x.endswith(_zip_ext)
if zip:
... | [
"def",
"_detect_eggs_in_folder",
"(",
"folder",
")",
":",
"eggs",
"=",
"{",
"}",
"for",
"x",
"in",
"os",
".",
"listdir",
"(",
"folder",
")",
":",
"zip",
"=",
"x",
".",
"endswith",
"(",
"_zip_ext",
")",
"if",
"zip",
":",
"root",
"=",
"x",
"[",
":"... | Detect egg distributions located in the given folder.
Only direct folder content is considered and subfolders are not searched
recursively. | [
"Detect",
"egg",
"distributions",
"located",
"in",
"the",
"given",
"folder",
".",
"Only",
"direct",
"folder",
"content",
"is",
"considered",
"and",
"subfolders",
"are",
"not",
"searched",
"recursively",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/tools/suds_devel/egg.py#L144-L175 |
suds-community/suds | tools/suds_devel/egg.py | _Egg.normalize | def normalize(self):
"""
Makes sure this egg distribution is stored only as an egg file.
The egg file will be created from another existing distribution format
if needed.
"""
if self.has_egg_file():
if self.has_zip():
self.__remove_... | python | def normalize(self):
"""
Makes sure this egg distribution is stored only as an egg file.
The egg file will be created from another existing distribution format
if needed.
"""
if self.has_egg_file():
if self.has_zip():
self.__remove_... | [
"def",
"normalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_egg_file",
"(",
")",
":",
"if",
"self",
".",
"has_zip",
"(",
")",
":",
"self",
".",
"__remove_zip",
"(",
")",
"else",
":",
"if",
"self",
".",
"has_egg_folder",
"(",
")",
":",
"if",
... | Makes sure this egg distribution is stored only as an egg file.
The egg file will be created from another existing distribution format
if needed. | [
"Makes",
"sure",
"this",
"egg",
"distribution",
"is",
"stored",
"only",
"as",
"an",
"egg",
"file",
".",
"The",
"egg",
"file",
"will",
"be",
"created",
"from",
"another",
"existing",
"distribution",
"format",
"if",
"needed",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/tools/suds_devel/egg.py#L85-L101 |
suds-community/suds | suds/argparser.py | parse_args | def parse_args(method_name, param_defs, args, kwargs, external_param_processor,
extra_parameter_errors):
"""
Parse arguments for suds web service operation invocation functions.
Suds prepares Python function objects for invoking web service operations.
This function implements generic binding agnos... | python | def parse_args(method_name, param_defs, args, kwargs, external_param_processor,
extra_parameter_errors):
"""
Parse arguments for suds web service operation invocation functions.
Suds prepares Python function objects for invoking web service operations.
This function implements generic binding agnos... | [
"def",
"parse_args",
"(",
"method_name",
",",
"param_defs",
",",
"args",
",",
"kwargs",
",",
"external_param_processor",
",",
"extra_parameter_errors",
")",
":",
"arg_parser",
"=",
"_ArgParser",
"(",
"method_name",
",",
"param_defs",
",",
"external_param_processor",
... | Parse arguments for suds web service operation invocation functions.
Suds prepares Python function objects for invoking web service operations.
This function implements generic binding agnostic part of processing the
arguments passed when calling those function objects.
Argument parsing rules:
*... | [
"Parse",
"arguments",
"for",
"suds",
"web",
"service",
"operation",
"invocation",
"functions",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L29-L83 |
suds-community/suds | suds/argparser.py | _ArgParser.__all_parameters_processed | def __all_parameters_processed(self):
"""
Finish the argument processing.
Should be called after all the web service operation's parameters have
been successfully processed and, afterwards, no further parameter
processing is allowed.
Returns a 2-tuple containing the num... | python | def __all_parameters_processed(self):
"""
Finish the argument processing.
Should be called after all the web service operation's parameters have
been successfully processed and, afterwards, no further parameter
processing is allowed.
Returns a 2-tuple containing the num... | [
"def",
"__all_parameters_processed",
"(",
"self",
")",
":",
"assert",
"self",
".",
"active",
"(",
")",
"sentinel_frame",
"=",
"self",
".",
"__stack",
"[",
"0",
"]",
"self",
".",
"__pop_frames_above",
"(",
"sentinel_frame",
")",
"assert",
"len",
"(",
"self",
... | Finish the argument processing.
Should be called after all the web service operation's parameters have
been successfully processed and, afterwards, no further parameter
processing is allowed.
Returns a 2-tuple containing the number of required & allowed
arguments.
See ... | [
"Finish",
"the",
"argument",
"processing",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L124-L147 |
suds-community/suds | suds/argparser.py | _ArgParser.__check_for_extra_arguments | def __check_for_extra_arguments(self, args_required, args_allowed):
"""
Report an error in case any extra arguments are detected.
Does nothing if reporting extra arguments as exceptions has not been
enabled.
May only be called after the argument processing has been completed.
... | python | def __check_for_extra_arguments(self, args_required, args_allowed):
"""
Report an error in case any extra arguments are detected.
Does nothing if reporting extra arguments as exceptions has not been
enabled.
May only be called after the argument processing has been completed.
... | [
"def",
"__check_for_extra_arguments",
"(",
"self",
",",
"args_required",
",",
"args_allowed",
")",
":",
"assert",
"not",
"self",
".",
"active",
"(",
")",
"if",
"not",
"self",
".",
"__extra_parameter_errors",
":",
"return",
"if",
"self",
".",
"__kwargs",
":",
... | Report an error in case any extra arguments are detected.
Does nothing if reporting extra arguments as exceptions has not been
enabled.
May only be called after the argument processing has been completed. | [
"Report",
"an",
"error",
"in",
"case",
"any",
"extra",
"arguments",
"are",
"detected",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L149-L187 |
suds-community/suds | suds/argparser.py | _ArgParser.__frame_factory | def __frame_factory(self, ancestry_item):
"""Construct a new frame representing the given ancestry item."""
frame_class = Frame
if ancestry_item is not None and ancestry_item.choice():
frame_class = ChoiceFrame
return frame_class(ancestry_item, self.__error,
self.... | python | def __frame_factory(self, ancestry_item):
"""Construct a new frame representing the given ancestry item."""
frame_class = Frame
if ancestry_item is not None and ancestry_item.choice():
frame_class = ChoiceFrame
return frame_class(ancestry_item, self.__error,
self.... | [
"def",
"__frame_factory",
"(",
"self",
",",
"ancestry_item",
")",
":",
"frame_class",
"=",
"Frame",
"if",
"ancestry_item",
"is",
"not",
"None",
"and",
"ancestry_item",
".",
"choice",
"(",
")",
":",
"frame_class",
"=",
"ChoiceFrame",
"return",
"frame_class",
"(... | Construct a new frame representing the given ancestry item. | [
"Construct",
"a",
"new",
"frame",
"representing",
"the",
"given",
"ancestry",
"item",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L198-L204 |
suds-community/suds | suds/argparser.py | _ArgParser.__get_param_value | def __get_param_value(self, name):
"""
Extract a parameter value from the remaining given arguments.
Returns a 2-tuple consisting of the following:
* Boolean indicating whether an argument has been specified for the
requested input parameter.
* Parameter value.
... | python | def __get_param_value(self, name):
"""
Extract a parameter value from the remaining given arguments.
Returns a 2-tuple consisting of the following:
* Boolean indicating whether an argument has been specified for the
requested input parameter.
* Parameter value.
... | [
"def",
"__get_param_value",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"__args",
":",
"return",
"True",
",",
"self",
".",
"__args",
".",
"pop",
"(",
"0",
")",
"try",
":",
"value",
"=",
"self",
".",
"__kwargs",
".",
"pop",
"(",
"name",
... | Extract a parameter value from the remaining given arguments.
Returns a 2-tuple consisting of the following:
* Boolean indicating whether an argument has been specified for the
requested input parameter.
* Parameter value. | [
"Extract",
"a",
"parameter",
"value",
"from",
"the",
"remaining",
"given",
"arguments",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L206-L222 |
suds-community/suds | suds/argparser.py | _ArgParser.__in_choice_context | def __in_choice_context(self):
"""
Whether we are currently processing a choice parameter group.
This includes processing a parameter defined directly or indirectly
within such a group.
May only be called during parameter processing or the result will be
calculated base... | python | def __in_choice_context(self):
"""
Whether we are currently processing a choice parameter group.
This includes processing a parameter defined directly or indirectly
within such a group.
May only be called during parameter processing or the result will be
calculated base... | [
"def",
"__in_choice_context",
"(",
"self",
")",
":",
"for",
"x",
"in",
"self",
".",
"__stack",
":",
"if",
"x",
".",
"__class__",
"is",
"ChoiceFrame",
":",
"return",
"True",
"return",
"False"
] | Whether we are currently processing a choice parameter group.
This includes processing a parameter defined directly or indirectly
within such a group.
May only be called during parameter processing or the result will be
calculated based on the context left behind by the previous parame... | [
"Whether",
"we",
"are",
"currently",
"processing",
"a",
"choice",
"parameter",
"group",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L224-L239 |
suds-community/suds | suds/argparser.py | _ArgParser.__init_run | def __init_run(self, args, kwargs, extra_parameter_errors):
"""Initializes data for a new argument parsing run."""
assert not self.active()
self.__args = list(args)
self.__kwargs = dict(kwargs)
self.__extra_parameter_errors = extra_parameter_errors
self.__args_count = len... | python | def __init_run(self, args, kwargs, extra_parameter_errors):
"""Initializes data for a new argument parsing run."""
assert not self.active()
self.__args = list(args)
self.__kwargs = dict(kwargs)
self.__extra_parameter_errors = extra_parameter_errors
self.__args_count = len... | [
"def",
"__init_run",
"(",
"self",
",",
"args",
",",
"kwargs",
",",
"extra_parameter_errors",
")",
":",
"assert",
"not",
"self",
".",
"active",
"(",
")",
"self",
".",
"__args",
"=",
"list",
"(",
"args",
")",
"self",
".",
"__kwargs",
"=",
"dict",
"(",
... | Initializes data for a new argument parsing run. | [
"Initializes",
"data",
"for",
"a",
"new",
"argument",
"parsing",
"run",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L241-L250 |
suds-community/suds | suds/argparser.py | _ArgParser.__match_ancestry | def __match_ancestry(self, ancestry):
"""
Find frames matching the given ancestry.
Returns a tuple containing the following:
* Topmost frame matching the given ancestry or the bottom-most sentry
frame if no frame matches.
* Unmatched ancestry part.
"""
... | python | def __match_ancestry(self, ancestry):
"""
Find frames matching the given ancestry.
Returns a tuple containing the following:
* Topmost frame matching the given ancestry or the bottom-most sentry
frame if no frame matches.
* Unmatched ancestry part.
"""
... | [
"def",
"__match_ancestry",
"(",
"self",
",",
"ancestry",
")",
":",
"stack",
"=",
"self",
".",
"__stack",
"if",
"len",
"(",
"stack",
")",
"==",
"1",
":",
"return",
"stack",
"[",
"0",
"]",
",",
"ancestry",
"previous",
"=",
"stack",
"[",
"0",
"]",
"fo... | Find frames matching the given ancestry.
Returns a tuple containing the following:
* Topmost frame matching the given ancestry or the bottom-most sentry
frame if no frame matches.
* Unmatched ancestry part. | [
"Find",
"frames",
"matching",
"the",
"given",
"ancestry",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L252-L270 |
suds-community/suds | suds/argparser.py | _ArgParser.__pop_frames_above | def __pop_frames_above(self, frame):
"""Pops all the frames above, but not including the given frame."""
while self.__stack[-1] is not frame:
self.__pop_top_frame()
assert self.__stack | python | def __pop_frames_above(self, frame):
"""Pops all the frames above, but not including the given frame."""
while self.__stack[-1] is not frame:
self.__pop_top_frame()
assert self.__stack | [
"def",
"__pop_frames_above",
"(",
"self",
",",
"frame",
")",
":",
"while",
"self",
".",
"__stack",
"[",
"-",
"1",
"]",
"is",
"not",
"frame",
":",
"self",
".",
"__pop_top_frame",
"(",
")",
"assert",
"self",
".",
"__stack"
] | Pops all the frames above, but not including the given frame. | [
"Pops",
"all",
"the",
"frames",
"above",
"but",
"not",
"including",
"the",
"given",
"frame",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L272-L276 |
suds-community/suds | suds/argparser.py | _ArgParser.__pop_top_frame | def __pop_top_frame(self):
"""Pops the top frame off the frame stack."""
popped = self.__stack.pop()
if self.__stack:
self.__stack[-1].process_subframe(popped) | python | def __pop_top_frame(self):
"""Pops the top frame off the frame stack."""
popped = self.__stack.pop()
if self.__stack:
self.__stack[-1].process_subframe(popped) | [
"def",
"__pop_top_frame",
"(",
"self",
")",
":",
"popped",
"=",
"self",
".",
"__stack",
".",
"pop",
"(",
")",
"if",
"self",
".",
"__stack",
":",
"self",
".",
"__stack",
"[",
"-",
"1",
"]",
".",
"process_subframe",
"(",
"popped",
")"
] | Pops the top frame off the frame stack. | [
"Pops",
"the",
"top",
"frame",
"off",
"the",
"frame",
"stack",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L278-L282 |
suds-community/suds | suds/argparser.py | _ArgParser.__process_parameter | def __process_parameter(self, param_name, param_type, ancestry=None):
"""Collect values for a given web service operation input parameter."""
assert self.active()
param_optional = param_type.optional()
has_argument, value = self.__get_param_value(param_name)
if has_argument:
... | python | def __process_parameter(self, param_name, param_type, ancestry=None):
"""Collect values for a given web service operation input parameter."""
assert self.active()
param_optional = param_type.optional()
has_argument, value = self.__get_param_value(param_name)
if has_argument:
... | [
"def",
"__process_parameter",
"(",
"self",
",",
"param_name",
",",
"param_type",
",",
"ancestry",
"=",
"None",
")",
":",
"assert",
"self",
".",
"active",
"(",
")",
"param_optional",
"=",
"param_type",
".",
"optional",
"(",
")",
"has_argument",
",",
"value",
... | Collect values for a given web service operation input parameter. | [
"Collect",
"values",
"for",
"a",
"given",
"web",
"service",
"operation",
"input",
"parameter",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L284-L294 |
suds-community/suds | suds/argparser.py | _ArgParser.__push_frame | def __push_frame(self, ancestry_item):
"""Push a new frame on top of the frame stack."""
frame = self.__frame_factory(ancestry_item)
self.__stack.append(frame) | python | def __push_frame(self, ancestry_item):
"""Push a new frame on top of the frame stack."""
frame = self.__frame_factory(ancestry_item)
self.__stack.append(frame) | [
"def",
"__push_frame",
"(",
"self",
",",
"ancestry_item",
")",
":",
"frame",
"=",
"self",
".",
"__frame_factory",
"(",
"ancestry_item",
")",
"self",
".",
"__stack",
".",
"append",
"(",
"frame",
")"
] | Push a new frame on top of the frame stack. | [
"Push",
"a",
"new",
"frame",
"on",
"top",
"of",
"the",
"frame",
"stack",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/argparser.py#L301-L304 |
suds-community/suds | suds/store.py | DocumentStore.open | def open(self, url):
"""
Open a document at the specified URL.
The document URL's needs not contain a protocol identifier, and if it
does, that protocol identifier is ignored when looking up the store
content.
Missing documents referenced using the internal 'suds' proto... | python | def open(self, url):
"""
Open a document at the specified URL.
The document URL's needs not contain a protocol identifier, and if it
does, that protocol identifier is ignored when looking up the store
content.
Missing documents referenced using the internal 'suds' proto... | [
"def",
"open",
"(",
"self",
",",
"url",
")",
":",
"protocol",
",",
"location",
"=",
"self",
".",
"__split",
"(",
"url",
")",
"content",
"=",
"self",
".",
"__find",
"(",
"location",
")",
"if",
"protocol",
"==",
"'suds'",
"and",
"content",
"is",
"None"... | Open a document at the specified URL.
The document URL's needs not contain a protocol identifier, and if it
does, that protocol identifier is ignored when looking up the store
content.
Missing documents referenced using the internal 'suds' protocol are
reported by raising an ex... | [
"Open",
"a",
"document",
"at",
"the",
"specified",
"URL",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/store.py#L548-L570 |
suds-community/suds | setup.py | read_python_code | def read_python_code(filename):
"Returns the given Python source file's compiled content."
file = open(filename, "rt")
try:
source = file.read()
finally:
file.close()
# Python 2.6 and below did not support passing strings to exec() &
# compile() functions containing line separato... | python | def read_python_code(filename):
"Returns the given Python source file's compiled content."
file = open(filename, "rt")
try:
source = file.read()
finally:
file.close()
# Python 2.6 and below did not support passing strings to exec() &
# compile() functions containing line separato... | [
"def",
"read_python_code",
"(",
"filename",
")",
":",
"file",
"=",
"open",
"(",
"filename",
",",
"\"rt\"",
")",
"try",
":",
"source",
"=",
"file",
".",
"read",
"(",
")",
"finally",
":",
"file",
".",
"close",
"(",
")",
"# Python 2.6 and below did not suppor... | Returns the given Python source file's compiled content. | [
"Returns",
"the",
"given",
"Python",
"source",
"file",
"s",
"compiled",
"content",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/setup.py#L309-L322 |
suds-community/suds | setup.py | recursive_package_list | def recursive_package_list(*packages):
"""
Returns a list of all the given packages and all their subpackages.
Given packages are expected to be found relative to this script's location.
Subpackages are detected by scanning the given packages' subfolder
hierarchy for any folders containing the '__... | python | def recursive_package_list(*packages):
"""
Returns a list of all the given packages and all their subpackages.
Given packages are expected to be found relative to this script's location.
Subpackages are detected by scanning the given packages' subfolder
hierarchy for any folders containing the '__... | [
"def",
"recursive_package_list",
"(",
"*",
"packages",
")",
":",
"result",
"=",
"set",
"(",
")",
"todo",
"=",
"[",
"]",
"for",
"package",
"in",
"packages",
":",
"folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"script_folder",
",",
"*",
"package",
... | Returns a list of all the given packages and all their subpackages.
Given packages are expected to be found relative to this script's location.
Subpackages are detected by scanning the given packages' subfolder
hierarchy for any folders containing the '__init__.py' module. As a
consequence, namespace ... | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"given",
"packages",
"and",
"all",
"their",
"subpackages",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/setup.py#L324-L356 |
suds-community/suds | suds/xsd/sxbase.py | SchemaObject.multi_occurrence | def multi_occurrence(self):
"""
Get whether the node has multiple occurrences, i.e. is a I{collection}.
@return: True if it has, False if it has at most 1 occurrence.
@rtype: boolean
"""
max = self.max
if max is None:
return False
if max.isdi... | python | def multi_occurrence(self):
"""
Get whether the node has multiple occurrences, i.e. is a I{collection}.
@return: True if it has, False if it has at most 1 occurrence.
@rtype: boolean
"""
max = self.max
if max is None:
return False
if max.isdi... | [
"def",
"multi_occurrence",
"(",
"self",
")",
":",
"max",
"=",
"self",
".",
"max",
"if",
"max",
"is",
"None",
":",
"return",
"False",
"if",
"max",
".",
"isdigit",
"(",
")",
":",
"return",
"int",
"(",
"max",
")",
">",
"1",
"return",
"max",
"==",
"\... | Get whether the node has multiple occurrences, i.e. is a I{collection}.
@return: True if it has, False if it has at most 1 occurrence.
@rtype: boolean | [
"Get",
"whether",
"the",
"node",
"has",
"multiple",
"occurrences",
"i",
".",
"e",
".",
"is",
"a",
"I",
"{",
"collection",
"}",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbase.py#L189-L202 |
suds-community/suds | suds/xsd/sxbase.py | SchemaObject.find | def find(self, qref, classes=[], ignore=None):
"""
Find a referenced type in self or children. Return None if not found.
Qualified references for all schema objects checked in this search will
be added to the set of ignored qualified references to avoid the find
operation going ... | python | def find(self, qref, classes=[], ignore=None):
"""
Find a referenced type in self or children. Return None if not found.
Qualified references for all schema objects checked in this search will
be added to the set of ignored qualified references to avoid the find
operation going ... | [
"def",
"find",
"(",
"self",
",",
"qref",
",",
"classes",
"=",
"[",
"]",
",",
"ignore",
"=",
"None",
")",
":",
"if",
"not",
"len",
"(",
"classes",
")",
":",
"classes",
"=",
"(",
"self",
".",
"__class__",
",",
")",
"if",
"ignore",
"is",
"None",
"... | Find a referenced type in self or children. Return None if not found.
Qualified references for all schema objects checked in this search will
be added to the set of ignored qualified references to avoid the find
operation going into an infinite loop in case of recursively defined
struct... | [
"Find",
"a",
"referenced",
"type",
"in",
"self",
"or",
"children",
".",
"Return",
"None",
"if",
"not",
"found",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbase.py#L342-L374 |
suds-community/suds | suds/xsd/sxbase.py | Iter.next | def next(self):
"""
Get the next item.
@return: A tuple: the next (child, ancestry).
@rtype: (L{SchemaObject}, [L{SchemaObject},..])
@raise StopIteration: A the end.
"""
frame = self.top()
while True:
result = frame.next()
if resu... | python | def next(self):
"""
Get the next item.
@return: A tuple: the next (child, ancestry).
@rtype: (L{SchemaObject}, [L{SchemaObject},..])
@raise StopIteration: A the end.
"""
frame = self.top()
while True:
result = frame.next()
if resu... | [
"def",
"next",
"(",
"self",
")",
":",
"frame",
"=",
"self",
".",
"top",
"(",
")",
"while",
"True",
":",
"result",
"=",
"frame",
".",
"next",
"(",
")",
"if",
"result",
"is",
"None",
":",
"self",
".",
"pop",
"(",
")",
"return",
"self",
".",
"next... | Get the next item.
@return: A tuple: the next (child, ancestry).
@rtype: (L{SchemaObject}, [L{SchemaObject},..])
@raise StopIteration: A the end. | [
"Get",
"the",
"next",
"item",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbase.py#L657-L676 |
suds-community/suds | suds/mx/core.py | Core.process | def process(self, content):
"""
Process (marshal) the tag with the specified value using the
optional type information.
@param content: The content to process.
@type content: L{Object}
"""
log.debug('processing:\n%s', content)
self.reset()
if conte... | python | def process(self, content):
"""
Process (marshal) the tag with the specified value using the
optional type information.
@param content: The content to process.
@type content: L{Object}
"""
log.debug('processing:\n%s', content)
self.reset()
if conte... | [
"def",
"process",
"(",
"self",
",",
"content",
")",
":",
"log",
".",
"debug",
"(",
"'processing:\\n%s'",
",",
"content",
")",
"self",
".",
"reset",
"(",
")",
"if",
"content",
".",
"tag",
"is",
"None",
":",
"content",
".",
"tag",
"=",
"content",
".",
... | Process (marshal) the tag with the specified value using the
optional type information.
@param content: The content to process.
@type content: L{Object} | [
"Process",
"(",
"marshal",
")",
"the",
"tag",
"with",
"the",
"specified",
"value",
"using",
"the",
"optional",
"type",
"information",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/mx/core.py#L43-L56 |
suds-community/suds | suds/servicedefinition.py | ServiceDefinition.getprefixes | def getprefixes(self):
"""Add prefixes for each namespace referenced by parameter types."""
namespaces = []
for l in (self.params, self.types):
for t,r in l:
ns = r.namespace()
if ns[1] is None: continue
if ns[1] in namespaces: continue... | python | def getprefixes(self):
"""Add prefixes for each namespace referenced by parameter types."""
namespaces = []
for l in (self.params, self.types):
for t,r in l:
ns = r.namespace()
if ns[1] is None: continue
if ns[1] in namespaces: continue... | [
"def",
"getprefixes",
"(",
"self",
")",
":",
"namespaces",
"=",
"[",
"]",
"for",
"l",
"in",
"(",
"self",
".",
"params",
",",
"self",
".",
"types",
")",
":",
"for",
"t",
",",
"r",
"in",
"l",
":",
"ns",
"=",
"r",
".",
"namespace",
"(",
")",
"if... | Add prefixes for each namespace referenced by parameter types. | [
"Add",
"prefixes",
"for",
"each",
"namespace",
"referenced",
"by",
"parameter",
"types",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/servicedefinition.py#L107-L128 |
suds-community/suds | suds/servicedefinition.py | ServiceDefinition.xlate | def xlate(self, type):
"""
Get a (namespace) translated I{qualified} name for specified type.
@param type: A schema type.
@type type: I{suds.xsd.sxbasic.SchemaObject}
@return: A translated I{qualified} name.
@rtype: str
"""
resolved = type.resolve()
... | python | def xlate(self, type):
"""
Get a (namespace) translated I{qualified} name for specified type.
@param type: A schema type.
@type type: I{suds.xsd.sxbasic.SchemaObject}
@return: A translated I{qualified} name.
@rtype: str
"""
resolved = type.resolve()
... | [
"def",
"xlate",
"(",
"self",
",",
"type",
")",
":",
"resolved",
"=",
"type",
".",
"resolve",
"(",
")",
"name",
"=",
"resolved",
".",
"name",
"if",
"type",
".",
"multi_occurrence",
"(",
")",
":",
"name",
"+=",
"'[]'",
"ns",
"=",
"resolved",
".",
"na... | Get a (namespace) translated I{qualified} name for specified type.
@param type: A schema type.
@type type: I{suds.xsd.sxbasic.SchemaObject}
@return: A translated I{qualified} name.
@rtype: str | [
"Get",
"a",
"(",
"namespace",
")",
"translated",
"I",
"{",
"qualified",
"}",
"name",
"for",
"specified",
"type",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/servicedefinition.py#L176-L192 |
suds-community/suds | suds/servicedefinition.py | ServiceDefinition.description | def description(self):
"""
Get a textual description of the service for which this object represents.
@return: A textual description.
@rtype: str
"""
s = []
indent = (lambda n : '\n%*s'%(n*3,' '))
s.append('Service ( %s ) tns="%s"' % (self.service.name, s... | python | def description(self):
"""
Get a textual description of the service for which this object represents.
@return: A textual description.
@rtype: str
"""
s = []
indent = (lambda n : '\n%*s'%(n*3,' '))
s.append('Service ( %s ) tns="%s"' % (self.service.name, s... | [
"def",
"description",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"indent",
"=",
"(",
"lambda",
"n",
":",
"'\\n%*s'",
"%",
"(",
"n",
"*",
"3",
",",
"' '",
")",
")",
"s",
".",
"append",
"(",
"'Service ( %s ) tns=\"%s\"'",
"%",
"(",
"self",
".",
"se... | Get a textual description of the service for which this object represents.
@return: A textual description.
@rtype: str | [
"Get",
"a",
"textual",
"description",
"of",
"the",
"service",
"for",
"which",
"this",
"object",
"represents",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/servicedefinition.py#L194-L233 |
suds-community/suds | suds/sax/document.py | Document.append | def append(self, node):
"""
Append (set) the document root.
@param node: A root L{Element} or name used to build
the document root element.
@type node: (L{Element}|str|None)
"""
if isinstance(node, basestring):
self.__root = Element(node)
... | python | def append(self, node):
"""
Append (set) the document root.
@param node: A root L{Element} or name used to build
the document root element.
@type node: (L{Element}|str|None)
"""
if isinstance(node, basestring):
self.__root = Element(node)
... | [
"def",
"append",
"(",
"self",
",",
"node",
")",
":",
"if",
"isinstance",
"(",
"node",
",",
"basestring",
")",
":",
"self",
".",
"__root",
"=",
"Element",
"(",
"node",
")",
"return",
"if",
"isinstance",
"(",
"node",
",",
"Element",
")",
":",
"self",
... | Append (set) the document root.
@param node: A root L{Element} or name used to build
the document root element.
@type node: (L{Element}|str|None) | [
"Append",
"(",
"set",
")",
"the",
"document",
"root",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L48-L60 |
suds-community/suds | suds/sax/document.py | Document.getChild | def getChild(self, name, ns=None, default=None):
"""
Get a child by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: (I{pr... | python | def getChild(self, name, ns=None, default=None):
"""
Get a child by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: (I{pr... | [
"def",
"getChild",
"(",
"self",
",",
"name",
",",
"ns",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"if",
"self",
".",
"__root",
"is",
"None",
":",
"return",
"default",
"if",
"ns",
"is",
"None",
":",
"prefix",
",",
"name",
"=",
"splitPrefix... | Get a child by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: (I{prefix}, I{name})
@param default: Returned when child not-found... | [
"Get",
"a",
"child",
"by",
"(",
"optional",
")",
"name",
"and",
"/",
"or",
"(",
"optional",
")",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L62-L85 |
suds-community/suds | suds/sax/document.py | Document.childAtPath | def childAtPath(self, path):
"""
Get a child at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The leaf node at the end of I{path}
... | python | def childAtPath(self, path):
"""
Get a child at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The leaf node at the end of I{path}
... | [
"def",
"childAtPath",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"__root",
"is",
"None",
":",
"return",
"None",
"if",
"path",
"[",
"0",
"]",
"==",
"'/'",
":",
"path",
"=",
"path",
"[",
"1",
":",
"]",
"path",
"=",
"path",
".",
"split... | Get a child at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The leaf node at the end of I{path}
@rtype: L{Element} | [
"Get",
"a",
"child",
"at",
"I",
"{",
"path",
"}",
"where",
"I",
"{",
"path",
"}",
"is",
"a",
"(",
"/",
")",
"separated",
"list",
"of",
"element",
"names",
"that",
"are",
"expected",
"to",
"be",
"children",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L87-L106 |
suds-community/suds | suds/sax/document.py | Document.childrenAtPath | def childrenAtPath(self, path):
"""
Get a list of children at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The collection leaf nodes at ... | python | def childrenAtPath(self, path):
"""
Get a list of children at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The collection leaf nodes at ... | [
"def",
"childrenAtPath",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"__root",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"path",
"[",
"0",
"]",
"==",
"'/'",
":",
"path",
"=",
"path",
"[",
"1",
":",
"]",
"path",
"=",
"path",
".",
... | Get a list of children at I{path} where I{path} is a (/) separated
list of element names that are expected to be children.
@param path: A (/) separated list of element names.
@type path: basestring
@return: The collection leaf nodes at the end of I{path}
@rtype: [L{Element},...] | [
"Get",
"a",
"list",
"of",
"children",
"at",
"I",
"{",
"path",
"}",
"where",
"I",
"{",
"path",
"}",
"is",
"a",
"(",
"/",
")",
"separated",
"list",
"of",
"element",
"names",
"that",
"are",
"expected",
"to",
"be",
"children",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L108-L127 |
suds-community/suds | suds/sax/document.py | Document.getChildren | def getChildren(self, name=None, ns=None):
"""
Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: ... | python | def getChildren(self, name=None, ns=None):
"""
Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: ... | [
"def",
"getChildren",
"(",
"self",
",",
"name",
"=",
"None",
",",
"ns",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"matched",
"=",
"self",
".",
"__root",
"else",
":",
"matched",
"=",
"self",
".",
"getChild",
"(",
"name",
",",
"ns",
"... | Get a list of children by (optional) name and/or (optional) namespace.
@param name: The name of a child element (may contain prefix).
@type name: basestring
@param ns: An optional namespace used to match the child.
@type ns: (I{prefix}, I{name})
@return: The list of matching chil... | [
"Get",
"a",
"list",
"of",
"children",
"by",
"(",
"optional",
")",
"name",
"and",
"/",
"or",
"(",
"optional",
")",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L129-L146 |
suds-community/suds | suds/sax/document.py | Document.plain | def plain(self):
"""
Get a string representation of this XML document.
@return: A I{plain} string.
@rtype: basestring
"""
s = []
s.append(self.DECL)
root = self.root()
if root is not None:
s.append(root.plain())
return ''.join(s... | python | def plain(self):
"""
Get a string representation of this XML document.
@return: A I{plain} string.
@rtype: basestring
"""
s = []
s.append(self.DECL)
root = self.root()
if root is not None:
s.append(root.plain())
return ''.join(s... | [
"def",
"plain",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"self",
".",
"DECL",
")",
"root",
"=",
"self",
".",
"root",
"(",
")",
"if",
"root",
"is",
"not",
"None",
":",
"s",
".",
"append",
"(",
"root",
".",
"plain",
... | Get a string representation of this XML document.
@return: A I{plain} string.
@rtype: basestring | [
"Get",
"a",
"string",
"representation",
"of",
"this",
"XML",
"document",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L162-L173 |
suds-community/suds | suds/xsd/schema.py | SchemaCollection.merge | def merge(self):
"""
Merge contained schemas into one.
@return: The merged schema.
@rtype: L{Schema}
"""
if self.children:
schema = self.children[0]
for s in self.children[1:]:
schema.merge(s)
return schema | python | def merge(self):
"""
Merge contained schemas into one.
@return: The merged schema.
@rtype: L{Schema}
"""
if self.children:
schema = self.children[0]
for s in self.children[1:]:
schema.merge(s)
return schema | [
"def",
"merge",
"(",
"self",
")",
":",
"if",
"self",
".",
"children",
":",
"schema",
"=",
"self",
".",
"children",
"[",
"0",
"]",
"for",
"s",
"in",
"self",
".",
"children",
"[",
"1",
":",
"]",
":",
"schema",
".",
"merge",
"(",
"s",
")",
"return... | Merge contained schemas into one.
@return: The merged schema.
@rtype: L{Schema} | [
"Merge",
"contained",
"schemas",
"into",
"one",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/schema.py#L146-L158 |
suds-community/suds | suds/xsd/schema.py | Schema.mktns | def mktns(self):
"""
Make the schema's target namespace.
@return: namespace representation of the schema's targetNamespace
value.
@rtype: (prefix, URI)
"""
tns = self.root.get("targetNamespace")
tns_prefix = None
if tns is not None:
... | python | def mktns(self):
"""
Make the schema's target namespace.
@return: namespace representation of the schema's targetNamespace
value.
@rtype: (prefix, URI)
"""
tns = self.root.get("targetNamespace")
tns_prefix = None
if tns is not None:
... | [
"def",
"mktns",
"(",
"self",
")",
":",
"tns",
"=",
"self",
".",
"root",
".",
"get",
"(",
"\"targetNamespace\"",
")",
"tns_prefix",
"=",
"None",
"if",
"tns",
"is",
"not",
"None",
":",
"tns_prefix",
"=",
"self",
".",
"root",
".",
"findPrefix",
"(",
"tn... | Make the schema's target namespace.
@return: namespace representation of the schema's targetNamespace
value.
@rtype: (prefix, URI) | [
"Make",
"the",
"schema",
"s",
"target",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/schema.py#L266-L279 |
suds-community/suds | suds/xsd/schema.py | Schema.open_imports | def open_imports(self, options, loaded_schemata):
"""
Instruct all contained L{sxbasic.Import} children to import all of
their referenced schemas. The imported schema contents are I{merged}
in.
@param options: An options dictionary.
@type options: L{options.Options}
... | python | def open_imports(self, options, loaded_schemata):
"""
Instruct all contained L{sxbasic.Import} children to import all of
their referenced schemas. The imported schema contents are I{merged}
in.
@param options: An options dictionary.
@type options: L{options.Options}
... | [
"def",
"open_imports",
"(",
"self",
",",
"options",
",",
"loaded_schemata",
")",
":",
"for",
"imp",
"in",
"self",
".",
"imports",
":",
"imported",
"=",
"imp",
".",
"open",
"(",
"options",
",",
"loaded_schemata",
")",
"if",
"imported",
"is",
"None",
":",
... | Instruct all contained L{sxbasic.Import} children to import all of
their referenced schemas. The imported schema contents are I{merged}
in.
@param options: An options dictionary.
@type options: L{options.Options}
@param loaded_schemata: Already loaded schemata cache (URL --> Sch... | [
"Instruct",
"all",
"contained",
"L",
"{",
"sxbasic",
".",
"Import",
"}",
"children",
"to",
"import",
"all",
"of",
"their",
"referenced",
"schemas",
".",
"The",
"imported",
"schema",
"contents",
"are",
"I",
"{",
"merged",
"}",
"in",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/schema.py#L338-L356 |
suds-community/suds | suds/xsd/schema.py | Schema.dereference | def dereference(self):
"""Instruct all children to perform dereferencing."""
all = []
indexes = {}
for child in self.children:
child.content(all)
dependencies = {}
for x in all:
x.qualify()
midx, deps = x.dependencies()
depe... | python | def dereference(self):
"""Instruct all children to perform dereferencing."""
all = []
indexes = {}
for child in self.children:
child.content(all)
dependencies = {}
for x in all:
x.qualify()
midx, deps = x.dependencies()
depe... | [
"def",
"dereference",
"(",
"self",
")",
":",
"all",
"=",
"[",
"]",
"indexes",
"=",
"{",
"}",
"for",
"child",
"in",
"self",
".",
"children",
":",
"child",
".",
"content",
"(",
"all",
")",
"dependencies",
"=",
"{",
"}",
"for",
"x",
"in",
"all",
":"... | Instruct all children to perform dereferencing. | [
"Instruct",
"all",
"children",
"to",
"perform",
"dereferencing",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/schema.py#L358-L376 |
suds-community/suds | suds/xsd/schema.py | Schema.instance | def instance(self, root, baseurl, loaded_schemata, options):
"""
Create and return an new schema object using the specified I{root} and
I{URL}.
@param root: A schema root node.
@type root: L{sax.element.Element}
@param baseurl: A base URL.
@type baseurl: str
... | python | def instance(self, root, baseurl, loaded_schemata, options):
"""
Create and return an new schema object using the specified I{root} and
I{URL}.
@param root: A schema root node.
@type root: L{sax.element.Element}
@param baseurl: A base URL.
@type baseurl: str
... | [
"def",
"instance",
"(",
"self",
",",
"root",
",",
"baseurl",
",",
"loaded_schemata",
",",
"options",
")",
":",
"return",
"Schema",
"(",
"root",
",",
"baseurl",
",",
"options",
",",
"loaded_schemata",
")"
] | Create and return an new schema object using the specified I{root} and
I{URL}.
@param root: A schema root node.
@type root: L{sax.element.Element}
@param baseurl: A base URL.
@type baseurl: str
@param loaded_schemata: Already loaded schemata cache (URL --> Schema).
... | [
"Create",
"and",
"return",
"an",
"new",
"schema",
"object",
"using",
"the",
"specified",
"I",
"{",
"root",
"}",
"and",
"I",
"{",
"URL",
"}",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/schema.py#L428-L446 |
remind101/stacker_blueprints | stacker_blueprints/sns.py | Topics.create_sqs_policy | def create_sqs_policy(self, topic_name, topic_arn, topic_subs):
"""
This method creates the SQS policy needed for an SNS subscription. It
also takes the ARN of the SQS queue and converts it to the URL needed
for the subscription, as that takes a URL rather than the ARN.
"""
... | python | def create_sqs_policy(self, topic_name, topic_arn, topic_subs):
"""
This method creates the SQS policy needed for an SNS subscription. It
also takes the ARN of the SQS queue and converts it to the URL needed
for the subscription, as that takes a URL rather than the ARN.
"""
... | [
"def",
"create_sqs_policy",
"(",
"self",
",",
"topic_name",
",",
"topic_arn",
",",
"topic_subs",
")",
":",
"t",
"=",
"self",
".",
"template",
"arn_endpoints",
"=",
"[",
"]",
"url_endpoints",
"=",
"[",
"]",
"for",
"sub",
"in",
"topic_subs",
":",
"arn_endpoi... | This method creates the SQS policy needed for an SNS subscription. It
also takes the ARN of the SQS queue and converts it to the URL needed
for the subscription, as that takes a URL rather than the ARN. | [
"This",
"method",
"creates",
"the",
"SQS",
"policy",
"needed",
"for",
"an",
"SNS",
"subscription",
".",
"It",
"also",
"takes",
"the",
"ARN",
"of",
"the",
"SQS",
"queue",
"and",
"converts",
"it",
"to",
"the",
"URL",
"needed",
"for",
"the",
"subscription",
... | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/sns.py#L81-L110 |
remind101/stacker_blueprints | stacker_blueprints/sns.py | Topics.create_topic | def create_topic(self, topic_name, topic_config):
"""
Creates the SNS topic, along with any subscriptions requested.
"""
topic_subs = []
t = self.template
if "Subscription" in topic_config:
topic_subs = topic_config["Subscription"]
t.add_resource(
... | python | def create_topic(self, topic_name, topic_config):
"""
Creates the SNS topic, along with any subscriptions requested.
"""
topic_subs = []
t = self.template
if "Subscription" in topic_config:
topic_subs = topic_config["Subscription"]
t.add_resource(
... | [
"def",
"create_topic",
"(",
"self",
",",
"topic_name",
",",
"topic_config",
")",
":",
"topic_subs",
"=",
"[",
"]",
"t",
"=",
"self",
".",
"template",
"if",
"\"Subscription\"",
"in",
"topic_config",
":",
"topic_subs",
"=",
"topic_config",
"[",
"\"Subscription\"... | Creates the SNS topic, along with any subscriptions requested. | [
"Creates",
"the",
"SNS",
"topic",
"along",
"with",
"any",
"subscriptions",
"requested",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/sns.py#L112-L138 |
remind101/stacker_blueprints | stacker_blueprints/aws_lambda.py | get_stream_action_type | def get_stream_action_type(stream_arn):
"""Returns the awacs Action for a stream type given an arn
Args:
stream_arn (str): The Arn of the stream.
Returns:
:class:`awacs.aws.Action`: The appropriate stream type awacs Action
class
Raises:
ValueError: If the stream ty... | python | def get_stream_action_type(stream_arn):
"""Returns the awacs Action for a stream type given an arn
Args:
stream_arn (str): The Arn of the stream.
Returns:
:class:`awacs.aws.Action`: The appropriate stream type awacs Action
class
Raises:
ValueError: If the stream ty... | [
"def",
"get_stream_action_type",
"(",
"stream_arn",
")",
":",
"stream_type_map",
"=",
"{",
"\"kinesis\"",
":",
"awacs",
".",
"kinesis",
".",
"Action",
",",
"\"dynamodb\"",
":",
"awacs",
".",
"dynamodb",
".",
"Action",
",",
"}",
"stream_type",
"=",
"stream_arn"... | Returns the awacs Action for a stream type given an arn
Args:
stream_arn (str): The Arn of the stream.
Returns:
:class:`awacs.aws.Action`: The appropriate stream type awacs Action
class
Raises:
ValueError: If the stream type doesn't match kinesis or dynamodb. | [
"Returns",
"the",
"awacs",
"Action",
"for",
"a",
"stream",
"type",
"given",
"an",
"arn"
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/aws_lambda.py#L37-L62 |
remind101/stacker_blueprints | stacker_blueprints/aws_lambda.py | stream_reader_statements | def stream_reader_statements(stream_arn):
"""Returns statements to allow Lambda to read from a stream.
Handles both DynamoDB & Kinesis streams. Automatically figures out the
type of stream, and provides the correct actions from the supplied Arn.
Arg:
stream_arn (str): A kinesis or dynamodb str... | python | def stream_reader_statements(stream_arn):
"""Returns statements to allow Lambda to read from a stream.
Handles both DynamoDB & Kinesis streams. Automatically figures out the
type of stream, and provides the correct actions from the supplied Arn.
Arg:
stream_arn (str): A kinesis or dynamodb str... | [
"def",
"stream_reader_statements",
"(",
"stream_arn",
")",
":",
"action_type",
"=",
"get_stream_action_type",
"(",
"stream_arn",
")",
"arn_parts",
"=",
"stream_arn",
".",
"split",
"(",
"\"/\"",
")",
"# Cut off the last bit and replace it with a wildcard",
"wildcard_arn_part... | Returns statements to allow Lambda to read from a stream.
Handles both DynamoDB & Kinesis streams. Automatically figures out the
type of stream, and provides the correct actions from the supplied Arn.
Arg:
stream_arn (str): A kinesis or dynamodb stream arn.
Returns:
list: A list of st... | [
"Returns",
"statements",
"to",
"allow",
"Lambda",
"to",
"read",
"from",
"a",
"stream",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/aws_lambda.py#L65-L99 |
remind101/stacker_blueprints | stacker_blueprints/aws_lambda.py | Function.add_policy_statements | def add_policy_statements(self, statements):
"""Adds statements to the policy.
Args:
statements (:class:`awacs.aws.Statement` or list): Either a single
Statment, or a list of statements.
"""
if isinstance(statements, Statement):
statements = [stat... | python | def add_policy_statements(self, statements):
"""Adds statements to the policy.
Args:
statements (:class:`awacs.aws.Statement` or list): Either a single
Statment, or a list of statements.
"""
if isinstance(statements, Statement):
statements = [stat... | [
"def",
"add_policy_statements",
"(",
"self",
",",
"statements",
")",
":",
"if",
"isinstance",
"(",
"statements",
",",
"Statement",
")",
":",
"statements",
"=",
"[",
"statements",
"]",
"self",
".",
"_policy_statements",
".",
"extend",
"(",
"statements",
")"
] | Adds statements to the policy.
Args:
statements (:class:`awacs.aws.Statement` or list): Either a single
Statment, or a list of statements. | [
"Adds",
"statements",
"to",
"the",
"policy",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/aws_lambda.py#L221-L230 |
remind101/stacker_blueprints | stacker_blueprints/aws_lambda.py | Function.generate_policy_statements | def generate_policy_statements(self):
"""Generates the policy statements for the role used by the function.
To add additional statements you can either override the
`extended_policy_statements` method to return a list of Statements
to be added to the policy, or override this method itse... | python | def generate_policy_statements(self):
"""Generates the policy statements for the role used by the function.
To add additional statements you can either override the
`extended_policy_statements` method to return a list of Statements
to be added to the policy, or override this method itse... | [
"def",
"generate_policy_statements",
"(",
"self",
")",
":",
"statements",
"=",
"self",
".",
"_policy_statements",
"statements",
".",
"extend",
"(",
"lambda_basic_execution_statements",
"(",
"self",
".",
"function",
".",
"Ref",
"(",
")",
")",
")",
"extended_stateme... | Generates the policy statements for the role used by the function.
To add additional statements you can either override the
`extended_policy_statements` method to return a list of Statements
to be added to the policy, or override this method itself if you
need more control.
Ret... | [
"Generates",
"the",
"policy",
"statements",
"for",
"the",
"role",
"used",
"by",
"the",
"function",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/aws_lambda.py#L240-L260 |
remind101/stacker_blueprints | stacker_blueprints/dynamodb.py | snake_to_camel_case | def snake_to_camel_case(name):
"""
Accept a snake_case string and return a CamelCase string.
For example::
>>> snake_to_camel_case('cidr_block')
'CidrBlock'
"""
name = name.replace("-", "_")
return "".join(word.capitalize() for word in name.split("_")) | python | def snake_to_camel_case(name):
"""
Accept a snake_case string and return a CamelCase string.
For example::
>>> snake_to_camel_case('cidr_block')
'CidrBlock'
"""
name = name.replace("-", "_")
return "".join(word.capitalize() for word in name.split("_")) | [
"def",
"snake_to_camel_case",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"\"-\"",
",",
"\"_\"",
")",
"return",
"\"\"",
".",
"join",
"(",
"word",
".",
"capitalize",
"(",
")",
"for",
"word",
"in",
"name",
".",
"split",
"(",
"\"_\"... | Accept a snake_case string and return a CamelCase string.
For example::
>>> snake_to_camel_case('cidr_block')
'CidrBlock' | [
"Accept",
"a",
"snake_case",
"string",
"and",
"return",
"a",
"CamelCase",
"string",
".",
"For",
"example",
"::",
">>>",
"snake_to_camel_case",
"(",
"cidr_block",
")",
"CidrBlock"
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/dynamodb.py#L39-L47 |
remind101/stacker_blueprints | stacker_blueprints/generic.py | GenericResourceCreator.setup_resource | def setup_resource(self):
""" Setting Up Resource """
template = self.template
variables = self.get_variables()
tclass = variables['Class']
tprops = variables['Properties']
output = variables['Output']
klass = load_object_from_string('troposphere.' + tclass)
... | python | def setup_resource(self):
""" Setting Up Resource """
template = self.template
variables = self.get_variables()
tclass = variables['Class']
tprops = variables['Properties']
output = variables['Output']
klass = load_object_from_string('troposphere.' + tclass)
... | [
"def",
"setup_resource",
"(",
"self",
")",
":",
"template",
"=",
"self",
".",
"template",
"variables",
"=",
"self",
".",
"get_variables",
"(",
")",
"tclass",
"=",
"variables",
"[",
"'Class'",
"]",
"tprops",
"=",
"variables",
"[",
"'Properties'",
"]",
"outp... | Setting Up Resource | [
"Setting",
"Up",
"Resource"
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/generic.py#L57-L75 |
remind101/stacker_blueprints | stacker_blueprints/kms.py | kms_key_policy | def kms_key_policy():
""" Creates a key policy for use of a KMS Key. """
statements = []
statements.extend(kms_key_root_statements())
return Policy(
Version="2012-10-17",
Id="root-account-access",
Statement=statements
) | python | def kms_key_policy():
""" Creates a key policy for use of a KMS Key. """
statements = []
statements.extend(kms_key_root_statements())
return Policy(
Version="2012-10-17",
Id="root-account-access",
Statement=statements
) | [
"def",
"kms_key_policy",
"(",
")",
":",
"statements",
"=",
"[",
"]",
"statements",
".",
"extend",
"(",
"kms_key_root_statements",
"(",
")",
")",
"return",
"Policy",
"(",
"Version",
"=",
"\"2012-10-17\"",
",",
"Id",
"=",
"\"root-account-access\"",
",",
"Stateme... | Creates a key policy for use of a KMS Key. | [
"Creates",
"a",
"key",
"policy",
"for",
"use",
"of",
"a",
"KMS",
"Key",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/kms.py#L40-L50 |
remind101/stacker_blueprints | stacker_blueprints/empire/policies.py | logstream_policy | def logstream_policy():
"""Policy needed for logspout -> kinesis log streaming."""
p = Policy(
Statement=[
Statement(
Effect=Allow,
Resource=["*"],
Action=[
kinesis.CreateStream, kinesis.DescribeStream,
A... | python | def logstream_policy():
"""Policy needed for logspout -> kinesis log streaming."""
p = Policy(
Statement=[
Statement(
Effect=Allow,
Resource=["*"],
Action=[
kinesis.CreateStream, kinesis.DescribeStream,
A... | [
"def",
"logstream_policy",
"(",
")",
":",
"p",
"=",
"Policy",
"(",
"Statement",
"=",
"[",
"Statement",
"(",
"Effect",
"=",
"Allow",
",",
"Resource",
"=",
"[",
"\"*\"",
"]",
",",
"Action",
"=",
"[",
"kinesis",
".",
"CreateStream",
",",
"kinesis",
".",
... | Policy needed for logspout -> kinesis log streaming. | [
"Policy",
"needed",
"for",
"logspout",
"-",
">",
"kinesis",
"log",
"streaming",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/empire/policies.py#L245-L257 |
remind101/stacker_blueprints | stacker_blueprints/empire/policies.py | runlogs_policy | def runlogs_policy(log_group_ref):
"""Policy needed for Empire -> Cloudwatch logs to record run output."""
p = Policy(
Statement=[
Statement(
Effect=Allow,
Resource=[
Join('', [
'arn:aws:logs:*:*:log-group:',
... | python | def runlogs_policy(log_group_ref):
"""Policy needed for Empire -> Cloudwatch logs to record run output."""
p = Policy(
Statement=[
Statement(
Effect=Allow,
Resource=[
Join('', [
'arn:aws:logs:*:*:log-group:',
... | [
"def",
"runlogs_policy",
"(",
"log_group_ref",
")",
":",
"p",
"=",
"Policy",
"(",
"Statement",
"=",
"[",
"Statement",
"(",
"Effect",
"=",
"Allow",
",",
"Resource",
"=",
"[",
"Join",
"(",
"''",
",",
"[",
"'arn:aws:logs:*:*:log-group:'",
",",
"log_group_ref",
... | Policy needed for Empire -> Cloudwatch logs to record run output. | [
"Policy",
"needed",
"for",
"Empire",
"-",
">",
"Cloudwatch",
"logs",
"to",
"record",
"run",
"output",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/empire/policies.py#L260-L275 |
remind101/stacker_blueprints | stacker_blueprints/util.py | check_properties | def check_properties(properties, allowed_properties, resource):
"""Checks the list of properties in the properties variable against the
property list provided by the allowed_properties variable. If any property
does not match the properties in allowed_properties, a ValueError is
raised to prevent unexpe... | python | def check_properties(properties, allowed_properties, resource):
"""Checks the list of properties in the properties variable against the
property list provided by the allowed_properties variable. If any property
does not match the properties in allowed_properties, a ValueError is
raised to prevent unexpe... | [
"def",
"check_properties",
"(",
"properties",
",",
"allowed_properties",
",",
"resource",
")",
":",
"for",
"key",
"in",
"properties",
".",
"keys",
"(",
")",
":",
"if",
"key",
"not",
"in",
"allowed_properties",
":",
"raise",
"ValueError",
"(",
"\"%s is not a va... | Checks the list of properties in the properties variable against the
property list provided by the allowed_properties variable. If any property
does not match the properties in allowed_properties, a ValueError is
raised to prevent unexpected behavior when creating resources.
properties: The config (as ... | [
"Checks",
"the",
"list",
"of",
"properties",
"in",
"the",
"properties",
"variable",
"against",
"the",
"property",
"list",
"provided",
"by",
"the",
"allowed_properties",
"variable",
".",
"If",
"any",
"property",
"does",
"not",
"match",
"the",
"properties",
"in",
... | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/util.py#L6-L22 |
remind101/stacker_blueprints | stacker_blueprints/util.py | merge_tags | def merge_tags(left, right, factory=Tags):
"""
Merge two sets of tags into a new troposphere object
Args:
left (Union[dict, troposphere.Tags]): dictionary or Tags object to be
merged with lower priority
right (Union[dict, troposphere.Tags]): dictionary or Tags object to be
... | python | def merge_tags(left, right, factory=Tags):
"""
Merge two sets of tags into a new troposphere object
Args:
left (Union[dict, troposphere.Tags]): dictionary or Tags object to be
merged with lower priority
right (Union[dict, troposphere.Tags]): dictionary or Tags object to be
... | [
"def",
"merge_tags",
"(",
"left",
",",
"right",
",",
"factory",
"=",
"Tags",
")",
":",
"if",
"isinstance",
"(",
"left",
",",
"Mapping",
")",
":",
"tags",
"=",
"dict",
"(",
"left",
")",
"elif",
"hasattr",
"(",
"left",
",",
"'tags'",
")",
":",
"tags"... | Merge two sets of tags into a new troposphere object
Args:
left (Union[dict, troposphere.Tags]): dictionary or Tags object to be
merged with lower priority
right (Union[dict, troposphere.Tags]): dictionary or Tags object to be
merged with higher priority
factory (typ... | [
"Merge",
"two",
"sets",
"of",
"tags",
"into",
"a",
"new",
"troposphere",
"object"
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/util.py#L29-L56 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | get_record_set_md5 | def get_record_set_md5(rs_name, rs_type):
"""Accept record_set Name and Type. Return MD5 sum of these values."""
rs_name = rs_name.lower()
rs_type = rs_type.upper()
# Make A and CNAME records hash to same sum to support updates.
rs_type = "ACNAME" if rs_type in ["A", "CNAME"] else rs_type
return... | python | def get_record_set_md5(rs_name, rs_type):
"""Accept record_set Name and Type. Return MD5 sum of these values."""
rs_name = rs_name.lower()
rs_type = rs_type.upper()
# Make A and CNAME records hash to same sum to support updates.
rs_type = "ACNAME" if rs_type in ["A", "CNAME"] else rs_type
return... | [
"def",
"get_record_set_md5",
"(",
"rs_name",
",",
"rs_type",
")",
":",
"rs_name",
"=",
"rs_name",
".",
"lower",
"(",
")",
"rs_type",
"=",
"rs_type",
".",
"upper",
"(",
")",
"# Make A and CNAME records hash to same sum to support updates.",
"rs_type",
"=",
"\"ACNAME\... | Accept record_set Name and Type. Return MD5 sum of these values. | [
"Accept",
"record_set",
"Name",
"and",
"Type",
".",
"Return",
"MD5",
"sum",
"of",
"these",
"values",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L66-L72 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | DNSRecords.add_hosted_zone_id_for_alias_target_if_missing | def add_hosted_zone_id_for_alias_target_if_missing(self, rs):
"""Add proper hosted zone id to record set alias target if missing."""
alias_target = getattr(rs, "AliasTarget", None)
if alias_target:
hosted_zone_id = getattr(alias_target, "HostedZoneId", None)
if not hosted... | python | def add_hosted_zone_id_for_alias_target_if_missing(self, rs):
"""Add proper hosted zone id to record set alias target if missing."""
alias_target = getattr(rs, "AliasTarget", None)
if alias_target:
hosted_zone_id = getattr(alias_target, "HostedZoneId", None)
if not hosted... | [
"def",
"add_hosted_zone_id_for_alias_target_if_missing",
"(",
"self",
",",
"rs",
")",
":",
"alias_target",
"=",
"getattr",
"(",
"rs",
",",
"\"AliasTarget\"",
",",
"None",
")",
"if",
"alias_target",
":",
"hosted_zone_id",
"=",
"getattr",
"(",
"alias_target",
",",
... | Add proper hosted zone id to record set alias target if missing. | [
"Add",
"proper",
"hosted",
"zone",
"id",
"to",
"record",
"set",
"alias",
"target",
"if",
"missing",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L123-L139 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | DNSRecords.create_record_set | def create_record_set(self, rs_dict):
"""Accept a record_set dict. Return a Troposphere record_set object."""
record_set_md5 = get_record_set_md5(rs_dict["Name"], rs_dict["Type"])
rs = route53.RecordSetType.from_dict(record_set_md5, rs_dict)
rs = add_hosted_zone_id_if_missing(rs, self.ho... | python | def create_record_set(self, rs_dict):
"""Accept a record_set dict. Return a Troposphere record_set object."""
record_set_md5 = get_record_set_md5(rs_dict["Name"], rs_dict["Type"])
rs = route53.RecordSetType.from_dict(record_set_md5, rs_dict)
rs = add_hosted_zone_id_if_missing(rs, self.ho... | [
"def",
"create_record_set",
"(",
"self",
",",
"rs_dict",
")",
":",
"record_set_md5",
"=",
"get_record_set_md5",
"(",
"rs_dict",
"[",
"\"Name\"",
"]",
",",
"rs_dict",
"[",
"\"Type\"",
"]",
")",
"rs",
"=",
"route53",
".",
"RecordSetType",
".",
"from_dict",
"("... | Accept a record_set dict. Return a Troposphere record_set object. | [
"Accept",
"a",
"record_set",
"dict",
".",
"Return",
"a",
"Troposphere",
"record_set",
"object",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L141-L147 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | DNSRecords.create_record_set_group | def create_record_set_group(self, name, g_dict):
"""Accept a record_set dict. Return a Troposphere record_set object."""
rs = route53.RecordSetGroup.from_dict(name, g_dict)
rs = add_hosted_zone_id_if_missing(rs, self.hosted_zone_id)
rs = self.add_hosted_zone_id_for_alias_target_if_missin... | python | def create_record_set_group(self, name, g_dict):
"""Accept a record_set dict. Return a Troposphere record_set object."""
rs = route53.RecordSetGroup.from_dict(name, g_dict)
rs = add_hosted_zone_id_if_missing(rs, self.hosted_zone_id)
rs = self.add_hosted_zone_id_for_alias_target_if_missin... | [
"def",
"create_record_set_group",
"(",
"self",
",",
"name",
",",
"g_dict",
")",
":",
"rs",
"=",
"route53",
".",
"RecordSetGroup",
".",
"from_dict",
"(",
"name",
",",
"g_dict",
")",
"rs",
"=",
"add_hosted_zone_id_if_missing",
"(",
"rs",
",",
"self",
".",
"h... | Accept a record_set dict. Return a Troposphere record_set object. | [
"Accept",
"a",
"record_set",
"dict",
".",
"Return",
"a",
"Troposphere",
"record_set",
"object",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L149-L154 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | DNSRecords.create_record_sets | def create_record_sets(self, record_set_dicts):
"""Accept list of record_set dicts.
Return list of record_set objects."""
record_set_objects = []
for record_set_dict in record_set_dicts:
# pop removes the 'Enabled' key and tests if True.
if record_set_dict.pop('En... | python | def create_record_sets(self, record_set_dicts):
"""Accept list of record_set dicts.
Return list of record_set objects."""
record_set_objects = []
for record_set_dict in record_set_dicts:
# pop removes the 'Enabled' key and tests if True.
if record_set_dict.pop('En... | [
"def",
"create_record_sets",
"(",
"self",
",",
"record_set_dicts",
")",
":",
"record_set_objects",
"=",
"[",
"]",
"for",
"record_set_dict",
"in",
"record_set_dicts",
":",
"# pop removes the 'Enabled' key and tests if True.",
"if",
"record_set_dict",
".",
"pop",
"(",
"'E... | Accept list of record_set dicts.
Return list of record_set objects. | [
"Accept",
"list",
"of",
"record_set",
"dicts",
".",
"Return",
"list",
"of",
"record_set",
"objects",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L156-L166 |
remind101/stacker_blueprints | stacker_blueprints/route53.py | DNSRecords.create_record_set_groups | def create_record_set_groups(self, record_set_group_dicts):
"""Accept list of record_set_group dicts.
Return list of record_set_group objects."""
record_set_groups = []
for name, group in record_set_group_dicts.iteritems():
# pop removes the 'Enabled' key and tests if True.
... | python | def create_record_set_groups(self, record_set_group_dicts):
"""Accept list of record_set_group dicts.
Return list of record_set_group objects."""
record_set_groups = []
for name, group in record_set_group_dicts.iteritems():
# pop removes the 'Enabled' key and tests if True.
... | [
"def",
"create_record_set_groups",
"(",
"self",
",",
"record_set_group_dicts",
")",
":",
"record_set_groups",
"=",
"[",
"]",
"for",
"name",
",",
"group",
"in",
"record_set_group_dicts",
".",
"iteritems",
"(",
")",
":",
"# pop removes the 'Enabled' key and tests if True.... | Accept list of record_set_group dicts.
Return list of record_set_group objects. | [
"Accept",
"list",
"of",
"record_set_group",
"dicts",
".",
"Return",
"list",
"of",
"record_set_group",
"objects",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/route53.py#L168-L178 |
remind101/stacker_blueprints | stacker_blueprints/policies.py | read_only_s3_bucket_policy_statements | def read_only_s3_bucket_policy_statements(buckets, folder="*"):
""" Read only policy an s3 bucket. """
list_buckets = [s3_arn(b) for b in buckets]
object_buckets = [s3_objects_arn(b, folder) for b in buckets]
bucket_resources = list_buckets + object_buckets
return [
Statement(
... | python | def read_only_s3_bucket_policy_statements(buckets, folder="*"):
""" Read only policy an s3 bucket. """
list_buckets = [s3_arn(b) for b in buckets]
object_buckets = [s3_objects_arn(b, folder) for b in buckets]
bucket_resources = list_buckets + object_buckets
return [
Statement(
... | [
"def",
"read_only_s3_bucket_policy_statements",
"(",
"buckets",
",",
"folder",
"=",
"\"*\"",
")",
":",
"list_buckets",
"=",
"[",
"s3_arn",
"(",
"b",
")",
"for",
"b",
"in",
"buckets",
"]",
"object_buckets",
"=",
"[",
"s3_objects_arn",
"(",
"b",
",",
"folder",... | Read only policy an s3 bucket. | [
"Read",
"only",
"policy",
"an",
"s3",
"bucket",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/policies.py#L62-L80 |
remind101/stacker_blueprints | stacker_blueprints/policies.py | static_website_bucket_policy | def static_website_bucket_policy(bucket):
"""
Attach this policy directly to an S3 bucket to make it a static website.
This policy grants read access to **all unauthenticated** users.
"""
return Policy(
Statement=[
Statement(
Effect=Allow,
Principa... | python | def static_website_bucket_policy(bucket):
"""
Attach this policy directly to an S3 bucket to make it a static website.
This policy grants read access to **all unauthenticated** users.
"""
return Policy(
Statement=[
Statement(
Effect=Allow,
Principa... | [
"def",
"static_website_bucket_policy",
"(",
"bucket",
")",
":",
"return",
"Policy",
"(",
"Statement",
"=",
"[",
"Statement",
"(",
"Effect",
"=",
"Allow",
",",
"Principal",
"=",
"Principal",
"(",
"\"*\"",
")",
",",
"Action",
"=",
"[",
"s3",
".",
"GetObject"... | Attach this policy directly to an S3 bucket to make it a static website.
This policy grants read access to **all unauthenticated** users. | [
"Attach",
"this",
"policy",
"directly",
"to",
"an",
"S3",
"bucket",
"to",
"make",
"it",
"a",
"static",
"website",
".",
"This",
"policy",
"grants",
"read",
"access",
"to",
"**",
"all",
"unauthenticated",
"**",
"users",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/policies.py#L126-L140 |
remind101/stacker_blueprints | stacker_blueprints/policies.py | lambda_vpc_execution_statements | def lambda_vpc_execution_statements():
"""Allow Lambda to manipuate EC2 ENIs for VPC support."""
return [
Statement(
Effect=Allow,
Resource=['*'],
Action=[
ec2.CreateNetworkInterface,
ec2.DescribeNetworkInterfaces,
ec2.D... | python | def lambda_vpc_execution_statements():
"""Allow Lambda to manipuate EC2 ENIs for VPC support."""
return [
Statement(
Effect=Allow,
Resource=['*'],
Action=[
ec2.CreateNetworkInterface,
ec2.DescribeNetworkInterfaces,
ec2.D... | [
"def",
"lambda_vpc_execution_statements",
"(",
")",
":",
"return",
"[",
"Statement",
"(",
"Effect",
"=",
"Allow",
",",
"Resource",
"=",
"[",
"'*'",
"]",
",",
"Action",
"=",
"[",
"ec2",
".",
"CreateNetworkInterface",
",",
"ec2",
".",
"DescribeNetworkInterfaces"... | Allow Lambda to manipuate EC2 ENIs for VPC support. | [
"Allow",
"Lambda",
"to",
"manipuate",
"EC2",
"ENIs",
"for",
"VPC",
"support",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/policies.py#L202-L214 |
remind101/stacker_blueprints | stacker_blueprints/policies.py | dynamodb_autoscaling_policy | def dynamodb_autoscaling_policy(tables):
"""Policy to allow AutoScaling a list of DynamoDB tables."""
return Policy(
Statement=[
Statement(
Effect=Allow,
Resource=dynamodb_arns(tables),
Action=[
dynamodb.DescribeTable,
... | python | def dynamodb_autoscaling_policy(tables):
"""Policy to allow AutoScaling a list of DynamoDB tables."""
return Policy(
Statement=[
Statement(
Effect=Allow,
Resource=dynamodb_arns(tables),
Action=[
dynamodb.DescribeTable,
... | [
"def",
"dynamodb_autoscaling_policy",
"(",
"tables",
")",
":",
"return",
"Policy",
"(",
"Statement",
"=",
"[",
"Statement",
"(",
"Effect",
"=",
"Allow",
",",
"Resource",
"=",
"dynamodb_arns",
"(",
"tables",
")",
",",
"Action",
"=",
"[",
"dynamodb",
".",
"D... | Policy to allow AutoScaling a list of DynamoDB tables. | [
"Policy",
"to",
"allow",
"AutoScaling",
"a",
"list",
"of",
"DynamoDB",
"tables",
"."
] | train | https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/policies.py#L222-L246 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.healpix_to_lonlat | def healpix_to_lonlat(self, healpix_index, dx=None, dy=None):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes
Parameters
----------
healpix_index : `~numpy.ndarray`
1-D array of HEALPix indices
dx, dy : `~numpy.ndarray`, optional... | python | def healpix_to_lonlat(self, healpix_index, dx=None, dy=None):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes
Parameters
----------
healpix_index : `~numpy.ndarray`
1-D array of HEALPix indices
dx, dy : `~numpy.ndarray`, optional... | [
"def",
"healpix_to_lonlat",
"(",
"self",
",",
"healpix_index",
",",
"dx",
"=",
"None",
",",
"dy",
"=",
"None",
")",
":",
"return",
"healpix_to_lonlat",
"(",
"healpix_index",
",",
"self",
".",
"nside",
",",
"dx",
"=",
"dx",
",",
"dy",
"=",
"dy",
",",
... | Convert HEALPix indices (optionally with offsets) to longitudes/latitudes
Parameters
----------
healpix_index : `~numpy.ndarray`
1-D array of HEALPix indices
dx, dy : `~numpy.ndarray`, optional
1-D arrays of offsets inside the HEALPix pixel, which must be in
... | [
"Convert",
"HEALPix",
"indices",
"(",
"optionally",
"with",
"offsets",
")",
"to",
"longitudes",
"/",
"latitudes"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L76-L96 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.lonlat_to_healpix | def lonlat_to_healpix(self, lon, lat, return_offsets=False):
"""
Convert longitudes/latitudes to HEALPix indices (optionally with offsets)
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Qu... | python | def lonlat_to_healpix(self, lon, lat, return_offsets=False):
"""
Convert longitudes/latitudes to HEALPix indices (optionally with offsets)
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Qu... | [
"def",
"lonlat_to_healpix",
"(",
"self",
",",
"lon",
",",
"lat",
",",
"return_offsets",
"=",
"False",
")",
":",
"return",
"lonlat_to_healpix",
"(",
"lon",
",",
"lat",
",",
"self",
".",
"nside",
",",
"return_offsets",
"=",
"return_offsets",
",",
"order",
"=... | Convert longitudes/latitudes to HEALPix indices (optionally with offsets)
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity` instances
with angle units.
return_offsets : bool
... | [
"Convert",
"longitudes",
"/",
"latitudes",
"to",
"HEALPix",
"indices",
"(",
"optionally",
"with",
"offsets",
")"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L98-L122 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.bilinear_interpolation_weights | def bilinear_interpolation_weights(self, lon, lat):
"""
Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude an... | python | def bilinear_interpolation_weights(self, lon, lat):
"""
Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude an... | [
"def",
"bilinear_interpolation_weights",
"(",
"self",
",",
"lon",
",",
"lat",
")",
":",
"return",
"bilinear_interpolation_weights",
"(",
"lon",
",",
"lat",
",",
"self",
".",
"nside",
",",
"order",
"=",
"self",
".",
"order",
")"
] | Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as
:class:`~astropy.units.Quantity` instan... | [
"Get",
"the",
"four",
"neighbours",
"for",
"each",
"(",
"lon",
"lat",
")",
"position",
"and",
"the",
"weight",
"associated",
"with",
"each",
"one",
"for",
"bilinear",
"interpolation",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L156-L176 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.interpolate_bilinear_lonlat | def interpolate_bilinear_lonlat(self, lon, lat, values):
"""
Interpolate values at specific longitudes/latitudes using bilinear interpolation
If a position does not have four neighbours, this currently returns NaN.
Parameters
----------
lon, lat : :class:`~astropy.units... | python | def interpolate_bilinear_lonlat(self, lon, lat, values):
"""
Interpolate values at specific longitudes/latitudes using bilinear interpolation
If a position does not have four neighbours, this currently returns NaN.
Parameters
----------
lon, lat : :class:`~astropy.units... | [
"def",
"interpolate_bilinear_lonlat",
"(",
"self",
",",
"lon",
",",
"lat",
",",
"values",
")",
":",
"if",
"len",
"(",
"values",
")",
"!=",
"self",
".",
"npix",
":",
"raise",
"ValueError",
"(",
"'values must be an array of length {0} (got {1})'",
".",
"format",
... | Interpolate values at specific longitudes/latitudes using bilinear interpolation
If a position does not have four neighbours, this currently returns NaN.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.... | [
"Interpolate",
"values",
"at",
"specific",
"longitudes",
"/",
"latitudes",
"using",
"bilinear",
"interpolation"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L178-L201 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.cone_search_lonlat | def cone_search_lonlat(self, lon, lat, radius):
"""
Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a... | python | def cone_search_lonlat(self, lon, lat, radius):
"""
Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a... | [
"def",
"cone_search_lonlat",
"(",
"self",
",",
"lon",
",",
"lat",
",",
"radius",
")",
":",
"if",
"not",
"lon",
".",
"isscalar",
"or",
"not",
"lat",
".",
"isscalar",
"or",
"not",
"radius",
".",
"isscalar",
":",
"raise",
"ValueError",
"(",
"'The longitude,... | Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a time, since different calls to the function may result in a differe... | [
"Find",
"all",
"the",
"HEALPix",
"pixels",
"within",
"a",
"given",
"radius",
"of",
"a",
"longitude",
"/",
"latitude",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L203-L227 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.boundaries_lonlat | def boundaries_lonlat(self, healpix_index, step):
"""
Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting... | python | def boundaries_lonlat(self, healpix_index, step):
"""
Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting... | [
"def",
"boundaries_lonlat",
"(",
"self",
",",
"healpix_index",
",",
"step",
")",
":",
"return",
"boundaries_lonlat",
"(",
"healpix_index",
",",
"step",
",",
"self",
".",
"nside",
",",
"order",
"=",
"self",
".",
"order",
")"
] | Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting ``step`` to 1 returns just the corners.
Parameters
-... | [
"Return",
"the",
"longitude",
"and",
"latitude",
"of",
"the",
"edges",
"of",
"HEALPix",
"pixels"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L229-L251 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.neighbours | def neighbours(self, healpix_index):
"""
Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
Returns
-------
neigh : `~numpy.ndarray`
... | python | def neighbours(self, healpix_index):
"""
Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
Returns
-------
neigh : `~numpy.ndarray`
... | [
"def",
"neighbours",
"(",
"self",
",",
"healpix_index",
")",
":",
"return",
"neighbours",
"(",
"healpix_index",
",",
"self",
".",
"nside",
",",
"order",
"=",
"self",
".",
"order",
")"
] | Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
Returns
-------
neigh : `~numpy.ndarray`
Array giving the neighbours starting SW and rotating cl... | [
"Find",
"all",
"the",
"HEALPix",
"pixels",
"that",
"are",
"the",
"neighbours",
"of",
"a",
"HEALPix",
"pixel"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L253-L270 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.healpix_to_skycoord | def healpix_to_skycoord(self, healpix_index, dx=None, dy=None):
"""
Convert HEALPix indices (optionally with offsets) to celestial coordinates.
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, y... | python | def healpix_to_skycoord(self, healpix_index, dx=None, dy=None):
"""
Convert HEALPix indices (optionally with offsets) to celestial coordinates.
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, y... | [
"def",
"healpix_to_skycoord",
"(",
"self",
",",
"healpix_index",
",",
"dx",
"=",
"None",
",",
"dy",
"=",
"None",
")",
":",
"if",
"self",
".",
"frame",
"is",
"None",
":",
"raise",
"NoFrameError",
"(",
"\"healpix_to_skycoord\"",
")",
"lon",
",",
"lat",
"="... | Convert HEALPix indices (optionally with offsets) to celestial coordinates.
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, you
can instead use :meth:`~astropy_healpix.HEALPix.healpix_to_lonlat`.
... | [
"Convert",
"HEALPix",
"indices",
"(",
"optionally",
"with",
"offsets",
")",
"to",
"celestial",
"coordinates",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L272-L298 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.skycoord_to_healpix | def skycoord_to_healpix(self, skycoord, return_offsets=False):
"""
Convert celestial coordinates to HEALPix indices (optionally with offsets).
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, yo... | python | def skycoord_to_healpix(self, skycoord, return_offsets=False):
"""
Convert celestial coordinates to HEALPix indices (optionally with offsets).
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, yo... | [
"def",
"skycoord_to_healpix",
"(",
"self",
",",
"skycoord",
",",
"return_offsets",
"=",
"False",
")",
":",
"if",
"self",
".",
"frame",
"is",
"None",
":",
"raise",
"NoFrameError",
"(",
"\"skycoord_to_healpix\"",
")",
"skycoord",
"=",
"skycoord",
".",
"transform... | Convert celestial coordinates to HEALPix indices (optionally with offsets).
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial frame, you
can instead use :meth:`~astropy_healpix.HEALPix.lonlat_to_healpix`.
... | [
"Convert",
"celestial",
"coordinates",
"to",
"HEALPix",
"indices",
"(",
"optionally",
"with",
"offsets",
")",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L300-L331 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.interpolate_bilinear_skycoord | def interpolate_bilinear_skycoord(self, skycoord, values):
"""
Interpolate values at specific celestial coordinates using bilinear interpolation.
If a position does not have four neighbours, this currently returns NaN.
Note that this method requires that a celestial frame was specified... | python | def interpolate_bilinear_skycoord(self, skycoord, values):
"""
Interpolate values at specific celestial coordinates using bilinear interpolation.
If a position does not have four neighbours, this currently returns NaN.
Note that this method requires that a celestial frame was specified... | [
"def",
"interpolate_bilinear_skycoord",
"(",
"self",
",",
"skycoord",
",",
"values",
")",
":",
"if",
"self",
".",
"frame",
"is",
"None",
":",
"raise",
"NoFrameError",
"(",
"\"interpolate_bilinear_skycoord\"",
")",
"skycoord",
"=",
"skycoord",
".",
"transform_to",
... | Interpolate values at specific celestial coordinates using bilinear interpolation.
If a position does not have four neighbours, this currently returns NaN.
Note that this method requires that a celestial frame was specified when
initializing HEALPix. If you don't know or need the celestial fra... | [
"Interpolate",
"values",
"at",
"specific",
"celestial",
"coordinates",
"using",
"bilinear",
"interpolation",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L333-L362 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.cone_search_skycoord | def cone_search_skycoord(self, skycoord, radius):
"""
Find all the HEALPix pixels within a given radius of a celestial position.
Note that this returns all pixels that overlap, including partially,
with the search cone. This function can only be used for a single
celestial posit... | python | def cone_search_skycoord(self, skycoord, radius):
"""
Find all the HEALPix pixels within a given radius of a celestial position.
Note that this returns all pixels that overlap, including partially,
with the search cone. This function can only be used for a single
celestial posit... | [
"def",
"cone_search_skycoord",
"(",
"self",
",",
"skycoord",
",",
"radius",
")",
":",
"if",
"self",
".",
"frame",
"is",
"None",
":",
"raise",
"NoFrameError",
"(",
"\"cone_search_skycoord\"",
")",
"skycoord",
"=",
"skycoord",
".",
"transform_to",
"(",
"self",
... | Find all the HEALPix pixels within a given radius of a celestial position.
Note that this returns all pixels that overlap, including partially,
with the search cone. This function can only be used for a single
celestial position at a time, since different calls to the function may
resul... | [
"Find",
"all",
"the",
"HEALPix",
"pixels",
"within",
"a",
"given",
"radius",
"of",
"a",
"celestial",
"position",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L364-L394 |
astropy/astropy-healpix | astropy_healpix/high_level.py | HEALPix.boundaries_skycoord | def boundaries_skycoord(self, healpix_index, step):
"""
Return the celestial coordinates of the edges of HEALPix pixels
This returns the celestial coordinates of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting... | python | def boundaries_skycoord(self, healpix_index, step):
"""
Return the celestial coordinates of the edges of HEALPix pixels
This returns the celestial coordinates of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting... | [
"def",
"boundaries_skycoord",
"(",
"self",
",",
"healpix_index",
",",
"step",
")",
":",
"if",
"self",
".",
"frame",
"is",
"None",
":",
"raise",
"NoFrameError",
"(",
"\"boundaries_skycoord\"",
")",
"lon",
",",
"lat",
"=",
"self",
".",
"boundaries_lonlat",
"("... | Return the celestial coordinates of the edges of HEALPix pixels
This returns the celestial coordinates of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting ``step`` to 1 returns just the corners.
This method requires t... | [
"Return",
"the",
"celestial",
"coordinates",
"of",
"the",
"edges",
"of",
"HEALPix",
"pixels"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/high_level.py#L396-L424 |
astropy/astropy-healpix | astropy_healpix/core.py | level_to_nside | def level_to_nside(level):
"""
Find the pixel dimensions of the top-level HEALPix tiles.
This is given by ``nside = 2**level``.
Parameters
----------
level : int
The resolution level
Returns
-------
nside : int
The number of pixels on the side of one of the 12 'top... | python | def level_to_nside(level):
"""
Find the pixel dimensions of the top-level HEALPix tiles.
This is given by ``nside = 2**level``.
Parameters
----------
level : int
The resolution level
Returns
-------
nside : int
The number of pixels on the side of one of the 12 'top... | [
"def",
"level_to_nside",
"(",
"level",
")",
":",
"level",
"=",
"np",
".",
"asarray",
"(",
"level",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"_validate_level",
"(",
"level",
")",
"return",
"2",
"**",
"level"
] | Find the pixel dimensions of the top-level HEALPix tiles.
This is given by ``nside = 2**level``.
Parameters
----------
level : int
The resolution level
Returns
-------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles. | [
"Find",
"the",
"pixel",
"dimensions",
"of",
"the",
"top",
"-",
"level",
"HEALPix",
"tiles",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L86-L105 |
astropy/astropy-healpix | astropy_healpix/core.py | nside_to_level | def nside_to_level(nside):
"""
Find the HEALPix level for a given nside.
This is given by ``level = log2(nside)``.
This function is the inverse of `level_to_nside`.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
... | python | def nside_to_level(nside):
"""
Find the HEALPix level for a given nside.
This is given by ``level = log2(nside)``.
This function is the inverse of `level_to_nside`.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
... | [
"def",
"nside_to_level",
"(",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"_validate_nside",
"(",
"nside",
")",
"return",
"np",
".",
"log2",
"(",
"nside",
")",
".",
"astype",
"(",
... | Find the HEALPix level for a given nside.
This is given by ``level = log2(nside)``.
This function is the inverse of `level_to_nside`.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Must be a power of two.
Returns... | [
"Find",
"the",
"HEALPix",
"level",
"for",
"a",
"given",
"nside",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L108-L130 |
astropy/astropy-healpix | astropy_healpix/core.py | uniq_to_level_ipix | def uniq_to_level_ipix(uniq):
"""
Convert a HEALPix cell uniq number to its (level, ipix) equivalent.
A uniq number is a 64 bits integer equaling to : ipix + 4*(4**level). Please read
this `paper <http://ivoa.net/documents/MOC/20140602/REC-MOC-1.0-20140602.pdf>`_
for more details about uniq numbers... | python | def uniq_to_level_ipix(uniq):
"""
Convert a HEALPix cell uniq number to its (level, ipix) equivalent.
A uniq number is a 64 bits integer equaling to : ipix + 4*(4**level). Please read
this `paper <http://ivoa.net/documents/MOC/20140602/REC-MOC-1.0-20140602.pdf>`_
for more details about uniq numbers... | [
"def",
"uniq_to_level_ipix",
"(",
"uniq",
")",
":",
"uniq",
"=",
"np",
".",
"asarray",
"(",
"uniq",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"level",
"=",
"(",
"np",
".",
"log2",
"(",
"uniq",
"//",
"4",
")",
")",
"//",
"2",
"level",
"=",
"le... | Convert a HEALPix cell uniq number to its (level, ipix) equivalent.
A uniq number is a 64 bits integer equaling to : ipix + 4*(4**level). Please read
this `paper <http://ivoa.net/documents/MOC/20140602/REC-MOC-1.0-20140602.pdf>`_
for more details about uniq numbers.
Parameters
----------
uniq ... | [
"Convert",
"a",
"HEALPix",
"cell",
"uniq",
"number",
"to",
"its",
"(",
"level",
"ipix",
")",
"equivalent",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L133-L160 |
astropy/astropy-healpix | astropy_healpix/core.py | level_ipix_to_uniq | def level_ipix_to_uniq(level, ipix):
"""
Convert a level and HEALPix index into a uniq number representing the cell.
This function is the inverse of `uniq_to_level_ipix`.
Parameters
----------
level : int
The level of the HEALPix cell
ipix : int
The index of the HEALPix cel... | python | def level_ipix_to_uniq(level, ipix):
"""
Convert a level and HEALPix index into a uniq number representing the cell.
This function is the inverse of `uniq_to_level_ipix`.
Parameters
----------
level : int
The level of the HEALPix cell
ipix : int
The index of the HEALPix cel... | [
"def",
"level_ipix_to_uniq",
"(",
"level",
",",
"ipix",
")",
":",
"level",
"=",
"np",
".",
"asarray",
"(",
"level",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"ipix",
"=",
"np",
".",
"asarray",
"(",
"ipix",
",",
"dtype",
"=",
"np",
".",
"int64",
... | Convert a level and HEALPix index into a uniq number representing the cell.
This function is the inverse of `uniq_to_level_ipix`.
Parameters
----------
level : int
The level of the HEALPix cell
ipix : int
The index of the HEALPix cell
Returns
-------
uniq : int
... | [
"Convert",
"a",
"level",
"and",
"HEALPix",
"index",
"into",
"a",
"uniq",
"number",
"representing",
"the",
"cell",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L163-L187 |
astropy/astropy-healpix | astropy_healpix/core.py | nside_to_pixel_area | def nside_to_pixel_area(nside):
"""
Find the area of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
pixel_ar... | python | def nside_to_pixel_area(nside):
"""
Find the area of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
pixel_ar... | [
"def",
"nside_to_pixel_area",
"(",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asanyarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"_validate_nside",
"(",
"nside",
")",
"npix",
"=",
"12",
"*",
"nside",
"*",
"nside",
"pixel_area",
"=... | Find the area of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
pixel_area : :class:`~astropy.units.Quantity`
... | [
"Find",
"the",
"area",
"of",
"HEALPix",
"pixels",
"given",
"the",
"pixel",
"dimensions",
"of",
"one",
"of",
"the",
"12",
"top",
"-",
"level",
"HEALPix",
"tiles",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L190-L209 |
astropy/astropy-healpix | astropy_healpix/core.py | nside_to_pixel_resolution | def nside_to_pixel_resolution(nside):
"""
Find the resolution of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
... | python | def nside_to_pixel_resolution(nside):
"""
Find the resolution of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
... | [
"def",
"nside_to_pixel_resolution",
"(",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asanyarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"_validate_nside",
"(",
"nside",
")",
"return",
"(",
"nside_to_pixel_area",
"(",
"nside",
")",
"**"... | Find the resolution of HEALPix pixels given the pixel dimensions of one of
the 12 'top-level' HEALPix tiles.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
resolution : :class:`~astropy.units.Quantity`
... | [
"Find",
"the",
"resolution",
"of",
"HEALPix",
"pixels",
"given",
"the",
"pixel",
"dimensions",
"of",
"one",
"of",
"the",
"12",
"top",
"-",
"level",
"HEALPix",
"tiles",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L212-L233 |
astropy/astropy-healpix | astropy_healpix/core.py | pixel_resolution_to_nside | def pixel_resolution_to_nside(resolution, round='nearest'):
"""Find closest HEALPix nside for a given angular resolution.
This function is the inverse of `nside_to_pixel_resolution`,
for the default rounding scheme of ``round='nearest'``.
If you choose ``round='up'``, you'll get HEALPix pixels that
... | python | def pixel_resolution_to_nside(resolution, round='nearest'):
"""Find closest HEALPix nside for a given angular resolution.
This function is the inverse of `nside_to_pixel_resolution`,
for the default rounding scheme of ``round='nearest'``.
If you choose ``round='up'``, you'll get HEALPix pixels that
... | [
"def",
"pixel_resolution_to_nside",
"(",
"resolution",
",",
"round",
"=",
"'nearest'",
")",
":",
"resolution",
"=",
"resolution",
".",
"to",
"(",
"u",
".",
"rad",
")",
".",
"value",
"pixel_area",
"=",
"resolution",
"*",
"resolution",
"npix",
"=",
"4",
"*",... | Find closest HEALPix nside for a given angular resolution.
This function is the inverse of `nside_to_pixel_resolution`,
for the default rounding scheme of ``round='nearest'``.
If you choose ``round='up'``, you'll get HEALPix pixels that
have at least the requested resolution (usually a bit better
... | [
"Find",
"closest",
"HEALPix",
"nside",
"for",
"a",
"given",
"angular",
"resolution",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L236-L295 |
astropy/astropy-healpix | astropy_healpix/core.py | nside_to_npix | def nside_to_npix(nside):
"""
Find the number of pixels corresponding to a HEALPix resolution.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
npix : int
The number of pixels in the HEALPix m... | python | def nside_to_npix(nside):
"""
Find the number of pixels corresponding to a HEALPix resolution.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
npix : int
The number of pixels in the HEALPix m... | [
"def",
"nside_to_npix",
"(",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asanyarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"_validate_nside",
"(",
"nside",
")",
"return",
"12",
"*",
"nside",
"**",
"2"
] | Find the number of pixels corresponding to a HEALPix resolution.
Parameters
----------
nside : int
The number of pixels on the side of one of the 12 'top-level' HEALPix tiles.
Returns
-------
npix : int
The number of pixels in the HEALPix map. | [
"Find",
"the",
"number",
"of",
"pixels",
"corresponding",
"to",
"a",
"HEALPix",
"resolution",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L298-L314 |
astropy/astropy-healpix | astropy_healpix/core.py | npix_to_nside | def npix_to_nside(npix):
"""
Find the number of pixels on the side of one of the 12 'top-level' HEALPix
tiles given a total number of pixels.
Parameters
----------
npix : int
The number of pixels in the HEALPix map.
Returns
-------
nside : int
The number of pixels o... | python | def npix_to_nside(npix):
"""
Find the number of pixels on the side of one of the 12 'top-level' HEALPix
tiles given a total number of pixels.
Parameters
----------
npix : int
The number of pixels in the HEALPix map.
Returns
-------
nside : int
The number of pixels o... | [
"def",
"npix_to_nside",
"(",
"npix",
")",
":",
"npix",
"=",
"np",
".",
"asanyarray",
"(",
"npix",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"if",
"not",
"np",
".",
"all",
"(",
"npix",
"%",
"12",
"==",
"0",
")",
":",
"raise",
"ValueError",
"(",
... | Find the number of pixels on the side of one of the 12 'top-level' HEALPix
tiles given a total number of pixels.
Parameters
----------
npix : int
The number of pixels in the HEALPix map.
Returns
-------
nside : int
The number of pixels on the side of one of the 12 'top-leve... | [
"Find",
"the",
"number",
"of",
"pixels",
"on",
"the",
"side",
"of",
"one",
"of",
"the",
"12",
"top",
"-",
"level",
"HEALPix",
"tiles",
"given",
"a",
"total",
"number",
"of",
"pixels",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L317-L342 |
astropy/astropy-healpix | astropy_healpix/core.py | healpix_to_lonlat | def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----... | python | def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----... | [
"def",
"healpix_to_lonlat",
"(",
"healpix_index",
",",
"nside",
",",
"dx",
"=",
"None",
",",
"dy",
"=",
"None",
",",
"order",
"=",
"'ring'",
")",
":",
"_validate_nside",
"(",
"nside",
")",
"if",
"_validate_order",
"(",
"order",
")",
"==",
"'ring'",
":",
... | Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar o... | [
"Convert",
"HEALPix",
"indices",
"(",
"optionally",
"with",
"offsets",
")",
"to",
"longitudes",
"/",
"latitudes",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L345-L395 |
astropy/astropy-healpix | astropy_healpix/core.py | lonlat_to_healpix | def lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring'):
"""
Convert longitudes/latitudes to HEALPix indices
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angl... | python | def lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring'):
"""
Convert longitudes/latitudes to HEALPix indices
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angl... | [
"def",
"lonlat_to_healpix",
"(",
"lon",
",",
"lat",
",",
"nside",
",",
"return_offsets",
"=",
"False",
",",
"order",
"=",
"'ring'",
")",
":",
"if",
"_validate_order",
"(",
"order",
")",
"==",
"'ring'",
":",
"func",
"=",
"_core",
".",
"lonlat_to_healpix_rin... | Convert longitudes/latitudes to HEALPix indices
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angle units.
nside : int or `~numpy.ndarray`
Number of pixels along the side of ... | [
"Convert",
"longitudes",
"/",
"latitudes",
"to",
"HEALPix",
"indices"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L398-L440 |
astropy/astropy-healpix | astropy_healpix/core.py | nested_to_ring | def nested_to_ring(nested_index, nside):
"""
Convert a HEALPix 'nested' index to a HEALPix 'ring' index
Parameters
----------
nested_index : int or `~numpy.ndarray`
Healpix index using the 'nested' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each ... | python | def nested_to_ring(nested_index, nside):
"""
Convert a HEALPix 'nested' index to a HEALPix 'ring' index
Parameters
----------
nested_index : int or `~numpy.ndarray`
Healpix index using the 'nested' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each ... | [
"def",
"nested_to_ring",
"(",
"nested_index",
",",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"intc",
")",
"return",
"_core",
".",
"nested_to_ring",
"(",
"nested_index",
",",
"nside",
")"
] | Convert a HEALPix 'nested' index to a HEALPix 'ring' index
Parameters
----------
nested_index : int or `~numpy.ndarray`
Healpix index using the 'nested' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each of the 12 top-level HEALPix tiles
Returns
--... | [
"Convert",
"a",
"HEALPix",
"nested",
"index",
"to",
"a",
"HEALPix",
"ring",
"index"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L443-L462 |
astropy/astropy-healpix | astropy_healpix/core.py | ring_to_nested | def ring_to_nested(ring_index, nside):
"""
Convert a HEALPix 'ring' index to a HEALPix 'nested' index
Parameters
----------
ring_index : int or `~numpy.ndarray`
Healpix index using the 'ring' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each of the... | python | def ring_to_nested(ring_index, nside):
"""
Convert a HEALPix 'ring' index to a HEALPix 'nested' index
Parameters
----------
ring_index : int or `~numpy.ndarray`
Healpix index using the 'ring' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each of the... | [
"def",
"ring_to_nested",
"(",
"ring_index",
",",
"nside",
")",
":",
"nside",
"=",
"np",
".",
"asarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"intc",
")",
"return",
"_core",
".",
"ring_to_nested",
"(",
"ring_index",
",",
"nside",
")"
] | Convert a HEALPix 'ring' index to a HEALPix 'nested' index
Parameters
----------
ring_index : int or `~numpy.ndarray`
Healpix index using the 'ring' ordering
nside : int or `~numpy.ndarray`
Number of pixels along the side of each of the 12 top-level HEALPix tiles
Returns
------... | [
"Convert",
"a",
"HEALPix",
"ring",
"index",
"to",
"a",
"HEALPix",
"nested",
"index"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L465-L484 |
astropy/astropy-healpix | astropy_healpix/core.py | bilinear_interpolation_weights | def bilinear_interpolation_weights(lon, lat, nside, order='ring'):
"""
Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude va... | python | def bilinear_interpolation_weights(lon, lat, nside, order='ring'):
"""
Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude va... | [
"def",
"bilinear_interpolation_weights",
"(",
"lon",
",",
"lat",
",",
"nside",
",",
"order",
"=",
"'ring'",
")",
":",
"lon",
"=",
"lon",
".",
"to_value",
"(",
"u",
".",
"rad",
")",
"lat",
"=",
"lat",
".",
"to_value",
"(",
"u",
".",
"rad",
")",
"_va... | Get the four neighbours for each (lon, lat) position and the weight
associated with each one for bilinear interpolation.
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angle units.
... | [
"Get",
"the",
"four",
"neighbours",
"for",
"each",
"(",
"lon",
"lat",
")",
"position",
"and",
"the",
"weight",
"associated",
"with",
"each",
"one",
"for",
"bilinear",
"interpolation",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L487-L526 |
astropy/astropy-healpix | astropy_healpix/core.py | interpolate_bilinear_lonlat | def interpolate_bilinear_lonlat(lon, lat, values, order='ring'):
"""
Interpolate values at specific longitudes/latitudes using bilinear interpolation
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity` insta... | python | def interpolate_bilinear_lonlat(lon, lat, values, order='ring'):
"""
Interpolate values at specific longitudes/latitudes using bilinear interpolation
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity` insta... | [
"def",
"interpolate_bilinear_lonlat",
"(",
"lon",
",",
"lat",
",",
"values",
",",
"order",
"=",
"'ring'",
")",
":",
"nside",
"=",
"npix_to_nside",
"(",
"values",
".",
"shape",
"[",
"0",
"]",
")",
"indices",
",",
"weights",
"=",
"bilinear_interpolation_weight... | Interpolate values at specific longitudes/latitudes using bilinear interpolation
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity` instances
with angle units.
values : `~numpy.ndarray`
Array wi... | [
"Interpolate",
"values",
"at",
"specific",
"longitudes",
"/",
"latitudes",
"using",
"bilinear",
"interpolation"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L529-L558 |
astropy/astropy-healpix | astropy_healpix/core.py | neighbours | def neighbours(healpix_index, nside, order='ring'):
"""
Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
nside : int
Number of pixels along the side of each of the 12 top-level H... | python | def neighbours(healpix_index, nside, order='ring'):
"""
Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
nside : int
Number of pixels along the side of each of the 12 top-level H... | [
"def",
"neighbours",
"(",
"healpix_index",
",",
"nside",
",",
"order",
"=",
"'ring'",
")",
":",
"_validate_nside",
"(",
"nside",
")",
"nside",
"=",
"np",
".",
"asarray",
"(",
"nside",
",",
"dtype",
"=",
"np",
".",
"intc",
")",
"if",
"_validate_order",
... | Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
order : { 'nested' | 'ring' }
Order of ... | [
"Find",
"all",
"the",
"HEALPix",
"pixels",
"that",
"are",
"the",
"neighbours",
"of",
"a",
"HEALPix",
"pixel"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L561-L592 |
astropy/astropy-healpix | astropy_healpix/core.py | healpix_cone_search | def healpix_cone_search(lon, lat, radius, nside, order='ring'):
"""
Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a tim... | python | def healpix_cone_search(lon, lat, radius, nside, order='ring'):
"""
Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a tim... | [
"def",
"healpix_cone_search",
"(",
"lon",
",",
"lat",
",",
"radius",
",",
"nside",
",",
"order",
"=",
"'ring'",
")",
":",
"lon",
"=",
"lon",
".",
"to_value",
"(",
"u",
".",
"deg",
")",
"lat",
"=",
"lat",
".",
"to_value",
"(",
"u",
".",
"deg",
")"... | Find all the HEALPix pixels within a given radius of a longitude/latitude.
Note that this returns all pixels that overlap, including partially, with
the search cone. This function can only be used for a single lon/lat pair at
a time, since different calls to the function may result in a different
numbe... | [
"Find",
"all",
"the",
"HEALPix",
"pixels",
"within",
"a",
"given",
"radius",
"of",
"a",
"longitude",
"/",
"latitude",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L595-L628 |
astropy/astropy-healpix | astropy_healpix/core.py | boundaries_lonlat | def boundaries_lonlat(healpix_index, step, nside, order='ring'):
"""
Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting ``st... | python | def boundaries_lonlat(healpix_index, step, nside, order='ring'):
"""
Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting ``st... | [
"def",
"boundaries_lonlat",
"(",
"healpix_index",
",",
"step",
",",
"nside",
",",
"order",
"=",
"'ring'",
")",
":",
"healpix_index",
"=",
"np",
".",
"asarray",
"(",
"healpix_index",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"step",
"=",
"int",
"(",
"... | Return the longitude and latitude of the edges of HEALPix pixels
This returns the longitude and latitude of points along the edge of each
HEALPIX pixel. The number of points returned for each pixel is ``4 * step``,
so setting ``step`` to 1 returns just the corners.
Parameters
----------
healpi... | [
"Return",
"the",
"longitude",
"and",
"latitude",
"of",
"the",
"edges",
"of",
"HEALPix",
"pixels"
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L631-L678 |
astropy/astropy-healpix | astropy_healpix/healpy.py | nside2resol | def nside2resol(nside, arcmin=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nside2resol`."""
resolution = nside_to_pixel_resolution(nside)
if arcmin:
return resolution.to(u.arcmin).value
else:
return resolution.to(u.rad).value | python | def nside2resol(nside, arcmin=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nside2resol`."""
resolution = nside_to_pixel_resolution(nside)
if arcmin:
return resolution.to(u.arcmin).value
else:
return resolution.to(u.rad).value | [
"def",
"nside2resol",
"(",
"nside",
",",
"arcmin",
"=",
"False",
")",
":",
"resolution",
"=",
"nside_to_pixel_resolution",
"(",
"nside",
")",
"if",
"arcmin",
":",
"return",
"resolution",
".",
"to",
"(",
"u",
".",
"arcmin",
")",
".",
"value",
"else",
":",... | Drop-in replacement for healpy `~healpy.pixelfunc.nside2resol`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"nside2resol",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L68-L74 |
astropy/astropy-healpix | astropy_healpix/healpy.py | nside2pixarea | def nside2pixarea(nside, degrees=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nside2pixarea`."""
area = nside_to_pixel_area(nside)
if degrees:
return area.to(u.deg ** 2).value
else:
return area.to(u.sr).value | python | def nside2pixarea(nside, degrees=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nside2pixarea`."""
area = nside_to_pixel_area(nside)
if degrees:
return area.to(u.deg ** 2).value
else:
return area.to(u.sr).value | [
"def",
"nside2pixarea",
"(",
"nside",
",",
"degrees",
"=",
"False",
")",
":",
"area",
"=",
"nside_to_pixel_area",
"(",
"nside",
")",
"if",
"degrees",
":",
"return",
"area",
".",
"to",
"(",
"u",
".",
"deg",
"**",
"2",
")",
".",
"value",
"else",
":",
... | Drop-in replacement for healpy `~healpy.pixelfunc.nside2pixarea`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"nside2pixarea",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L77-L83 |
astropy/astropy-healpix | astropy_healpix/healpy.py | pix2ang | def pix2ang(nside, ipix, nest=False, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.pix2ang`."""
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
return _lonlat_to_healpy(lon, lat, lonlat=lonlat) | python | def pix2ang(nside, ipix, nest=False, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.pix2ang`."""
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
return _lonlat_to_healpy(lon, lat, lonlat=lonlat) | [
"def",
"pix2ang",
"(",
"nside",
",",
"ipix",
",",
"nest",
"=",
"False",
",",
"lonlat",
"=",
"False",
")",
":",
"lon",
",",
"lat",
"=",
"healpix_to_lonlat",
"(",
"ipix",
",",
"nside",
",",
"order",
"=",
"'nested'",
"if",
"nest",
"else",
"'ring'",
")",... | Drop-in replacement for healpy `~healpy.pixelfunc.pix2ang`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"pix2ang",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L101-L104 |
astropy/astropy-healpix | astropy_healpix/healpy.py | ang2pix | def ang2pix(nside, theta, phi, nest=False, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.ang2pix`."""
lon, lat = _healpy_to_lonlat(theta, phi, lonlat=lonlat)
return lonlat_to_healpix(lon, lat, nside, order='nested' if nest else 'ring') | python | def ang2pix(nside, theta, phi, nest=False, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.ang2pix`."""
lon, lat = _healpy_to_lonlat(theta, phi, lonlat=lonlat)
return lonlat_to_healpix(lon, lat, nside, order='nested' if nest else 'ring') | [
"def",
"ang2pix",
"(",
"nside",
",",
"theta",
",",
"phi",
",",
"nest",
"=",
"False",
",",
"lonlat",
"=",
"False",
")",
":",
"lon",
",",
"lat",
"=",
"_healpy_to_lonlat",
"(",
"theta",
",",
"phi",
",",
"lonlat",
"=",
"lonlat",
")",
"return",
"lonlat_to... | Drop-in replacement for healpy `~healpy.pixelfunc.ang2pix`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"ang2pix",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L107-L110 |
astropy/astropy-healpix | astropy_healpix/healpy.py | pix2vec | def pix2vec(nside, ipix, nest=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.pix2vec`."""
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
return ang2vec(*_lonlat_to_healpy(lon, lat)) | python | def pix2vec(nside, ipix, nest=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.pix2vec`."""
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
return ang2vec(*_lonlat_to_healpy(lon, lat)) | [
"def",
"pix2vec",
"(",
"nside",
",",
"ipix",
",",
"nest",
"=",
"False",
")",
":",
"lon",
",",
"lat",
"=",
"healpix_to_lonlat",
"(",
"ipix",
",",
"nside",
",",
"order",
"=",
"'nested'",
"if",
"nest",
"else",
"'ring'",
")",
"return",
"ang2vec",
"(",
"*... | Drop-in replacement for healpy `~healpy.pixelfunc.pix2vec`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"pix2vec",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L113-L116 |
astropy/astropy-healpix | astropy_healpix/healpy.py | vec2pix | def vec2pix(nside, x, y, z, nest=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.vec2pix`."""
theta, phi = vec2ang(np.transpose([x, y, z]))
# hp.vec2ang() returns raveled arrays, which are 1D.
if np.isscalar(x):
theta = theta.item()
phi = phi.item()
else:
shape =... | python | def vec2pix(nside, x, y, z, nest=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.vec2pix`."""
theta, phi = vec2ang(np.transpose([x, y, z]))
# hp.vec2ang() returns raveled arrays, which are 1D.
if np.isscalar(x):
theta = theta.item()
phi = phi.item()
else:
shape =... | [
"def",
"vec2pix",
"(",
"nside",
",",
"x",
",",
"y",
",",
"z",
",",
"nest",
"=",
"False",
")",
":",
"theta",
",",
"phi",
"=",
"vec2ang",
"(",
"np",
".",
"transpose",
"(",
"[",
"x",
",",
"y",
",",
"z",
"]",
")",
")",
"# hp.vec2ang() returns raveled... | Drop-in replacement for healpy `~healpy.pixelfunc.vec2pix`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"vec2pix",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L119-L131 |
astropy/astropy-healpix | astropy_healpix/healpy.py | nest2ring | def nest2ring(nside, ipix):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nest2ring`."""
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return nested_to_ring(ipix, nside) | python | def nest2ring(nside, ipix):
"""Drop-in replacement for healpy `~healpy.pixelfunc.nest2ring`."""
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return nested_to_ring(ipix, nside) | [
"def",
"nest2ring",
"(",
"nside",
",",
"ipix",
")",
":",
"ipix",
"=",
"np",
".",
"atleast_1d",
"(",
"ipix",
")",
".",
"astype",
"(",
"np",
".",
"int64",
",",
"copy",
"=",
"False",
")",
"return",
"nested_to_ring",
"(",
"ipix",
",",
"nside",
")"
] | Drop-in replacement for healpy `~healpy.pixelfunc.nest2ring`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"nest2ring",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L134-L137 |
astropy/astropy-healpix | astropy_healpix/healpy.py | ring2nest | def ring2nest(nside, ipix):
"""Drop-in replacement for healpy `~healpy.pixelfunc.ring2nest`."""
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return ring_to_nested(ipix, nside) | python | def ring2nest(nside, ipix):
"""Drop-in replacement for healpy `~healpy.pixelfunc.ring2nest`."""
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return ring_to_nested(ipix, nside) | [
"def",
"ring2nest",
"(",
"nside",
",",
"ipix",
")",
":",
"ipix",
"=",
"np",
".",
"atleast_1d",
"(",
"ipix",
")",
".",
"astype",
"(",
"np",
".",
"int64",
",",
"copy",
"=",
"False",
")",
"return",
"ring_to_nested",
"(",
"ipix",
",",
"nside",
")"
] | Drop-in replacement for healpy `~healpy.pixelfunc.ring2nest`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"ring2nest",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L140-L143 |
astropy/astropy-healpix | astropy_healpix/healpy.py | boundaries | def boundaries(nside, pix, step=1, nest=False):
"""Drop-in replacement for healpy `~healpy.boundaries`."""
pix = np.asarray(pix)
if pix.ndim > 1:
# For consistency with healpy we only support scalars or 1D arrays
raise ValueError("Array has to be one dimensional")
lon, lat = boundaries_l... | python | def boundaries(nside, pix, step=1, nest=False):
"""Drop-in replacement for healpy `~healpy.boundaries`."""
pix = np.asarray(pix)
if pix.ndim > 1:
# For consistency with healpy we only support scalars or 1D arrays
raise ValueError("Array has to be one dimensional")
lon, lat = boundaries_l... | [
"def",
"boundaries",
"(",
"nside",
",",
"pix",
",",
"step",
"=",
"1",
",",
"nest",
"=",
"False",
")",
":",
"pix",
"=",
"np",
".",
"asarray",
"(",
"pix",
")",
"if",
"pix",
".",
"ndim",
">",
"1",
":",
"# For consistency with healpy we only support scalars ... | Drop-in replacement for healpy `~healpy.boundaries`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"boundaries",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L146-L158 |
astropy/astropy-healpix | astropy_healpix/healpy.py | vec2ang | def vec2ang(vectors, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.vec2ang`."""
x, y, z = vectors.transpose()
rep_car = CartesianRepresentation(x, y, z)
rep_sph = rep_car.represent_as(UnitSphericalRepresentation)
return _lonlat_to_healpy(rep_sph.lon.ravel(), rep_sph.lat.ravel()... | python | def vec2ang(vectors, lonlat=False):
"""Drop-in replacement for healpy `~healpy.pixelfunc.vec2ang`."""
x, y, z = vectors.transpose()
rep_car = CartesianRepresentation(x, y, z)
rep_sph = rep_car.represent_as(UnitSphericalRepresentation)
return _lonlat_to_healpy(rep_sph.lon.ravel(), rep_sph.lat.ravel()... | [
"def",
"vec2ang",
"(",
"vectors",
",",
"lonlat",
"=",
"False",
")",
":",
"x",
",",
"y",
",",
"z",
"=",
"vectors",
".",
"transpose",
"(",
")",
"rep_car",
"=",
"CartesianRepresentation",
"(",
"x",
",",
"y",
",",
"z",
")",
"rep_sph",
"=",
"rep_car",
"... | Drop-in replacement for healpy `~healpy.pixelfunc.vec2ang`. | [
"Drop",
"-",
"in",
"replacement",
"for",
"healpy",
"~healpy",
".",
"pixelfunc",
".",
"vec2ang",
"."
] | train | https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/healpy.py#L161-L166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.