repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_base_provider.py | SamBaseProvider.get_template | def get_template(template_dict, parameter_overrides=None):
"""
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted.
Parameters
----------
template_dict : dict
unproc... | python | def get_template(template_dict, parameter_overrides=None):
"""
Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted.
Parameters
----------
template_dict : dict
unproc... | [
"def",
"get_template",
"(",
"template_dict",
",",
"parameter_overrides",
"=",
"None",
")",
":",
"template_dict",
"=",
"template_dict",
"or",
"{",
"}",
"if",
"template_dict",
":",
"template_dict",
"=",
"SamTranslatorWrapper",
"(",
"template_dict",
")",
".",
"run_pl... | Given a SAM template dictionary, return a cleaned copy of the template where SAM plugins have been run
and parameter values have been substituted.
Parameters
----------
template_dict : dict
unprocessed SAM template dictionary
parameter_overrides: dict
Op... | [
"Given",
"a",
"SAM",
"template",
"dictionary",
"return",
"a",
"cleaned",
"copy",
"of",
"the",
"template",
"where",
"SAM",
"plugins",
"have",
"been",
"run",
"and",
"parameter",
"values",
"have",
"been",
"substituted",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_base_provider.py#L41-L66 | train | Given a SAM template dictionary return a cleaned copy of the template where the SAM plugins have been run and the parameter values have been substituted. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_base_provider.py | SamBaseProvider._resolve_parameters | def _resolve_parameters(template_dict, parameter_overrides):
"""
In the given template, apply parameter values to resolve intrinsic functions
Parameters
----------
template_dict : dict
SAM Template
parameter_overrides : dict
Values for template p... | python | def _resolve_parameters(template_dict, parameter_overrides):
"""
In the given template, apply parameter values to resolve intrinsic functions
Parameters
----------
template_dict : dict
SAM Template
parameter_overrides : dict
Values for template p... | [
"def",
"_resolve_parameters",
"(",
"template_dict",
",",
"parameter_overrides",
")",
":",
"parameter_values",
"=",
"SamBaseProvider",
".",
"_get_parameter_values",
"(",
"template_dict",
",",
"parameter_overrides",
")",
"supported_intrinsics",
"=",
"{",
"action",
".",
"i... | In the given template, apply parameter values to resolve intrinsic functions
Parameters
----------
template_dict : dict
SAM Template
parameter_overrides : dict
Values for template parameters provided by user
Returns
-------
dict
... | [
"In",
"the",
"given",
"template",
"apply",
"parameter",
"values",
"to",
"resolve",
"intrinsic",
"functions"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_base_provider.py#L69-L93 | train | Resolves the parameters of the user defined template with their respective values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_base_provider.py | SamBaseProvider._get_parameter_values | def _get_parameter_values(template_dict, parameter_overrides):
"""
Construct a final list of values for CloudFormation template parameters based on user-supplied values,
default values provided in template, and sane defaults for pseudo-parameters.
Parameters
----------
t... | python | def _get_parameter_values(template_dict, parameter_overrides):
"""
Construct a final list of values for CloudFormation template parameters based on user-supplied values,
default values provided in template, and sane defaults for pseudo-parameters.
Parameters
----------
t... | [
"def",
"_get_parameter_values",
"(",
"template_dict",
",",
"parameter_overrides",
")",
":",
"default_values",
"=",
"SamBaseProvider",
".",
"_get_default_parameter_values",
"(",
"template_dict",
")",
"# NOTE: Ordering of following statements is important. It makes sure that any user-s... | Construct a final list of values for CloudFormation template parameters based on user-supplied values,
default values provided in template, and sane defaults for pseudo-parameters.
Parameters
----------
template_dict : dict
SAM template dictionary
parameter_override... | [
"Construct",
"a",
"final",
"list",
"of",
"values",
"for",
"CloudFormation",
"template",
"parameters",
"based",
"on",
"user",
"-",
"supplied",
"values",
"default",
"values",
"provided",
"in",
"template",
"and",
"sane",
"defaults",
"for",
"pseudo",
"-",
"parameter... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_base_provider.py#L96-L124 | train | Constructs a list of values for CloudFormation template parameters based on user - supplied values and sane defaults for pseudo - parameters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_base_provider.py | SamBaseProvider._get_default_parameter_values | def _get_default_parameter_values(sam_template):
"""
Method to read default values for template parameters and return it
Example:
If the template contains the following parameters defined
Parameters:
Param1:
Type: String
Default: defaul... | python | def _get_default_parameter_values(sam_template):
"""
Method to read default values for template parameters and return it
Example:
If the template contains the following parameters defined
Parameters:
Param1:
Type: String
Default: defaul... | [
"def",
"_get_default_parameter_values",
"(",
"sam_template",
")",
":",
"default_values",
"=",
"{",
"}",
"parameter_definition",
"=",
"sam_template",
".",
"get",
"(",
"\"Parameters\"",
",",
"None",
")",
"if",
"not",
"parameter_definition",
"or",
"not",
"isinstance",
... | Method to read default values for template parameters and return it
Example:
If the template contains the following parameters defined
Parameters:
Param1:
Type: String
Default: default_value1
Param2:
Type: String
... | [
"Method",
"to",
"read",
"default",
"values",
"for",
"template",
"parameters",
"and",
"return",
"it",
"Example",
":",
"If",
"the",
"template",
"contains",
"the",
"following",
"parameters",
"defined",
"Parameters",
":",
"Param1",
":",
"Type",
":",
"String",
"Def... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_base_provider.py#L127-L161 | train | Method to read default values for parameters in SAM template and return them | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/utils.py | to_posix_path | def to_posix_path(code_path):
"""
Change the code_path to be of unix-style if running on windows when supplied with an absolute windows path.
Parameters
----------
code_path : str
Directory in the host operating system that should be mounted within the container.
Returns
-------
... | python | def to_posix_path(code_path):
"""
Change the code_path to be of unix-style if running on windows when supplied with an absolute windows path.
Parameters
----------
code_path : str
Directory in the host operating system that should be mounted within the container.
Returns
-------
... | [
"def",
"to_posix_path",
"(",
"code_path",
")",
":",
"return",
"re",
".",
"sub",
"(",
"\"^([A-Za-z])+:\"",
",",
"lambda",
"match",
":",
"posixpath",
".",
"sep",
"+",
"match",
".",
"group",
"(",
")",
".",
"replace",
"(",
"\":\"",
",",
"\"\"",
")",
".",
... | Change the code_path to be of unix-style if running on windows when supplied with an absolute windows path.
Parameters
----------
code_path : str
Directory in the host operating system that should be mounted within the container.
Returns
-------
str
Posix equivalent of absolute ... | [
"Change",
"the",
"code_path",
"to",
"be",
"of",
"unix",
"-",
"style",
"if",
"running",
"on",
"windows",
"when",
"supplied",
"with",
"an",
"absolute",
"windows",
"path",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/utils.py#L14-L36 | train | Converts a Windows path to a POSIX - style path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_container.py | LambdaContainer._get_additional_options | def _get_additional_options(runtime, debug_options):
"""
Return additional Docker container options. Used by container debug mode to enable certain container
security options.
:param DebugContext debug_options: DebugContext for the runtime of the container.
:return dict: Dictiona... | python | def _get_additional_options(runtime, debug_options):
"""
Return additional Docker container options. Used by container debug mode to enable certain container
security options.
:param DebugContext debug_options: DebugContext for the runtime of the container.
:return dict: Dictiona... | [
"def",
"_get_additional_options",
"(",
"runtime",
",",
"debug_options",
")",
":",
"if",
"not",
"debug_options",
":",
"return",
"None",
"opts",
"=",
"{",
"}",
"if",
"runtime",
"==",
"Runtime",
".",
"go1x",
".",
"value",
":",
"# These options are required for delv... | Return additional Docker container options. Used by container debug mode to enable certain container
security options.
:param DebugContext debug_options: DebugContext for the runtime of the container.
:return dict: Dictionary containing additional arguments to be passed to container creation. | [
"Return",
"additional",
"Docker",
"container",
"options",
".",
"Used",
"by",
"container",
"debug",
"mode",
"to",
"enable",
"certain",
"container",
"security",
"options",
".",
":",
"param",
"DebugContext",
"debug_options",
":",
"DebugContext",
"for",
"the",
"runtim... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_container.py#L104-L122 | train | Returns additional Docker container options. Used by container debug mode to enable certain container specific options. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_container.py | LambdaContainer._get_entry_point | def _get_entry_point(runtime, debug_options=None): # pylint: disable=too-many-branches
"""
Returns the entry point for the container. The default value for the entry point is already configured in the
Dockerfile. We override this default specifically when enabling debugging. The overridden entr... | python | def _get_entry_point(runtime, debug_options=None): # pylint: disable=too-many-branches
"""
Returns the entry point for the container. The default value for the entry point is already configured in the
Dockerfile. We override this default specifically when enabling debugging. The overridden entr... | [
"def",
"_get_entry_point",
"(",
"runtime",
",",
"debug_options",
"=",
"None",
")",
":",
"# pylint: disable=too-many-branches",
"if",
"not",
"debug_options",
":",
"return",
"None",
"if",
"runtime",
"not",
"in",
"LambdaContainer",
".",
"_supported_runtimes",
"(",
")",... | Returns the entry point for the container. The default value for the entry point is already configured in the
Dockerfile. We override this default specifically when enabling debugging. The overridden entry point includes
a few extra flags to start the runtime in debug mode.
:param string runtim... | [
"Returns",
"the",
"entry",
"point",
"for",
"the",
"container",
".",
"The",
"default",
"value",
"for",
"the",
"entry",
"point",
"is",
"already",
"configured",
"in",
"the",
"Dockerfile",
".",
"We",
"override",
"this",
"default",
"specifically",
"when",
"enabling... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_container.py#L161-L305 | train | Returns the entry point for the Lambda container. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._extract_apis | def _extract_apis(self, resources):
"""
Extract all Implicit Apis (Apis defined through Serverless Function with an Api Event
:param dict resources: Dictionary of SAM/CloudFormation resources
:return: List of nametuple Api
"""
# Some properties like BinaryMediaTypes, Co... | python | def _extract_apis(self, resources):
"""
Extract all Implicit Apis (Apis defined through Serverless Function with an Api Event
:param dict resources: Dictionary of SAM/CloudFormation resources
:return: List of nametuple Api
"""
# Some properties like BinaryMediaTypes, Co... | [
"def",
"_extract_apis",
"(",
"self",
",",
"resources",
")",
":",
"# Some properties like BinaryMediaTypes, Cors are set once on the resource but need to be applied to each API.",
"# For Implicit APIs, which are defined on the Function resource, these properties",
"# are defined on a AWS::Serverl... | Extract all Implicit Apis (Apis defined through Serverless Function with an Api Event
:param dict resources: Dictionary of SAM/CloudFormation resources
:return: List of nametuple Api | [
"Extract",
"all",
"Implicit",
"Apis",
"(",
"Apis",
"defined",
"through",
"Serverless",
"Function",
"with",
"an",
"Api",
"Event"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L76-L107 | train | Extract all Implicit Apis from Serverless Function with an Api Event
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._extract_from_serverless_api | def _extract_from_serverless_api(self, logical_id, api_resource, collector):
"""
Extract APIs from AWS::Serverless::Api resource by reading and parsing Swagger documents. The result is added
to the collector.
Parameters
----------
logical_id : str
Logical ID ... | python | def _extract_from_serverless_api(self, logical_id, api_resource, collector):
"""
Extract APIs from AWS::Serverless::Api resource by reading and parsing Swagger documents. The result is added
to the collector.
Parameters
----------
logical_id : str
Logical ID ... | [
"def",
"_extract_from_serverless_api",
"(",
"self",
",",
"logical_id",
",",
"api_resource",
",",
"collector",
")",
":",
"properties",
"=",
"api_resource",
".",
"get",
"(",
"\"Properties\"",
",",
"{",
"}",
")",
"body",
"=",
"properties",
".",
"get",
"(",
"\"D... | Extract APIs from AWS::Serverless::Api resource by reading and parsing Swagger documents. The result is added
to the collector.
Parameters
----------
logical_id : str
Logical ID of the resource
api_resource : dict
Resource definition, including its prope... | [
"Extract",
"APIs",
"from",
"AWS",
"::",
"Serverless",
"::",
"Api",
"resource",
"by",
"reading",
"and",
"parsing",
"Swagger",
"documents",
".",
"The",
"result",
"is",
"added",
"to",
"the",
"collector",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L109-L147 | train | Extract APIs from AWS Serverless API resource by reading and parsing Swagger documents and adding them to the collector. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._merge_apis | def _merge_apis(collector):
"""
Quite often, an API is defined both in Implicit and Explicit API definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two such list of Apis with the right or... | python | def _merge_apis(collector):
"""
Quite often, an API is defined both in Implicit and Explicit API definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two such list of Apis with the right or... | [
"def",
"_merge_apis",
"(",
"collector",
")",
":",
"implicit_apis",
"=",
"[",
"]",
"explicit_apis",
"=",
"[",
"]",
"# Store implicit and explicit APIs separately in order to merge them later in the correct order",
"# Implicit APIs are defined on a resource with logicalID ServerlessRestA... | Quite often, an API is defined both in Implicit and Explicit API definitions. In such cases, Implicit API
definition wins because that conveys clear intent that the API is backed by a function. This method will
merge two such list of Apis with the right order of precedence. If a Path+Method combination ... | [
"Quite",
"often",
"an",
"API",
"is",
"defined",
"both",
"in",
"Implicit",
"and",
"Explicit",
"API",
"definitions",
".",
"In",
"such",
"cases",
"Implicit",
"API",
"definition",
"wins",
"because",
"that",
"conveys",
"clear",
"intent",
"that",
"the",
"API",
"is... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L150-L198 | train | This method merges implicit and explicit APIs into a single API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._normalize_apis | def _normalize_apis(apis):
"""
Normalize the APIs to use standard method name
Parameters
----------
apis : list of samcli.commands.local.lib.provider.Api
List of APIs to replace normalize
Returns
-------
list of samcli.commands.local.lib.prov... | python | def _normalize_apis(apis):
"""
Normalize the APIs to use standard method name
Parameters
----------
apis : list of samcli.commands.local.lib.provider.Api
List of APIs to replace normalize
Returns
-------
list of samcli.commands.local.lib.prov... | [
"def",
"_normalize_apis",
"(",
"apis",
")",
":",
"result",
"=",
"list",
"(",
")",
"for",
"api",
"in",
"apis",
":",
"for",
"normalized_method",
"in",
"SamApiProvider",
".",
"_normalize_http_methods",
"(",
"api",
".",
"method",
")",
":",
"# _replace returns a co... | Normalize the APIs to use standard method name
Parameters
----------
apis : list of samcli.commands.local.lib.provider.Api
List of APIs to replace normalize
Returns
-------
list of samcli.commands.local.lib.provider.Api
List of normalized APIs | [
"Normalize",
"the",
"APIs",
"to",
"use",
"standard",
"method",
"name"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L201-L222 | train | Normalizes the APIs to use standard method name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._extract_apis_from_function | def _extract_apis_from_function(logical_id, function_resource, collector):
"""
Fetches a list of APIs configured for this SAM Function resource.
Parameters
----------
logical_id : str
Logical ID of the resource
function_resource : dict
Contents o... | python | def _extract_apis_from_function(logical_id, function_resource, collector):
"""
Fetches a list of APIs configured for this SAM Function resource.
Parameters
----------
logical_id : str
Logical ID of the resource
function_resource : dict
Contents o... | [
"def",
"_extract_apis_from_function",
"(",
"logical_id",
",",
"function_resource",
",",
"collector",
")",
":",
"resource_properties",
"=",
"function_resource",
".",
"get",
"(",
"\"Properties\"",
",",
"{",
"}",
")",
"serverless_function_events",
"=",
"resource_properties... | Fetches a list of APIs configured for this SAM Function resource.
Parameters
----------
logical_id : str
Logical ID of the resource
function_resource : dict
Contents of the function resource including its properties
collector : ApiCollector
... | [
"Fetches",
"a",
"list",
"of",
"APIs",
"configured",
"for",
"this",
"SAM",
"Function",
"resource",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L225-L243 | train | Extracts the APIs configured for this SAM Function resource from the serverless function events. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._extract_apis_from_events | def _extract_apis_from_events(function_logical_id, serverless_function_events, collector):
"""
Given an AWS::Serverless::Function Event Dictionary, extract out all 'Api' events and store within the
collector
Parameters
----------
function_logical_id : str
Lo... | python | def _extract_apis_from_events(function_logical_id, serverless_function_events, collector):
"""
Given an AWS::Serverless::Function Event Dictionary, extract out all 'Api' events and store within the
collector
Parameters
----------
function_logical_id : str
Lo... | [
"def",
"_extract_apis_from_events",
"(",
"function_logical_id",
",",
"serverless_function_events",
",",
"collector",
")",
":",
"count",
"=",
"0",
"for",
"_",
",",
"event",
"in",
"serverless_function_events",
".",
"items",
"(",
")",
":",
"if",
"SamApiProvider",
"."... | Given an AWS::Serverless::Function Event Dictionary, extract out all 'Api' events and store within the
collector
Parameters
----------
function_logical_id : str
LogicalId of the AWS::Serverless::Function
serverless_function_events : dict
Event Dictionar... | [
"Given",
"an",
"AWS",
"::",
"Serverless",
"::",
"Function",
"Event",
"Dictionary",
"extract",
"out",
"all",
"Api",
"events",
"and",
"store",
"within",
"the",
"collector"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L246-L270 | train | Given an AWS Serverless function logical ID and an Api collector and an ApiCollector object this function extracts all API events from the serverless function event dictionary and stores them into the ApiCollector instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._convert_event_api | def _convert_event_api(lambda_logical_id, event_properties):
"""
Converts a AWS::Serverless::Function's Event Property to an Api configuration usable by the provider.
:param str lambda_logical_id: Logical Id of the AWS::Serverless::Function
:param dict event_properties: Dictionary of th... | python | def _convert_event_api(lambda_logical_id, event_properties):
"""
Converts a AWS::Serverless::Function's Event Property to an Api configuration usable by the provider.
:param str lambda_logical_id: Logical Id of the AWS::Serverless::Function
:param dict event_properties: Dictionary of th... | [
"def",
"_convert_event_api",
"(",
"lambda_logical_id",
",",
"event_properties",
")",
":",
"path",
"=",
"event_properties",
".",
"get",
"(",
"SamApiProvider",
".",
"_EVENT_PATH",
")",
"method",
"=",
"event_properties",
".",
"get",
"(",
"SamApiProvider",
".",
"_EVEN... | Converts a AWS::Serverless::Function's Event Property to an Api configuration usable by the provider.
:param str lambda_logical_id: Logical Id of the AWS::Serverless::Function
:param dict event_properties: Dictionary of the Event's Property
:return tuple: tuple of API resource name and Api name... | [
"Converts",
"a",
"AWS",
"::",
"Serverless",
"::",
"Function",
"s",
"Event",
"Property",
"to",
"an",
"Api",
"configuration",
"usable",
"by",
"the",
"provider",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L273-L298 | train | Converts a AWS Serverless Lambda event property to an Api configuration usable by the provider. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | SamApiProvider._normalize_http_methods | def _normalize_http_methods(http_method):
"""
Normalizes Http Methods. Api Gateway allows a Http Methods of ANY. This is a special verb to denote all
supported Http Methods on Api Gateway.
:param str http_method: Http method
:yield str: Either the input http_method or one of the... | python | def _normalize_http_methods(http_method):
"""
Normalizes Http Methods. Api Gateway allows a Http Methods of ANY. This is a special verb to denote all
supported Http Methods on Api Gateway.
:param str http_method: Http method
:yield str: Either the input http_method or one of the... | [
"def",
"_normalize_http_methods",
"(",
"http_method",
")",
":",
"if",
"http_method",
".",
"upper",
"(",
")",
"==",
"'ANY'",
":",
"for",
"method",
"in",
"SamApiProvider",
".",
"_ANY_HTTP_METHODS",
":",
"yield",
"method",
".",
"upper",
"(",
")",
"else",
":",
... | Normalizes Http Methods. Api Gateway allows a Http Methods of ANY. This is a special verb to denote all
supported Http Methods on Api Gateway.
:param str http_method: Http method
:yield str: Either the input http_method or one of the _ANY_HTTP_METHODS (normalized Http Methods) | [
"Normalizes",
"Http",
"Methods",
".",
"Api",
"Gateway",
"allows",
"a",
"Http",
"Methods",
"of",
"ANY",
".",
"This",
"is",
"a",
"special",
"verb",
"to",
"denote",
"all",
"supported",
"Http",
"Methods",
"on",
"Api",
"Gateway",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L301-L314 | train | Normalizes the HTTP Methods of the resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | ApiCollector.add_apis | def add_apis(self, logical_id, apis):
"""
Stores the given APIs tagged under the given logicalId
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
apis : list of samcli.commands.local.lib.provider.Api
List of A... | python | def add_apis(self, logical_id, apis):
"""
Stores the given APIs tagged under the given logicalId
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
apis : list of samcli.commands.local.lib.provider.Api
List of A... | [
"def",
"add_apis",
"(",
"self",
",",
"logical_id",
",",
"apis",
")",
":",
"properties",
"=",
"self",
".",
"_get_properties",
"(",
"logical_id",
")",
"properties",
".",
"apis",
".",
"extend",
"(",
"apis",
")"
] | Stores the given APIs tagged under the given logicalId
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
apis : list of samcli.commands.local.lib.provider.Api
List of APIs available in this resource | [
"Stores",
"the",
"given",
"APIs",
"tagged",
"under",
"the",
"given",
"logicalId"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L350-L363 | train | Adds the given APIs to the set of APIs tagged under the given logicalId. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | ApiCollector.add_binary_media_types | def add_binary_media_types(self, logical_id, binary_media_types):
"""
Stores the binary media type configuration for the API with given logical ID
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
binary_media_types : list... | python | def add_binary_media_types(self, logical_id, binary_media_types):
"""
Stores the binary media type configuration for the API with given logical ID
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
binary_media_types : list... | [
"def",
"add_binary_media_types",
"(",
"self",
",",
"logical_id",
",",
"binary_media_types",
")",
":",
"properties",
"=",
"self",
".",
"_get_properties",
"(",
"logical_id",
")",
"binary_media_types",
"=",
"binary_media_types",
"or",
"[",
"]",
"for",
"value",
"in",
... | Stores the binary media type configuration for the API with given logical ID
Parameters
----------
logical_id : str
LogicalId of the AWS::Serverless::Api resource
binary_media_types : list of str
List of binary media types supported by this resource | [
"Stores",
"the",
"binary",
"media",
"type",
"configuration",
"for",
"the",
"API",
"with",
"given",
"logical",
"ID"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L365-L388 | train | Adds the given list of binary media types supported by this resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | ApiCollector._get_apis_with_config | def _get_apis_with_config(self, logical_id):
"""
Returns the list of APIs in this resource along with other extra configuration such as binary media types,
cors etc. Additional configuration is merged directly into the API data because these properties, although
defined globally, actuall... | python | def _get_apis_with_config(self, logical_id):
"""
Returns the list of APIs in this resource along with other extra configuration such as binary media types,
cors etc. Additional configuration is merged directly into the API data because these properties, although
defined globally, actuall... | [
"def",
"_get_apis_with_config",
"(",
"self",
",",
"logical_id",
")",
":",
"properties",
"=",
"self",
".",
"_get_properties",
"(",
"logical_id",
")",
"# These configs need to be applied to each API",
"binary_media",
"=",
"sorted",
"(",
"list",
"(",
"properties",
".",
... | Returns the list of APIs in this resource along with other extra configuration such as binary media types,
cors etc. Additional configuration is merged directly into the API data because these properties, although
defined globally, actually apply to each API.
Parameters
----------
... | [
"Returns",
"the",
"list",
"of",
"APIs",
"in",
"this",
"resource",
"along",
"with",
"other",
"extra",
"configuration",
"such",
"as",
"binary",
"media",
"types",
"cors",
"etc",
".",
"Additional",
"configuration",
"is",
"merged",
"directly",
"into",
"the",
"API",... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L390-L421 | train | Returns the list of APIs in this resource along with additional configuration such as binary media types cors etc. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/sam_api_provider.py | ApiCollector._get_properties | def _get_properties(self, logical_id):
"""
Returns the properties of resource with given logical ID. If a resource is not found, then it returns an
empty data.
Parameters
----------
logical_id : str
Logical ID of the resource
Returns
-------
... | python | def _get_properties(self, logical_id):
"""
Returns the properties of resource with given logical ID. If a resource is not found, then it returns an
empty data.
Parameters
----------
logical_id : str
Logical ID of the resource
Returns
-------
... | [
"def",
"_get_properties",
"(",
"self",
",",
"logical_id",
")",
":",
"if",
"logical_id",
"not",
"in",
"self",
".",
"by_resource",
":",
"self",
".",
"by_resource",
"[",
"logical_id",
"]",
"=",
"self",
".",
"Properties",
"(",
"apis",
"=",
"[",
"]",
",",
"... | Returns the properties of resource with given logical ID. If a resource is not found, then it returns an
empty data.
Parameters
----------
logical_id : str
Logical ID of the resource
Returns
-------
samcli.commands.local.lib.sam_api_provider.ApiColle... | [
"Returns",
"the",
"properties",
"of",
"resource",
"with",
"given",
"logical",
"ID",
".",
"If",
"a",
"resource",
"is",
"not",
"found",
"then",
"it",
"returns",
"an",
"empty",
"data",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L423-L445 | train | Returns the properties of the resource with given logical ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/runtime.py | _unzip_file | def _unzip_file(filepath):
"""
Helper method to unzip a file to a temporary directory
:param string filepath: Absolute path to this file
:return string: Path to the temporary directory where it was unzipped
"""
temp_dir = tempfile.mkdtemp()
if os.name == 'posix':
os.chmod(temp_dir... | python | def _unzip_file(filepath):
"""
Helper method to unzip a file to a temporary directory
:param string filepath: Absolute path to this file
:return string: Path to the temporary directory where it was unzipped
"""
temp_dir = tempfile.mkdtemp()
if os.name == 'posix':
os.chmod(temp_dir... | [
"def",
"_unzip_file",
"(",
"filepath",
")",
":",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"if",
"os",
".",
"name",
"==",
"'posix'",
":",
"os",
".",
"chmod",
"(",
"temp_dir",
",",
"0o755",
")",
"LOG",
".",
"info",
"(",
"\"Decompressing %s\... | Helper method to unzip a file to a temporary directory
:param string filepath: Absolute path to this file
:return string: Path to the temporary directory where it was unzipped | [
"Helper",
"method",
"to",
"unzip",
"a",
"file",
"to",
"a",
"temporary",
"directory"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/runtime.py#L184-L205 | train | Unzips a file to a temporary directory and returns the real path to the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/runtime.py | LambdaRuntime.invoke | def invoke(self,
function_config,
event,
debug_context=None,
stdout=None,
stderr=None):
"""
Invoke the given Lambda function locally.
##### NOTE: THIS IS A LONG BLOCKING CALL #####
This method will block until ei... | python | def invoke(self,
function_config,
event,
debug_context=None,
stdout=None,
stderr=None):
"""
Invoke the given Lambda function locally.
##### NOTE: THIS IS A LONG BLOCKING CALL #####
This method will block until ei... | [
"def",
"invoke",
"(",
"self",
",",
"function_config",
",",
"event",
",",
"debug_context",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
")",
":",
"timer",
"=",
"None",
"# Update with event input",
"environ",
"=",
"function_config",
"."... | Invoke the given Lambda function locally.
##### NOTE: THIS IS A LONG BLOCKING CALL #####
This method will block until either the Lambda function completes or timed out, which could be seconds.
A blocking call will block the thread preventing any other operations from happening. If you are using... | [
"Invoke",
"the",
"given",
"Lambda",
"function",
"locally",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/runtime.py#L42-L116 | train | Invoke the given Lambda function locally. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/runtime.py | LambdaRuntime._configure_interrupt | def _configure_interrupt(self, function_name, timeout, container, is_debugging):
"""
When a Lambda function is executing, we setup certain interrupt handlers to stop the execution.
Usually, we setup a function timeout interrupt to kill the container after timeout expires. If debugging though,
... | python | def _configure_interrupt(self, function_name, timeout, container, is_debugging):
"""
When a Lambda function is executing, we setup certain interrupt handlers to stop the execution.
Usually, we setup a function timeout interrupt to kill the container after timeout expires. If debugging though,
... | [
"def",
"_configure_interrupt",
"(",
"self",
",",
"function_name",
",",
"timeout",
",",
"container",
",",
"is_debugging",
")",
":",
"def",
"timer_handler",
"(",
")",
":",
"# NOTE: This handler runs in a separate thread. So don't try to mutate any non-thread-safe data structures"... | When a Lambda function is executing, we setup certain interrupt handlers to stop the execution.
Usually, we setup a function timeout interrupt to kill the container after timeout expires. If debugging though,
we don't enforce a timeout. But we setup a SIGINT interrupt to catch Ctrl+C and terminate the c... | [
"When",
"a",
"Lambda",
"function",
"is",
"executing",
"we",
"setup",
"certain",
"interrupt",
"handlers",
"to",
"stop",
"the",
"execution",
".",
"Usually",
"we",
"setup",
"a",
"function",
"timeout",
"interrupt",
"to",
"kill",
"the",
"container",
"after",
"timeo... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/runtime.py#L118-L149 | train | Configure interrupt handlers for the Lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/runtime.py | LambdaRuntime._get_code_dir | def _get_code_dir(self, code_path):
"""
Method to get a path to a directory where the Lambda function code is available. This directory will
be mounted directly inside the Docker container.
This method handles a few different cases for ``code_path``:
- ``code_path``is a exis... | python | def _get_code_dir(self, code_path):
"""
Method to get a path to a directory where the Lambda function code is available. This directory will
be mounted directly inside the Docker container.
This method handles a few different cases for ``code_path``:
- ``code_path``is a exis... | [
"def",
"_get_code_dir",
"(",
"self",
",",
"code_path",
")",
":",
"decompressed_dir",
"=",
"None",
"try",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"code_path",
")",
"and",
"code_path",
".",
"endswith",
"(",
"self",
".",
"SUPPORTED_ARCHIVE_EXTENSIONS"... | Method to get a path to a directory where the Lambda function code is available. This directory will
be mounted directly inside the Docker container.
This method handles a few different cases for ``code_path``:
- ``code_path``is a existent zip/jar file: Unzip in a temp directory and return ... | [
"Method",
"to",
"get",
"a",
"path",
"to",
"a",
"directory",
"where",
"the",
"Lambda",
"function",
"code",
"is",
"available",
".",
"This",
"directory",
"will",
"be",
"mounted",
"directly",
"inside",
"the",
"Docker",
"container",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/runtime.py#L152-L181 | train | Method to get a path to a directory where the Lambda function code is available. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_image.py | LambdaImage.build | def build(self, runtime, layers):
"""
Build the image if one is not already on the system that matches the runtime and layers
Parameters
----------
runtime str
Name of the Lambda runtime
layers list(samcli.commands.local.lib.provider.Layer)
List o... | python | def build(self, runtime, layers):
"""
Build the image if one is not already on the system that matches the runtime and layers
Parameters
----------
runtime str
Name of the Lambda runtime
layers list(samcli.commands.local.lib.provider.Layer)
List o... | [
"def",
"build",
"(",
"self",
",",
"runtime",
",",
"layers",
")",
":",
"base_image",
"=",
"\"{}:{}\"",
".",
"format",
"(",
"self",
".",
"_DOCKER_LAMBDA_REPO_NAME",
",",
"runtime",
")",
"# Don't build the image if there are no layers.",
"if",
"not",
"layers",
":",
... | Build the image if one is not already on the system that matches the runtime and layers
Parameters
----------
runtime str
Name of the Lambda runtime
layers list(samcli.commands.local.lib.provider.Layer)
List of layers
Returns
-------
str
... | [
"Build",
"the",
"image",
"if",
"one",
"is",
"not",
"already",
"on",
"the",
"system",
"that",
"matches",
"the",
"runtime",
"and",
"layers"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_image.py#L73-L115 | train | Build the image if one is not already on the system that matches the runtime and layers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_image.py | LambdaImage._generate_docker_image_version | def _generate_docker_image_version(layers, runtime):
"""
Generate the Docker TAG that will be used to create the image
Parameters
----------
layers list(samcli.commands.local.lib.provider.Layer)
List of the layers
runtime str
Runtime of the image... | python | def _generate_docker_image_version(layers, runtime):
"""
Generate the Docker TAG that will be used to create the image
Parameters
----------
layers list(samcli.commands.local.lib.provider.Layer)
List of the layers
runtime str
Runtime of the image... | [
"def",
"_generate_docker_image_version",
"(",
"layers",
",",
"runtime",
")",
":",
"# Docker has a concept of a TAG on an image. This is plus the REPOSITORY is a way to determine",
"# a version of the image. We will produced a TAG for a combination of the runtime with the layers",
"# specified in... | Generate the Docker TAG that will be used to create the image
Parameters
----------
layers list(samcli.commands.local.lib.provider.Layer)
List of the layers
runtime str
Runtime of the image to create
Returns
-------
str
Strin... | [
"Generate",
"the",
"Docker",
"TAG",
"that",
"will",
"be",
"used",
"to",
"create",
"the",
"image"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_image.py#L118-L142 | train | Generate the Docker TAG that will be used to create the image | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_image.py | LambdaImage._build_image | def _build_image(self, base_image, docker_tag, layers):
"""
Builds the image
Parameters
----------
base_image str
Base Image to use for the new image
docker_tag
Docker tag (REPOSITORY:TAG) to use when building the image
layers list(samcli.... | python | def _build_image(self, base_image, docker_tag, layers):
"""
Builds the image
Parameters
----------
base_image str
Base Image to use for the new image
docker_tag
Docker tag (REPOSITORY:TAG) to use when building the image
layers list(samcli.... | [
"def",
"_build_image",
"(",
"self",
",",
"base_image",
",",
"docker_tag",
",",
"layers",
")",
":",
"dockerfile_content",
"=",
"self",
".",
"_generate_dockerfile",
"(",
"base_image",
",",
"layers",
")",
"# Create dockerfile in the same directory of the layer cache",
"doc... | Builds the image
Parameters
----------
base_image str
Base Image to use for the new image
docker_tag
Docker tag (REPOSITORY:TAG) to use when building the image
layers list(samcli.commands.local.lib.provider.Layer)
List of Layers to be use to m... | [
"Builds",
"the",
"image"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_image.py#L144-L192 | train | Builds the image and stores it in the layer cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_image.py | LambdaImage._generate_dockerfile | def _generate_dockerfile(base_image, layers):
"""
Generate the Dockerfile contents
A generated Dockerfile will look like the following:
```
FROM lambci/lambda:python3.6
ADD --chown=sbx_user1051:495 layer1 /opt
ADD --chown=sbx_user1051:495 layer2 /opt
```... | python | def _generate_dockerfile(base_image, layers):
"""
Generate the Dockerfile contents
A generated Dockerfile will look like the following:
```
FROM lambci/lambda:python3.6
ADD --chown=sbx_user1051:495 layer1 /opt
ADD --chown=sbx_user1051:495 layer2 /opt
```... | [
"def",
"_generate_dockerfile",
"(",
"base_image",
",",
"layers",
")",
":",
"dockerfile_content",
"=",
"\"FROM {}\\n\"",
".",
"format",
"(",
"base_image",
")",
"for",
"layer",
"in",
"layers",
":",
"dockerfile_content",
"=",
"dockerfile_content",
"+",
"\"ADD --chown=s... | Generate the Dockerfile contents
A generated Dockerfile will look like the following:
```
FROM lambci/lambda:python3.6
ADD --chown=sbx_user1051:495 layer1 /opt
ADD --chown=sbx_user1051:495 layer2 /opt
```
Parameters
----------
base_image str
... | [
"Generate",
"the",
"Dockerfile",
"contents"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_image.py#L195-L225 | train | Generate the Dockerfile contents for the new image and list of layers | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | LocalApiService.start | def start(self):
"""
Creates and starts the local API Gateway service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
... | python | def start(self):
"""
Creates and starts the local API Gateway service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
... | [
"def",
"start",
"(",
"self",
")",
":",
"routing_list",
"=",
"self",
".",
"_make_routing_list",
"(",
"self",
".",
"api_provider",
")",
"if",
"not",
"routing_list",
":",
"raise",
"NoApisDefined",
"(",
"\"No APIs available in SAM template\"",
")",
"static_dir_path",
... | Creates and starts the local API Gateway service. This method will block until the service is stopped
manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint
to invoke the Lambda function and receive a response.
NOTE: This is a blocking call tha... | [
"Creates",
"and",
"starts",
"the",
"local",
"API",
"Gateway",
"service",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"service",
"is",
"stopped",
"manually",
"using",
"an",
"interrupt",
".",
"After",
"the",
"service",
"is",
"started",
"callers",
"... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_api_service.py#L47-L83 | train | Creates and starts the local API Gateway service. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | LocalApiService._make_routing_list | def _make_routing_list(api_provider):
"""
Returns a list of routes to configure the Local API Service based on the APIs configured in the template.
Parameters
----------
api_provider : samcli.commands.local.lib.sam_api_provider.SamApiProvider
Returns
-------
... | python | def _make_routing_list(api_provider):
"""
Returns a list of routes to configure the Local API Service based on the APIs configured in the template.
Parameters
----------
api_provider : samcli.commands.local.lib.sam_api_provider.SamApiProvider
Returns
-------
... | [
"def",
"_make_routing_list",
"(",
"api_provider",
")",
":",
"routes",
"=",
"[",
"]",
"for",
"api",
"in",
"api_provider",
".",
"get_all",
"(",
")",
":",
"route",
"=",
"Route",
"(",
"methods",
"=",
"[",
"api",
".",
"method",
"]",
",",
"function_name",
"=... | Returns a list of routes to configure the Local API Service based on the APIs configured in the template.
Parameters
----------
api_provider : samcli.commands.local.lib.sam_api_provider.SamApiProvider
Returns
-------
list(samcli.local.apigw.service.Route)
Li... | [
"Returns",
"a",
"list",
"of",
"routes",
"to",
"configure",
"the",
"Local",
"API",
"Service",
"based",
"on",
"the",
"APIs",
"configured",
"in",
"the",
"template",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_api_service.py#L86-L106 | train | Returns a list of routes to configure the Local API Service based on the APIs configured in the template. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | LocalApiService._print_routes | def _print_routes(api_provider, host, port):
"""
Helper method to print the APIs that will be mounted. This method is purely for printing purposes.
This method takes in a list of Route Configurations and prints out the Routes grouped by path.
Grouping routes by Function Name + Path is th... | python | def _print_routes(api_provider, host, port):
"""
Helper method to print the APIs that will be mounted. This method is purely for printing purposes.
This method takes in a list of Route Configurations and prints out the Routes grouped by path.
Grouping routes by Function Name + Path is th... | [
"def",
"_print_routes",
"(",
"api_provider",
",",
"host",
",",
"port",
")",
":",
"grouped_api_configs",
"=",
"{",
"}",
"for",
"api",
"in",
"api_provider",
".",
"get_all",
"(",
")",
":",
"key",
"=",
"\"{}-{}\"",
".",
"format",
"(",
"api",
".",
"function_n... | Helper method to print the APIs that will be mounted. This method is purely for printing purposes.
This method takes in a list of Route Configurations and prints out the Routes grouped by path.
Grouping routes by Function Name + Path is the bulk of the logic.
Example output:
Mountin... | [
"Helper",
"method",
"to",
"print",
"the",
"APIs",
"that",
"will",
"be",
"mounted",
".",
"This",
"method",
"is",
"purely",
"for",
"printing",
"purposes",
".",
"This",
"method",
"takes",
"in",
"a",
"list",
"of",
"Route",
"Configurations",
"and",
"prints",
"o... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_api_service.py#L109-L151 | train | This method prints out the routes that will be mounted. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_api_service.py | LocalApiService._make_static_dir_path | def _make_static_dir_path(cwd, static_dir):
"""
This method returns the path to the directory where static files are to be served from. If static_dir is a
relative path, then it is resolved to be relative to the current working directory. If no static directory is
provided, or if the res... | python | def _make_static_dir_path(cwd, static_dir):
"""
This method returns the path to the directory where static files are to be served from. If static_dir is a
relative path, then it is resolved to be relative to the current working directory. If no static directory is
provided, or if the res... | [
"def",
"_make_static_dir_path",
"(",
"cwd",
",",
"static_dir",
")",
":",
"if",
"not",
"static_dir",
":",
"return",
"None",
"static_dir_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cwd",
",",
"static_dir",
")",
"if",
"os",
".",
"path",
".",
"exists",... | This method returns the path to the directory where static files are to be served from. If static_dir is a
relative path, then it is resolved to be relative to the current working directory. If no static directory is
provided, or if the resolved directory does not exist, this method will return None
... | [
"This",
"method",
"returns",
"the",
"path",
"to",
"the",
"directory",
"where",
"static",
"files",
"are",
"to",
"be",
"served",
"from",
".",
"If",
"static_dir",
"is",
"a",
"relative",
"path",
"then",
"it",
"is",
"resolved",
"to",
"be",
"relative",
"to",
"... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_api_service.py#L154-L170 | train | This method returns the path to the static directory where we will serve the static files from. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambda_service/local_lambda_invoke_service.py | LocalLambdaInvokeService.create | def create(self):
"""
Creates a Flask Application that can be started.
"""
self._app = Flask(__name__)
path = '/2015-03-31/functions/<function_name>/invocations'
self._app.add_url_rule(path,
endpoint=path,
vie... | python | def create(self):
"""
Creates a Flask Application that can be started.
"""
self._app = Flask(__name__)
path = '/2015-03-31/functions/<function_name>/invocations'
self._app.add_url_rule(path,
endpoint=path,
vie... | [
"def",
"create",
"(",
"self",
")",
":",
"self",
".",
"_app",
"=",
"Flask",
"(",
"__name__",
")",
"path",
"=",
"'/2015-03-31/functions/<function_name>/invocations'",
"self",
".",
"_app",
".",
"add_url_rule",
"(",
"path",
",",
"endpoint",
"=",
"path",
",",
"vi... | Creates a Flask Application that can be started. | [
"Creates",
"a",
"Flask",
"Application",
"that",
"can",
"be",
"started",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambda_service/local_lambda_invoke_service.py#L38-L54 | train | Creates a Flask Application that can be started. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambda_service/local_lambda_invoke_service.py | LocalLambdaInvokeService.validate_request | def validate_request():
"""
Validates the incoming request
The following are invalid
1. The Request data is not json serializable
2. Query Parameters are sent to the endpoint
3. The Request Content-Type is not application/json
4. 'X-Amz-Log-Type' ... | python | def validate_request():
"""
Validates the incoming request
The following are invalid
1. The Request data is not json serializable
2. Query Parameters are sent to the endpoint
3. The Request Content-Type is not application/json
4. 'X-Amz-Log-Type' ... | [
"def",
"validate_request",
"(",
")",
":",
"flask_request",
"=",
"request",
"request_data",
"=",
"flask_request",
".",
"get_data",
"(",
")",
"if",
"not",
"request_data",
":",
"request_data",
"=",
"b'{}'",
"request_data",
"=",
"request_data",
".",
"decode",
"(",
... | Validates the incoming request
The following are invalid
1. The Request data is not json serializable
2. Query Parameters are sent to the endpoint
3. The Request Content-Type is not application/json
4. 'X-Amz-Log-Type' header is not 'None'
5. 'X-Amz-I... | [
"Validates",
"the",
"incoming",
"request"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambda_service/local_lambda_invoke_service.py#L57-L107 | train | Validates the incoming request and returns a flask. Response object with the result of the validation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambda_service/local_lambda_invoke_service.py | LocalLambdaInvokeService._construct_error_handling | def _construct_error_handling(self):
"""
Updates the Flask app with Error Handlers for different Error Codes
"""
self._app.register_error_handler(500, LambdaErrorResponses.generic_service_exception)
self._app.register_error_handler(404, LambdaErrorResponses.generic_path_not_foun... | python | def _construct_error_handling(self):
"""
Updates the Flask app with Error Handlers for different Error Codes
"""
self._app.register_error_handler(500, LambdaErrorResponses.generic_service_exception)
self._app.register_error_handler(404, LambdaErrorResponses.generic_path_not_foun... | [
"def",
"_construct_error_handling",
"(",
"self",
")",
":",
"self",
".",
"_app",
".",
"register_error_handler",
"(",
"500",
",",
"LambdaErrorResponses",
".",
"generic_service_exception",
")",
"self",
".",
"_app",
".",
"register_error_handler",
"(",
"404",
",",
"Lam... | Updates the Flask app with Error Handlers for different Error Codes | [
"Updates",
"the",
"Flask",
"app",
"with",
"Error",
"Handlers",
"for",
"different",
"Error",
"Codes"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambda_service/local_lambda_invoke_service.py#L109-L116 | train | Constructs the error handling handlers for different error codes | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambda_service/local_lambda_invoke_service.py | LocalLambdaInvokeService._invoke_request_handler | def _invoke_request_handler(self, function_name):
"""
Request Handler for the Local Lambda Invoke path. This method is responsible for understanding the incoming
request and invoking the Local Lambda Function
Parameters
----------
function_name str
Name of th... | python | def _invoke_request_handler(self, function_name):
"""
Request Handler for the Local Lambda Invoke path. This method is responsible for understanding the incoming
request and invoking the Local Lambda Function
Parameters
----------
function_name str
Name of th... | [
"def",
"_invoke_request_handler",
"(",
"self",
",",
"function_name",
")",
":",
"flask_request",
"=",
"request",
"request_data",
"=",
"flask_request",
".",
"get_data",
"(",
")",
"if",
"not",
"request_data",
":",
"request_data",
"=",
"b'{}'",
"request_data",
"=",
... | Request Handler for the Local Lambda Invoke path. This method is responsible for understanding the incoming
request and invoking the Local Lambda Function
Parameters
----------
function_name str
Name of the function to invoke
Returns
-------
A Flask ... | [
"Request",
"Handler",
"for",
"the",
"Local",
"Lambda",
"Invoke",
"path",
".",
"This",
"method",
"is",
"responsible",
"for",
"understanding",
"the",
"incoming",
"request",
"and",
"invoking",
"the",
"Local",
"Lambda",
"Function"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambda_service/local_lambda_invoke_service.py#L118-L162 | train | This method is responsible for understanding the incoming lambda request and invoking the Local Lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/zip.py | unzip | def unzip(zip_file_path, output_dir, permission=None):
"""
Unzip the given file into the given directory while preserving file permissions in the process.
Parameters
----------
zip_file_path : str
Path to the zip file
output_dir : str
Path to the directory where the it should b... | python | def unzip(zip_file_path, output_dir, permission=None):
"""
Unzip the given file into the given directory while preserving file permissions in the process.
Parameters
----------
zip_file_path : str
Path to the zip file
output_dir : str
Path to the directory where the it should b... | [
"def",
"unzip",
"(",
"zip_file_path",
",",
"output_dir",
",",
"permission",
"=",
"None",
")",
":",
"with",
"zipfile",
".",
"ZipFile",
"(",
"zip_file_path",
",",
"'r'",
")",
"as",
"zip_ref",
":",
"# For each item in the zip file, extract the file and set permissions if... | Unzip the given file into the given directory while preserving file permissions in the process.
Parameters
----------
zip_file_path : str
Path to the zip file
output_dir : str
Path to the directory where the it should be unzipped to
permission : octal int
Permission to set | [
"Unzip",
"the",
"given",
"file",
"into",
"the",
"given",
"directory",
"while",
"preserving",
"file",
"permissions",
"in",
"the",
"process",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/zip.py#L23-L51 | train | Unzip the given file into the given directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/zip.py | _set_permissions | def _set_permissions(zip_file_info, extracted_path):
"""
Sets permissions on the extracted file by reading the ``external_attr`` property of given file info.
Parameters
----------
zip_file_info : zipfile.ZipInfo
Object containing information about a file within a zip archive
extracted_... | python | def _set_permissions(zip_file_info, extracted_path):
"""
Sets permissions on the extracted file by reading the ``external_attr`` property of given file info.
Parameters
----------
zip_file_info : zipfile.ZipInfo
Object containing information about a file within a zip archive
extracted_... | [
"def",
"_set_permissions",
"(",
"zip_file_info",
",",
"extracted_path",
")",
":",
"# Permission information is stored in first two bytes.",
"permission",
"=",
"zip_file_info",
".",
"external_attr",
">>",
"16",
"if",
"not",
"permission",
":",
"# Zips created on certain Windows... | Sets permissions on the extracted file by reading the ``external_attr`` property of given file info.
Parameters
----------
zip_file_info : zipfile.ZipInfo
Object containing information about a file within a zip archive
extracted_path : str
Path where the file has been extracted to | [
"Sets",
"permissions",
"on",
"the",
"extracted",
"file",
"by",
"reading",
"the",
"external_attr",
"property",
"of",
"given",
"file",
"info",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/zip.py#L70-L91 | train | Sets permissions on the extracted file by reading the external_attr property of the zip file info. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/lambdafn/zip.py | unzip_from_uri | def unzip_from_uri(uri, layer_zip_path, unzip_output_dir, progressbar_label):
"""
Download the LayerVersion Zip to the Layer Pkg Cache
Parameters
----------
uri str
Uri to download from
layer_zip_path str
Path to where the content from the uri should be downloaded to
unzip_o... | python | def unzip_from_uri(uri, layer_zip_path, unzip_output_dir, progressbar_label):
"""
Download the LayerVersion Zip to the Layer Pkg Cache
Parameters
----------
uri str
Uri to download from
layer_zip_path str
Path to where the content from the uri should be downloaded to
unzip_o... | [
"def",
"unzip_from_uri",
"(",
"uri",
",",
"layer_zip_path",
",",
"unzip_output_dir",
",",
"progressbar_label",
")",
":",
"try",
":",
"get_request",
"=",
"requests",
".",
"get",
"(",
"uri",
",",
"stream",
"=",
"True",
",",
"verify",
"=",
"os",
".",
"environ... | Download the LayerVersion Zip to the Layer Pkg Cache
Parameters
----------
uri str
Uri to download from
layer_zip_path str
Path to where the content from the uri should be downloaded to
unzip_output_dir str
Path to unzip the zip to
progressbar_label str
Label to ... | [
"Download",
"the",
"LayerVersion",
"Zip",
"to",
"the",
"Layer",
"Pkg",
"Cache"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/lambdafn/zip.py#L94-L130 | train | Download the LayerVersion Zip from the LayerVersion Zip to the Layer Pkg Cache
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService.create | def create(self):
"""
Creates a Flask Application that can be started.
"""
self._app = Flask(__name__,
static_url_path="", # Mount static files at root '/'
static_folder=self.static_dir # Serve static files from this directory
... | python | def create(self):
"""
Creates a Flask Application that can be started.
"""
self._app = Flask(__name__,
static_url_path="", # Mount static files at root '/'
static_folder=self.static_dir # Serve static files from this directory
... | [
"def",
"create",
"(",
"self",
")",
":",
"self",
".",
"_app",
"=",
"Flask",
"(",
"__name__",
",",
"static_url_path",
"=",
"\"\"",
",",
"# Mount static files at root '/'",
"static_folder",
"=",
"self",
".",
"static_dir",
"# Serve static files from this directory",
")"... | Creates a Flask Application that can be started. | [
"Creates",
"a",
"Flask",
"Application",
"that",
"can",
"be",
"started",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L68-L90 | train | Creates a Flask application that can be started. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._generate_route_keys | def _generate_route_keys(self, methods, path):
"""
Generates the key to the _dict_of_routes based on the list of methods
and path supplied
:param list(str) methods: List of HTTP Methods
:param str path: Path off the base url
:return: str of Path:Method
"""
... | python | def _generate_route_keys(self, methods, path):
"""
Generates the key to the _dict_of_routes based on the list of methods
and path supplied
:param list(str) methods: List of HTTP Methods
:param str path: Path off the base url
:return: str of Path:Method
"""
... | [
"def",
"_generate_route_keys",
"(",
"self",
",",
"methods",
",",
"path",
")",
":",
"for",
"method",
"in",
"methods",
":",
"yield",
"self",
".",
"_route_key",
"(",
"method",
",",
"path",
")"
] | Generates the key to the _dict_of_routes based on the list of methods
and path supplied
:param list(str) methods: List of HTTP Methods
:param str path: Path off the base url
:return: str of Path:Method | [
"Generates",
"the",
"key",
"to",
"the",
"_dict_of_routes",
"based",
"on",
"the",
"list",
"of",
"methods",
"and",
"path",
"supplied"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L92-L102 | train | Generates the key to the _dict_of_routes based on the list of HTTP Methods and path | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._construct_error_handling | def _construct_error_handling(self):
"""
Updates the Flask app with Error Handlers for different Error Codes
"""
# Both path and method not present
self._app.register_error_handler(404, ServiceErrorResponses.route_not_found)
# Path is present, but method not allowed
... | python | def _construct_error_handling(self):
"""
Updates the Flask app with Error Handlers for different Error Codes
"""
# Both path and method not present
self._app.register_error_handler(404, ServiceErrorResponses.route_not_found)
# Path is present, but method not allowed
... | [
"def",
"_construct_error_handling",
"(",
"self",
")",
":",
"# Both path and method not present",
"self",
".",
"_app",
".",
"register_error_handler",
"(",
"404",
",",
"ServiceErrorResponses",
".",
"route_not_found",
")",
"# Path is present, but method not allowed",
"self",
"... | Updates the Flask app with Error Handlers for different Error Codes | [
"Updates",
"the",
"Flask",
"app",
"with",
"Error",
"Handlers",
"for",
"different",
"Error",
"Codes"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L108-L117 | train | Constructs the error handling handlers for different Error Codes
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._request_handler | def _request_handler(self, **kwargs):
"""
We handle all requests to the host:port. The general flow of handling a request is as follows
* Fetch request from the Flask Global state. This is where Flask places the request and is per thread so
multiple requests are still handled correctl... | python | def _request_handler(self, **kwargs):
"""
We handle all requests to the host:port. The general flow of handling a request is as follows
* Fetch request from the Flask Global state. This is where Flask places the request and is per thread so
multiple requests are still handled correctl... | [
"def",
"_request_handler",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"route",
"=",
"self",
".",
"_get_current_route",
"(",
"request",
")",
"try",
":",
"event",
"=",
"self",
".",
"_construct_event",
"(",
"request",
",",
"self",
".",
"port",
",",
"... | We handle all requests to the host:port. The general flow of handling a request is as follows
* Fetch request from the Flask Global state. This is where Flask places the request and is per thread so
multiple requests are still handled correctly
* Find the Lambda function to invoke by doing a ... | [
"We",
"handle",
"all",
"requests",
"to",
"the",
"host",
":",
"port",
".",
"The",
"general",
"flow",
"of",
"handling",
"a",
"request",
"is",
"as",
"follows"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L119-L172 | train | This function is called by the request handler method. It handles all requests and returns a dict containing the service - level attributes that are passed to the handler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._get_current_route | def _get_current_route(self, flask_request):
"""
Get the route (Route) based on the current request
:param request flask_request: Flask Request
:return: Route matching the endpoint and method of the request
"""
endpoint = flask_request.endpoint
method = flask_req... | python | def _get_current_route(self, flask_request):
"""
Get the route (Route) based on the current request
:param request flask_request: Flask Request
:return: Route matching the endpoint and method of the request
"""
endpoint = flask_request.endpoint
method = flask_req... | [
"def",
"_get_current_route",
"(",
"self",
",",
"flask_request",
")",
":",
"endpoint",
"=",
"flask_request",
".",
"endpoint",
"method",
"=",
"flask_request",
".",
"method",
"route_key",
"=",
"self",
".",
"_route_key",
"(",
"method",
",",
"endpoint",
")",
"route... | Get the route (Route) based on the current request
:param request flask_request: Flask Request
:return: Route matching the endpoint and method of the request | [
"Get",
"the",
"route",
"(",
"Route",
")",
"based",
"on",
"the",
"current",
"request"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L174-L193 | train | Get the route based on the current request and the current route key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._parse_lambda_output | def _parse_lambda_output(lambda_output, binary_types, flask_request):
"""
Parses the output from the Lambda Container
:param str lambda_output: Output from Lambda Invoke
:return: Tuple(int, dict, str, bool)
"""
json_output = json.loads(lambda_output)
if not isin... | python | def _parse_lambda_output(lambda_output, binary_types, flask_request):
"""
Parses the output from the Lambda Container
:param str lambda_output: Output from Lambda Invoke
:return: Tuple(int, dict, str, bool)
"""
json_output = json.loads(lambda_output)
if not isin... | [
"def",
"_parse_lambda_output",
"(",
"lambda_output",
",",
"binary_types",
",",
"flask_request",
")",
":",
"json_output",
"=",
"json",
".",
"loads",
"(",
"lambda_output",
")",
"if",
"not",
"isinstance",
"(",
"json_output",
",",
"dict",
")",
":",
"raise",
"TypeE... | Parses the output from the Lambda Container
:param str lambda_output: Output from Lambda Invoke
:return: Tuple(int, dict, str, bool) | [
"Parses",
"the",
"output",
"from",
"the",
"Lambda",
"Container"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L197-L231 | train | Parses the output from the Lambda Invoke
API call and returns the status code headers and body. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._should_base64_decode_body | def _should_base64_decode_body(binary_types, flask_request, lamba_response_headers, is_base_64_encoded):
"""
Whether or not the body should be decoded from Base64 to Binary
Parameters
----------
binary_types list(basestring)
Corresponds to self.binary_types (aka. wha... | python | def _should_base64_decode_body(binary_types, flask_request, lamba_response_headers, is_base_64_encoded):
"""
Whether or not the body should be decoded from Base64 to Binary
Parameters
----------
binary_types list(basestring)
Corresponds to self.binary_types (aka. wha... | [
"def",
"_should_base64_decode_body",
"(",
"binary_types",
",",
"flask_request",
",",
"lamba_response_headers",
",",
"is_base_64_encoded",
")",
":",
"best_match_mimetype",
"=",
"flask_request",
".",
"accept_mimetypes",
".",
"best_match",
"(",
"[",
"lamba_response_headers",
... | Whether or not the body should be decoded from Base64 to Binary
Parameters
----------
binary_types list(basestring)
Corresponds to self.binary_types (aka. what is parsed from SAM Template
flask_request flask.request
Flask request
lamba_response_headers di... | [
"Whether",
"or",
"not",
"the",
"body",
"should",
"be",
"decoded",
"from",
"Base64",
"to",
"Binary"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L234-L257 | train | Returns True if the body should be decoded from Base64 to Binary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._construct_event | def _construct_event(flask_request, port, binary_types):
"""
Helper method that constructs the Event to be passed to Lambda
:param request flask_request: Flask Request
:return: String representing the event
"""
identity = ContextIdentity(source_ip=flask_request.remote_a... | python | def _construct_event(flask_request, port, binary_types):
"""
Helper method that constructs the Event to be passed to Lambda
:param request flask_request: Flask Request
:return: String representing the event
"""
identity = ContextIdentity(source_ip=flask_request.remote_a... | [
"def",
"_construct_event",
"(",
"flask_request",
",",
"port",
",",
"binary_types",
")",
":",
"identity",
"=",
"ContextIdentity",
"(",
"source_ip",
"=",
"flask_request",
".",
"remote_addr",
")",
"endpoint",
"=",
"PathConverter",
".",
"convert_path_to_api_gateway",
"(... | Helper method that constructs the Event to be passed to Lambda
:param request flask_request: Flask Request
:return: String representing the event | [
"Helper",
"method",
"that",
"constructs",
"the",
"Event",
"to",
"be",
"passed",
"to",
"Lambda"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L260-L314 | train | Helper method that constructs the Event to be passed to Lambda. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/local_apigw_service.py | LocalApigwService._query_string_params | def _query_string_params(flask_request):
"""
Constructs an APIGW equivalent query string dictionary
Parameters
----------
flask_request request
Request from Flask
Returns dict (str: str)
-------
Empty dict if no query params where in the ... | python | def _query_string_params(flask_request):
"""
Constructs an APIGW equivalent query string dictionary
Parameters
----------
flask_request request
Request from Flask
Returns dict (str: str)
-------
Empty dict if no query params where in the ... | [
"def",
"_query_string_params",
"(",
"flask_request",
")",
":",
"query_string_dict",
"=",
"{",
"}",
"# Flask returns an ImmutableMultiDict so convert to a dictionary that becomes",
"# a dict(str: list) then iterate over",
"for",
"query_string_key",
",",
"query_string_list",
"in",
"f... | Constructs an APIGW equivalent query string dictionary
Parameters
----------
flask_request request
Request from Flask
Returns dict (str: str)
-------
Empty dict if no query params where in the request otherwise returns a dictionary of key to value | [
"Constructs",
"an",
"APIGW",
"equivalent",
"query",
"string",
"dictionary"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/local_apigw_service.py#L317-L345 | train | Constructs an APIGW equivalent query string dictionary from flask_request. args | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | LocalLambdaRunner.invoke | def invoke(self, function_name, event, stdout=None, stderr=None):
"""
Find the Lambda function with given name and invoke it. Pass the given event to the function and return
response through the given streams.
This function will block until either the function completes or times out.
... | python | def invoke(self, function_name, event, stdout=None, stderr=None):
"""
Find the Lambda function with given name and invoke it. Pass the given event to the function and return
response through the given streams.
This function will block until either the function completes or times out.
... | [
"def",
"invoke",
"(",
"self",
",",
"function_name",
",",
"event",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
")",
":",
"# Generate the correct configuration based on given inputs",
"function",
"=",
"self",
".",
"provider",
".",
"get",
"(",
"function... | Find the Lambda function with given name and invoke it. Pass the given event to the function and return
response through the given streams.
This function will block until either the function completes or times out.
Parameters
----------
function_name str
Name of the... | [
"Find",
"the",
"Lambda",
"function",
"with",
"given",
"name",
"and",
"invoke",
"it",
".",
"Pass",
"the",
"given",
"event",
"to",
"the",
"function",
"and",
"return",
"response",
"through",
"the",
"given",
"streams",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_lambda.py#L49-L89 | train | Invoke the Lambda function with given name and return the result of the Lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | LocalLambdaRunner._get_invoke_config | def _get_invoke_config(self, function):
"""
Returns invoke configuration to pass to Lambda Runtime to invoke the given function
:param samcli.commands.local.lib.provider.Function function: Lambda function to generate the configuration for
:return samcli.local.lambdafn.config.FunctionCon... | python | def _get_invoke_config(self, function):
"""
Returns invoke configuration to pass to Lambda Runtime to invoke the given function
:param samcli.commands.local.lib.provider.Function function: Lambda function to generate the configuration for
:return samcli.local.lambdafn.config.FunctionCon... | [
"def",
"_get_invoke_config",
"(",
"self",
",",
"function",
")",
":",
"env_vars",
"=",
"self",
".",
"_make_env_vars",
"(",
"function",
")",
"code_abs_path",
"=",
"resolve_code_path",
"(",
"self",
".",
"cwd",
",",
"function",
".",
"codeuri",
")",
"LOG",
".",
... | Returns invoke configuration to pass to Lambda Runtime to invoke the given function
:param samcli.commands.local.lib.provider.Function function: Lambda function to generate the configuration for
:return samcli.local.lambdafn.config.FunctionConfig: Function configuration to pass to Lambda runtime | [
"Returns",
"invoke",
"configuration",
"to",
"pass",
"to",
"Lambda",
"Runtime",
"to",
"invoke",
"the",
"given",
"function"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_lambda.py#L103-L131 | train | Returns the invoke configuration for the given Lambda function | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | LocalLambdaRunner._make_env_vars | def _make_env_vars(self, function):
"""Returns the environment variables configuration for this function
Parameters
----------
function : samcli.commands.local.lib.provider.Function
Lambda function to generate the configuration for
Returns
-------
sa... | python | def _make_env_vars(self, function):
"""Returns the environment variables configuration for this function
Parameters
----------
function : samcli.commands.local.lib.provider.Function
Lambda function to generate the configuration for
Returns
-------
sa... | [
"def",
"_make_env_vars",
"(",
"self",
",",
"function",
")",
":",
"name",
"=",
"function",
".",
"name",
"variables",
"=",
"None",
"if",
"function",
".",
"environment",
"and",
"isinstance",
"(",
"function",
".",
"environment",
",",
"dict",
")",
"and",
"\"Var... | Returns the environment variables configuration for this function
Parameters
----------
function : samcli.commands.local.lib.provider.Function
Lambda function to generate the configuration for
Returns
-------
samcli.local.lambdafn.env_vars.EnvironmentVariabl... | [
"Returns",
"the",
"environment",
"variables",
"configuration",
"for",
"this",
"function"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_lambda.py#L133-L193 | train | Returns the environment variables configuration for this Lambda function | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/lib/local_lambda.py | LocalLambdaRunner.get_aws_creds | def get_aws_creds(self):
"""
Returns AWS credentials obtained from the shell environment or given profile
:return dict: A dictionary containing credentials. This dict has the structure
{"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials could not be resolved... | python | def get_aws_creds(self):
"""
Returns AWS credentials obtained from the shell environment or given profile
:return dict: A dictionary containing credentials. This dict has the structure
{"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials could not be resolved... | [
"def",
"get_aws_creds",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"# to pass command line arguments for region & profile to setup boto3 default session",
"if",
"boto3",
".",
"DEFAULT_SESSION",
":",
"session",
"=",
"boto3",
".",
"DEFAULT_SESSION",
"else",
":",
"ses... | Returns AWS credentials obtained from the shell environment or given profile
:return dict: A dictionary containing credentials. This dict has the structure
{"region": "", "key": "", "secret": "", "sessiontoken": ""}. If credentials could not be resolved,
this returns None | [
"Returns",
"AWS",
"credentials",
"obtained",
"from",
"the",
"shell",
"environment",
"or",
"given",
"profile"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/local_lambda.py#L195-L238 | train | Returns the AWS credentials obtained from the shell environment or given profile
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/events/api_event.py | ContextIdentity.to_dict | def to_dict(self):
"""
Constructs an dictionary representation of the Identity Object to be used in serializing to JSON
:return: dict representing the object
"""
json_dict = {"apiKey": self.api_key,
"userArn": self.user_arn,
"cognitoAuth... | python | def to_dict(self):
"""
Constructs an dictionary representation of the Identity Object to be used in serializing to JSON
:return: dict representing the object
"""
json_dict = {"apiKey": self.api_key,
"userArn": self.user_arn,
"cognitoAuth... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"json_dict",
"=",
"{",
"\"apiKey\"",
":",
"self",
".",
"api_key",
",",
"\"userArn\"",
":",
"self",
".",
"user_arn",
",",
"\"cognitoAuthenticationType\"",
":",
"self",
".",
"cognito_authentication_type",
",",
"\"caller\"",... | Constructs an dictionary representation of the Identity Object to be used in serializing to JSON
:return: dict representing the object | [
"Constructs",
"an",
"dictionary",
"representation",
"of",
"the",
"Identity",
"Object",
"to",
"be",
"used",
"in",
"serializing",
"to",
"JSON"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/events/api_event.py#L42-L60 | train | Constructs a dictionary representation of the Identity Object to be used in serializing to JSON | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/events/api_event.py | RequestContext.to_dict | def to_dict(self):
"""
Constructs an dictionary representation of the RequestContext Object to be used in serializing to JSON
:return: dict representing the object
"""
identity_dict = {}
if self.identity:
identity_dict = self.identity.to_dict()
json_... | python | def to_dict(self):
"""
Constructs an dictionary representation of the RequestContext Object to be used in serializing to JSON
:return: dict representing the object
"""
identity_dict = {}
if self.identity:
identity_dict = self.identity.to_dict()
json_... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"identity_dict",
"=",
"{",
"}",
"if",
"self",
".",
"identity",
":",
"identity_dict",
"=",
"self",
".",
"identity",
".",
"to_dict",
"(",
")",
"json_dict",
"=",
"{",
"\"resourceId\"",
":",
"self",
".",
"resource_id"... | Constructs an dictionary representation of the RequestContext Object to be used in serializing to JSON
:return: dict representing the object | [
"Constructs",
"an",
"dictionary",
"representation",
"of",
"the",
"RequestContext",
"Object",
"to",
"be",
"used",
"in",
"serializing",
"to",
"JSON"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/events/api_event.py#L102-L124 | train | Constructs a dictionary representation of the RequestContext Object to be used in serializing to JSON | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/events/api_event.py | ApiGatewayLambdaEvent.to_dict | def to_dict(self):
"""
Constructs an dictionary representation of the ApiGatewayLambdaEvent Object to be used in serializing to JSON
:return: dict representing the object
"""
request_context_dict = {}
if self.request_context:
request_context_dict = self.reque... | python | def to_dict(self):
"""
Constructs an dictionary representation of the ApiGatewayLambdaEvent Object to be used in serializing to JSON
:return: dict representing the object
"""
request_context_dict = {}
if self.request_context:
request_context_dict = self.reque... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"request_context_dict",
"=",
"{",
"}",
"if",
"self",
".",
"request_context",
":",
"request_context_dict",
"=",
"self",
".",
"request_context",
".",
"to_dict",
"(",
")",
"json_dict",
"=",
"{",
"\"httpMethod\"",
":",
"s... | Constructs an dictionary representation of the ApiGatewayLambdaEvent Object to be used in serializing to JSON
:return: dict representing the object | [
"Constructs",
"an",
"dictionary",
"representation",
"of",
"the",
"ApiGatewayLambdaEvent",
"Object",
"to",
"be",
"used",
"in",
"serializing",
"to",
"JSON"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/events/api_event.py#L179-L201 | train | Constructs a dictionary representation of the ApiGatewayLambdaEvent Object to be used in serializing to JSON | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/logs/command.py | do_cli | def do_cli(function_name, stack_name, filter_pattern, tailing, start_time, end_time):
"""
Implementation of the ``cli`` method
"""
LOG.debug("'logs' command is called")
with LogsCommandContext(function_name,
stack_name=stack_name,
filter_patt... | python | def do_cli(function_name, stack_name, filter_pattern, tailing, start_time, end_time):
"""
Implementation of the ``cli`` method
"""
LOG.debug("'logs' command is called")
with LogsCommandContext(function_name,
stack_name=stack_name,
filter_patt... | [
"def",
"do_cli",
"(",
"function_name",
",",
"stack_name",
",",
"filter_pattern",
",",
"tailing",
",",
"start_time",
",",
"end_time",
")",
":",
"LOG",
".",
"debug",
"(",
"\"'logs' command is called\"",
")",
"with",
"LogsCommandContext",
"(",
"function_name",
",",
... | Implementation of the ``cli`` method | [
"Implementation",
"of",
"the",
"cli",
"method"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/logs/command.py#L76-L105 | train | Implementation of the CLI method | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/manager.py | ContainerManager.is_docker_reachable | def is_docker_reachable(self):
"""
Checks if Docker daemon is running. This is required for us to invoke the function locally
Returns
-------
bool
True, if Docker is available, False otherwise
"""
try:
self.docker_client.ping()
... | python | def is_docker_reachable(self):
"""
Checks if Docker daemon is running. This is required for us to invoke the function locally
Returns
-------
bool
True, if Docker is available, False otherwise
"""
try:
self.docker_client.ping()
... | [
"def",
"is_docker_reachable",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"docker_client",
".",
"ping",
"(",
")",
"return",
"True",
"# When Docker is not installed, a request.exceptions.ConnectionError is thrown.",
"except",
"(",
"docker",
".",
"errors",
".",
"API... | Checks if Docker daemon is running. This is required for us to invoke the function locally
Returns
-------
bool
True, if Docker is available, False otherwise | [
"Checks",
"if",
"Docker",
"daemon",
"is",
"running",
".",
"This",
"is",
"required",
"for",
"us",
"to",
"invoke",
"the",
"function",
"locally"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/manager.py#L40-L57 | train | Checks if Docker daemon is available and if it is available. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/manager.py | ContainerManager.run | def run(self, container, input_data=None, warm=False):
"""
Create and run a Docker container based on the given configuration.
:param samcli.local.docker.container.Container container: Container to create and run
:param input_data: Optional. Input data sent to the container through cont... | python | def run(self, container, input_data=None, warm=False):
"""
Create and run a Docker container based on the given configuration.
:param samcli.local.docker.container.Container container: Container to create and run
:param input_data: Optional. Input data sent to the container through cont... | [
"def",
"run",
"(",
"self",
",",
"container",
",",
"input_data",
"=",
"None",
",",
"warm",
"=",
"False",
")",
":",
"if",
"warm",
":",
"raise",
"ValueError",
"(",
"\"The facility to invoke warm container does not exist\"",
")",
"image_name",
"=",
"container",
".",... | Create and run a Docker container based on the given configuration.
:param samcli.local.docker.container.Container container: Container to create and run
:param input_data: Optional. Input data sent to the container through container's stdin.
:param bool warm: Indicates if an existing container... | [
"Create",
"and",
"run",
"a",
"Docker",
"container",
"based",
"on",
"the",
"given",
"configuration",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/manager.py#L59-L98 | train | Create and run a Docker container based on the given configuration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/manager.py | ContainerManager.pull_image | def pull_image(self, image_name, stream=None):
"""
Ask Docker to pull the container image with given name.
Parameters
----------
image_name str
Name of the image
stream samcli.lib.utils.stream_writer.StreamWriter
Optional stream writer to output t... | python | def pull_image(self, image_name, stream=None):
"""
Ask Docker to pull the container image with given name.
Parameters
----------
image_name str
Name of the image
stream samcli.lib.utils.stream_writer.StreamWriter
Optional stream writer to output t... | [
"def",
"pull_image",
"(",
"self",
",",
"image_name",
",",
"stream",
"=",
"None",
")",
":",
"stream_writer",
"=",
"stream",
"or",
"StreamWriter",
"(",
"sys",
".",
"stderr",
")",
"try",
":",
"result_itr",
"=",
"self",
".",
"docker_client",
".",
"api",
".",... | Ask Docker to pull the container image with given name.
Parameters
----------
image_name str
Name of the image
stream samcli.lib.utils.stream_writer.StreamWriter
Optional stream writer to output to. Defaults to stderr
Raises
------
Docker... | [
"Ask",
"Docker",
"to",
"pull",
"the",
"container",
"image",
"with",
"given",
"name",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/manager.py#L108-L142 | train | Ask Docker to pull the container image with given name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/manager.py | ContainerManager.has_image | def has_image(self, image_name):
"""
Is the container image with given name available?
:param string image_name: Name of the image
:return bool: True, if image is available. False, otherwise
"""
try:
self.docker_client.images.get(image_name)
retu... | python | def has_image(self, image_name):
"""
Is the container image with given name available?
:param string image_name: Name of the image
:return bool: True, if image is available. False, otherwise
"""
try:
self.docker_client.images.get(image_name)
retu... | [
"def",
"has_image",
"(",
"self",
",",
"image_name",
")",
":",
"try",
":",
"self",
".",
"docker_client",
".",
"images",
".",
"get",
"(",
"image_name",
")",
"return",
"True",
"except",
"docker",
".",
"errors",
".",
"ImageNotFound",
":",
"return",
"False"
] | Is the container image with given name available?
:param string image_name: Name of the image
:return bool: True, if image is available. False, otherwise | [
"Is",
"the",
"container",
"image",
"with",
"given",
"name",
"available?"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/manager.py#L144-L156 | train | Check if the image with given name exists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/publish/command.py | do_cli | def do_cli(ctx, template, semantic_version):
"""Publish the application based on command line inputs."""
try:
template_data = get_template_data(template)
except ValueError as ex:
click.secho("Publish Failed", fg='red')
raise UserException(str(ex))
# Override SemanticVersion in t... | python | def do_cli(ctx, template, semantic_version):
"""Publish the application based on command line inputs."""
try:
template_data = get_template_data(template)
except ValueError as ex:
click.secho("Publish Failed", fg='red')
raise UserException(str(ex))
# Override SemanticVersion in t... | [
"def",
"do_cli",
"(",
"ctx",
",",
"template",
",",
"semantic_version",
")",
":",
"try",
":",
"template_data",
"=",
"get_template_data",
"(",
"template",
")",
"except",
"ValueError",
"as",
"ex",
":",
"click",
".",
"secho",
"(",
"\"Publish Failed\"",
",",
"fg"... | Publish the application based on command line inputs. | [
"Publish",
"the",
"application",
"based",
"on",
"command",
"line",
"inputs",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/publish/command.py#L55-L83 | train | Publish the application based on command line inputs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/publish/command.py | _gen_success_message | def _gen_success_message(publish_output):
"""
Generate detailed success message for published applications.
Parameters
----------
publish_output : dict
Output from serverlessrepo publish_application
Returns
-------
str
Detailed success message
"""
application_id... | python | def _gen_success_message(publish_output):
"""
Generate detailed success message for published applications.
Parameters
----------
publish_output : dict
Output from serverlessrepo publish_application
Returns
-------
str
Detailed success message
"""
application_id... | [
"def",
"_gen_success_message",
"(",
"publish_output",
")",
":",
"application_id",
"=",
"publish_output",
".",
"get",
"(",
"'application_id'",
")",
"details",
"=",
"json",
".",
"dumps",
"(",
"publish_output",
".",
"get",
"(",
"'details'",
")",
",",
"indent",
"=... | Generate detailed success message for published applications.
Parameters
----------
publish_output : dict
Output from serverlessrepo publish_application
Returns
-------
str
Detailed success message | [
"Generate",
"detailed",
"success",
"message",
"for",
"published",
"applications",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/publish/command.py#L86-L106 | train | Generate detailed success message for published applications. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/publish/command.py | _print_console_link | def _print_console_link(region, application_id):
"""
Print link for the application in AWS Serverless Application Repository console.
Parameters
----------
region : str
AWS region name
application_id : str
The Amazon Resource Name (ARN) of the application
"""
if not reg... | python | def _print_console_link(region, application_id):
"""
Print link for the application in AWS Serverless Application Repository console.
Parameters
----------
region : str
AWS region name
application_id : str
The Amazon Resource Name (ARN) of the application
"""
if not reg... | [
"def",
"_print_console_link",
"(",
"region",
",",
"application_id",
")",
":",
"if",
"not",
"region",
":",
"region",
"=",
"boto3",
".",
"Session",
"(",
")",
".",
"region_name",
"console_link",
"=",
"SERVERLESSREPO_CONSOLE_URL",
".",
"format",
"(",
"region",
","... | Print link for the application in AWS Serverless Application Repository console.
Parameters
----------
region : str
AWS region name
application_id : str
The Amazon Resource Name (ARN) of the application | [
"Print",
"link",
"for",
"the",
"application",
"in",
"AWS",
"Serverless",
"Application",
"Repository",
"console",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/publish/command.py#L109-L126 | train | Print link for the application in AWS Serverless Application Repository console. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/service_error_responses.py | ServiceErrorResponses.lambda_failure_response | def lambda_failure_response(*args):
"""
Helper function to create a Lambda Failure Response
:return: A Flask Response
"""
response_data = jsonify(ServiceErrorResponses._LAMBDA_FAILURE)
return make_response(response_data, ServiceErrorResponses.HTTP_STATUS_CODE_502) | python | def lambda_failure_response(*args):
"""
Helper function to create a Lambda Failure Response
:return: A Flask Response
"""
response_data = jsonify(ServiceErrorResponses._LAMBDA_FAILURE)
return make_response(response_data, ServiceErrorResponses.HTTP_STATUS_CODE_502) | [
"def",
"lambda_failure_response",
"(",
"*",
"args",
")",
":",
"response_data",
"=",
"jsonify",
"(",
"ServiceErrorResponses",
".",
"_LAMBDA_FAILURE",
")",
"return",
"make_response",
"(",
"response_data",
",",
"ServiceErrorResponses",
".",
"HTTP_STATUS_CODE_502",
")"
] | Helper function to create a Lambda Failure Response
:return: A Flask Response | [
"Helper",
"function",
"to",
"create",
"a",
"Lambda",
"Failure",
"Response"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/service_error_responses.py#L16-L23 | train | Helper function to create a Lambda Failure Response | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/service_error_responses.py | ServiceErrorResponses.lambda_not_found_response | def lambda_not_found_response(*args):
"""
Constructs a Flask Response for when a Lambda function is not found for an endpoint
:return: a Flask Response
"""
response_data = jsonify(ServiceErrorResponses._NO_LAMBDA_INTEGRATION)
return make_response(response_data, ServiceEr... | python | def lambda_not_found_response(*args):
"""
Constructs a Flask Response for when a Lambda function is not found for an endpoint
:return: a Flask Response
"""
response_data = jsonify(ServiceErrorResponses._NO_LAMBDA_INTEGRATION)
return make_response(response_data, ServiceEr... | [
"def",
"lambda_not_found_response",
"(",
"*",
"args",
")",
":",
"response_data",
"=",
"jsonify",
"(",
"ServiceErrorResponses",
".",
"_NO_LAMBDA_INTEGRATION",
")",
"return",
"make_response",
"(",
"response_data",
",",
"ServiceErrorResponses",
".",
"HTTP_STATUS_CODE_502",
... | Constructs a Flask Response for when a Lambda function is not found for an endpoint
:return: a Flask Response | [
"Constructs",
"a",
"Flask",
"Response",
"for",
"when",
"a",
"Lambda",
"function",
"is",
"not",
"found",
"for",
"an",
"endpoint"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/service_error_responses.py#L26-L33 | train | Constructs a Flask Response for when a Lambda function is not found for an endpoint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/apigw/service_error_responses.py | ServiceErrorResponses.route_not_found | def route_not_found(*args):
"""
Constructs a Flask Response for when a API Route (path+method) is not found. This is usually
HTTP 404 but with API Gateway this is a HTTP 403 (https://forums.aws.amazon.com/thread.jspa?threadID=2166840)
:return: a Flask Response
"""
respon... | python | def route_not_found(*args):
"""
Constructs a Flask Response for when a API Route (path+method) is not found. This is usually
HTTP 404 but with API Gateway this is a HTTP 403 (https://forums.aws.amazon.com/thread.jspa?threadID=2166840)
:return: a Flask Response
"""
respon... | [
"def",
"route_not_found",
"(",
"*",
"args",
")",
":",
"response_data",
"=",
"jsonify",
"(",
"ServiceErrorResponses",
".",
"_MISSING_AUTHENTICATION",
")",
"return",
"make_response",
"(",
"response_data",
",",
"ServiceErrorResponses",
".",
"HTTP_STATUS_CODE_403",
")"
] | Constructs a Flask Response for when a API Route (path+method) is not found. This is usually
HTTP 404 but with API Gateway this is a HTTP 403 (https://forums.aws.amazon.com/thread.jspa?threadID=2166840)
:return: a Flask Response | [
"Constructs",
"a",
"Flask",
"Response",
"for",
"when",
"a",
"API",
"Route",
"(",
"path",
"+",
"method",
")",
"is",
"not",
"found",
".",
"This",
"is",
"usually",
"HTTP",
"404",
"but",
"with",
"API",
"Gateway",
"this",
"is",
"a",
"HTTP",
"403",
"(",
"h... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/apigw/service_error_responses.py#L36-L44 | train | Construct a Flask Response for when a API Route is not found. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/utils/progressbar.py | progressbar | def progressbar(length, label):
"""
Creates a progressbar
Parameters
----------
length int
Length of the ProgressBar
label str
Label to give to the progressbar
Returns
-------
click.progressbar
Progressbar
"""
return click.progressbar(length=length,... | python | def progressbar(length, label):
"""
Creates a progressbar
Parameters
----------
length int
Length of the ProgressBar
label str
Label to give to the progressbar
Returns
-------
click.progressbar
Progressbar
"""
return click.progressbar(length=length,... | [
"def",
"progressbar",
"(",
"length",
",",
"label",
")",
":",
"return",
"click",
".",
"progressbar",
"(",
"length",
"=",
"length",
",",
"label",
"=",
"label",
",",
"show_pos",
"=",
"True",
")"
] | Creates a progressbar
Parameters
----------
length int
Length of the ProgressBar
label str
Label to give to the progressbar
Returns
-------
click.progressbar
Progressbar | [
"Creates",
"a",
"progressbar"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/utils/progressbar.py#L8-L25 | train | Returns a progressbar that shows the length and label of the base tree tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/cli/types.py | CfnParameterOverridesType._unquote | def _unquote(value):
r"""
Removes wrapping double quotes and any '\ ' characters. They are usually added to preserve spaces when passing
value thru shell.
Examples
--------
>>> _unquote('val\ ue')
value
>>> _unquote("hel\ lo")
hello
Para... | python | def _unquote(value):
r"""
Removes wrapping double quotes and any '\ ' characters. They are usually added to preserve spaces when passing
value thru shell.
Examples
--------
>>> _unquote('val\ ue')
value
>>> _unquote("hel\ lo")
hello
Para... | [
"def",
"_unquote",
"(",
"value",
")",
":",
"if",
"value",
"and",
"(",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
")",
":",
"# Remove quotes only if the string is wrapped in quotes",
"value",
"=",
"value",
".",
"strip",
"(",
... | r"""
Removes wrapping double quotes and any '\ ' characters. They are usually added to preserve spaces when passing
value thru shell.
Examples
--------
>>> _unquote('val\ ue')
value
>>> _unquote("hel\ lo")
hello
Parameters
----------
... | [
"r",
"Removes",
"wrapping",
"double",
"quotes",
"and",
"any",
"\\",
"characters",
".",
"They",
"are",
"usually",
"added",
"to",
"preserve",
"spaces",
"when",
"passing",
"value",
"thru",
"shell",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/cli/types.py#L42-L68 | train | r Unquotes double quotes and any \ spaces characters in the input string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/services/base_local_service.py | BaseLocalService.run | def run(self):
"""
This starts up the (threaded) Local Server.
Note: This is a **blocking call**
Raises
------
RuntimeError
if the service was not created
"""
if not self._app:
raise RuntimeError("The application must be created be... | python | def run(self):
"""
This starts up the (threaded) Local Server.
Note: This is a **blocking call**
Raises
------
RuntimeError
if the service was not created
"""
if not self._app:
raise RuntimeError("The application must be created be... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_app",
":",
"raise",
"RuntimeError",
"(",
"\"The application must be created before running\"",
")",
"# Flask can operate as a single threaded server (which is default) and a multi-threaded server which is",
"# more ... | This starts up the (threaded) Local Server.
Note: This is a **blocking call**
Raises
------
RuntimeError
if the service was not created | [
"This",
"starts",
"up",
"the",
"(",
"threaded",
")",
"Local",
"Server",
".",
"Note",
":",
"This",
"is",
"a",
"**",
"blocking",
"call",
"**"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/services/base_local_service.py#L55-L81 | train | This starts up the local server and runs the application. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/services/base_local_service.py | BaseLocalService.service_response | def service_response(body, headers, status_code):
"""
Constructs a Flask Response from the body, headers, and status_code.
:param str body: Response body as a string
:param dict headers: headers for the response
:param int status_code: status_code for response
:return: F... | python | def service_response(body, headers, status_code):
"""
Constructs a Flask Response from the body, headers, and status_code.
:param str body: Response body as a string
:param dict headers: headers for the response
:param int status_code: status_code for response
:return: F... | [
"def",
"service_response",
"(",
"body",
",",
"headers",
",",
"status_code",
")",
":",
"response",
"=",
"Response",
"(",
"body",
")",
"response",
".",
"headers",
"=",
"headers",
"response",
".",
"status_code",
"=",
"status_code",
"return",
"response"
] | Constructs a Flask Response from the body, headers, and status_code.
:param str body: Response body as a string
:param dict headers: headers for the response
:param int status_code: status_code for response
:return: Flask Response | [
"Constructs",
"a",
"Flask",
"Response",
"from",
"the",
"body",
"headers",
"and",
"status_code",
"."
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/services/base_local_service.py#L84-L96 | train | Constructs a Flask Response from the body headers and status_code. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/services/base_local_service.py | LambdaOutputParser.get_lambda_output | def get_lambda_output(stdout_stream):
"""
This method will extract read the given stream and return the response from Lambda function separated out
from any log statements it might have outputted. Logs end up in the stdout stream if the Lambda function
wrote directly to stdout using Syst... | python | def get_lambda_output(stdout_stream):
"""
This method will extract read the given stream and return the response from Lambda function separated out
from any log statements it might have outputted. Logs end up in the stdout stream if the Lambda function
wrote directly to stdout using Syst... | [
"def",
"get_lambda_output",
"(",
"stdout_stream",
")",
":",
"# We only want the last line of stdout, because it's possible that",
"# the function may have written directly to stdout using",
"# System.out.println or similar, before docker-lambda output the result",
"stdout_data",
"=",
"stdout_s... | This method will extract read the given stream and return the response from Lambda function separated out
from any log statements it might have outputted. Logs end up in the stdout stream if the Lambda function
wrote directly to stdout using System.out.println or equivalents.
Parameters
... | [
"This",
"method",
"will",
"extract",
"read",
"the",
"given",
"stream",
"and",
"return",
"the",
"response",
"from",
"Lambda",
"function",
"separated",
"out",
"from",
"any",
"log",
"statements",
"it",
"might",
"have",
"outputted",
".",
"Logs",
"end",
"up",
"in... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/services/base_local_service.py#L102-L149 | train | This method will extract the output from the Lambda function and return the response as JSON string and the error and exception from the container. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/services/base_local_service.py | LambdaOutputParser.is_lambda_error_response | def is_lambda_error_response(lambda_response):
"""
Check to see if the output from the container is in the form of an Error/Exception from the Lambda invoke
Parameters
----------
lambda_response str
The response the container returned
Returns
-------... | python | def is_lambda_error_response(lambda_response):
"""
Check to see if the output from the container is in the form of an Error/Exception from the Lambda invoke
Parameters
----------
lambda_response str
The response the container returned
Returns
-------... | [
"def",
"is_lambda_error_response",
"(",
"lambda_response",
")",
":",
"is_lambda_user_error_response",
"=",
"False",
"try",
":",
"lambda_response_dict",
"=",
"json",
".",
"loads",
"(",
"lambda_response",
")",
"# This is a best effort attempt to determine if the output (lambda_re... | Check to see if the output from the container is in the form of an Error/Exception from the Lambda invoke
Parameters
----------
lambda_response str
The response the container returned
Returns
-------
bool
True if the output matches the Error/Exce... | [
"Check",
"to",
"see",
"if",
"the",
"output",
"from",
"the",
"container",
"is",
"in",
"the",
"form",
"of",
"an",
"Error",
"/",
"Exception",
"from",
"the",
"Lambda",
"invoke"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/services/base_local_service.py#L152-L184 | train | Check to see if the response from the Lambda is in the form of an Error or Exception. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/build/app_builder.py | ApplicationBuilder.build | def build(self):
"""
Build the entire application
Returns
-------
dict
Returns the path to where each resource was built as a map of resource's LogicalId to the path string
"""
result = {}
for lambda_function in self._functions_to_build:
... | python | def build(self):
"""
Build the entire application
Returns
-------
dict
Returns the path to where each resource was built as a map of resource's LogicalId to the path string
"""
result = {}
for lambda_function in self._functions_to_build:
... | [
"def",
"build",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"lambda_function",
"in",
"self",
".",
"_functions_to_build",
":",
"LOG",
".",
"info",
"(",
"\"Building resource '%s'\"",
",",
"lambda_function",
".",
"name",
")",
"result",
"[",
"lambda_f... | Build the entire application
Returns
-------
dict
Returns the path to where each resource was built as a map of resource's LogicalId to the path string | [
"Build",
"the",
"entire",
"application"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/build/app_builder.py#L91-L110 | train | Builds the entire application and returns a dictionary of resource names to their logical IDs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/build/app_builder.py | ApplicationBuilder.update_template | def update_template(self, template_dict, original_template_path, built_artifacts):
"""
Given the path to built artifacts, update the template to point appropriate resource CodeUris to the artifacts
folder
Parameters
----------
template_dict
original_template_path... | python | def update_template(self, template_dict, original_template_path, built_artifacts):
"""
Given the path to built artifacts, update the template to point appropriate resource CodeUris to the artifacts
folder
Parameters
----------
template_dict
original_template_path... | [
"def",
"update_template",
"(",
"self",
",",
"template_dict",
",",
"original_template_path",
",",
"built_artifacts",
")",
":",
"original_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"original_template_path",
")",
"for",
"logical_id",
",",
"resource",
"in",
... | Given the path to built artifacts, update the template to point appropriate resource CodeUris to the artifacts
folder
Parameters
----------
template_dict
original_template_path : str
Path where the template file will be written to
built_artifacts : dict
... | [
"Given",
"the",
"path",
"to",
"built",
"artifacts",
"update",
"the",
"template",
"to",
"point",
"appropriate",
"resource",
"CodeUris",
"to",
"the",
"artifacts",
"folder"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/build/app_builder.py#L112-L153 | train | Update the template with the codeUris and artifacts that are needed for the template file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/build/app_builder.py | ApplicationBuilder._build_function | def _build_function(self, function_name, codeuri, runtime):
"""
Given the function information, this method will build the Lambda function. Depending on the configuration
it will either build the function in process or by spinning up a Docker container.
Parameters
----------
... | python | def _build_function(self, function_name, codeuri, runtime):
"""
Given the function information, this method will build the Lambda function. Depending on the configuration
it will either build the function in process or by spinning up a Docker container.
Parameters
----------
... | [
"def",
"_build_function",
"(",
"self",
",",
"function_name",
",",
"codeuri",
",",
"runtime",
")",
":",
"# Create the arguments to pass to the builder",
"# Code is always relative to the given base directory.",
"code_dir",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"sel... | Given the function information, this method will build the Lambda function. Depending on the configuration
it will either build the function in process or by spinning up a Docker container.
Parameters
----------
function_name : str
Name or LogicalId of the function
... | [
"Given",
"the",
"function",
"information",
"this",
"method",
"will",
"build",
"the",
"Lambda",
"function",
".",
"Depending",
"on",
"the",
"configuration",
"it",
"will",
"either",
"build",
"the",
"function",
"in",
"process",
"or",
"by",
"spinning",
"up",
"a",
... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/build/app_builder.py#L155-L199 | train | Build the Lambda function given the function information. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_build_container.py | LambdaBuildContainer._get_container_dirs | def _get_container_dirs(source_dir, manifest_dir):
"""
Provides paths to directories within the container that is required by the builder
Parameters
----------
source_dir : str
Path to the function source code
manifest_dir : str
Path to the direc... | python | def _get_container_dirs(source_dir, manifest_dir):
"""
Provides paths to directories within the container that is required by the builder
Parameters
----------
source_dir : str
Path to the function source code
manifest_dir : str
Path to the direc... | [
"def",
"_get_container_dirs",
"(",
"source_dir",
",",
"manifest_dir",
")",
":",
"base",
"=",
"\"/tmp/samcli\"",
"result",
"=",
"{",
"\"source_dir\"",
":",
"\"{}/source\"",
".",
"format",
"(",
"base",
")",
",",
"\"artifacts_dir\"",
":",
"\"{}/artifacts\"",
".",
"... | Provides paths to directories within the container that is required by the builder
Parameters
----------
source_dir : str
Path to the function source code
manifest_dir : str
Path to the directory containing manifest
Returns
-------
dict
... | [
"Provides",
"paths",
"to",
"directories",
"within",
"the",
"container",
"that",
"is",
"required",
"by",
"the",
"builder"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_build_container.py#L150-L180 | train | Returns a dictionary containing the paths to directories that are required by the builder. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/local/docker/lambda_build_container.py | LambdaBuildContainer._convert_to_container_dirs | def _convert_to_container_dirs(host_paths_to_convert, host_to_container_path_mapping):
"""
Use this method to convert a list of host paths to a list of equivalent paths within the container
where the given host path is mounted. This is necessary when SAM CLI needs to pass path information to
... | python | def _convert_to_container_dirs(host_paths_to_convert, host_to_container_path_mapping):
"""
Use this method to convert a list of host paths to a list of equivalent paths within the container
where the given host path is mounted. This is necessary when SAM CLI needs to pass path information to
... | [
"def",
"_convert_to_container_dirs",
"(",
"host_paths_to_convert",
",",
"host_to_container_path_mapping",
")",
":",
"if",
"not",
"host_paths_to_convert",
":",
"# Nothing to do",
"return",
"host_paths_to_convert",
"# Make sure the key is absolute host path. Relative paths are tricky to ... | Use this method to convert a list of host paths to a list of equivalent paths within the container
where the given host path is mounted. This is necessary when SAM CLI needs to pass path information to
the Lambda Builder running within the container.
If a host path is not mounted within the con... | [
"Use",
"this",
"method",
"to",
"convert",
"a",
"list",
"of",
"host",
"paths",
"to",
"a",
"list",
"of",
"equivalent",
"paths",
"within",
"the",
"container",
"where",
"the",
"given",
"host",
"path",
"is",
"mounted",
".",
"This",
"is",
"necessary",
"when",
... | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_build_container.py#L183-L228 | train | Convert a list of host paths to a list of equivalent paths within the container. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/samlib/wrapper.py | SamTranslatorWrapper.__translate | def __translate(self, parameter_values):
"""
This method is unused and a Work In Progress
"""
template_copy = self.template
sam_parser = Parser()
sam_translator = Translator(managed_policy_map=self.__managed_policy_map(),
sam_parser=s... | python | def __translate(self, parameter_values):
"""
This method is unused and a Work In Progress
"""
template_copy = self.template
sam_parser = Parser()
sam_translator = Translator(managed_policy_map=self.__managed_policy_map(),
sam_parser=s... | [
"def",
"__translate",
"(",
"self",
",",
"parameter_values",
")",
":",
"template_copy",
"=",
"self",
".",
"template",
"sam_parser",
"=",
"Parser",
"(",
")",
"sam_translator",
"=",
"Translator",
"(",
"managed_policy_map",
"=",
"self",
".",
"__managed_policy_map",
... | This method is unused and a Work In Progress | [
"This",
"method",
"is",
"unused",
"and",
"a",
"Work",
"In",
"Progress"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/samlib/wrapper.py#L74-L88 | train | This method is used to translate the SAM template into a new SAM template. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/samlib/wrapper.py | SamTranslatorWrapper.__managed_policy_map | def __managed_policy_map(self):
"""
This method is unused and a Work In Progress
"""
try:
iam_client = boto3.client('iam')
return ManagedPolicyLoader(iam_client).load()
except Exception as ex:
if self._offline_fallback:
# If of... | python | def __managed_policy_map(self):
"""
This method is unused and a Work In Progress
"""
try:
iam_client = boto3.client('iam')
return ManagedPolicyLoader(iam_client).load()
except Exception as ex:
if self._offline_fallback:
# If of... | [
"def",
"__managed_policy_map",
"(",
"self",
")",
":",
"try",
":",
"iam_client",
"=",
"boto3",
".",
"client",
"(",
"'iam'",
")",
"return",
"ManagedPolicyLoader",
"(",
"iam_client",
")",
".",
"load",
"(",
")",
"except",
"Exception",
"as",
"ex",
":",
"if",
... | This method is unused and a Work In Progress | [
"This",
"method",
"is",
"unused",
"and",
"a",
"Work",
"In",
"Progress"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/samlib/wrapper.py#L94-L110 | train | Returns a dict of managed policies and their local names. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/lib/samlib/wrapper.py | _SamParserReimplemented._validate | def _validate(self, sam_template):
""" Validates the template and parameter values and raises exceptions if there's an issue
:param dict sam_template: SAM template
"""
if "Resources" not in sam_template or not isinstance(sam_template["Resources"], dict) \
or not sam_tem... | python | def _validate(self, sam_template):
""" Validates the template and parameter values and raises exceptions if there's an issue
:param dict sam_template: SAM template
"""
if "Resources" not in sam_template or not isinstance(sam_template["Resources"], dict) \
or not sam_tem... | [
"def",
"_validate",
"(",
"self",
",",
"sam_template",
")",
":",
"if",
"\"Resources\"",
"not",
"in",
"sam_template",
"or",
"not",
"isinstance",
"(",
"sam_template",
"[",
"\"Resources\"",
"]",
",",
"dict",
")",
"or",
"not",
"sam_template",
"[",
"\"Resources\"",
... | Validates the template and parameter values and raises exceptions if there's an issue
:param dict sam_template: SAM template | [
"Validates",
"the",
"template",
"and",
"parameter",
"values",
"and",
"raises",
"exceptions",
"if",
"there",
"s",
"an",
"issue"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/lib/samlib/wrapper.py#L136-L147 | train | Validates the SAM template and parameter values and raises exceptions if there s an issue | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | ServiceCommand.get_command | def get_command(self, ctx, cmd_name):
"""
gets the subcommands under the service name
Parameters
----------
ctx : Context
the context object passed into the method
cmd_name : str
the service name
Returns
-------
EventTypeSu... | python | def get_command(self, ctx, cmd_name):
"""
gets the subcommands under the service name
Parameters
----------
ctx : Context
the context object passed into the method
cmd_name : str
the service name
Returns
-------
EventTypeSu... | [
"def",
"get_command",
"(",
"self",
",",
"ctx",
",",
"cmd_name",
")",
":",
"if",
"cmd_name",
"not",
"in",
"self",
".",
"all_cmds",
":",
"return",
"None",
"return",
"EventTypeSubCommand",
"(",
"self",
".",
"events_lib",
",",
"cmd_name",
",",
"self",
".",
"... | gets the subcommands under the service name
Parameters
----------
ctx : Context
the context object passed into the method
cmd_name : str
the service name
Returns
-------
EventTypeSubCommand:
returns subcommand if successful, No... | [
"gets",
"the",
"subcommands",
"under",
"the",
"service",
"name"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/generate_event/event_generation.py#L45-L63 | train | Returns the command object for the given command name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | EventTypeSubCommand.get_command | def get_command(self, ctx, cmd_name):
"""
gets the Click Commands underneath a service name
Parameters
----------
ctx: Context
context object passed in
cmd_name: string
the service name
Returns
-------
cmd: Click.Command
... | python | def get_command(self, ctx, cmd_name):
"""
gets the Click Commands underneath a service name
Parameters
----------
ctx: Context
context object passed in
cmd_name: string
the service name
Returns
-------
cmd: Click.Command
... | [
"def",
"get_command",
"(",
"self",
",",
"ctx",
",",
"cmd_name",
")",
":",
"if",
"cmd_name",
"not",
"in",
"self",
".",
"subcmd_definition",
":",
"return",
"None",
"parameters",
"=",
"[",
"]",
"for",
"param_name",
"in",
"self",
".",
"subcmd_definition",
"[",... | gets the Click Commands underneath a service name
Parameters
----------
ctx: Context
context object passed in
cmd_name: string
the service name
Returns
-------
cmd: Click.Command
the Click Commands that can be called from the C... | [
"gets",
"the",
"Click",
"Commands",
"underneath",
"a",
"service",
"name"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/generate_event/event_generation.py#L119-L157 | train | Gets the Click. Command object that can be called from the CLI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
awslabs/aws-sam-cli | samcli/commands/local/generate_event/event_generation.py | EventTypeSubCommand.cmd_implementation | def cmd_implementation(self, events_lib, top_level_cmd_name, subcmd_name, *args, **kwargs):
"""
calls for value substitution in the event json and returns the
customized json as a string
Parameters
----------
events_lib
top_level_cmd_name: string
the ... | python | def cmd_implementation(self, events_lib, top_level_cmd_name, subcmd_name, *args, **kwargs):
"""
calls for value substitution in the event json and returns the
customized json as a string
Parameters
----------
events_lib
top_level_cmd_name: string
the ... | [
"def",
"cmd_implementation",
"(",
"self",
",",
"events_lib",
",",
"top_level_cmd_name",
",",
"subcmd_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"event",
"=",
"events_lib",
".",
"generate_event",
"(",
"top_level_cmd_name",
",",
"subcmd_name",
"... | calls for value substitution in the event json and returns the
customized json as a string
Parameters
----------
events_lib
top_level_cmd_name: string
the name of the service
subcmd_name: string
the name of the event under the service
args... | [
"calls",
"for",
"value",
"substitution",
"in",
"the",
"event",
"json",
"and",
"returns",
"the",
"customized",
"json",
"as",
"a",
"string"
] | c05af5e7378c6f05f7d82ad3f0bca17204177db6 | https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/generate_event/event_generation.py#L173-L196 | train | This function is called by the event_implementation function in order to generate the event json and return the customized json as a string | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_base.py | LimeBase.generate_lars_path | def generate_lars_path(weighted_data, weighted_labels):
"""Generates the lars path for weighted data.
Args:
weighted_data: data that has been weighted by kernel
weighted_label: labels, weighted by kernel
Returns:
(alphas, coefs), both are arrays correspondin... | python | def generate_lars_path(weighted_data, weighted_labels):
"""Generates the lars path for weighted data.
Args:
weighted_data: data that has been weighted by kernel
weighted_label: labels, weighted by kernel
Returns:
(alphas, coefs), both are arrays correspondin... | [
"def",
"generate_lars_path",
"(",
"weighted_data",
",",
"weighted_labels",
")",
":",
"x_vector",
"=",
"weighted_data",
"alphas",
",",
"_",
",",
"coefs",
"=",
"lars_path",
"(",
"x_vector",
",",
"weighted_labels",
",",
"method",
"=",
"'lasso'",
",",
"verbose",
"... | Generates the lars path for weighted data.
Args:
weighted_data: data that has been weighted by kernel
weighted_label: labels, weighted by kernel
Returns:
(alphas, coefs), both are arrays corresponding to the
regularization parameter and coefficients, res... | [
"Generates",
"the",
"lars",
"path",
"for",
"weighted",
"data",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_base.py#L31-L47 | train | Generates the lars path for weighted data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_base.py | LimeBase.forward_selection | def forward_selection(self, data, labels, weights, num_features):
"""Iteratively adds features to the model"""
clf = Ridge(alpha=0, fit_intercept=True, random_state=self.random_state)
used_features = []
for _ in range(min(num_features, data.shape[1])):
max_ = -100000000
... | python | def forward_selection(self, data, labels, weights, num_features):
"""Iteratively adds features to the model"""
clf = Ridge(alpha=0, fit_intercept=True, random_state=self.random_state)
used_features = []
for _ in range(min(num_features, data.shape[1])):
max_ = -100000000
... | [
"def",
"forward_selection",
"(",
"self",
",",
"data",
",",
"labels",
",",
"weights",
",",
"num_features",
")",
":",
"clf",
"=",
"Ridge",
"(",
"alpha",
"=",
"0",
",",
"fit_intercept",
"=",
"True",
",",
"random_state",
"=",
"self",
".",
"random_state",
")"... | Iteratively adds features to the model | [
"Iteratively",
"adds",
"features",
"to",
"the",
"model"
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_base.py#L49-L68 | train | Iteratively adds features to the model | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_base.py | LimeBase.feature_selection | def feature_selection(self, data, labels, weights, num_features, method):
"""Selects features for the model. see explain_instance_with_data to
understand the parameters."""
if method == 'none':
return np.array(range(data.shape[1]))
elif method == 'forward_selection':
... | python | def feature_selection(self, data, labels, weights, num_features, method):
"""Selects features for the model. see explain_instance_with_data to
understand the parameters."""
if method == 'none':
return np.array(range(data.shape[1]))
elif method == 'forward_selection':
... | [
"def",
"feature_selection",
"(",
"self",
",",
"data",
",",
"labels",
",",
"weights",
",",
"num_features",
",",
"method",
")",
":",
"if",
"method",
"==",
"'none'",
":",
"return",
"np",
".",
"array",
"(",
"range",
"(",
"data",
".",
"shape",
"[",
"1",
"... | Selects features for the model. see explain_instance_with_data to
understand the parameters. | [
"Selects",
"features",
"for",
"the",
"model",
".",
"see",
"explain_instance_with_data",
"to",
"understand",
"the",
"parameters",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_base.py#L70-L106 | train | Selects features for the model. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_base.py | LimeBase.explain_instance_with_data | def explain_instance_with_data(self,
neighborhood_data,
neighborhood_labels,
distances,
label,
num_features,
f... | python | def explain_instance_with_data(self,
neighborhood_data,
neighborhood_labels,
distances,
label,
num_features,
f... | [
"def",
"explain_instance_with_data",
"(",
"self",
",",
"neighborhood_data",
",",
"neighborhood_labels",
",",
"distances",
",",
"label",
",",
"num_features",
",",
"feature_selection",
"=",
"'auto'",
",",
"model_regressor",
"=",
"None",
")",
":",
"weights",
"=",
"se... | Takes perturbed data, labels and distances, returns explanation.
Args:
neighborhood_data: perturbed data, 2d array. first element is
assumed to be the original data point.
neighborhood_labels: corresponding perturbed labels. should have as
... | [
"Takes",
"perturbed",
"data",
"labels",
"and",
"distances",
"returns",
"explanation",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_base.py#L108-L179 | train | This function returns an explanation of an instance with the original data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | id_generator | def id_generator(size=15, random_state=None):
"""Helper function to generate random div ids. This is useful for embedding
HTML into ipython notebooks."""
chars = list(string.ascii_uppercase + string.digits)
return ''.join(random_state.choice(chars, size, replace=True)) | python | def id_generator(size=15, random_state=None):
"""Helper function to generate random div ids. This is useful for embedding
HTML into ipython notebooks."""
chars = list(string.ascii_uppercase + string.digits)
return ''.join(random_state.choice(chars, size, replace=True)) | [
"def",
"id_generator",
"(",
"size",
"=",
"15",
",",
"random_state",
"=",
"None",
")",
":",
"chars",
"=",
"list",
"(",
"string",
".",
"ascii_uppercase",
"+",
"string",
".",
"digits",
")",
"return",
"''",
".",
"join",
"(",
"random_state",
".",
"choice",
... | Helper function to generate random div ids. This is useful for embedding
HTML into ipython notebooks. | [
"Helper",
"function",
"to",
"generate",
"random",
"div",
"ids",
".",
"This",
"is",
"useful",
"for",
"embedding",
"HTML",
"into",
"ipython",
"notebooks",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L17-L21 | train | Helper function to generate random div ids. This is useful for embedding
HTML into ipython notebooks. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.available_labels | def available_labels(self):
"""
Returns the list of classification labels for which we have any explanations.
"""
try:
assert self.mode == "classification"
except AssertionError:
raise NotImplementedError('Not supported for regression explanations.')
... | python | def available_labels(self):
"""
Returns the list of classification labels for which we have any explanations.
"""
try:
assert self.mode == "classification"
except AssertionError:
raise NotImplementedError('Not supported for regression explanations.')
... | [
"def",
"available_labels",
"(",
"self",
")",
":",
"try",
":",
"assert",
"self",
".",
"mode",
"==",
"\"classification\"",
"except",
"AssertionError",
":",
"raise",
"NotImplementedError",
"(",
"'Not supported for regression explanations.'",
")",
"else",
":",
"ans",
"=... | Returns the list of classification labels for which we have any explanations. | [
"Returns",
"the",
"list",
"of",
"classification",
"labels",
"for",
"which",
"we",
"have",
"any",
"explanations",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L117-L127 | train | Returns the list of labels that are available for classification explanations. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.as_list | def as_list(self, label=1, **kwargs):
"""Returns the explanation as a list.
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exception.
Will be ignored for regression explanations.
kwargs: ... | python | def as_list(self, label=1, **kwargs):
"""Returns the explanation as a list.
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exception.
Will be ignored for regression explanations.
kwargs: ... | [
"def",
"as_list",
"(",
"self",
",",
"label",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"label_to_use",
"=",
"label",
"if",
"self",
".",
"mode",
"==",
"\"classification\"",
"else",
"self",
".",
"dummy_label",
"ans",
"=",
"self",
".",
"domain_mapper",
... | Returns the explanation as a list.
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exception.
Will be ignored for regression explanations.
kwargs: keyword arguments, passed to domain_mapper
... | [
"Returns",
"the",
"explanation",
"as",
"a",
"list",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L129-L145 | train | Returns the explanation as a list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.as_pyplot_figure | def as_pyplot_figure(self, label=1, **kwargs):
"""Returns the explanation as a pyplot figure.
Will throw an error if you don't have matplotlib installed
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exce... | python | def as_pyplot_figure(self, label=1, **kwargs):
"""Returns the explanation as a pyplot figure.
Will throw an error if you don't have matplotlib installed
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exce... | [
"def",
"as_pyplot_figure",
"(",
"self",
",",
"label",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"exp",
"=",
"self",
".",
"as_list",
"(",
"label",
"=",
"label",
",",
"*",
"*",
"kwargs",
")",
"fi... | Returns the explanation as a pyplot figure.
Will throw an error if you don't have matplotlib installed
Args:
label: desired label. If you ask for a label for which an
explanation wasn't computed, will throw an exception.
Will be ignored for regression e... | [
"Returns",
"the",
"explanation",
"as",
"a",
"pyplot",
"figure",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L155-L184 | train | Returns the explanation as a pyplot figure. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.show_in_notebook | def show_in_notebook(self,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Shows html explanation in ipython notebook.
See as_html() for parameters.
This will throw an e... | python | def show_in_notebook(self,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Shows html explanation in ipython notebook.
See as_html() for parameters.
This will throw an e... | [
"def",
"show_in_notebook",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"predict_proba",
"=",
"True",
",",
"show_predicted_value",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"IPython",
".",
"core",
".",
"display",
"import",
"display",
",",
... | Shows html explanation in ipython notebook.
See as_html() for parameters.
This will throw an error if you don't have IPython installed | [
"Shows",
"html",
"explanation",
"in",
"ipython",
"notebook",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L186-L200 | train | Shows html explanation in ipython notebook. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.save_to_file | def save_to_file(self,
file_path,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Saves html explanation to file. .
Params:
file_path: file to save explanations... | python | def save_to_file(self,
file_path,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Saves html explanation to file. .
Params:
file_path: file to save explanations... | [
"def",
"save_to_file",
"(",
"self",
",",
"file_path",
",",
"labels",
"=",
"None",
",",
"predict_proba",
"=",
"True",
",",
"show_predicted_value",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"file_",
"=",
"open",
"(",
"file_path",
",",
"'w'",
",",
"... | Saves html explanation to file. .
Params:
file_path: file to save explanations to
See as_html() for additional parameters. | [
"Saves",
"html",
"explanation",
"to",
"file",
".",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L202-L221 | train | Saves the current state of the entry to a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/explanation.py | Explanation.as_html | def as_html(self,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Returns the explanation as an html page.
Args:
labels: desired labels to show explanations for (as barcharts).
If you a... | python | def as_html(self,
labels=None,
predict_proba=True,
show_predicted_value=True,
**kwargs):
"""Returns the explanation as an html page.
Args:
labels: desired labels to show explanations for (as barcharts).
If you a... | [
"def",
"as_html",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"predict_proba",
"=",
"True",
",",
"show_predicted_value",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"jsonize",
"(",
"x",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"x",... | Returns the explanation as an html page.
Args:
labels: desired labels to show explanations for (as barcharts).
If you ask for a label for which an explanation wasn't
computed, will throw an exception. If None, will show
explanations for all available ... | [
"Returns",
"the",
"explanation",
"as",
"an",
"html",
"page",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/explanation.py#L223-L328 | train | Returns the explanation as an html page. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/wrappers/scikit_image.py | BaseWrapper._check_params | def _check_params(self, parameters):
"""Checks for mistakes in 'parameters'
Args :
parameters: dict, parameters to be checked
Raises :
ValueError: if any parameter is not a valid argument for the target function
or the target function is not defined
... | python | def _check_params(self, parameters):
"""Checks for mistakes in 'parameters'
Args :
parameters: dict, parameters to be checked
Raises :
ValueError: if any parameter is not a valid argument for the target function
or the target function is not defined
... | [
"def",
"_check_params",
"(",
"self",
",",
"parameters",
")",
":",
"a_valid_fn",
"=",
"[",
"]",
"if",
"self",
".",
"target_fn",
"is",
"None",
":",
"if",
"callable",
"(",
"self",
")",
":",
"a_valid_fn",
".",
"append",
"(",
"self",
".",
"__call__",
")",
... | Checks for mistakes in 'parameters'
Args :
parameters: dict, parameters to be checked
Raises :
ValueError: if any parameter is not a valid argument for the target function
or the target function is not defined
TypeError: if argument parameters is not... | [
"Checks",
"for",
"mistakes",
"in",
"parameters"
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/wrappers/scikit_image.py#L26-L58 | train | Checks for mistakes in parameters | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/wrappers/scikit_image.py | BaseWrapper.filter_params | def filter_params(self, fn, override=None):
"""Filters `target_params` and return those in `fn`'s arguments.
Args:
fn : arbitrary function
override: dict, values to override target_params
Returns:
result : dict, dictionary containing variables
in b... | python | def filter_params(self, fn, override=None):
"""Filters `target_params` and return those in `fn`'s arguments.
Args:
fn : arbitrary function
override: dict, values to override target_params
Returns:
result : dict, dictionary containing variables
in b... | [
"def",
"filter_params",
"(",
"self",
",",
"fn",
",",
"override",
"=",
"None",
")",
":",
"override",
"=",
"override",
"or",
"{",
"}",
"result",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
"self",
".",
"target_params",
".",
"items",
"(",
")",
"... | Filters `target_params` and return those in `fn`'s arguments.
Args:
fn : arbitrary function
override: dict, values to override target_params
Returns:
result : dict, dictionary containing variables
in both target_params and fn's arguments. | [
"Filters",
"target_params",
"and",
"return",
"those",
"in",
"fn",
"s",
"arguments",
".",
"Args",
":",
"fn",
":",
"arbitrary",
"function",
"override",
":",
"dict",
"values",
"to",
"override",
"target_params",
"Returns",
":",
"result",
":",
"dict",
"dictionary",... | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/wrappers/scikit_image.py#L72-L87 | train | Filters target_params and returns those in fn s arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_text.py | TextDomainMapper.map_exp_ids | def map_exp_ids(self, exp, positions=False):
"""Maps ids to words or word-position strings.
Args:
exp: list of tuples [(id, weight), (id,weight)]
positions: if True, also return word positions
Returns:
list of tuples (word, weight), or (word_positions, weigh... | python | def map_exp_ids(self, exp, positions=False):
"""Maps ids to words or word-position strings.
Args:
exp: list of tuples [(id, weight), (id,weight)]
positions: if True, also return word positions
Returns:
list of tuples (word, weight), or (word_positions, weigh... | [
"def",
"map_exp_ids",
"(",
"self",
",",
"exp",
",",
"positions",
"=",
"False",
")",
":",
"if",
"positions",
":",
"exp",
"=",
"[",
"(",
"'%s_%s'",
"%",
"(",
"self",
".",
"indexed_string",
".",
"word",
"(",
"x",
"[",
"0",
"]",
")",
",",
"'-'",
".",... | Maps ids to words or word-position strings.
Args:
exp: list of tuples [(id, weight), (id,weight)]
positions: if True, also return word positions
Returns:
list of tuples (word, weight), or (word_positions, weight) if
examples: ('bad', 1) or ('bad_3-6-12',... | [
"Maps",
"ids",
"to",
"words",
"or",
"word",
"-",
"position",
"strings",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L31-L51 | train | Maps ids to words or word - position strings. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_text.py | TextDomainMapper.visualize_instance_html | def visualize_instance_html(self, exp, label, div_name, exp_object_name,
text=True, opacity=True):
"""Adds text with highlighted words to visualization.
Args:
exp: list of tuples [(id, weight), (id,weight)]
label: label id (integer)
... | python | def visualize_instance_html(self, exp, label, div_name, exp_object_name,
text=True, opacity=True):
"""Adds text with highlighted words to visualization.
Args:
exp: list of tuples [(id, weight), (id,weight)]
label: label id (integer)
... | [
"def",
"visualize_instance_html",
"(",
"self",
",",
"exp",
",",
"label",
",",
"div_name",
",",
"exp_object_name",
",",
"text",
"=",
"True",
",",
"opacity",
"=",
"True",
")",
":",
"if",
"not",
"text",
":",
"return",
"u''",
"text",
"=",
"(",
"self",
".",... | Adds text with highlighted words to visualization.
Args:
exp: list of tuples [(id, weight), (id,weight)]
label: label id (integer)
div_name: name of div object to be used for rendering(in js)
exp_object_name: name of js explanation object
text: i... | [
"Adds",
"text",
"with",
"highlighted",
"words",
"to",
"visualization",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L53-L80 | train | Adds text with highlighted words to visualize the instance of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_text.py | IndexedString.string_position | def string_position(self, id_):
"""Returns a np array with indices to id_ (int) occurrences"""
if self.bow:
return self.string_start[self.positions[id_]]
else:
return self.string_start[[self.positions[id_]]] | python | def string_position(self, id_):
"""Returns a np array with indices to id_ (int) occurrences"""
if self.bow:
return self.string_start[self.positions[id_]]
else:
return self.string_start[[self.positions[id_]]] | [
"def",
"string_position",
"(",
"self",
",",
"id_",
")",
":",
"if",
"self",
".",
"bow",
":",
"return",
"self",
".",
"string_start",
"[",
"self",
".",
"positions",
"[",
"id_",
"]",
"]",
"else",
":",
"return",
"self",
".",
"string_start",
"[",
"[",
"sel... | Returns a np array with indices to id_ (int) occurrences | [
"Returns",
"a",
"np",
"array",
"with",
"indices",
"to",
"id_",
"(",
"int",
")",
"occurrences"
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L155-L160 | train | Returns a np array with indices to id_ ( int ) occurrences | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_text.py | IndexedString.inverse_removing | def inverse_removing(self, words_to_remove):
"""Returns a string after removing the appropriate words.
If self.bow is false, replaces word with UNKWORDZ instead of removing
it.
Args:
words_to_remove: list of ids (ints) to remove
Returns:
original raw st... | python | def inverse_removing(self, words_to_remove):
"""Returns a string after removing the appropriate words.
If self.bow is false, replaces word with UNKWORDZ instead of removing
it.
Args:
words_to_remove: list of ids (ints) to remove
Returns:
original raw st... | [
"def",
"inverse_removing",
"(",
"self",
",",
"words_to_remove",
")",
":",
"mask",
"=",
"np",
".",
"ones",
"(",
"self",
".",
"as_np",
".",
"shape",
"[",
"0",
"]",
",",
"dtype",
"=",
"'bool'",
")",
"mask",
"[",
"self",
".",
"__get_idxs",
"(",
"words_to... | Returns a string after removing the appropriate words.
If self.bow is false, replaces word with UNKWORDZ instead of removing
it.
Args:
words_to_remove: list of ids (ints) to remove
Returns:
original raw string with appropriate words removed. | [
"Returns",
"a",
"string",
"after",
"removing",
"the",
"appropriate",
"words",
"."
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L162-L179 | train | Returns a string after removing the appropriate words. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marcotcr/lime | lime/lime_text.py | IndexedString._segment_with_tokens | def _segment_with_tokens(text, tokens):
"""Segment a string around the tokens created by a passed-in tokenizer"""
list_form = []
text_ptr = 0
for token in tokens:
inter_token_string = []
while not text[text_ptr:].startswith(token):
inter_token_stri... | python | def _segment_with_tokens(text, tokens):
"""Segment a string around the tokens created by a passed-in tokenizer"""
list_form = []
text_ptr = 0
for token in tokens:
inter_token_string = []
while not text[text_ptr:].startswith(token):
inter_token_stri... | [
"def",
"_segment_with_tokens",
"(",
"text",
",",
"tokens",
")",
":",
"list_form",
"=",
"[",
"]",
"text_ptr",
"=",
"0",
"for",
"token",
"in",
"tokens",
":",
"inter_token_string",
"=",
"[",
"]",
"while",
"not",
"text",
"[",
"text_ptr",
":",
"]",
".",
"st... | Segment a string around the tokens created by a passed-in tokenizer | [
"Segment",
"a",
"string",
"around",
"the",
"tokens",
"created",
"by",
"a",
"passed",
"-",
"in",
"tokenizer"
] | 08133d47df00ed918e22005e0c98f6eefd5a1d71 | https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L182-L199 | train | Segment a string around the tokens created by a passed - in tokenizer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.