partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Router.handle
Prepares for the CallBackResolver and handles the response and exceptions :param request HttpRequest :rtype: HttpResponse
rinzler/__init__.py
def handle(self, request: HttpRequest) -> HttpResponse: """ Prepares for the CallBackResolver and handles the response and exceptions :param request HttpRequest :rtype: HttpResponse """ self.__request_start = datetime.now() self.__request = request self.__...
def handle(self, request: HttpRequest) -> HttpResponse: """ Prepares for the CallBackResolver and handles the response and exceptions :param request HttpRequest :rtype: HttpResponse """ self.__request_start = datetime.now() self.__request = request self.__...
[ "Prepares", "for", "the", "CallBackResolver", "and", "handles", "the", "response", "and", "exceptions", ":", "param", "request", "HttpRequest", ":", "rtype", ":", "HttpResponse" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L125-L165
[ "def", "handle", "(", "self", ",", "request", ":", "HttpRequest", ")", "->", "HttpResponse", ":", "self", ".", "__request_start", "=", "datetime", ".", "now", "(", ")", "self", ".", "__request", "=", "request", "self", ".", "__uri", "=", "request", ".", ...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.exec_route_callback
Executes the resolved end-point callback, or its fallback :rtype: Response or object
rinzler/__init__.py
def exec_route_callback(self) -> Response or object: """ Executes the resolved end-point callback, or its fallback :rtype: Response or object """ if self.__method.lower() in self.__end_points: for bound in self.__end_points[self.__method.lower()]: rou...
def exec_route_callback(self) -> Response or object: """ Executes the resolved end-point callback, or its fallback :rtype: Response or object """ if self.__method.lower() in self.__end_points: for bound in self.__end_points[self.__method.lower()]: rou...
[ "Executes", "the", "resolved", "end", "-", "point", "callback", "or", "its", "fallback", ":", "rtype", ":", "Response", "or", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L167-L201
[ "def", "exec_route_callback", "(", "self", ")", "->", "Response", "or", "object", ":", "if", "self", ".", "__method", ".", "lower", "(", ")", "in", "self", ".", "__end_points", ":", "for", "bound", "in", "self", ".", "__end_points", "[", "self", ".", "...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.request_matches_route
Determines whether a route matches the actual requested route or not :param actual_route str :param expected_route :rtype: Boolean
rinzler/__init__.py
def request_matches_route(self, actual_route: str, expected_route: str): """ Determines whether a route matches the actual requested route or not :param actual_route str :param expected_route :rtype: Boolean """ expected_params = self.get_url_params(expected_route...
def request_matches_route(self, actual_route: str, expected_route: str): """ Determines whether a route matches the actual requested route or not :param actual_route str :param expected_route :rtype: Boolean """ expected_params = self.get_url_params(expected_route...
[ "Determines", "whether", "a", "route", "matches", "the", "actual", "requested", "route", "or", "not", ":", "param", "actual_route", "str", ":", "param", "expected_route", ":", "rtype", ":", "Boolean" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L203-L223
[ "def", "request_matches_route", "(", "self", ",", "actual_route", ":", "str", ",", "expected_route", ":", "str", ")", ":", "expected_params", "=", "self", ".", "get_url_params", "(", "expected_route", ")", "actual_params", "=", "self", ".", "get_url_params", "("...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.authenticate
Runs the pre-defined authenticaton service :param bound_route str route matched :param actual_params dict actual url parameters :rtype: bool
rinzler/__init__.py
def authenticate(self, bound_route, actual_params) -> bool: """ Runs the pre-defined authenticaton service :param bound_route str route matched :param actual_params dict actual url parameters :rtype: bool """ if self.__auth_service is not None: auth_ro...
def authenticate(self, bound_route, actual_params) -> bool: """ Runs the pre-defined authenticaton service :param bound_route str route matched :param actual_params dict actual url parameters :rtype: bool """ if self.__auth_service is not None: auth_ro...
[ "Runs", "the", "pre", "-", "defined", "authenticaton", "service", ":", "param", "bound_route", "str", "route", "matched", ":", "param", "actual_params", "dict", "actual", "url", "parameters", ":", "rtype", ":", "bool" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L225-L240
[ "def", "authenticate", "(", "self", ",", "bound_route", ",", "actual_params", ")", "->", "bool", ":", "if", "self", ".", "__auth_service", "is", "not", "None", ":", "auth_route", "=", "\"{0}_{1}{2}\"", ".", "format", "(", "self", ".", "__method", ",", "sel...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.get_callback_pattern
Assembles a dictionary whith the parameters schema defined for this route :param expected_params dict parameters schema defined for this route :param actual_params dict actual url parameters :rtype: dict
rinzler/__init__.py
def get_callback_pattern(expected_params, actual_params): """ Assembles a dictionary whith the parameters schema defined for this route :param expected_params dict parameters schema defined for this route :param actual_params dict actual url parameters :rtype: dict """ ...
def get_callback_pattern(expected_params, actual_params): """ Assembles a dictionary whith the parameters schema defined for this route :param expected_params dict parameters schema defined for this route :param actual_params dict actual url parameters :rtype: dict """ ...
[ "Assembles", "a", "dictionary", "whith", "the", "parameters", "schema", "defined", "for", "this", "route", ":", "param", "expected_params", "dict", "parameters", "schema", "defined", "for", "this", "route", ":", "param", "actual_params", "dict", "actual", "url", ...
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L243-L256
[ "def", "get_callback_pattern", "(", "expected_params", ",", "actual_params", ")", ":", "pattern", "=", "dict", "(", ")", "key", "=", "0", "for", "exp_param", "in", "expected_params", ":", "if", "exp_param", "[", "0", "]", "==", "'{'", "and", "exp_param", "...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.get_url_params
Gets route parameters as dictionary :param end_point str target route :rtype: list
rinzler/__init__.py
def get_url_params(end_point: str) -> list: """ Gets route parameters as dictionary :param end_point str target route :rtype: list """ var_params = end_point.split('/') if len(var_params) == 1 and var_params[0] == '': return [] elif len(var_p...
def get_url_params(end_point: str) -> list: """ Gets route parameters as dictionary :param end_point str target route :rtype: list """ var_params = end_point.split('/') if len(var_params) == 1 and var_params[0] == '': return [] elif len(var_p...
[ "Gets", "route", "parameters", "as", "dictionary", ":", "param", "end_point", "str", "target", "route", ":", "rtype", ":", "list" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L259-L277
[ "def", "get_url_params", "(", "end_point", ":", "str", ")", "->", "list", ":", "var_params", "=", "end_point", ".", "split", "(", "'/'", ")", "if", "len", "(", "var_params", ")", "==", "1", "and", "var_params", "[", "0", "]", "==", "''", ":", "return...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.set_end_point_uri
Extracts the route from the accessed URL and sets it to __end_point_uri :rtype: bool
rinzler/__init__.py
def set_end_point_uri(self) -> bool: """ Extracts the route from the accessed URL and sets it to __end_point_uri :rtype: bool """ expected_parts = self.__route.split("/") actual_parts = self.__uri.split("/") i = 0 for part in expected_parts: i...
def set_end_point_uri(self) -> bool: """ Extracts the route from the accessed URL and sets it to __end_point_uri :rtype: bool """ expected_parts = self.__route.split("/") actual_parts = self.__uri.split("/") i = 0 for part in expected_parts: i...
[ "Extracts", "the", "route", "from", "the", "accessed", "URL", "and", "sets", "it", "to", "__end_point_uri", ":", "rtype", ":", "bool" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L286-L302
[ "def", "set_end_point_uri", "(", "self", ")", "->", "bool", ":", "expected_parts", "=", "self", ".", "__route", ".", "split", "(", "\"/\"", ")", "actual_parts", "=", "self", ".", "__uri", ".", "split", "(", "\"/\"", ")", "i", "=", "0", "for", "part", ...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.no_route_found
Default callback for route not found :param request HttpRequest :rtype: Response
rinzler/__init__.py
def no_route_found(self, request): """ Default callback for route not found :param request HttpRequest :rtype: Response """ response_obj = OrderedDict() response_obj["status"] = False response_obj["exceptions"] = { "message": "No route found fo...
def no_route_found(self, request): """ Default callback for route not found :param request HttpRequest :rtype: Response """ response_obj = OrderedDict() response_obj["status"] = False response_obj["exceptions"] = { "message": "No route found fo...
[ "Default", "callback", "for", "route", "not", "found", ":", "param", "request", "HttpRequest", ":", "rtype", ":", "Response" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L304-L322
[ "def", "no_route_found", "(", "self", ",", "request", ")", ":", "response_obj", "=", "OrderedDict", "(", ")", "response_obj", "[", "\"status\"", "]", "=", "False", "response_obj", "[", "\"exceptions\"", "]", "=", "{", "\"message\"", ":", "\"No route found for {0...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.welcome_page
Defaulf welcome page when the route / is note mapped yet :rtype: HttpResponse
rinzler/__init__.py
def welcome_page(self): """ Defaulf welcome page when the route / is note mapped yet :rtype: HttpResponse """ message = "HTTP/1.1 200 OK RINZLER FRAMEWORK" return HttpResponse( "<center><h1>{0}({1})</h1></center>".format(message, self.app.app_name), ...
def welcome_page(self): """ Defaulf welcome page when the route / is note mapped yet :rtype: HttpResponse """ message = "HTTP/1.1 200 OK RINZLER FRAMEWORK" return HttpResponse( "<center><h1>{0}({1})</h1></center>".format(message, self.app.app_name), ...
[ "Defaulf", "welcome", "page", "when", "the", "route", "/", "is", "note", "mapped", "yet", ":", "rtype", ":", "HttpResponse" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L324-L333
[ "def", "welcome_page", "(", "self", ")", ":", "message", "=", "\"HTTP/1.1 200 OK RINZLER FRAMEWORK\"", "return", "HttpResponse", "(", "\"<center><h1>{0}({1})</h1></center>\"", ".", "format", "(", "message", ",", "self", ".", "app", ".", "app_name", ")", ",", "conten...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.default_route_options
Default callback for OPTIONS request :rtype: Response
rinzler/__init__.py
def default_route_options(): """ Default callback for OPTIONS request :rtype: Response """ response_obj = OrderedDict() response_obj["status"] = True response_obj["data"] = "Ok" return Response(response_obj, content_type="application/json", charset="utf-...
def default_route_options(): """ Default callback for OPTIONS request :rtype: Response """ response_obj = OrderedDict() response_obj["status"] = True response_obj["data"] = "Ok" return Response(response_obj, content_type="application/json", charset="utf-...
[ "Default", "callback", "for", "OPTIONS", "request", ":", "rtype", ":", "Response" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L336-L346
[ "def", "default_route_options", "(", ")", ":", "response_obj", "=", "OrderedDict", "(", ")", "response_obj", "[", "\"status\"", "]", "=", "True", "response_obj", "[", "\"data\"", "]", "=", "\"Ok\"", "return", "Response", "(", "response_obj", ",", "content_type",...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.set_response_headers
Appends default headers to every response returned by the API :param response HttpResponse :rtype: HttpResponse
rinzler/__init__.py
def set_response_headers(self, response: HttpResponse) -> HttpResponse: """ Appends default headers to every response returned by the API :param response HttpResponse :rtype: HttpResponse """ public_name = os.environ.get('SERVER_PUBLIC_NAME') response_headers = { ...
def set_response_headers(self, response: HttpResponse) -> HttpResponse: """ Appends default headers to every response returned by the API :param response HttpResponse :rtype: HttpResponse """ public_name = os.environ.get('SERVER_PUBLIC_NAME') response_headers = { ...
[ "Appends", "default", "headers", "to", "every", "response", "returned", "by", "the", "API", ":", "param", "response", "HttpResponse", ":", "rtype", ":", "HttpResponse" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L348-L374
[ "def", "set_response_headers", "(", "self", ",", "response", ":", "HttpResponse", ")", "->", "HttpResponse", ":", "public_name", "=", "os", ".", "environ", ".", "get", "(", "'SERVER_PUBLIC_NAME'", ")", "response_headers", "=", "{", "'access-control-allow-headers'", ...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
Router.get_json_ident
Defines whether the JSON response will be indented or not :param request_headers: dict :return: self
rinzler/__init__.py
def get_json_ident(request_headers: dict) -> int: """ Defines whether the JSON response will be indented or not :param request_headers: dict :return: self """ if 'HTTP_USER_AGENT' in request_headers: indent = 2 if re.match("[Mozilla]{7}", request_headers['HTTP...
def get_json_ident(request_headers: dict) -> int: """ Defines whether the JSON response will be indented or not :param request_headers: dict :return: self """ if 'HTTP_USER_AGENT' in request_headers: indent = 2 if re.match("[Mozilla]{7}", request_headers['HTTP...
[ "Defines", "whether", "the", "JSON", "response", "will", "be", "indented", "or", "not", ":", "param", "request_headers", ":", "dict", ":", "return", ":", "self" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L377-L388
[ "def", "get_json_ident", "(", "request_headers", ":", "dict", ")", "->", "int", ":", "if", "'HTTP_USER_AGENT'", "in", "request_headers", ":", "indent", "=", "2", "if", "re", ".", "match", "(", "\"[Mozilla]{7}\"", ",", "request_headers", "[", "'HTTP_USER_AGENT'",...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
prop
Implementation of prop (get_item) that also supports object attributes :param key: :param dct_or_obj: :return:
rescape_python_helpers/functional/ramda.py
def prop(key, dct_or_obj): """ Implementation of prop (get_item) that also supports object attributes :param key: :param dct_or_obj: :return: """ # Note that hasattr is a builtin and getattr is a ramda function, hence the different arg position if isinstance(dict, dct_or_obj): ...
def prop(key, dct_or_obj): """ Implementation of prop (get_item) that also supports object attributes :param key: :param dct_or_obj: :return: """ # Note that hasattr is a builtin and getattr is a ramda function, hence the different arg position if isinstance(dict, dct_or_obj): ...
[ "Implementation", "of", "prop", "(", "get_item", ")", "that", "also", "supports", "object", "attributes", ":", "param", "key", ":", ":", "param", "dct_or_obj", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L12-L36
[ "def", "prop", "(", "key", ",", "dct_or_obj", ")", ":", "# Note that hasattr is a builtin and getattr is a ramda function, hence the different arg position", "if", "isinstance", "(", "dict", ",", "dct_or_obj", ")", ":", "if", "has", "(", "key", ",", "dct_or_obj", ")", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
all_pass_dict
Returns true if all dct values pass f :param f: binary lambda predicate :param dct: :return: True or false
rescape_python_helpers/functional/ramda.py
def all_pass_dict(f, dct): """ Returns true if all dct values pass f :param f: binary lambda predicate :param dct: :return: True or false """ return all(map_with_obj_to_values( lambda key, value: f(key, value), dct ))
def all_pass_dict(f, dct): """ Returns true if all dct values pass f :param f: binary lambda predicate :param dct: :return: True or false """ return all(map_with_obj_to_values( lambda key, value: f(key, value), dct ))
[ "Returns", "true", "if", "all", "dct", "values", "pass", "f", ":", "param", "f", ":", "binary", "lambda", "predicate", ":", "param", "dct", ":", ":", "return", ":", "True", "or", "false" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L50-L60
[ "def", "all_pass_dict", "(", "f", ",", "dct", ")", ":", "return", "all", "(", "map_with_obj_to_values", "(", "lambda", "key", ",", "value", ":", "f", "(", "key", ",", "value", ")", ",", "dct", ")", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
prop_or
Ramda propOr implementation. This also resolves object attributes, so key can be a dict prop or an attribute of dct_or_obj :param default: Value if dct_or_obj doesn't have key_or_prop or the resolved value is null :param key: :param dct_or_obj: :return:
rescape_python_helpers/functional/ramda.py
def prop_or(default, key, dct_or_obj): """ Ramda propOr implementation. This also resolves object attributes, so key can be a dict prop or an attribute of dct_or_obj :param default: Value if dct_or_obj doesn't have key_or_prop or the resolved value is null :param key: :param dct_or_obj: ...
def prop_or(default, key, dct_or_obj): """ Ramda propOr implementation. This also resolves object attributes, so key can be a dict prop or an attribute of dct_or_obj :param default: Value if dct_or_obj doesn't have key_or_prop or the resolved value is null :param key: :param dct_or_obj: ...
[ "Ramda", "propOr", "implementation", ".", "This", "also", "resolves", "object", "attributes", "so", "key", "can", "be", "a", "dict", "prop", "or", "an", "attribute", "of", "dct_or_obj", ":", "param", "default", ":", "Value", "if", "dct_or_obj", "doesn", "t",...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L82-L101
[ "def", "prop_or", "(", "default", ",", "key", ",", "dct_or_obj", ")", ":", "# Note that hasattr is a builtin and getattr is a ramda function, hence the different arg position", "if", "isinstance", "(", "dict", ",", "dct_or_obj", ")", ":", "value", "=", "dct_or_obj", "[", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
prop_eq_or
Ramda propEq plus propOr implementation :param default: :param key: :param value: :param dct: :return:
rescape_python_helpers/functional/ramda.py
def prop_eq_or(default, key, value, dct): """ Ramda propEq plus propOr implementation :param default: :param key: :param value: :param dct: :return: """ return dct[key] and dct[key] == value if key in dct else default
def prop_eq_or(default, key, value, dct): """ Ramda propEq plus propOr implementation :param default: :param key: :param value: :param dct: :return: """ return dct[key] and dct[key] == value if key in dct else default
[ "Ramda", "propEq", "plus", "propOr", "implementation", ":", "param", "default", ":", ":", "param", "key", ":", ":", "param", "value", ":", ":", "param", "dct", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L117-L126
[ "def", "prop_eq_or", "(", "default", ",", "key", ",", "value", ",", "dct", ")", ":", "return", "dct", "[", "key", "]", "and", "dct", "[", "key", "]", "==", "value", "if", "key", "in", "dct", "else", "default" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
prop_eq_or_in_or
Ramda propEq/propIn plus propOr :param default: :param key: :param value: :param dct: :return:
rescape_python_helpers/functional/ramda.py
def prop_eq_or_in_or(default, key, value, dct): """ Ramda propEq/propIn plus propOr :param default: :param key: :param value: :param dct: :return: """ return has(key, dct) and \ (dct[key] == value if key in dct else ( dct[key] in value if isinstance((lis...
def prop_eq_or_in_or(default, key, value, dct): """ Ramda propEq/propIn plus propOr :param default: :param key: :param value: :param dct: :return: """ return has(key, dct) and \ (dct[key] == value if key in dct else ( dct[key] in value if isinstance((lis...
[ "Ramda", "propEq", "/", "propIn", "plus", "propOr", ":", "param", "default", ":", ":", "param", "key", ":", ":", "param", "value", ":", ":", "param", "dct", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L142-L155
[ "def", "prop_eq_or_in_or", "(", "default", ",", "key", ",", "value", ",", "dct", ")", ":", "return", "has", "(", "key", ",", "dct", ")", "and", "(", "dct", "[", "key", "]", "==", "value", "if", "key", "in", "dct", "else", "(", "dct", "[", "key", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
item_path_or
Optional version of item_path with a default value. keys can be dict keys or object attributes, or a combination :param default: :param keys: List of keys or dot-separated string :param dict_or_obj: A dict or obj :return:
rescape_python_helpers/functional/ramda.py
def item_path_or(default, keys, dict_or_obj): """ Optional version of item_path with a default value. keys can be dict keys or object attributes, or a combination :param default: :param keys: List of keys or dot-separated string :param dict_or_obj: A dict or obj :return: """ if not keys:...
def item_path_or(default, keys, dict_or_obj): """ Optional version of item_path with a default value. keys can be dict keys or object attributes, or a combination :param default: :param keys: List of keys or dot-separated string :param dict_or_obj: A dict or obj :return: """ if not keys:...
[ "Optional", "version", "of", "item_path", "with", "a", "default", "value", ".", "keys", "can", "be", "dict", "keys", "or", "object", "attributes", "or", "a", "combination", ":", "param", "default", ":", ":", "param", "keys", ":", "List", "of", "keys", "o...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L170-L184
[ "def", "item_path_or", "(", "default", ",", "keys", ",", "dict_or_obj", ")", ":", "if", "not", "keys", ":", "raise", "ValueError", "(", "\"Expected at least one key, got {0}\"", ".", "format", "(", "keys", ")", ")", "resolved_keys", "=", "keys", ".", "split", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
item_str_path
Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param keys: e.g. 'foo.bar.1.goo' :param dct: e.g. dict(foo=dict(bar=[dict(goo='a'), dict(goo='b')]) :return: The resolved value or an error. E.g. for above the ...
rescape_python_helpers/functional/ramda.py
def item_str_path(keys, dct): """ Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param keys: e.g. 'foo.bar.1.goo' :param dct: e.g. dict(foo=dict(bar=[dict(goo='a'), dict(goo='b')]) :return: The r...
def item_str_path(keys, dct): """ Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param keys: e.g. 'foo.bar.1.goo' :param dct: e.g. dict(foo=dict(bar=[dict(goo='a'), dict(goo='b')]) :return: The r...
[ "Given", "a", "string", "of", "path", "segments", "separated", "by", ".", "splits", "them", "into", "an", "array", ".", "Int", "strings", "are", "converted", "to", "numbers", "to", "serve", "as", "an", "array", "index", ":", "param", "keys", ":", "e", ...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L212-L220
[ "def", "item_str_path", "(", "keys", ",", "dct", ")", ":", "return", "item_path", "(", "map", "(", "lambda", "segment", ":", "int", "(", "segment", ")", "if", "isint", "(", "segment", ")", "else", "segment", ",", "keys", ".", "split", "(", "'.'", ")"...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
item_str_path_or
Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param default: Value if any part yields None or undefined :param keys: e.g. 'foo.bar.1.goo' :param dct: e.g. dict(foo=dict(bar=[dict(goo='a'), dict(goo='b')]) ...
rescape_python_helpers/functional/ramda.py
def item_str_path_or(default, keys, dct): """ Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param default: Value if any part yields None or undefined :param keys: e.g. 'foo.bar.1.goo' :param dct...
def item_str_path_or(default, keys, dct): """ Given a string of path segments separated by ., splits them into an array. Int strings are converted to numbers to serve as an array index :param default: Value if any part yields None or undefined :param keys: e.g. 'foo.bar.1.goo' :param dct...
[ "Given", "a", "string", "of", "path", "segments", "separated", "by", ".", "splits", "them", "into", "an", "array", ".", "Int", "strings", "are", "converted", "to", "numbers", "to", "serve", "as", "an", "array", "index", ":", "param", "default", ":", "Val...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L224-L233
[ "def", "item_str_path_or", "(", "default", ",", "keys", ",", "dct", ")", ":", "return", "item_path_or", "(", "default", ",", "map", "(", "lambda", "segment", ":", "int", "(", "segment", ")", "if", "isint", "(", "segment", ")", "else", "segment", ",", "...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
has
Implementation of ramda has :param prop: :param object_or_dct: :return:
rescape_python_helpers/functional/ramda.py
def has(prop, object_or_dct): """ Implementation of ramda has :param prop: :param object_or_dct: :return: """ return prop in object_or_dct if isinstance(dict, object_or_dct) else hasattr(object_or_dct, prop)
def has(prop, object_or_dct): """ Implementation of ramda has :param prop: :param object_or_dct: :return: """ return prop in object_or_dct if isinstance(dict, object_or_dct) else hasattr(object_or_dct, prop)
[ "Implementation", "of", "ramda", "has", ":", "param", "prop", ":", ":", "param", "object_or_dct", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L237-L244
[ "def", "has", "(", "prop", ",", "object_or_dct", ")", ":", "return", "prop", "in", "object_or_dct", "if", "isinstance", "(", "dict", ",", "object_or_dct", ")", "else", "hasattr", "(", "object_or_dct", ",", "prop", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
omit_deep
Implementation of omit that recurses. This tests the same keys at every level of dict and in lists :param omit_props: :param dct: :return:
rescape_python_helpers/functional/ramda.py
def omit_deep(omit_props, dct): """ Implementation of omit that recurses. This tests the same keys at every level of dict and in lists :param omit_props: :param dct: :return: """ omit_partial = omit_deep(omit_props) if isinstance(dict, dct): # Filter out keys and then recurse o...
def omit_deep(omit_props, dct): """ Implementation of omit that recurses. This tests the same keys at every level of dict and in lists :param omit_props: :param dct: :return: """ omit_partial = omit_deep(omit_props) if isinstance(dict, dct): # Filter out keys and then recurse o...
[ "Implementation", "of", "omit", "that", "recurses", ".", "This", "tests", "the", "same", "keys", "at", "every", "level", "of", "dict", "and", "in", "lists", ":", "param", "omit_props", ":", ":", "param", "dct", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L259-L276
[ "def", "omit_deep", "(", "omit_props", ",", "dct", ")", ":", "omit_partial", "=", "omit_deep", "(", "omit_props", ")", "if", "isinstance", "(", "dict", ",", "dct", ")", ":", "# Filter out keys and then recurse on each value that wasn't filtered out", "return", "map_di...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
pick_deep
Implementation of pick that recurses. This tests the same keys at every level of dict and in lists :param pick_dct: Deep dict matching some portion of dct. :param dct: Dct to filter. Any key matching pick_dct pass through. It doesn't matter what the pick_dct value is as long as the key exists. Arrays also p...
rescape_python_helpers/functional/ramda.py
def pick_deep(pick_dct, dct): """ Implementation of pick that recurses. This tests the same keys at every level of dict and in lists :param pick_dct: Deep dict matching some portion of dct. :param dct: Dct to filter. Any key matching pick_dct pass through. It doesn't matter what the pick_dct value i...
def pick_deep(pick_dct, dct): """ Implementation of pick that recurses. This tests the same keys at every level of dict and in lists :param pick_dct: Deep dict matching some portion of dct. :param dct: Dct to filter. Any key matching pick_dct pass through. It doesn't matter what the pick_dct value i...
[ "Implementation", "of", "pick", "that", "recurses", ".", "This", "tests", "the", "same", "keys", "at", "every", "level", "of", "dict", "and", "in", "lists", ":", "param", "pick_dct", ":", "Deep", "dict", "matching", "some", "portion", "of", "dct", ".", "...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L280-L302
[ "def", "pick_deep", "(", "pick_dct", ",", "dct", ")", ":", "if", "isinstance", "(", "dict", ",", "dct", ")", ":", "# Filter out keys and then recurse on each value that wasn't filtered out", "return", "map_with_obj", "(", "lambda", "k", ",", "v", ":", "pick_deep", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_with_obj_deep
Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified value :param dct: Dict for deep processing :return: Modified dct with matching props mapped
rescape_python_helpers/functional/ramda.py
def map_with_obj_deep(f, dct): """ Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified value :param dct: Dict for deep processing :return: Modified dct with matching props mapped ...
def map_with_obj_deep(f, dct): """ Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified value :param dct: Dict for deep processing :return: Modified dct with matching props mapped ...
[ "Implementation", "of", "map", "that", "recurses", ".", "This", "tests", "the", "same", "keys", "at", "every", "level", "of", "dict", "and", "in", "lists", ":", "param", "f", ":", "2", "-", "ary", "function", "expecting", "a", "key", "and", "value", "a...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L306-L313
[ "def", "map_with_obj_deep", "(", "f", ",", "dct", ")", ":", "return", "_map_deep", "(", "lambda", "k", ",", "v", ":", "[", "k", ",", "f", "(", "k", ",", "v", ")", "]", ",", "dct", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_keys_deep
Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified key :param dct: Dict for deep processing :return: Modified dct with matching props mapped
rescape_python_helpers/functional/ramda.py
def map_keys_deep(f, dct): """ Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified key :param dct: Dict for deep processing :return: Modified dct with matching props mapped """...
def map_keys_deep(f, dct): """ Implementation of map that recurses. This tests the same keys at every level of dict and in lists :param f: 2-ary function expecting a key and value and returns a modified key :param dct: Dict for deep processing :return: Modified dct with matching props mapped """...
[ "Implementation", "of", "map", "that", "recurses", ".", "This", "tests", "the", "same", "keys", "at", "every", "level", "of", "dict", "and", "in", "lists", ":", "param", "f", ":", "2", "-", "ary", "function", "expecting", "a", "key", "and", "value", "a...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L317-L324
[ "def", "map_keys_deep", "(", "f", ",", "dct", ")", ":", "return", "_map_deep", "(", "lambda", "k", ",", "v", ":", "[", "f", "(", "k", ",", "v", ")", ",", "v", "]", ",", "dct", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
_map_deep
Used by map_deep and map_keys_deep :param map_props: :param f: Expects a key and value and returns a pair :param dct: :return:
rescape_python_helpers/functional/ramda.py
def _map_deep(f, dct): """ Used by map_deep and map_keys_deep :param map_props: :param f: Expects a key and value and returns a pair :param dct: :return: """ if isinstance(dict, dct): return map_key_values(lambda k, v: f(k, _map_deep(f, v)), dct) elif isinstance((list, tuple...
def _map_deep(f, dct): """ Used by map_deep and map_keys_deep :param map_props: :param f: Expects a key and value and returns a pair :param dct: :return: """ if isinstance(dict, dct): return map_key_values(lambda k, v: f(k, _map_deep(f, v)), dct) elif isinstance((list, tuple...
[ "Used", "by", "map_deep", "and", "map_keys_deep", ":", "param", "map_props", ":", ":", "param", "f", ":", "Expects", "a", "key", "and", "value", "and", "returns", "a", "pair", ":", "param", "dct", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L327-L343
[ "def", "_map_deep", "(", "f", ",", "dct", ")", ":", "if", "isinstance", "(", "dict", ",", "dct", ")", ":", "return", "map_key_values", "(", "lambda", "k", ",", "v", ":", "f", "(", "k", ",", "_map_deep", "(", "f", ",", "v", ")", ")", ",", "dct",...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
dict_matches_params_deep
Filters deeply by comparing dct to filter_dct's value at each depth. Whenever a mismatch occurs the whole thing returns false :param params_dct: dict matching any portion of dct. E.g. filter_dct = {foo: {bar: 1}} would allow {foo: {bar: 1, car: 2}} to pass, {foo: {bar: 2}} would fail, {goo: ...} would fail ...
rescape_python_helpers/functional/ramda.py
def dict_matches_params_deep(params_dct, dct): """ Filters deeply by comparing dct to filter_dct's value at each depth. Whenever a mismatch occurs the whole thing returns false :param params_dct: dict matching any portion of dct. E.g. filter_dct = {foo: {bar: 1}} would allow {foo: {bar: 1, car: 2}} ...
def dict_matches_params_deep(params_dct, dct): """ Filters deeply by comparing dct to filter_dct's value at each depth. Whenever a mismatch occurs the whole thing returns false :param params_dct: dict matching any portion of dct. E.g. filter_dct = {foo: {bar: 1}} would allow {foo: {bar: 1, car: 2}} ...
[ "Filters", "deeply", "by", "comparing", "dct", "to", "filter_dct", "s", "value", "at", "each", "depth", ".", "Whenever", "a", "mismatch", "occurs", "the", "whole", "thing", "returns", "false", ":", "param", "params_dct", ":", "dict", "matching", "any", "port...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L347-L402
[ "def", "dict_matches_params_deep", "(", "params_dct", ",", "dct", ")", ":", "def", "recurse_if_param_exists", "(", "params", ",", "key", ",", "value", ")", ":", "\"\"\"\n If a param[key] exists, recurse. Otherwise return True since there is no param to contest value\n ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
join
Ramda implementation of join :param strin: :param items: :return:
rescape_python_helpers/functional/ramda.py
def join(strin, items): """ Ramda implementation of join :param strin: :param items: :return: """ return strin.join(map(lambda item: str(item), items))
def join(strin, items): """ Ramda implementation of join :param strin: :param items: :return: """ return strin.join(map(lambda item: str(item), items))
[ "Ramda", "implementation", "of", "join", ":", "param", "strin", ":", ":", "param", "items", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L406-L413
[ "def", "join", "(", "strin", ",", "items", ")", ":", "return", "strin", ".", "join", "(", "map", "(", "lambda", "item", ":", "str", "(", "item", ")", ",", "items", ")", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_with_obj
Implementation of Ramda's mapObjIndexed without the final argument. This returns the original key with the mapped value. Use map_key_values to modify the keys too :param f: Called with a key and value :param dct: :return {dict}: Keyed by the original key, valued by the mapped value
rescape_python_helpers/functional/ramda.py
def map_with_obj(f, dct): """ Implementation of Ramda's mapObjIndexed without the final argument. This returns the original key with the mapped value. Use map_key_values to modify the keys too :param f: Called with a key and value :param dct: :return {dict}: Keyed by the original key, va...
def map_with_obj(f, dct): """ Implementation of Ramda's mapObjIndexed without the final argument. This returns the original key with the mapped value. Use map_key_values to modify the keys too :param f: Called with a key and value :param dct: :return {dict}: Keyed by the original key, va...
[ "Implementation", "of", "Ramda", "s", "mapObjIndexed", "without", "the", "final", "argument", ".", "This", "returns", "the", "original", "key", "with", "the", "mapped", "value", ".", "Use", "map_key_values", "to", "modify", "the", "keys", "too", ":", "param", ...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L462-L473
[ "def", "map_with_obj", "(", "f", ",", "dct", ")", ":", "f_dict", "=", "{", "}", "for", "k", ",", "v", "in", "dct", ".", "items", "(", ")", ":", "f_dict", "[", "k", "]", "=", "f", "(", "k", ",", "v", ")", "return", "f_dict" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_keys
Calls f with each key of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged
rescape_python_helpers/functional/ramda.py
def map_keys(f, dct): """ Calls f with each key of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged """ f_dict = {} for k, ...
def map_keys(f, dct): """ Calls f with each key of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged """ f_dict = {} for k, ...
[ "Calls", "f", "with", "each", "key", "of", "dct", "possibly", "returning", "a", "modified", "key", ".", "Values", "are", "unchanged", ":", "param", "f", ":", "Called", "with", "each", "key", "and", "returns", "the", "same", "key", "or", "a", "modified", ...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L499-L509
[ "def", "map_keys", "(", "f", ",", "dct", ")", ":", "f_dict", "=", "{", "}", "for", "k", ",", "v", "in", "dct", ".", "items", "(", ")", ":", "f_dict", "[", "f", "(", "k", ")", "]", "=", "v", "return", "f_dict" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_keys_with_obj
Calls f with each key and value of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and value and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged
rescape_python_helpers/functional/ramda.py
def map_keys_with_obj(f, dct): """ Calls f with each key and value of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and value and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged ""...
def map_keys_with_obj(f, dct): """ Calls f with each key and value of dct, possibly returning a modified key. Values are unchanged :param f: Called with each key and value and returns the same key or a modified key :param dct: :return: A dct with keys possibly modifed but values unchanged ""...
[ "Calls", "f", "with", "each", "key", "and", "value", "of", "dct", "possibly", "returning", "a", "modified", "key", ".", "Values", "are", "unchanged", ":", "param", "f", ":", "Called", "with", "each", "key", "and", "value", "and", "returns", "the", "same"...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L513-L523
[ "def", "map_keys_with_obj", "(", "f", ",", "dct", ")", ":", "f_dict", "=", "{", "}", "for", "k", ",", "v", "in", "dct", ".", "items", "(", ")", ":", "f_dict", "[", "f", "(", "k", ",", "v", ")", "]", "=", "v", "return", "f_dict" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
merge_deep
Deep merge by this spec below :param dct1: :param dct2: :param merger Optional merger :return:
rescape_python_helpers/functional/ramda.py
def merge_deep(dct1, dct2, merger=None): """ Deep merge by this spec below :param dct1: :param dct2: :param merger Optional merger :return: """ my_merger = merger or Merger( # pass in a list of tuples,with the # strategies you are looking to apply # to each ty...
def merge_deep(dct1, dct2, merger=None): """ Deep merge by this spec below :param dct1: :param dct2: :param merger Optional merger :return: """ my_merger = merger or Merger( # pass in a list of tuples,with the # strategies you are looking to apply # to each ty...
[ "Deep", "merge", "by", "this", "spec", "below", ":", "param", "dct1", ":", ":", "param", "dct2", ":", ":", "param", "merger", "Optional", "merger", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L538-L561
[ "def", "merge_deep", "(", "dct1", ",", "dct2", ",", "merger", "=", "None", ")", ":", "my_merger", "=", "merger", "or", "Merger", "(", "# pass in a list of tuples,with the", "# strategies you are looking to apply", "# to each type.", "[", "(", "list", ",", "[", "\"...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
merge_all
Shallow merge all the dcts :param dcts: :return:
rescape_python_helpers/functional/ramda.py
def merge_all(dcts): """ Shallow merge all the dcts :param dcts: :return: """ return reduce( lambda accum, dct: merge(accum, dct), dict(), dcts )
def merge_all(dcts): """ Shallow merge all the dcts :param dcts: :return: """ return reduce( lambda accum, dct: merge(accum, dct), dict(), dcts )
[ "Shallow", "merge", "all", "the", "dcts", ":", "param", "dcts", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L564-L574
[ "def", "merge_all", "(", "dcts", ")", ":", "return", "reduce", "(", "lambda", "accum", ",", "dct", ":", "merge", "(", "accum", ",", "dct", ")", ",", "dict", "(", ")", ",", "dcts", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
from_pairs_to_array_values
Like from pairs but combines duplicate key values into arrays :param pairs: :return:
rescape_python_helpers/functional/ramda.py
def from_pairs_to_array_values(pairs): """ Like from pairs but combines duplicate key values into arrays :param pairs: :return: """ result = {} for pair in pairs: result[pair[0]] = concat(prop_or([], pair[0], result), [pair[1]]) return result
def from_pairs_to_array_values(pairs): """ Like from pairs but combines duplicate key values into arrays :param pairs: :return: """ result = {} for pair in pairs: result[pair[0]] = concat(prop_or([], pair[0], result), [pair[1]]) return result
[ "Like", "from", "pairs", "but", "combines", "duplicate", "key", "values", "into", "arrays", ":", "param", "pairs", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L658-L667
[ "def", "from_pairs_to_array_values", "(", "pairs", ")", ":", "result", "=", "{", "}", "for", "pair", "in", "pairs", ":", "result", "[", "pair", "[", "0", "]", "]", "=", "concat", "(", "prop_or", "(", "[", "]", ",", "pair", "[", "0", "]", ",", "re...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
map_prop_value_as_index
Returns the given prop of each item in the list :param prp: :param lst: :return:
rescape_python_helpers/functional/ramda.py
def map_prop_value_as_index(prp, lst): """ Returns the given prop of each item in the list :param prp: :param lst: :return: """ return from_pairs(map(lambda item: (prop(prp, item), item), lst))
def map_prop_value_as_index(prp, lst): """ Returns the given prop of each item in the list :param prp: :param lst: :return: """ return from_pairs(map(lambda item: (prop(prp, item), item), lst))
[ "Returns", "the", "given", "prop", "of", "each", "item", "in", "the", "list", ":", "param", "prp", ":", ":", "param", "lst", ":", ":", "return", ":" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L698-L705
[ "def", "map_prop_value_as_index", "(", "prp", ",", "lst", ")", ":", "return", "from_pairs", "(", "map", "(", "lambda", "item", ":", "(", "prop", "(", "prp", ",", "item", ")", ",", "item", ")", ",", "lst", ")", ")" ]
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
key_string_to_lens_path
Converts a key string like 'foo.bar.0.wopper' to ['foo', 'bar', 0, 'wopper'] :param {String} keyString The dot-separated key string :return {[String]} The lens array containing string or integers
rescape_python_helpers/functional/ramda.py
def key_string_to_lens_path(key_string): """ Converts a key string like 'foo.bar.0.wopper' to ['foo', 'bar', 0, 'wopper'] :param {String} keyString The dot-separated key string :return {[String]} The lens array containing string or integers """ return map( if_else( isinstance(int)...
def key_string_to_lens_path(key_string): """ Converts a key string like 'foo.bar.0.wopper' to ['foo', 'bar', 0, 'wopper'] :param {String} keyString The dot-separated key string :return {[String]} The lens array containing string or integers """ return map( if_else( isinstance(int)...
[ "Converts", "a", "key", "string", "like", "foo", ".", "bar", ".", "0", ".", "wopper", "to", "[", "foo", "bar", "0", "wopper", "]", ":", "param", "{", "String", "}", "keyString", "The", "dot", "-", "separated", "key", "string", ":", "return", "{", "...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L791-L806
[ "def", "key_string_to_lens_path", "(", "key_string", ")", ":", "return", "map", "(", "if_else", "(", "isinstance", "(", "int", ")", ",", "# convert to int", "lambda", "s", ":", "int", "(", "s", ")", ",", "# Leave the string alone", "identity", ")", ",", "key...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
fake_lens_path_view
Simulates R.view with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param obj: Object containing the given path :return: The value at the path or None
rescape_python_helpers/functional/ramda.py
def fake_lens_path_view(lens_path, obj): """ Simulates R.view with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param obj: Object containing the given path :return: The value at the path or None """ segment = head(lens_path) return if_else( ...
def fake_lens_path_view(lens_path, obj): """ Simulates R.view with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param obj: Object containing the given path :return: The value at the path or None """ segment = head(lens_path) return if_else( ...
[ "Simulates", "R", ".", "view", "with", "a", "lens_path", "since", "we", "don", "t", "have", "lens", "functions", ":", "param", "lens_path", ":", "Array", "of", "string", "paths", ":", "param", "obj", ":", "Object", "containing", "the", "given", "path", "...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L810-L824
[ "def", "fake_lens_path_view", "(", "lens_path", ",", "obj", ")", ":", "segment", "=", "head", "(", "lens_path", ")", "return", "if_else", "(", "both", "(", "lambda", "_", ":", "identity", "(", "segment", ")", ",", "has", "(", "segment", ")", ")", ",", ...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
fake_lens_path_set
Simulates R.set with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param value: The value to set at the lens path :param obj: Object containing the given path :return: The value at the path or None
rescape_python_helpers/functional/ramda.py
def fake_lens_path_set(lens_path, value, obj): """ Simulates R.set with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param value: The value to set at the lens path :param obj: Object containing the given path :return: The value at the path or None "...
def fake_lens_path_set(lens_path, value, obj): """ Simulates R.set with a lens_path since we don't have lens functions :param lens_path: Array of string paths :param value: The value to set at the lens path :param obj: Object containing the given path :return: The value at the path or None "...
[ "Simulates", "R", ".", "set", "with", "a", "lens_path", "since", "we", "don", "t", "have", "lens", "functions", ":", "param", "lens_path", ":", "Array", "of", "string", "paths", ":", "param", "value", ":", "The", "value", "to", "set", "at", "the", "len...
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L828-L870
[ "def", "fake_lens_path_set", "(", "lens_path", ",", "value", ",", "obj", ")", ":", "segment", "=", "head", "(", "lens_path", ")", "obj_copy", "=", "copy", ".", "copy", "(", "obj", ")", "def", "set_array_index", "(", "i", ",", "v", ",", "l", ")", ":",...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
unflatten_dct
Undoes the work of flatten_dict @param {Object} obj 1-D object in the form returned by flattenObj @returns {Object} The original :param obj: :return:
rescape_python_helpers/functional/ramda.py
def unflatten_dct(obj): """ Undoes the work of flatten_dict @param {Object} obj 1-D object in the form returned by flattenObj @returns {Object} The original :param obj: :return: """ def reduce_func(accum, key_string_and_value): key_string = key_string_and_value[0] val...
def unflatten_dct(obj): """ Undoes the work of flatten_dict @param {Object} obj 1-D object in the form returned by flattenObj @returns {Object} The original :param obj: :return: """ def reduce_func(accum, key_string_and_value): key_string = key_string_and_value[0] val...
[ "Undoes", "the", "work", "of", "flatten_dict" ]
calocan/rescape-python-helpers
python
https://github.com/calocan/rescape-python-helpers/blob/91a1724f062ee40a25aa60fc96b2d7acadd99618/rescape_python_helpers/functional/ramda.py#L873-L915
[ "def", "unflatten_dct", "(", "obj", ")", ":", "def", "reduce_func", "(", "accum", ",", "key_string_and_value", ")", ":", "key_string", "=", "key_string_and_value", "[", "0", "]", "value", "=", "key_string_and_value", "[", "1", "]", "item_key_path", "=", "key_s...
91a1724f062ee40a25aa60fc96b2d7acadd99618
train
ppj
ppj :param json_data: dictionary to print
antinex_client/utils.py
def ppj(json_data): """ppj :param json_data: dictionary to print """ return str(json.dumps( json_data, sort_keys=True, indent=4, separators=(',', ': ')))
def ppj(json_data): """ppj :param json_data: dictionary to print """ return str(json.dumps( json_data, sort_keys=True, indent=4, separators=(',', ': ')))
[ "ppj" ]
jay-johnson/antinex-client
python
https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/utils.py#L41-L50
[ "def", "ppj", "(", "json_data", ")", ":", "return", "str", "(", "json", ".", "dumps", "(", "json_data", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ",", "separators", "=", "(", "','", ",", "': '", ")", ")", ")" ]
850ba2a2fe21c836e071def618dcecc9caf5d59c
train
AdminModeratorMixin.change_view
Override change view to add extra context enabling moderate tool.
molo/commenting/admin.py
def change_view(self, request, object_id, form_url='', extra_context=None): """ Override change view to add extra context enabling moderate tool. """ context = { 'has_moderate_tool': True } if extra_context: context.update(extra_context) re...
def change_view(self, request, object_id, form_url='', extra_context=None): """ Override change view to add extra context enabling moderate tool. """ context = { 'has_moderate_tool': True } if extra_context: context.update(extra_context) re...
[ "Override", "change", "view", "to", "add", "extra", "context", "enabling", "moderate", "tool", "." ]
praekeltfoundation/molo.commenting
python
https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/admin.py#L156-L170
[ "def", "change_view", "(", "self", ",", "request", ",", "object_id", ",", "form_url", "=", "''", ",", "extra_context", "=", "None", ")", ":", "context", "=", "{", "'has_moderate_tool'", ":", "True", "}", "if", "extra_context", ":", "context", ".", "update"...
94549bd75e4a5c5b3db43149e32d636330b3969c
train
AdminModeratorMixin.get_urls
Add aditional moderate url.
molo/commenting/admin.py
def get_urls(self): """ Add aditional moderate url. """ from django.conf.urls import url urls = super(AdminModeratorMixin, self).get_urls() info = self.model._meta.app_label, self.model._meta.model_name return [ url(r'^(.+)/moderate/$', ...
def get_urls(self): """ Add aditional moderate url. """ from django.conf.urls import url urls = super(AdminModeratorMixin, self).get_urls() info = self.model._meta.app_label, self.model._meta.model_name return [ url(r'^(.+)/moderate/$', ...
[ "Add", "aditional", "moderate", "url", "." ]
praekeltfoundation/molo.commenting
python
https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/admin.py#L172-L183
[ "def", "get_urls", "(", "self", ")", ":", "from", "django", ".", "conf", ".", "urls", "import", "url", "urls", "=", "super", "(", "AdminModeratorMixin", ",", "self", ")", ".", "get_urls", "(", ")", "info", "=", "self", ".", "model", ".", "_meta", "."...
94549bd75e4a5c5b3db43149e32d636330b3969c
train
Response.render
Renders a HttpResponse for the ongoing request :param indent int :rtype: HttpResponse
rinzler/core/response.py
def render(self, indent=0): """ Renders a HttpResponse for the ongoing request :param indent int :rtype: HttpResponse """ self.__indent = indent return HttpResponse( str(self), content_type=self.__content_type, charset=self.__charset, **self.__kwargs ...
def render(self, indent=0): """ Renders a HttpResponse for the ongoing request :param indent int :rtype: HttpResponse """ self.__indent = indent return HttpResponse( str(self), content_type=self.__content_type, charset=self.__charset, **self.__kwargs ...
[ "Renders", "a", "HttpResponse", "for", "the", "ongoing", "request", ":", "param", "indent", "int", ":", "rtype", ":", "HttpResponse" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/response.py#L34-L43
[ "def", "render", "(", "self", ",", "indent", "=", "0", ")", ":", "self", ".", "__indent", "=", "indent", "return", "HttpResponse", "(", "str", "(", "self", ")", ",", "content_type", "=", "self", ".", "__content_type", ",", "charset", "=", "self", ".", ...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
setup_logging
Setup logging configuration
rinzler/logger/log.py
def setup_logging(default_path='logging.yaml', env_key='LOG_CFG'): """ Setup logging configuration """ path = default_path value = os.getenv(env_key, None) if value: path = value if os.path.exists(path): with open(path, 'rt') as f: configs = yaml.safe_load(f.read(...
def setup_logging(default_path='logging.yaml', env_key='LOG_CFG'): """ Setup logging configuration """ path = default_path value = os.getenv(env_key, None) if value: path = value if os.path.exists(path): with open(path, 'rt') as f: configs = yaml.safe_load(f.read(...
[ "Setup", "logging", "configuration" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/logger/log.py#L9-L22
[ "def", "setup_logging", "(", "default_path", "=", "'logging.yaml'", ",", "env_key", "=", "'LOG_CFG'", ")", ":", "path", "=", "default_path", "value", "=", "os", ".", "getenv", "(", "env_key", ",", "None", ")", "if", "value", ":", "path", "=", "value", "i...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.get
Binds a GET route with the given callback :rtype: object
rinzler/core/route_mapping.py
def get(self, route: str(), callback: object()): """ Binds a GET route with the given callback :rtype: object """ self.__set_route('get', {route: callback}) return RouteMapping
def get(self, route: str(), callback: object()): """ Binds a GET route with the given callback :rtype: object """ self.__set_route('get', {route: callback}) return RouteMapping
[ "Binds", "a", "GET", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L16-L22
[ "def", "get", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'get'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.post
Binds a POST route with the given callback :rtype: object
rinzler/core/route_mapping.py
def post(self, route: str(), callback: object()): """ Binds a POST route with the given callback :rtype: object """ self.__set_route('post', {route: callback}) return RouteMapping
def post(self, route: str(), callback: object()): """ Binds a POST route with the given callback :rtype: object """ self.__set_route('post', {route: callback}) return RouteMapping
[ "Binds", "a", "POST", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L24-L30
[ "def", "post", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'post'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.put
Binds a PUT route with the given callback :rtype: object
rinzler/core/route_mapping.py
def put(self, route: str(), callback: object()): """ Binds a PUT route with the given callback :rtype: object """ self.__set_route('put', {route: callback}) return RouteMapping
def put(self, route: str(), callback: object()): """ Binds a PUT route with the given callback :rtype: object """ self.__set_route('put', {route: callback}) return RouteMapping
[ "Binds", "a", "PUT", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L32-L38
[ "def", "put", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'put'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.patch
Binds a PATCH route with the given callback :rtype: object
rinzler/core/route_mapping.py
def patch(self, route: str(), callback: object()): """ Binds a PATCH route with the given callback :rtype: object """ self.__set_route('patch', {route: callback}) return RouteMapping
def patch(self, route: str(), callback: object()): """ Binds a PATCH route with the given callback :rtype: object """ self.__set_route('patch', {route: callback}) return RouteMapping
[ "Binds", "a", "PATCH", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L40-L46
[ "def", "patch", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'patch'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.delete
Binds a PUT route with the given callback :rtype: object
rinzler/core/route_mapping.py
def delete(self, route: str(), callback: object()): """ Binds a PUT route with the given callback :rtype: object """ self.__set_route('delete', {route: callback}) return RouteMapping
def delete(self, route: str(), callback: object()): """ Binds a PUT route with the given callback :rtype: object """ self.__set_route('delete', {route: callback}) return RouteMapping
[ "Binds", "a", "PUT", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L48-L54
[ "def", "delete", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'delete'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.head
Binds a HEAD route with the given callback :rtype: object
rinzler/core/route_mapping.py
def head(self, route: str(), callback: object()): """ Binds a HEAD route with the given callback :rtype: object """ self.__set_route('head', {route: callback}) return RouteMapping
def head(self, route: str(), callback: object()): """ Binds a HEAD route with the given callback :rtype: object """ self.__set_route('head', {route: callback}) return RouteMapping
[ "Binds", "a", "HEAD", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L56-L62
[ "def", "head", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'head'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.options
Binds a OPTIONS route with the given callback :rtype: object
rinzler/core/route_mapping.py
def options(self, route: str(), callback: object()): """ Binds a OPTIONS route with the given callback :rtype: object """ self.__set_route('options', {route: callback}) return RouteMapping
def options(self, route: str(), callback: object()): """ Binds a OPTIONS route with the given callback :rtype: object """ self.__set_route('options', {route: callback}) return RouteMapping
[ "Binds", "a", "OPTIONS", "route", "with", "the", "given", "callback", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L64-L70
[ "def", "options", "(", "self", ",", "route", ":", "str", "(", ")", ",", "callback", ":", "object", "(", ")", ")", ":", "self", ".", "__set_route", "(", "'options'", ",", "{", "route", ":", "callback", "}", ")", "return", "RouteMapping" ]
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
RouteMapping.__set_route
Sets the given type_route and route to the route mapping :rtype: object
rinzler/core/route_mapping.py
def __set_route(self, type_route, route): """ Sets the given type_route and route to the route mapping :rtype: object """ if type_route in self.__routes: if not self.verify_route_already_bound(type_route, route): self.__routes[type_route].append(route)...
def __set_route(self, type_route, route): """ Sets the given type_route and route to the route mapping :rtype: object """ if type_route in self.__routes: if not self.verify_route_already_bound(type_route, route): self.__routes[type_route].append(route)...
[ "Sets", "the", "given", "type_route", "and", "route", "to", "the", "route", "mapping", ":", "rtype", ":", "object" ]
feliphebueno/Rinzler
python
https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/core/route_mapping.py#L72-L82
[ "def", "__set_route", "(", "self", ",", "type_route", ",", "route", ")", ":", "if", "type_route", "in", "self", ".", "__routes", ":", "if", "not", "self", ".", "verify_route_already_bound", "(", "type_route", ",", "route", ")", ":", "self", ".", "__routes"...
7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8
train
operating_system
Return a string identifying the operating system the application is running on. :rtype: str
helper/unix.py
def operating_system(): """Return a string identifying the operating system the application is running on. :rtype: str """ if platform.system() == 'Darwin': return 'OS X Version %s' % platform.mac_ver()[0] distribution = ' '.join(platform.linux_distribution()).strip() os_platform =...
def operating_system(): """Return a string identifying the operating system the application is running on. :rtype: str """ if platform.system() == 'Darwin': return 'OS X Version %s' % platform.mac_ver()[0] distribution = ' '.join(platform.linux_distribution()).strip() os_platform =...
[ "Return", "a", "string", "identifying", "the", "operating", "system", "the", "application", "is", "running", "on", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L27-L40
[ "def", "operating_system", "(", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Darwin'", ":", "return", "'OS X Version %s'", "%", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", "distribution", "=", "' '", ".", "join", "(", "platform",...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon.start
Daemonize if the process is not already running.
helper/unix.py
def start(self): """Daemonize if the process is not already running.""" if self._is_already_running(): LOGGER.error('Is already running') sys.exit(1) try: self._daemonize() self.controller.start() except Exception as error: sys....
def start(self): """Daemonize if the process is not already running.""" if self._is_already_running(): LOGGER.error('Is already running') sys.exit(1) try: self._daemonize() self.controller.start() except Exception as error: sys....
[ "Daemonize", "if", "the", "process", "is", "not", "already", "running", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L85-L114
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_is_already_running", "(", ")", ":", "LOGGER", ".", "error", "(", "'Is already running'", ")", "sys", ".", "exit", "(", "1", ")", "try", ":", "self", ".", "_daemonize", "(", ")", "self", ".",...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon.gid
Return the group id that the daemon will run with :rtype: int
helper/unix.py
def gid(self): """Return the group id that the daemon will run with :rtype: int """ if not self._gid: if self.controller.config.daemon.group: self._gid = grp.getgrnam(self.config.daemon.group).gr_gid else: self._gid = os.getgid() ...
def gid(self): """Return the group id that the daemon will run with :rtype: int """ if not self._gid: if self.controller.config.daemon.group: self._gid = grp.getgrnam(self.config.daemon.group).gr_gid else: self._gid = os.getgid() ...
[ "Return", "the", "group", "id", "that", "the", "daemon", "will", "run", "with" ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L117-L128
[ "def", "gid", "(", "self", ")", ":", "if", "not", "self", ".", "_gid", ":", "if", "self", ".", "controller", ".", "config", ".", "daemon", ".", "group", ":", "self", ".", "_gid", "=", "grp", ".", "getgrnam", "(", "self", ".", "config", ".", "daem...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon.uid
Return the user id that the process will run as :rtype: int
helper/unix.py
def uid(self): """Return the user id that the process will run as :rtype: int """ if not self._uid: if self.config.daemon.user: self._uid = pwd.getpwnam(self.config.daemon.user).pw_uid else: self._uid = os.getuid() return ...
def uid(self): """Return the user id that the process will run as :rtype: int """ if not self._uid: if self.config.daemon.user: self._uid = pwd.getpwnam(self.config.daemon.user).pw_uid else: self._uid = os.getuid() return ...
[ "Return", "the", "user", "id", "that", "the", "process", "will", "run", "as" ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L131-L142
[ "def", "uid", "(", "self", ")", ":", "if", "not", "self", ".", "_uid", ":", "if", "self", ".", "config", ".", "daemon", ".", "user", ":", "self", ".", "_uid", "=", "pwd", ".", "getpwnam", "(", "self", ".", "config", ".", "daemon", ".", "user", ...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._daemonize
Fork into a background process and setup the process, copied in part from http://www.jejik.com/files/examples/daemon3x.py
helper/unix.py
def _daemonize(self): """Fork into a background process and setup the process, copied in part from http://www.jejik.com/files/examples/daemon3x.py """ LOGGER.info('Forking %s into the background', sys.argv[0]) # Write the pidfile if current uid != final uid if os.getuid...
def _daemonize(self): """Fork into a background process and setup the process, copied in part from http://www.jejik.com/files/examples/daemon3x.py """ LOGGER.info('Forking %s into the background', sys.argv[0]) # Write the pidfile if current uid != final uid if os.getuid...
[ "Fork", "into", "a", "background", "process", "and", "setup", "the", "process", "copied", "in", "part", "from", "http", ":", "//", "www", ".", "jejik", ".", "com", "/", "files", "/", "examples", "/", "daemon3x", ".", "py" ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L144-L201
[ "def", "_daemonize", "(", "self", ")", ":", "LOGGER", ".", "info", "(", "'Forking %s into the background'", ",", "sys", ".", "argv", "[", "0", "]", ")", "# Write the pidfile if current uid != final uid", "if", "os", ".", "getuid", "(", ")", "!=", "self", ".", ...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._get_exception_log_path
Return the normalized path for the connection log, raising an exception if it can not written to. :return: str
helper/unix.py
def _get_exception_log_path(): """Return the normalized path for the connection log, raising an exception if it can not written to. :return: str """ app = sys.argv[0].split('/')[-1] for exception_log in ['/var/log/%s.errors' % app, '/var/tm...
def _get_exception_log_path(): """Return the normalized path for the connection log, raising an exception if it can not written to. :return: str """ app = sys.argv[0].split('/')[-1] for exception_log in ['/var/log/%s.errors' % app, '/var/tm...
[ "Return", "the", "normalized", "path", "for", "the", "connection", "log", "raising", "an", "exception", "if", "it", "can", "not", "written", "to", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L204-L217
[ "def", "_get_exception_log_path", "(", ")", ":", "app", "=", "sys", ".", "argv", "[", "0", "]", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "for", "exception_log", "in", "[", "'/var/log/%s.errors'", "%", "app", ",", "'/var/tmp/%s.errors'", "%", ...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._get_pidfile_path
Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError
helper/unix.py
def _get_pidfile_path(self): """Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError """ if self.config.daemon.pidfile: pidfile = path.abspath(self.config.daemon....
def _get_pidfile_path(self): """Return the normalized path for the pidfile, raising an exception if it can not written to. :return: str :raises: ValueError :raises: OSError """ if self.config.daemon.pidfile: pidfile = path.abspath(self.config.daemon....
[ "Return", "the", "normalized", "path", "for", "the", "pidfile", "raising", "an", "exception", "if", "it", "can", "not", "written", "to", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L219-L243
[ "def", "_get_pidfile_path", "(", "self", ")", ":", "if", "self", ".", "config", ".", "daemon", ".", "pidfile", ":", "pidfile", "=", "path", ".", "abspath", "(", "self", ".", "config", ".", "daemon", ".", "pidfile", ")", "if", "not", "os", ".", "acces...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._is_already_running
Check to see if the process is running, first looking for a pidfile, then shelling out in either case, removing a pidfile if it exists but the process is not running.
helper/unix.py
def _is_already_running(self): """Check to see if the process is running, first looking for a pidfile, then shelling out in either case, removing a pidfile if it exists but the process is not running. """ # Look for the pidfile, if exists determine if the process is alive ...
def _is_already_running(self): """Check to see if the process is running, first looking for a pidfile, then shelling out in either case, removing a pidfile if it exists but the process is not running. """ # Look for the pidfile, if exists determine if the process is alive ...
[ "Check", "to", "see", "if", "the", "process", "is", "running", "first", "looking", "for", "a", "pidfile", "then", "shelling", "out", "in", "either", "case", "removing", "a", "pidfile", "if", "it", "exists", "but", "the", "process", "is", "not", "running", ...
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L245-L284
[ "def", "_is_already_running", "(", "self", ")", ":", "# Look for the pidfile, if exists determine if the process is alive", "pidfile", "=", "self", ".", "_get_pidfile_path", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "pidfile", ")", ":", "pid", "=", "o...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._remove_pidfile
Remove the pid file from the filesystem
helper/unix.py
def _remove_pidfile(self): """Remove the pid file from the filesystem""" LOGGER.debug('Removing pidfile: %s', self.pidfile_path) try: os.unlink(self.pidfile_path) except OSError: pass
def _remove_pidfile(self): """Remove the pid file from the filesystem""" LOGGER.debug('Removing pidfile: %s', self.pidfile_path) try: os.unlink(self.pidfile_path) except OSError: pass
[ "Remove", "the", "pid", "file", "from", "the", "filesystem" ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L286-L292
[ "def", "_remove_pidfile", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Removing pidfile: %s'", ",", "self", ".", "pidfile_path", ")", "try", ":", "os", ".", "unlink", "(", "self", ".", "pidfile_path", ")", "except", "OSError", ":", "pass" ]
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Daemon._write_pidfile
Write the pid file out with the process number in the pid file
helper/unix.py
def _write_pidfile(self): """Write the pid file out with the process number in the pid file""" LOGGER.debug('Writing pidfile: %s', self.pidfile_path) with open(self.pidfile_path, "w") as handle: handle.write(str(os.getpid()))
def _write_pidfile(self): """Write the pid file out with the process number in the pid file""" LOGGER.debug('Writing pidfile: %s', self.pidfile_path) with open(self.pidfile_path, "w") as handle: handle.write(str(os.getpid()))
[ "Write", "the", "pid", "file", "out", "with", "the", "process", "number", "in", "the", "pid", "file" ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/unix.py#L294-L298
[ "def", "_write_pidfile", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Writing pidfile: %s'", ",", "self", ".", "pidfile_path", ")", "with", "open", "(", "self", ".", "pidfile_path", ",", "\"w\"", ")", "as", "handle", ":", "handle", ".", "write", ...
fe8e45fc8eabf619429b2940c682c252ee33c082
train
to_camel_case
Convert a string from snake case to camel case. For example, "some_var" would become "someVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_string.
pypif/util/case.py
def to_camel_case(snake_case_string): """ Convert a string from snake case to camel case. For example, "some_var" would become "someVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_string. """ parts = snake_case_string.lstr...
def to_camel_case(snake_case_string): """ Convert a string from snake case to camel case. For example, "some_var" would become "someVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_string. """ parts = snake_case_string.lstr...
[ "Convert", "a", "string", "from", "snake", "case", "to", "camel", "case", ".", "For", "example", "some_var", "would", "become", "someVar", "." ]
CitrineInformatics/pypif
python
https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/case.py#L8-L16
[ "def", "to_camel_case", "(", "snake_case_string", ")", ":", "parts", "=", "snake_case_string", ".", "lstrip", "(", "'_'", ")", ".", "split", "(", "'_'", ")", "return", "parts", "[", "0", "]", "+", "''", ".", "join", "(", "[", "i", ".", "title", "(", ...
938348a8ff7b10b330770cccaaeb2109922f681b
train
to_capitalized_camel_case
Convert a string from snake case to camel case with the first letter capitalized. For example, "some_var" would become "SomeVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_string.
pypif/util/case.py
def to_capitalized_camel_case(snake_case_string): """ Convert a string from snake case to camel case with the first letter capitalized. For example, "some_var" would become "SomeVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_...
def to_capitalized_camel_case(snake_case_string): """ Convert a string from snake case to camel case with the first letter capitalized. For example, "some_var" would become "SomeVar". :param snake_case_string: Snake-cased string to convert to camel case. :returns: Camel-cased version of snake_case_...
[ "Convert", "a", "string", "from", "snake", "case", "to", "camel", "case", "with", "the", "first", "letter", "capitalized", ".", "For", "example", "some_var", "would", "become", "SomeVar", "." ]
CitrineInformatics/pypif
python
https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/case.py#L19-L28
[ "def", "to_capitalized_camel_case", "(", "snake_case_string", ")", ":", "parts", "=", "snake_case_string", ".", "split", "(", "'_'", ")", "return", "''", ".", "join", "(", "[", "i", ".", "title", "(", ")", "for", "i", "in", "parts", "]", ")" ]
938348a8ff7b10b330770cccaaeb2109922f681b
train
to_snake_case
Convert a string from camel case to snake case. From example, "someVar" would become "some_var". :param camel_case_string: Camel-cased string to convert to snake case. :return: Snake-cased version of camel_case_string.
pypif/util/case.py
def to_snake_case(camel_case_string): """ Convert a string from camel case to snake case. From example, "someVar" would become "some_var". :param camel_case_string: Camel-cased string to convert to snake case. :return: Snake-cased version of camel_case_string. """ first_pass = _first_camel_case...
def to_snake_case(camel_case_string): """ Convert a string from camel case to snake case. From example, "someVar" would become "some_var". :param camel_case_string: Camel-cased string to convert to snake case. :return: Snake-cased version of camel_case_string. """ first_pass = _first_camel_case...
[ "Convert", "a", "string", "from", "camel", "case", "to", "snake", "case", ".", "From", "example", "someVar", "would", "become", "some_var", "." ]
CitrineInformatics/pypif
python
https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/case.py#L31-L39
[ "def", "to_snake_case", "(", "camel_case_string", ")", ":", "first_pass", "=", "_first_camel_case_regex", ".", "sub", "(", "r'\\1_\\2'", ",", "camel_case_string", ")", "return", "_second_camel_case_regex", ".", "sub", "(", "r'\\1_\\2'", ",", "first_pass", ")", ".", ...
938348a8ff7b10b330770cccaaeb2109922f681b
train
keys_to_snake_case
Make a copy of a dictionary with all keys converted to snake case. This is just calls to_snake_case on each of the keys in the dictionary and returns a new dictionary. :param camel_case_dict: Dictionary with the keys to convert. :type camel_case_dict: Dictionary. :return: Dictionary with the keys conv...
pypif/util/case.py
def keys_to_snake_case(camel_case_dict): """ Make a copy of a dictionary with all keys converted to snake case. This is just calls to_snake_case on each of the keys in the dictionary and returns a new dictionary. :param camel_case_dict: Dictionary with the keys to convert. :type camel_case_dict: Di...
def keys_to_snake_case(camel_case_dict): """ Make a copy of a dictionary with all keys converted to snake case. This is just calls to_snake_case on each of the keys in the dictionary and returns a new dictionary. :param camel_case_dict: Dictionary with the keys to convert. :type camel_case_dict: Di...
[ "Make", "a", "copy", "of", "a", "dictionary", "with", "all", "keys", "converted", "to", "snake", "case", ".", "This", "is", "just", "calls", "to_snake_case", "on", "each", "of", "the", "keys", "in", "the", "dictionary", "and", "returns", "a", "new", "dic...
CitrineInformatics/pypif
python
https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/case.py#L42-L52
[ "def", "keys_to_snake_case", "(", "camel_case_dict", ")", ":", "return", "dict", "(", "(", "to_snake_case", "(", "key", ")", ",", "value", ")", "for", "(", "key", ",", "value", ")", "in", "camel_case_dict", ".", "items", "(", ")", ")" ]
938348a8ff7b10b330770cccaaeb2109922f681b
train
list_functions
List the deployed lambda functions and print configuration. :return: exit_code
gcdt/ramuda_core.py
def list_functions(awsclient): """List the deployed lambda functions and print configuration. :return: exit_code """ client_lambda = awsclient.get_client('lambda') response = client_lambda.list_functions() for function in response['Functions']: log.info(function['FunctionName']) ...
def list_functions(awsclient): """List the deployed lambda functions and print configuration. :return: exit_code """ client_lambda = awsclient.get_client('lambda') response = client_lambda.list_functions() for function in response['Functions']: log.info(function['FunctionName']) ...
[ "List", "the", "deployed", "lambda", "functions", "and", "print", "configuration", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L125-L142
[ "def", "list_functions", "(", "awsclient", ")", ":", "client_lambda", "=", "awsclient", ".", "get_client", "(", "'lambda'", ")", "response", "=", "client_lambda", ".", "list_functions", "(", ")", "for", "function", "in", "response", "[", "'Functions'", "]", ":...
cd67cf416371337b83cb9ca3f696277125703339
train
deploy_lambda
Create or update a lambda function. :param awsclient: :param function_name: :param role: :param handler_filename: :param handler_function: :param folders: :param description: :param timeout: :param memory: :param subnet_ids: :param security_groups: :param artifact_bucket...
gcdt/ramuda_core.py
def deploy_lambda(awsclient, function_name, role, handler_filename, handler_function, folders, description, timeout, memory, subnet_ids=None, security_groups=None, artifact_bucket=None, zipfile=None, fail_deployment_on_unsuccessfu...
def deploy_lambda(awsclient, function_name, role, handler_filename, handler_function, folders, description, timeout, memory, subnet_ids=None, security_groups=None, artifact_bucket=None, zipfile=None, fail_deployment_on_unsuccessfu...
[ "Create", "or", "update", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L145-L213
[ "def", "deploy_lambda", "(", "awsclient", ",", "function_name", ",", "role", ",", "handler_filename", ",", "handler_function", ",", "folders", ",", "description", ",", "timeout", ",", "memory", ",", "subnet_ids", "=", "None", ",", "security_groups", "=", "None",...
cd67cf416371337b83cb9ca3f696277125703339
train
bundle_lambda
Write zipfile contents to file. :param zipfile: :return: exit_code
gcdt/ramuda_core.py
def bundle_lambda(zipfile): """Write zipfile contents to file. :param zipfile: :return: exit_code """ # TODO have 'bundle.zip' as default config if not zipfile: return 1 with open('bundle.zip', 'wb') as zfile: zfile.write(zipfile) log.info('Finished - a bundle.zip is wai...
def bundle_lambda(zipfile): """Write zipfile contents to file. :param zipfile: :return: exit_code """ # TODO have 'bundle.zip' as default config if not zipfile: return 1 with open('bundle.zip', 'wb') as zfile: zfile.write(zipfile) log.info('Finished - a bundle.zip is wai...
[ "Write", "zipfile", "contents", "to", "file", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L319-L331
[ "def", "bundle_lambda", "(", "zipfile", ")", ":", "# TODO have 'bundle.zip' as default config", "if", "not", "zipfile", ":", "return", "1", "with", "open", "(", "'bundle.zip'", ",", "'wb'", ")", "as", "zfile", ":", "zfile", ".", "write", "(", "zipfile", ")", ...
cd67cf416371337b83cb9ca3f696277125703339
train
get_metrics
Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code
gcdt/ramuda_core.py
def get_metrics(awsclient, name): """Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code """ metrics = ['Duration', 'Errors', 'Invocations', 'Throttles'] client_cw = awsclient.get_client('cloudwatch') for m...
def get_metrics(awsclient, name): """Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code """ metrics = ['Duration', 'Errors', 'Invocations', 'Throttles'] client_cw = awsclient.get_client('cloudwatch') for m...
[ "Print", "out", "cloudformation", "metrics", "for", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L419-L450
[ "def", "get_metrics", "(", "awsclient", ",", "name", ")", ":", "metrics", "=", "[", "'Duration'", ",", "'Errors'", ",", "'Invocations'", ",", "'Throttles'", "]", "client_cw", "=", "awsclient", ".", "get_client", "(", "'cloudwatch'", ")", "for", "metric", "in...
cd67cf416371337b83cb9ca3f696277125703339
train
rollback
Rollback a lambda function to a given version. :param awsclient: :param function_name: :param alias_name: :param version: :return: exit_code
gcdt/ramuda_core.py
def rollback(awsclient, function_name, alias_name=ALIAS_NAME, version=None): """Rollback a lambda function to a given version. :param awsclient: :param function_name: :param alias_name: :param version: :return: exit_code """ if version: log.info('rolling back to version {}'.form...
def rollback(awsclient, function_name, alias_name=ALIAS_NAME, version=None): """Rollback a lambda function to a given version. :param awsclient: :param function_name: :param alias_name: :param version: :return: exit_code """ if version: log.info('rolling back to version {}'.form...
[ "Rollback", "a", "lambda", "function", "to", "a", "given", "version", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L453-L474
[ "def", "rollback", "(", "awsclient", ",", "function_name", ",", "alias_name", "=", "ALIAS_NAME", ",", "version", "=", "None", ")", ":", "if", "version", ":", "log", ".", "info", "(", "'rolling back to version {}'", ".", "format", "(", "version", ")", ")", ...
cd67cf416371337b83cb9ca3f696277125703339
train
delete_lambda
Delete a lambda function. :param awsclient: :param function_name: :param events: list of events :param delete_logs: :return: exit_code
gcdt/ramuda_core.py
def delete_lambda(awsclient, function_name, events=None, delete_logs=False): """Delete a lambda function. :param awsclient: :param function_name: :param events: list of events :param delete_logs: :return: exit_code """ if events is not None: unwire(awsclient, events, function_na...
def delete_lambda(awsclient, function_name, events=None, delete_logs=False): """Delete a lambda function. :param awsclient: :param function_name: :param events: list of events :param delete_logs: :return: exit_code """ if events is not None: unwire(awsclient, events, function_na...
[ "Delete", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L477-L496
[ "def", "delete_lambda", "(", "awsclient", ",", "function_name", ",", "events", "=", "None", ",", "delete_logs", "=", "False", ")", ":", "if", "events", "is", "not", "None", ":", "unwire", "(", "awsclient", ",", "events", ",", "function_name", ",", "alias_n...
cd67cf416371337b83cb9ca3f696277125703339
train
delete_lambda_deprecated
Deprecated: please use delete_lambda! :param awsclient: :param function_name: :param s3_event_sources: :param time_event_sources: :param delete_logs: :return: exit_code
gcdt/ramuda_core.py
def delete_lambda_deprecated(awsclient, function_name, s3_event_sources=[], time_event_sources=[], delete_logs=False): # FIXME: mutable default arguments! """Deprecated: please use delete_lambda! :param awsclient: :param function_name: :param s3_event_sources: :para...
def delete_lambda_deprecated(awsclient, function_name, s3_event_sources=[], time_event_sources=[], delete_logs=False): # FIXME: mutable default arguments! """Deprecated: please use delete_lambda! :param awsclient: :param function_name: :param s3_event_sources: :para...
[ "Deprecated", ":", "please", "use", "delete_lambda!" ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L499-L522
[ "def", "delete_lambda_deprecated", "(", "awsclient", ",", "function_name", ",", "s3_event_sources", "=", "[", "]", ",", "time_event_sources", "=", "[", "]", ",", "delete_logs", "=", "False", ")", ":", "# FIXME: mutable default arguments!", "unwire_deprecated", "(", ...
cd67cf416371337b83cb9ca3f696277125703339
train
cleanup_bundle
Deletes files used for creating bundle. * vendored/* * bundle.zip
gcdt/ramuda_core.py
def cleanup_bundle(): """Deletes files used for creating bundle. * vendored/* * bundle.zip """ paths = ['./vendored', './bundle.zip'] for path in paths: if os.path.exists(path): log.debug("Deleting %s..." % path) if os.path.isdir(path): shu...
def cleanup_bundle(): """Deletes files used for creating bundle. * vendored/* * bundle.zip """ paths = ['./vendored', './bundle.zip'] for path in paths: if os.path.exists(path): log.debug("Deleting %s..." % path) if os.path.isdir(path): shu...
[ "Deletes", "files", "used", "for", "creating", "bundle", ".", "*", "vendored", "/", "*", "*", "bundle", ".", "zip" ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L623-L635
[ "def", "cleanup_bundle", "(", ")", ":", "paths", "=", "[", "'./vendored'", ",", "'./bundle.zip'", "]", "for", "path", "in", "paths", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "log", ".", "debug", "(", "\"Deleting %s...\"", "%"...
cd67cf416371337b83cb9ca3f696277125703339
train
ping
Send a ping request to a lambda function. :param awsclient: :param function_name: :param alias_name: :param version: :return: ping response payload
gcdt/ramuda_core.py
def ping(awsclient, function_name, alias_name=ALIAS_NAME, version=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param alias_name: :param version: :return: ping response payload """ log.debug('sending ping to lambda function: %s', function_n...
def ping(awsclient, function_name, alias_name=ALIAS_NAME, version=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param alias_name: :param version: :return: ping response payload """ log.debug('sending ping to lambda function: %s', function_n...
[ "Send", "a", "ping", "request", "to", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L638-L651
[ "def", "ping", "(", "awsclient", ",", "function_name", ",", "alias_name", "=", "ALIAS_NAME", ",", "version", "=", "None", ")", ":", "log", ".", "debug", "(", "'sending ping to lambda function: %s'", ",", "function_name", ")", "payload", "=", "'{\"ramuda_action\": ...
cd67cf416371337b83cb9ca3f696277125703339
train
invoke
Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: :param outfile: write response to file :return: ping response payload
gcdt/ramuda_core.py
def invoke(awsclient, function_name, payload, invocation_type=None, alias_name=ALIAS_NAME, version=None, outfile=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: ...
def invoke(awsclient, function_name, payload, invocation_type=None, alias_name=ALIAS_NAME, version=None, outfile=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: ...
[ "Send", "a", "ping", "request", "to", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L654-L700
[ "def", "invoke", "(", "awsclient", ",", "function_name", ",", "payload", ",", "invocation_type", "=", "None", ",", "alias_name", "=", "ALIAS_NAME", ",", "version", "=", "None", ",", "outfile", "=", "None", ")", ":", "log", ".", "debug", "(", "'invoking lam...
cd67cf416371337b83cb9ca3f696277125703339
train
logs
Send a ping request to a lambda function. :param awsclient: :param function_name: :param start_dt: :param end_dt: :param tail: :return:
gcdt/ramuda_core.py
def logs(awsclient, function_name, start_dt, end_dt=None, tail=False): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param start_dt: :param end_dt: :param tail: :return: """ log.debug('Getting cloudwatch logs for: %s', function_name) log_g...
def logs(awsclient, function_name, start_dt, end_dt=None, tail=False): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param start_dt: :param end_dt: :param tail: :return: """ log.debug('Getting cloudwatch logs for: %s', function_name) log_g...
[ "Send", "a", "ping", "request", "to", "a", "lambda", "function", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L703-L743
[ "def", "logs", "(", "awsclient", ",", "function_name", ",", "start_dt", ",", "end_dt", "=", "None", ",", "tail", "=", "False", ")", ":", "log", ".", "debug", "(", "'Getting cloudwatch logs for: %s'", ",", "function_name", ")", "log_group_name", "=", "'/aws/lam...
cd67cf416371337b83cb9ca3f696277125703339
train
DateTimeConverter.__validate_datetime_string
This will require validating version string (such as "3.3.5"). A version string could be converted to a datetime value if this validation is not executed.
typepy/converter/_datetime.py
def __validate_datetime_string(self): """ This will require validating version string (such as "3.3.5"). A version string could be converted to a datetime value if this validation is not executed. """ try: try: StrictVersion(self._value) ...
def __validate_datetime_string(self): """ This will require validating version string (such as "3.3.5"). A version string could be converted to a datetime value if this validation is not executed. """ try: try: StrictVersion(self._value) ...
[ "This", "will", "require", "validating", "version", "string", "(", "such", "as", "3", ".", "3", ".", "5", ")", ".", "A", "version", "string", "could", "be", "converted", "to", "a", "datetime", "value", "if", "this", "validation", "is", "not", "executed",...
thombashi/typepy
python
https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/converter/_datetime.py#L131-L147
[ "def", "__validate_datetime_string", "(", "self", ")", ":", "try", ":", "try", ":", "StrictVersion", "(", "self", ".", "_value", ")", "raise", "TypeConversionError", "(", "\"invalid datetime string: version string found {}\"", ".", "format", "(", "self", ".", "_valu...
8209d1df4f2a7f196a9fa4bfb0708c5ff648461f
train
Memory.ADR
ADR Ra, [PC, #imm10_4] ADR Ra, label Load the address of label or the PC offset into Ra Ra must be a low register
iarm/arm_instructions/memory.py
def ADR(self, params): """ ADR Ra, [PC, #imm10_4] ADR Ra, label Load the address of label or the PC offset into Ra Ra must be a low register """ # TODO may need to rethink how I do PC, may need to be byte alligned # TODO This is wrong as each address is a...
def ADR(self, params): """ ADR Ra, [PC, #imm10_4] ADR Ra, label Load the address of label or the PC offset into Ra Ra must be a low register """ # TODO may need to rethink how I do PC, may need to be byte alligned # TODO This is wrong as each address is a...
[ "ADR", "Ra", "[", "PC", "#imm10_4", "]", "ADR", "Ra", "label" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L9-L39
[ "def", "ADR", "(", "self", ",", "params", ")", ":", "# TODO may need to rethink how I do PC, may need to be byte alligned", "# TODO This is wrong as each address is a word, not a byte. The filled value with its location (Do we want that, or the value at that location [Decompiled instruction])", ...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.LDR
LDR Ra, [PC, #imm10_4] LDR Ra, label LDR Ra, =equate LDR Ra, [Rb, Rc] LDR Ra, [Rb, #imm7_4] LDR Ra, [SP, #imm10_4] Load a word from memory into Ra Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def LDR(self, params): """ LDR Ra, [PC, #imm10_4] LDR Ra, label LDR Ra, =equate LDR Ra, [Rb, Rc] LDR Ra, [Rb, #imm7_4] LDR Ra, [SP, #imm10_4] Load a word from memory into Ra Ra, Rb, and Rc must be low registers """ # TODO definitio...
def LDR(self, params): """ LDR Ra, [PC, #imm10_4] LDR Ra, label LDR Ra, =equate LDR Ra, [Rb, Rc] LDR Ra, [Rb, #imm7_4] LDR Ra, [SP, #imm10_4] Load a word from memory into Ra Ra, Rb, and Rc must be low registers """ # TODO definitio...
[ "LDR", "Ra", "[", "PC", "#imm10_4", "]", "LDR", "Ra", "label", "LDR", "Ra", "=", "equate", "LDR", "Ra", "[", "Rb", "Rc", "]", "LDR", "Ra", "[", "Rb", "#imm7_4", "]", "LDR", "Ra", "[", "SP", "#imm10_4", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L64-L187
[ "def", "LDR", "(", "self", ",", "params", ")", ":", "# TODO definition for PC is Ra <- M[PC + Imm10_4], Imm10_4 = PC - label, need to figure this one out", "try", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMET...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.LDRB
LDRB Ra, [Rb, Rc] LDRB Ra, [Rb, #imm5] Load a byte from memory into Ra Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def LDRB(self, params): """ LDRB Ra, [Rb, Rc] LDRB Ra, [Rb, #imm5] Load a byte from memory into Ra Ra, Rb, and Rc must be low registers """ try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) except iarm.exc...
def LDRB(self, params): """ LDRB Ra, [Rb, Rc] LDRB Ra, [Rb, #imm5] Load a byte from memory into Ra Ra, Rb, and Rc must be low registers """ try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) except iarm.exc...
[ "LDRB", "Ra", "[", "Rb", "Rc", "]", "LDRB", "Ra", "[", "Rb", "#imm5", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L189-L215
[ "def", "LDRB", "(", "self", ",", "params", ")", ":", "try", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "except", "iarm", ".", "exceptions", ".", "Parsi...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.LDRH
LDRH Ra, [Rb, Rc] LDRH Ra, [Rb, #imm6_2] Load a half word from memory into Ra Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def LDRH(self, params): """ LDRH Ra, [Rb, Rc] LDRH Ra, [Rb, #imm6_2] Load a half word from memory into Ra Ra, Rb, and Rc must be low registers """ try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) except i...
def LDRH(self, params): """ LDRH Ra, [Rb, Rc] LDRH Ra, [Rb, #imm6_2] Load a half word from memory into Ra Ra, Rb, and Rc must be low registers """ try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) except i...
[ "LDRH", "Ra", "[", "Rb", "Rc", "]", "LDRH", "Ra", "[", "Rb", "#imm6_2", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L217-L258
[ "def", "LDRH", "(", "self", ",", "params", ")", ":", "try", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "except", "iarm", ".", "exceptions", ".", "Parsi...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.LDRSB
LDRSB Ra, [Rb, Rc] Load a byte from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def LDRSB(self, params): """ LDRSB Ra, [Rb, Rc] Load a byte from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers """ # TODO LDRSB cant use immediates Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) ...
def LDRSB(self, params): """ LDRSB Ra, [Rb, Rc] Load a byte from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers """ # TODO LDRSB cant use immediates Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) ...
[ "LDRSB", "Ra", "[", "Rb", "Rc", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L260-L279
[ "def", "LDRSB", "(", "self", ",", "params", ")", ":", "# TODO LDRSB cant use immediates", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "self", ".", "check_arguments",...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.LDRSH
LDRSH Ra, [Rb, Rc] Load a half word from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def LDRSH(self, params): """ LDRSH Ra, [Rb, Rc] Load a half word from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers """ # TODO LDRSH cant use immediates Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)...
def LDRSH(self, params): """ LDRSH Ra, [Rb, Rc] Load a half word from memory, sign extend, and put into Ra Ra, Rb, and Rc must be low registers """ # TODO LDRSH cant use immediates Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)...
[ "LDRSH", "Ra", "[", "Rb", "Rc", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L281-L305
[ "def", "LDRSH", "(", "self", ",", "params", ")", ":", "# TODO LDRSH cant use immediates", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "self", ".", "check_arguments",...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.POP
POP {RPopList} Pop from the stack into the list of registers List must contain only low registers or PC
iarm/arm_instructions/memory.py
def POP(self, params): """ POP {RPopList} Pop from the stack into the list of registers List must contain only low registers or PC """ # TODO verify pop order # TODO pop list is comma separate, right? # TODO what registeres are allowed to POP to? Low Regi...
def POP(self, params): """ POP {RPopList} Pop from the stack into the list of registers List must contain only low registers or PC """ # TODO verify pop order # TODO pop list is comma separate, right? # TODO what registeres are allowed to POP to? Low Regi...
[ "POP", "{", "RPopList", "}" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L307-L334
[ "def", "POP", "(", "self", ",", "params", ")", ":", "# TODO verify pop order", "# TODO pop list is comma separate, right?", "# TODO what registeres are allowed to POP to? Low Registers and PC", "# TODO need to support ranges, ie {R2, R5-R7}", "# TODO PUSH should reverse the list, not POP", ...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.PUSH
PUSH {RPushList} Push to the stack from a list of registers List must contain only low registers or LR
iarm/arm_instructions/memory.py
def PUSH(self, params): """ PUSH {RPushList} Push to the stack from a list of registers List must contain only low registers or LR """ # TODO what registers are allowed to PUSH to? Low registers and LR # TODO PUSH should reverse the list, not POP RPushLis...
def PUSH(self, params): """ PUSH {RPushList} Push to the stack from a list of registers List must contain only low registers or LR """ # TODO what registers are allowed to PUSH to? Low registers and LR # TODO PUSH should reverse the list, not POP RPushLis...
[ "PUSH", "{", "RPushList", "}" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L336-L357
[ "def", "PUSH", "(", "self", ",", "params", ")", ":", "# TODO what registers are allowed to PUSH to? Low registers and LR", "# TODO PUSH should reverse the list, not POP", "RPushList", "=", "self", ".", "get_one_parameter", "(", "r'\\s*{(.*)}(.*)'", ",", "params", ")", ".", ...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.STM
STM Ra!, {RLoList} Store multiple registers into memory
iarm/arm_instructions/memory.py
def STM(self, params): """ STM Ra!, {RLoList} Store multiple registers into memory """ # TODO what registers can be stored? Ra, RLoList = self.get_two_parameters(r'\s*([^\s,]*)!,\s*{(.*)}(.*)', params).split(',') RLoList = RLoList.split(',') RLoList = [i....
def STM(self, params): """ STM Ra!, {RLoList} Store multiple registers into memory """ # TODO what registers can be stored? Ra, RLoList = self.get_two_parameters(r'\s*([^\s,]*)!,\s*{(.*)}(.*)', params).split(',') RLoList = RLoList.split(',') RLoList = [i....
[ "STM", "Ra!", "{", "RLoList", "}" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L359-L378
[ "def", "STM", "(", "self", ",", "params", ")", ":", "# TODO what registers can be stored?", "Ra", ",", "RLoList", "=", "self", ".", "get_two_parameters", "(", "r'\\s*([^\\s,]*)!,\\s*{(.*)}(.*)'", ",", "params", ")", ".", "split", "(", "','", ")", "RLoList", "=",...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.STR
STR Ra, [Rb, Rc] STR Ra, [Rb, #imm7_4] STR Ra, [SP, #imm10_4] Store Ra into memory as a word Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def STR(self, params): """ STR Ra, [Rb, Rc] STR Ra, [Rb, #imm7_4] STR Ra, [SP, #imm10_4] Store Ra into memory as a word Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if...
def STR(self, params): """ STR Ra, [Rb, Rc] STR Ra, [Rb, #imm7_4] STR Ra, [SP, #imm10_4] Store Ra into memory as a word Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if...
[ "STR", "Ra", "[", "Rb", "Rc", "]", "STR", "Ra", "[", "Rb", "#imm7_4", "]", "STR", "Ra", "[", "SP", "#imm10_4", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L380-L407
[ "def", "STR", "(", "self", ",", "params", ")", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "if", "self", ".", "is_immediate", "(", "Rc", ")", ":", "if...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.STRB
STRB Ra, [Rb, Rc] STRB Ra, [Rb, #imm5] Store Ra into memory as a byte Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def STRB(self, params): """ STRB Ra, [Rb, Rc] STRB Ra, [Rb, #imm5] Store Ra into memory as a byte Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if self.is_immediate(Rc): ...
def STRB(self, params): """ STRB Ra, [Rb, Rc] STRB Ra, [Rb, #imm5] Store Ra into memory as a byte Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if self.is_immediate(Rc): ...
[ "STRB", "Ra", "[", "Rb", "Rc", "]", "STRB", "Ra", "[", "Rb", "#imm5", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L409-L430
[ "def", "STRB", "(", "self", ",", "params", ")", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "if", "self", ".", "is_immediate", "(", "Rc", ")", ":", "s...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
Memory.STRH
STRH Ra, [Rb, Rc] STRH Ra, [Rb, #imm6_2] Store Ra into memory as a half word Ra, Rb, and Rc must be low registers
iarm/arm_instructions/memory.py
def STRH(self, params): """ STRH Ra, [Rb, Rc] STRH Ra, [Rb, #imm6_2] Store Ra into memory as a half word Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if self.is_immediate(Rc):...
def STRH(self, params): """ STRH Ra, [Rb, Rc] STRH Ra, [Rb, #imm6_2] Store Ra into memory as a half word Ra, Rb, and Rc must be low registers """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params) if self.is_immediate(Rc):...
[ "STRH", "Ra", "[", "Rb", "Rc", "]", "STRH", "Ra", "[", "Rb", "#imm6_2", "]" ]
DeepHorizons/iarm
python
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L432-L455
[ "def", "STRH", "(", "self", ",", "params", ")", ":", "Ra", ",", "Rb", ",", "Rc", "=", "self", ".", "get_three_parameters", "(", "self", ".", "THREE_PARAMETER_WITH_BRACKETS", ",", "params", ")", "if", "self", ".", "is_immediate", "(", "Rc", ")", ":", "s...
b913c9fd577b793a6bbced78b78a5d8d7cd88de4
train
_stop_ec2_instances
Helper to stop ec2 instances. By default it waits for instances to stop. :param awsclient: :param ec2_instances: :param wait: waits for instances to stop :return:
gcdt/kumo_start_stop.py
def _stop_ec2_instances(awsclient, ec2_instances, wait=True): """Helper to stop ec2 instances. By default it waits for instances to stop. :param awsclient: :param ec2_instances: :param wait: waits for instances to stop :return: """ if len(ec2_instances) == 0: return client_e...
def _stop_ec2_instances(awsclient, ec2_instances, wait=True): """Helper to stop ec2 instances. By default it waits for instances to stop. :param awsclient: :param ec2_instances: :param wait: waits for instances to stop :return: """ if len(ec2_instances) == 0: return client_e...
[ "Helper", "to", "stop", "ec2", "instances", ".", "By", "default", "it", "waits", "for", "instances", "to", "stop", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L11-L44
[ "def", "_stop_ec2_instances", "(", "awsclient", ",", "ec2_instances", ",", "wait", "=", "True", ")", ":", "if", "len", "(", "ec2_instances", ")", "==", "0", ":", "return", "client_ec2", "=", "awsclient", ".", "get_client", "(", "'ec2'", ")", "# get running i...
cd67cf416371337b83cb9ca3f696277125703339
train
_start_ec2_instances
Helper to start ec2 instances :param awsclient: :param ec2_instances: :param wait: waits for instances to start :return:
gcdt/kumo_start_stop.py
def _start_ec2_instances(awsclient, ec2_instances, wait=True): """Helper to start ec2 instances :param awsclient: :param ec2_instances: :param wait: waits for instances to start :return: """ if len(ec2_instances) == 0: return client_ec2 = awsclient.get_client('ec2') # get s...
def _start_ec2_instances(awsclient, ec2_instances, wait=True): """Helper to start ec2 instances :param awsclient: :param ec2_instances: :param wait: waits for instances to start :return: """ if len(ec2_instances) == 0: return client_ec2 = awsclient.get_client('ec2') # get s...
[ "Helper", "to", "start", "ec2", "instances" ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L47-L85
[ "def", "_start_ec2_instances", "(", "awsclient", ",", "ec2_instances", ",", "wait", "=", "True", ")", ":", "if", "len", "(", "ec2_instances", ")", "==", "0", ":", "return", "client_ec2", "=", "awsclient", ".", "get_client", "(", "'ec2'", ")", "# get stopped ...
cd67cf416371337b83cb9ca3f696277125703339
train
_filter_db_instances_by_status
helper to select dbinstances. :param awsclient: :param db_instances: :param status_list: :return: list of db_instances that match the filter
gcdt/kumo_start_stop.py
def _filter_db_instances_by_status(awsclient, db_instances, status_list): """helper to select dbinstances. :param awsclient: :param db_instances: :param status_list: :return: list of db_instances that match the filter """ client_rds = awsclient.get_client('rds') db_instances_with_status...
def _filter_db_instances_by_status(awsclient, db_instances, status_list): """helper to select dbinstances. :param awsclient: :param db_instances: :param status_list: :return: list of db_instances that match the filter """ client_rds = awsclient.get_client('rds') db_instances_with_status...
[ "helper", "to", "select", "dbinstances", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L88-L107
[ "def", "_filter_db_instances_by_status", "(", "awsclient", ",", "db_instances", ",", "status_list", ")", ":", "client_rds", "=", "awsclient", ".", "get_client", "(", "'rds'", ")", "db_instances_with_status", "=", "[", "]", "for", "db", "in", "db_instances", ":", ...
cd67cf416371337b83cb9ca3f696277125703339
train
_stop_ecs_services
Helper to change desiredCount of ECS services to zero. By default it waits for this to complete. Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html :param awsclient: :param services: :param template: the cloudformation template :param parameters: the parameters u...
gcdt/kumo_start_stop.py
def _stop_ecs_services(awsclient, services, template, parameters, wait=True): """Helper to change desiredCount of ECS services to zero. By default it waits for this to complete. Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html :param awsclient: :param services: ...
def _stop_ecs_services(awsclient, services, template, parameters, wait=True): """Helper to change desiredCount of ECS services to zero. By default it waits for this to complete. Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html :param awsclient: :param services: ...
[ "Helper", "to", "change", "desiredCount", "of", "ECS", "services", "to", "zero", ".", "By", "default", "it", "waits", "for", "this", "to", "complete", ".", "Docs", "here", ":", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "c...
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L110-L136
[ "def", "_stop_ecs_services", "(", "awsclient", ",", "services", ",", "template", ",", "parameters", ",", "wait", "=", "True", ")", ":", "if", "len", "(", "services", ")", "==", "0", ":", "return", "client_ecs", "=", "awsclient", ".", "get_client", "(", "...
cd67cf416371337b83cb9ca3f696277125703339
train
stop_stack
Stop an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code
gcdt/kumo_start_stop.py
def stop_stack(awsclient, stack_name, use_suspend=False): """Stop an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code """ exit_code = 0 # check for DisableStop #disable_stop = co...
def stop_stack(awsclient, stack_name, use_suspend=False): """Stop an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code """ exit_code = 0 # check for DisableStop #disable_stop = co...
[ "Stop", "an", "existing", "stack", "on", "AWS", "cloud", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L169-L284
[ "def", "stop_stack", "(", "awsclient", ",", "stack_name", ",", "use_suspend", "=", "False", ")", ":", "exit_code", "=", "0", "# check for DisableStop", "#disable_stop = conf.get('deployment', {}).get('DisableStop', False)", "#if disable_stop:", "# log.warn('\\'DisableStop\\' i...
cd67cf416371337b83cb9ca3f696277125703339
train
_get_autoscaling_min_max
Helper to extract the configured MinSize, MaxSize attributes from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param asg_name: logical resource name of the autoscaling group :return: MinSize, MaxSize
gcdt/kumo_start_stop.py
def _get_autoscaling_min_max(template, parameters, asg_name): """Helper to extract the configured MinSize, MaxSize attributes from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param asg_name: logical resourc...
def _get_autoscaling_min_max(template, parameters, asg_name): """Helper to extract the configured MinSize, MaxSize attributes from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param asg_name: logical resourc...
[ "Helper", "to", "extract", "the", "configured", "MinSize", "MaxSize", "attributes", "from", "the", "template", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L287-L307
[ "def", "_get_autoscaling_min_max", "(", "template", ",", "parameters", ",", "asg_name", ")", ":", "params", "=", "{", "e", "[", "'ParameterKey'", "]", ":", "e", "[", "'ParameterValue'", "]", "for", "e", "in", "parameters", "}", "asg", "=", "template", ".",...
cd67cf416371337b83cb9ca3f696277125703339
train
_get_service_cluster_desired_count
Helper to extract the configured desiredCount attribute from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param service_name: logical resource name of the ECS service :return: cluster, desiredCount
gcdt/kumo_start_stop.py
def _get_service_cluster_desired_count(template, parameters, service_name): """Helper to extract the configured desiredCount attribute from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param service_name: lo...
def _get_service_cluster_desired_count(template, parameters, service_name): """Helper to extract the configured desiredCount attribute from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param service_name: lo...
[ "Helper", "to", "extract", "the", "configured", "desiredCount", "attribute", "from", "the", "template", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L310-L329
[ "def", "_get_service_cluster_desired_count", "(", "template", ",", "parameters", ",", "service_name", ")", ":", "params", "=", "{", "e", "[", "'ParameterKey'", "]", ":", "e", "[", "'ParameterValue'", "]", "for", "e", "in", "parameters", "}", "service", "=", ...
cd67cf416371337b83cb9ca3f696277125703339
train
start_stack
Start an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code
gcdt/kumo_start_stop.py
def start_stack(awsclient, stack_name, use_suspend=False): """Start an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code """ exit_code = 0 # check for DisableStop #disable_stop = ...
def start_stack(awsclient, stack_name, use_suspend=False): """Start an existing stack on AWS cloud. :param awsclient: :param stack_name: :param use_suspend: use suspend and resume on the autoscaling group :return: exit_code """ exit_code = 0 # check for DisableStop #disable_stop = ...
[ "Start", "an", "existing", "stack", "on", "AWS", "cloud", "." ]
glomex/gcdt
python
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L348-L455
[ "def", "start_stack", "(", "awsclient", ",", "stack_name", ",", "use_suspend", "=", "False", ")", ":", "exit_code", "=", "0", "# check for DisableStop", "#disable_stop = conf.get('deployment', {}).get('DisableStop', False)", "#if disable_stop:", "# log.warn('\\'DisableStop\\' ...
cd67cf416371337b83cb9ca3f696277125703339
train
Controller.is_running
Property method that returns a bool specifying if the process is currently running. This will return true if the state is active, idle or initializing. :rtype: bool
helper/controller.py
def is_running(self): """Property method that returns a bool specifying if the process is currently running. This will return true if the state is active, idle or initializing. :rtype: bool """ return self._state in [self.STATE_ACTIVE, sel...
def is_running(self): """Property method that returns a bool specifying if the process is currently running. This will return true if the state is active, idle or initializing. :rtype: bool """ return self._state in [self.STATE_ACTIVE, sel...
[ "Property", "method", "that", "returns", "a", "bool", "specifying", "if", "the", "process", "is", "currently", "running", ".", "This", "will", "return", "true", "if", "the", "state", "is", "active", "idle", "or", "initializing", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L143-L153
[ "def", "is_running", "(", "self", ")", ":", "return", "self", ".", "_state", "in", "[", "self", ".", "STATE_ACTIVE", ",", "self", ".", "STATE_IDLE", ",", "self", ".", "STATE_INITIALIZING", "]" ]
fe8e45fc8eabf619429b2940c682c252ee33c082
train
Controller.process_signal
Invoked whenever a signal is added to the stack. :param int signum: The signal that was added
helper/controller.py
def process_signal(self, signum): """Invoked whenever a signal is added to the stack. :param int signum: The signal that was added """ if signum == signal.SIGTERM: LOGGER.info('Received SIGTERM, initiating shutdown') self.stop() elif signum == signal.SIG...
def process_signal(self, signum): """Invoked whenever a signal is added to the stack. :param int signum: The signal that was added """ if signum == signal.SIGTERM: LOGGER.info('Received SIGTERM, initiating shutdown') self.stop() elif signum == signal.SIG...
[ "Invoked", "whenever", "a", "signal", "is", "added", "to", "the", "stack", "." ]
gmr/helper
python
https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L225-L243
[ "def", "process_signal", "(", "self", ",", "signum", ")", ":", "if", "signum", "==", "signal", ".", "SIGTERM", ":", "LOGGER", ".", "info", "(", "'Received SIGTERM, initiating shutdown'", ")", "self", ".", "stop", "(", ")", "elif", "signum", "==", "signal", ...
fe8e45fc8eabf619429b2940c682c252ee33c082