hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7bd924cb80f88684ddad674fc492c168739cab94 | EtneteraLogicworks/munkireport-parser | munkireport_parser.py | [
"MIT"
] | Python | parse_config | <not_specific> | def parse_config(config_file):
"""Parse and check provided configuration file"""
try:
config = yaml.load(config_file, Loader=yaml.SafeLoader)
for member in CONFIG_REQUIRED_PARAMETERS:
if member not in config:
raise MunkiParseError(
"'{}' parameter ... | Parse and check provided configuration file | Parse and check provided configuration file | [
"Parse",
"and",
"check",
"provided",
"configuration",
"file"
] | def parse_config(config_file):
try:
config = yaml.load(config_file, Loader=yaml.SafeLoader)
for member in CONFIG_REQUIRED_PARAMETERS:
if member not in config:
raise MunkiParseError(
"'{}' parameter is missing in the config".format(member)
... | [
"def",
"parse_config",
"(",
"config_file",
")",
":",
"try",
":",
"config",
"=",
"yaml",
".",
"load",
"(",
"config_file",
",",
"Loader",
"=",
"yaml",
".",
"SafeLoader",
")",
"for",
"member",
"in",
"CONFIG_REQUIRED_PARAMETERS",
":",
"if",
"member",
"not",
"i... | Parse and check provided configuration file | [
"Parse",
"and",
"check",
"provided",
"configuration",
"file"
] | [
"\"\"\"Parse and check provided configuration file\"\"\""
] | [
{
"param": "config_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d6fc35732ee272a7267a1e23107809ccc5bc9bec | basit9958/chaos-mesh | build/build_image.py | [
"Apache-2.0"
] | Python | pass_env_to_build_arg | null | def pass_env_to_build_arg(cmd, arg_name):
"""
pass the environment variable to the build arguments
"""
if os.getenv(arg_name) is not None:
cmd += ["--build-arg", f"{arg_name}={os.getenv(arg_name)}"] |
pass the environment variable to the build arguments
| pass the environment variable to the build arguments | [
"pass",
"the",
"environment",
"variable",
"to",
"the",
"build",
"arguments"
] | def pass_env_to_build_arg(cmd, arg_name):
if os.getenv(arg_name) is not None:
cmd += ["--build-arg", f"{arg_name}={os.getenv(arg_name)}"] | [
"def",
"pass_env_to_build_arg",
"(",
"cmd",
",",
"arg_name",
")",
":",
"if",
"os",
".",
"getenv",
"(",
"arg_name",
")",
"is",
"not",
"None",
":",
"cmd",
"+=",
"[",
"\"--build-arg\"",
",",
"f\"{arg_name}={os.getenv(arg_name)}\"",
"]"
] | pass the environment variable to the build arguments | [
"pass",
"the",
"environment",
"variable",
"to",
"the",
"build",
"arguments"
] | [
"\"\"\"\n pass the environment variable to the build arguments\n \"\"\""
] | [
{
"param": "cmd",
"type": null
},
{
"param": "arg_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg_name",
"type": null,
"docstring": null,
"docstring_tokens"... |
e14563fc1de67dad7e755fc961261854ba3028e6 | basit9958/chaos-mesh | build/utils.py | [
"Apache-2.0"
] | Python | underscore_uppercase | <not_specific> | def underscore_uppercase(name):
"""
convert the given name to the underscore_uppercase format
"""
return name.replace('-', '_').upper() |
convert the given name to the underscore_uppercase format
| convert the given name to the underscore_uppercase format | [
"convert",
"the",
"given",
"name",
"to",
"the",
"underscore_uppercase",
"format"
] | def underscore_uppercase(name):
return name.replace('-', '_').upper() | [
"def",
"underscore_uppercase",
"(",
"name",
")",
":",
"return",
"name",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
".",
"upper",
"(",
")"
] | convert the given name to the underscore_uppercase format | [
"convert",
"the",
"given",
"name",
"to",
"the",
"underscore_uppercase",
"format"
] | [
"\"\"\"\n convert the given name to the underscore_uppercase format\n \"\"\""
] | [
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | up | <not_specific> | def up(self):
"""Check if Database is up and running"""
try:
return self.server.up()
except Database.Exception:
return False | Check if Database is up and running | Check if Database is up and running | [
"Check",
"if",
"Database",
"is",
"up",
"and",
"running"
] | def up(self):
try:
return self.server.up()
except Database.Exception:
return False | [
"def",
"up",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"server",
".",
"up",
"(",
")",
"except",
"Database",
".",
"Exception",
":",
"return",
"False"
] | Check if Database is up and running | [
"Check",
"if",
"Database",
"is",
"up",
"and",
"running"
] | [
"\"\"\"Check if Database is up and running\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | all | list | def all(self) -> list:
"""Return all documents from the current table"""
all_list = DocumentList(self)
for doc in self.table:
all_list.add(dict(doc))
return all_list | Return all documents from the current table | Return all documents from the current table | [
"Return",
"all",
"documents",
"from",
"the",
"current",
"table"
] | def all(self) -> list:
all_list = DocumentList(self)
for doc in self.table:
all_list.add(dict(doc))
return all_list | [
"def",
"all",
"(",
"self",
")",
"->",
"list",
":",
"all_list",
"=",
"DocumentList",
"(",
"self",
")",
"for",
"doc",
"in",
"self",
".",
"table",
":",
"all_list",
".",
"add",
"(",
"dict",
"(",
"doc",
")",
")",
"return",
"all_list"
] | Return all documents from the current table | [
"Return",
"all",
"documents",
"from",
"the",
"current",
"table"
] | [
"\"\"\"Return all documents from the current table\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | insert | any | def insert(self, document: dict) -> any:
"""Insert a document in the current table"""
try:
self.table.put(document)
return True
except Database.Exception:
return False | Insert a document in the current table | Insert a document in the current table | [
"Insert",
"a",
"document",
"in",
"the",
"current",
"table"
] | def insert(self, document: dict) -> any:
try:
self.table.put(document)
return True
except Database.Exception:
return False | [
"def",
"insert",
"(",
"self",
",",
"document",
":",
"dict",
")",
"->",
"any",
":",
"try",
":",
"self",
".",
"table",
".",
"put",
"(",
"document",
")",
"return",
"True",
"except",
"Database",
".",
"Exception",
":",
"return",
"False"
] | Insert a document in the current table | [
"Insert",
"a",
"document",
"in",
"the",
"current",
"table"
] | [
"\"\"\"Insert a document in the current table\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "document",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "document",
"type": "dict",
"docstring": null,
"docstring_toke... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | filter | list | def filter(self, filter: any = {}) -> list:
"""THE USE OF THIS FUNCTION IS DISCOURAGED! USE FIND INSTEAD!
Filters a table
`filter` can be either a lamba or object
Returns a list of all documents that match"""
doc_list = DocumentList(self)
if (isinstance(filter, types.... | THE USE OF THIS FUNCTION IS DISCOURAGED! USE FIND INSTEAD!
Filters a table
`filter` can be either a lamba or object
Returns a list of all documents that match | THE USE OF THIS FUNCTION IS DISCOURAGED. USE FIND INSTEAD.
Filters a table
`filter` can be either a lamba or object
Returns a list of all documents that match | [
"THE",
"USE",
"OF",
"THIS",
"FUNCTION",
"IS",
"DISCOURAGED",
".",
"USE",
"FIND",
"INSTEAD",
".",
"Filters",
"a",
"table",
"`",
"filter",
"`",
"can",
"be",
"either",
"a",
"lamba",
"or",
"object",
"Returns",
"a",
"list",
"of",
"all",
"documents",
"that",
... | def filter(self, filter: any = {}) -> list:
doc_list = DocumentList(self)
if (isinstance(filter, types.LambdaType)):
for document in self.all():
if filter.__call__(document):
doc_list.add(document)
if (isinstance(filter, dict)):
if len(... | [
"def",
"filter",
"(",
"self",
",",
"filter",
":",
"any",
"=",
"{",
"}",
")",
"->",
"list",
":",
"doc_list",
"=",
"DocumentList",
"(",
"self",
")",
"if",
"(",
"isinstance",
"(",
"filter",
",",
"types",
".",
"LambdaType",
")",
")",
":",
"for",
"docum... | THE USE OF THIS FUNCTION IS DISCOURAGED! | [
"THE",
"USE",
"OF",
"THIS",
"FUNCTION",
"IS",
"DISCOURAGED!"
] | [
"\"\"\"THE USE OF THIS FUNCTION IS DISCOURAGED! USE FIND INSTEAD!\n Filters a table \n `filter` can be either a lamba or object \n Returns a list of all documents that match\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filter",
"type": "any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filter",
"type": "any",
"docstring": null,
"docstring_tokens"... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | find | list | def find(self, filter: dict = {}) -> list:
"""Find documents by a <a href="https://pouchdb.com/guides/mango-queries.html">Mango query</a>"""
doc_list = DocumentList(self)
doc_list.document_list = self.table.find(filter)["docs"]
return doc_list | Find documents by a <a href="https://pouchdb.com/guides/mango-queries.html">Mango query</a> | Find documents by a Mango query | [
"Find",
"documents",
"by",
"a",
"Mango",
"query"
] | def find(self, filter: dict = {}) -> list:
doc_list = DocumentList(self)
doc_list.document_list = self.table.find(filter)["docs"]
return doc_list | [
"def",
"find",
"(",
"self",
",",
"filter",
":",
"dict",
"=",
"{",
"}",
")",
"->",
"list",
":",
"doc_list",
"=",
"DocumentList",
"(",
"self",
")",
"doc_list",
".",
"document_list",
"=",
"self",
".",
"table",
".",
"find",
"(",
"filter",
")",
"[",
"\"... | Find documents by a <a href="https://pouchdb.com/guides/mango-queries.html">Mango query</a> | [
"Find",
"documents",
"by",
"a",
"<a",
"href",
"=",
"\"",
"https",
":",
"//",
"pouchdb",
".",
"com",
"/",
"guides",
"/",
"mango",
"-",
"queries",
".",
"html",
"\"",
">",
"Mango",
"query<",
"/",
"a",
">"
] | [
"\"\"\"Find documents by a <a href=\"https://pouchdb.com/guides/mango-queries.html\">Mango query</a>\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filter",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filter",
"type": "dict",
"docstring": null,
"docstring_tokens... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | add | None | def add(self, item: dict) -> None:
"""
Add a document to the DocumentList
"""
self.document_list.append(item) |
Add a document to the DocumentList
| Add a document to the DocumentList | [
"Add",
"a",
"document",
"to",
"the",
"DocumentList"
] | def add(self, item: dict) -> None:
self.document_list.append(item) | [
"def",
"add",
"(",
"self",
",",
"item",
":",
"dict",
")",
"->",
"None",
":",
"self",
".",
"document_list",
".",
"append",
"(",
"item",
")"
] | Add a document to the DocumentList | [
"Add",
"a",
"document",
"to",
"the",
"DocumentList"
] | [
"\"\"\"\n Add a document to the DocumentList\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "dict",
"docstring": null,
"docstring_tokens":... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | update | None | def update(self, modify_function_or_new_object: any) -> None:
"""
Update all documents using a function or a dictionary with updated keys
The if a function is passed, the object the function returns is used,
else the merged dictionaries
"""
if isinstance(modify_functi... |
Update all documents using a function or a dictionary with updated keys
The if a function is passed, the object the function returns is used,
else the merged dictionaries
| Update all documents using a function or a dictionary with updated keys
The if a function is passed, the object the function returns is used,
else the merged dictionaries | [
"Update",
"all",
"documents",
"using",
"a",
"function",
"or",
"a",
"dictionary",
"with",
"updated",
"keys",
"The",
"if",
"a",
"function",
"is",
"passed",
"the",
"object",
"the",
"function",
"returns",
"is",
"used",
"else",
"the",
"merged",
"dictionaries"
] | def update(self, modify_function_or_new_object: any) -> None:
if isinstance(modify_function_or_new_object, dict):
for document in self.document_list:
def merge_dicts(x, y):
z = x.copy()
z.update(y)
return z
s... | [
"def",
"update",
"(",
"self",
",",
"modify_function_or_new_object",
":",
"any",
")",
"->",
"None",
":",
"if",
"isinstance",
"(",
"modify_function_or_new_object",
",",
"dict",
")",
":",
"for",
"document",
"in",
"self",
".",
"document_list",
":",
"def",
"merge_d... | Update all documents using a function or a dictionary with updated keys
The if a function is passed, the object the function returns is used,
else the merged dictionaries | [
"Update",
"all",
"documents",
"using",
"a",
"function",
"or",
"a",
"dictionary",
"with",
"updated",
"keys",
"The",
"if",
"a",
"function",
"is",
"passed",
"the",
"object",
"the",
"function",
"returns",
"is",
"used",
"else",
"the",
"merged",
"dictionaries"
] | [
"\"\"\"\n Update all documents using a function or a dictionary with updated keys \n The if a function is passed, the object the function returns is used, \n else the merged dictionaries\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "modify_function_or_new_object",
"type": "any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modify_function_or_new_object",
"type": "any",
"docstring": null,
... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | delete | None | def delete(self) -> None:
"""
Delete all documents in the current DocumentList
"""
for document in self.document_list:
self.table.delete(document) |
Delete all documents in the current DocumentList
| Delete all documents in the current DocumentList | [
"Delete",
"all",
"documents",
"in",
"the",
"current",
"DocumentList"
] | def delete(self) -> None:
for document in self.document_list:
self.table.delete(document) | [
"def",
"delete",
"(",
"self",
")",
"->",
"None",
":",
"for",
"document",
"in",
"self",
".",
"document_list",
":",
"self",
".",
"table",
".",
"delete",
"(",
"document",
")"
] | Delete all documents in the current DocumentList | [
"Delete",
"all",
"documents",
"in",
"the",
"current",
"DocumentList"
] | [
"\"\"\"\n Delete all documents in the current DocumentList\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | sort | None | def sort(self, keyname: str) -> None:
"""
Sort all documents in the current DocumentList by a given `keyname`
"""
self.document_list = sorted(
self.document_list, key=lambda k: k[keyname] if keyname in k else 0)
return self |
Sort all documents in the current DocumentList by a given `keyname`
| Sort all documents in the current DocumentList by a given `keyname` | [
"Sort",
"all",
"documents",
"in",
"the",
"current",
"DocumentList",
"by",
"a",
"given",
"`",
"keyname",
"`"
] | def sort(self, keyname: str) -> None:
self.document_list = sorted(
self.document_list, key=lambda k: k[keyname] if keyname in k else 0)
return self | [
"def",
"sort",
"(",
"self",
",",
"keyname",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"document_list",
"=",
"sorted",
"(",
"self",
".",
"document_list",
",",
"key",
"=",
"lambda",
"k",
":",
"k",
"[",
"keyname",
"]",
"if",
"keyname",
"in",
"k... | Sort all documents in the current DocumentList by a given `keyname` | [
"Sort",
"all",
"documents",
"in",
"the",
"current",
"DocumentList",
"by",
"a",
"given",
"`",
"keyname",
"`"
] | [
"\"\"\"\n Sort all documents in the current DocumentList by a given `keyname`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "keyname",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keyname",
"type": "str",
"docstring": null,
"docstring_tokens... |
49655e2ab1c167ad4759923d2c27070dbbc9e93e | open-jarvis/jarvis-pip | jarvis/Database.py | [
"MIT"
] | Python | found | <not_specific> | def found(self):
"""
Check if the Table query returned any results (length of the current DocumentList is not 0)
"""
return len(self.document_list) != 0 |
Check if the Table query returned any results (length of the current DocumentList is not 0)
| Check if the Table query returned any results (length of the current DocumentList is not 0) | [
"Check",
"if",
"the",
"Table",
"query",
"returned",
"any",
"results",
"(",
"length",
"of",
"the",
"current",
"DocumentList",
"is",
"not",
"0",
")"
] | def found(self):
return len(self.document_list) != 0 | [
"def",
"found",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"document_list",
")",
"!=",
"0"
] | Check if the Table query returned any results (length of the current DocumentList is not 0) | [
"Check",
"if",
"the",
"Table",
"query",
"returned",
"any",
"results",
"(",
"length",
"of",
"the",
"current",
"DocumentList",
"is",
"not",
"0",
")"
] | [
"\"\"\"\n Check if the Table query returned any results (length of the current DocumentList is not 0)\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f397b09bd0b489c1151293968030548fc29375b8 | Boring-Mind/ckeditor-admin | src/blog_admin/forms.py | [
"MIT"
] | Python | crispy_init | null | def crispy_init(self): # pragma: no cover
"""Initialize crispy-forms helper."""
self.helper = FormHelper()
self.helper.form_id = 'id-RegistrationForm'
self.helper.form_class = 'form-group'
self.helper.form_method = 'post'
self.helper.form_action = reverse('register')
... | Initialize crispy-forms helper. | Initialize crispy-forms helper. | [
"Initialize",
"crispy",
"-",
"forms",
"helper",
"."
] | def crispy_init(self):
self.helper = FormHelper()
self.helper.form_id = 'id-RegistrationForm'
self.helper.form_class = 'form-group'
self.helper.form_method = 'post'
self.helper.form_action = reverse('register')
self.helper.layout = layout.Layout(
layout.Field... | [
"def",
"crispy_init",
"(",
"self",
")",
":",
"self",
".",
"helper",
"=",
"FormHelper",
"(",
")",
"self",
".",
"helper",
".",
"form_id",
"=",
"'id-RegistrationForm'",
"self",
".",
"helper",
".",
"form_class",
"=",
"'form-group'",
"self",
".",
"helper",
".",... | Initialize crispy-forms helper. | [
"Initialize",
"crispy",
"-",
"forms",
"helper",
"."
] | [
"# pragma: no cover",
"\"\"\"Initialize crispy-forms helper.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f397b09bd0b489c1151293968030548fc29375b8 | Boring-Mind/ckeditor-admin | src/blog_admin/forms.py | [
"MIT"
] | Python | crispy_init | null | def crispy_init(self): # pragma: no cover
"""Initialize crispy-forms helper."""
self.helper = FormHelper()
self.helper.form_id = 'id-PostCreateForm'
self.helper.form_class = 'form-group'
self.helper.form_method = 'post'
self.helper.form_action = reverse('create_post')
... | Initialize crispy-forms helper. | Initialize crispy-forms helper. | [
"Initialize",
"crispy",
"-",
"forms",
"helper",
"."
] | def crispy_init(self):
self.helper = FormHelper()
self.helper.form_id = 'id-PostCreateForm'
self.helper.form_class = 'form-group'
self.helper.form_method = 'post'
self.helper.form_action = reverse('create_post')
self.helper.layout = layout.Layout(
layout.Div(... | [
"def",
"crispy_init",
"(",
"self",
")",
":",
"self",
".",
"helper",
"=",
"FormHelper",
"(",
")",
"self",
".",
"helper",
".",
"form_id",
"=",
"'id-PostCreateForm'",
"self",
".",
"helper",
".",
"form_class",
"=",
"'form-group'",
"self",
".",
"helper",
".",
... | Initialize crispy-forms helper. | [
"Initialize",
"crispy",
"-",
"forms",
"helper",
"."
] | [
"# pragma: no cover",
"\"\"\"Initialize crispy-forms helper.\"\"\"",
"# self.helper.layout = layout.Layout(",
"# layout.Field('title'),",
"# layout.Field('description'),",
"# layout.Field('hashtags'),",
"# layout.Field('content'),",
"# layout.Field('preview_img_url'),",
"# la... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fe14fabd2503c97e1a316fdd1db6bc66e51651d8 | Boring-Mind/ckeditor-admin | tests/unit/blog_admin/fixtures.py | [
"MIT"
] | Python | user | null | def user():
"""Fake user data fixture.
Generate user data.
"""
yield FakeUser() | Fake user data fixture.
Generate user data.
| Fake user data fixture.
Generate user data. | [
"Fake",
"user",
"data",
"fixture",
".",
"Generate",
"user",
"data",
"."
] | def user():
yield FakeUser() | [
"def",
"user",
"(",
")",
":",
"yield",
"FakeUser",
"(",
")"
] | Fake user data fixture. | [
"Fake",
"user",
"data",
"fixture",
"."
] | [
"\"\"\"Fake user data fixture.\n \n Generate user data.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4c24c73c8b947dc3bfec23a2388e7a04500d42c5 | Boring-Mind/ckeditor-admin | src/blog_admin/views.py | [
"MIT"
] | Python | filter_new_tags | List[TagForm] | def filter_new_tags(self, post_tags: List[str]) -> List[TagForm]:
"""Filter all the tags, which are not present in the db."""
return [
TagForm({'text': tag})
for tag in post_tags
if tag not in self.stored_tags
] | Filter all the tags, which are not present in the db. | Filter all the tags, which are not present in the db. | [
"Filter",
"all",
"the",
"tags",
"which",
"are",
"not",
"present",
"in",
"the",
"db",
"."
] | def filter_new_tags(self, post_tags: List[str]) -> List[TagForm]:
return [
TagForm({'text': tag})
for tag in post_tags
if tag not in self.stored_tags
] | [
"def",
"filter_new_tags",
"(",
"self",
",",
"post_tags",
":",
"List",
"[",
"str",
"]",
")",
"->",
"List",
"[",
"TagForm",
"]",
":",
"return",
"[",
"TagForm",
"(",
"{",
"'text'",
":",
"tag",
"}",
")",
"for",
"tag",
"in",
"post_tags",
"if",
"tag",
"n... | Filter all the tags, which are not present in the db. | [
"Filter",
"all",
"the",
"tags",
"which",
"are",
"not",
"present",
"in",
"the",
"db",
"."
] | [
"\"\"\"Filter all the tags, which are not present in the db.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "post_tags",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post_tags",
"type": "List[str]",
"docstring": null,
"docstrin... |
4c24c73c8b947dc3bfec23a2388e7a04500d42c5 | Boring-Mind/ckeditor-admin | src/blog_admin/views.py | [
"MIT"
] | Python | save_post | Post | def save_post(self, form: Form) -> Post:
"""Save post and add author to it.
Post needs to be saved before linking hashtag objects.
"""
post = form.save(commit=False)
post.author = self.get_user()
post.save()
return post | Save post and add author to it.
Post needs to be saved before linking hashtag objects.
| Save post and add author to it.
Post needs to be saved before linking hashtag objects. | [
"Save",
"post",
"and",
"add",
"author",
"to",
"it",
".",
"Post",
"needs",
"to",
"be",
"saved",
"before",
"linking",
"hashtag",
"objects",
"."
] | def save_post(self, form: Form) -> Post:
post = form.save(commit=False)
post.author = self.get_user()
post.save()
return post | [
"def",
"save_post",
"(",
"self",
",",
"form",
":",
"Form",
")",
"->",
"Post",
":",
"post",
"=",
"form",
".",
"save",
"(",
"commit",
"=",
"False",
")",
"post",
".",
"author",
"=",
"self",
".",
"get_user",
"(",
")",
"post",
".",
"save",
"(",
")",
... | Save post and add author to it. | [
"Save",
"post",
"and",
"add",
"author",
"to",
"it",
"."
] | [
"\"\"\"Save post and add author to it.\n \n Post needs to be saved before linking hashtag objects.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "form",
"type": "Form"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "form",
"type": "Form",
"docstring": null,
"docstring_tokens":... |
4c24c73c8b947dc3bfec23a2388e7a04500d42c5 | Boring-Mind/ckeditor-admin | src/blog_admin/views.py | [
"MIT"
] | Python | form_valid | <not_specific> | def form_valid(self, form):
"""Process and save form data and return back an RedirectResponse."""
# ToDo: Add unit tests
# ToDo: Refactor (extract method)
# Convert received hashtags from json format to the list[str]
hashtags = PostFormView.parse_hashtags(
form.cleane... | Process and save form data and return back an RedirectResponse. | Process and save form data and return back an RedirectResponse. | [
"Process",
"and",
"save",
"form",
"data",
"and",
"return",
"back",
"an",
"RedirectResponse",
"."
] | def form_valid(self, form):
hashtags = PostFormView.parse_hashtags(
form.cleaned_data['hashtags']
)
self.stored_tags = PostFormView.retrieve_stored_tags()
new_tags = self.filter_new_tags(hashtags)
if not self.new_tags_are_valid(new_tags):
form.add_error('h... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"hashtags",
"=",
"PostFormView",
".",
"parse_hashtags",
"(",
"form",
".",
"cleaned_data",
"[",
"'hashtags'",
"]",
")",
"self",
".",
"stored_tags",
"=",
"PostFormView",
".",
"retrieve_stored_tags",
"(",
... | Process and save form data and return back an RedirectResponse. | [
"Process",
"and",
"save",
"form",
"data",
"and",
"return",
"back",
"an",
"RedirectResponse",
"."
] | [
"\"\"\"Process and save form data and return back an RedirectResponse.\"\"\"",
"# ToDo: Add unit tests",
"# ToDo: Refactor (extract method)",
"# Convert received hashtags from json format to the list[str]",
"# Filter new tags, validate them and save them to db",
"# Save post and add author to it.",
"# P... | [
{
"param": "self",
"type": null
},
{
"param": "form",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "form",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ec05b4886dff1294182d766f6296821606ae6d40 | Boring-Mind/ckeditor-admin | tests/integration/blog_admin/fixtures.py | [
"MIT"
] | Python | browser | null | def browser():
"""Return an instance of chrome headless browser."""
br = Browser("chrome", headless=True)
yield br
br.quit() | Return an instance of chrome headless browser. | Return an instance of chrome headless browser. | [
"Return",
"an",
"instance",
"of",
"chrome",
"headless",
"browser",
"."
] | def browser():
br = Browser("chrome", headless=True)
yield br
br.quit() | [
"def",
"browser",
"(",
")",
":",
"br",
"=",
"Browser",
"(",
"\"chrome\"",
",",
"headless",
"=",
"True",
")",
"yield",
"br",
"br",
".",
"quit",
"(",
")"
] | Return an instance of chrome headless browser. | [
"Return",
"an",
"instance",
"of",
"chrome",
"headless",
"browser",
"."
] | [
"\"\"\"Return an instance of chrome headless browser.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ec05b4886dff1294182d766f6296821606ae6d40 | Boring-Mind/ckeditor-admin | tests/integration/blog_admin/fixtures.py | [
"MIT"
] | Python | user_with_delete | null | def user_with_delete():
"""Fake user data fixture.
Generate user data and remove it from the db after work.
"""
fake = Faker()
u = FakeUser(
slugify(fake.name()),
fake.email(),
fake.password(length=settings.MIN_PASSWORD_LENGTH)
)
yield u
if len(User.objects.f... | Fake user data fixture.
Generate user data and remove it from the db after work.
| Fake user data fixture.
Generate user data and remove it from the db after work. | [
"Fake",
"user",
"data",
"fixture",
".",
"Generate",
"user",
"data",
"and",
"remove",
"it",
"from",
"the",
"db",
"after",
"work",
"."
] | def user_with_delete():
fake = Faker()
u = FakeUser(
slugify(fake.name()),
fake.email(),
fake.password(length=settings.MIN_PASSWORD_LENGTH)
)
yield u
if len(User.objects.filter(username=u.username).values()) > 0:
User.objects.filter(username=u.username).delete() | [
"def",
"user_with_delete",
"(",
")",
":",
"fake",
"=",
"Faker",
"(",
")",
"u",
"=",
"FakeUser",
"(",
"slugify",
"(",
"fake",
".",
"name",
"(",
")",
")",
",",
"fake",
".",
"email",
"(",
")",
",",
"fake",
".",
"password",
"(",
"length",
"=",
"setti... | Fake user data fixture. | [
"Fake",
"user",
"data",
"fixture",
"."
] | [
"\"\"\"Fake user data fixture.\n \n Generate user data and remove it from the db after work.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e6babcb48805ee9f438df55ce3a85a2674ba3f63 | datawire/Loom | ci/dockerize.py | [
"Apache-2.0"
] | Python | handle_git_tag | null | def handle_git_tag(repo, git_commit, git_tag):
"""Tag a Docker image.
The tag of the Docker image will be the same as the Git tag. The Git tag must be semantic version ("semver")
compliant otherwise an error will be raised.
A new Docker image is *NOT* built for the tag rather it is assumed t... | Tag a Docker image.
The tag of the Docker image will be the same as the Git tag. The Git tag must be semantic version ("semver")
compliant otherwise an error will be raised.
A new Docker image is *NOT* built for the tag rather it is assumed that the tag points to a Docker image for the
previo... | Tag a Docker image.
The tag of the Docker image will be the same as the Git tag. The Git tag must be semantic version ("semver")
compliant otherwise an error will be raised.
A new Docker image is *NOT* built for the tag rather it is assumed that the tag points to a Docker image for the
previous commit. | [
"Tag",
"a",
"Docker",
"image",
".",
"The",
"tag",
"of",
"the",
"Docker",
"image",
"will",
"be",
"the",
"same",
"as",
"the",
"Git",
"tag",
".",
"The",
"Git",
"tag",
"must",
"be",
"semantic",
"version",
"(",
"\"",
"semver",
"\"",
")",
"compliant",
"oth... | def handle_git_tag(repo, git_commit, git_tag):
if git_tag == 'latest':
raise ValueError('Invalid tag name "latest" not allowed!')
check_semver(git_tag)
print("==> Triggered from Tag <{0}>: Pulling Docker image associated with the tagged commit and adding "
+ "additional tag for version (ve... | [
"def",
"handle_git_tag",
"(",
"repo",
",",
"git_commit",
",",
"git_tag",
")",
":",
"if",
"git_tag",
"==",
"'latest'",
":",
"raise",
"ValueError",
"(",
"'Invalid tag name \"latest\" not allowed!'",
")",
"check_semver",
"(",
"git_tag",
")",
"print",
"(",
"\"==> Trig... | Tag a Docker image. | [
"Tag",
"a",
"Docker",
"image",
"."
] | [
"\"\"\"Tag a Docker image.\n \n The tag of the Docker image will be the same as the Git tag. The Git tag must be semantic version (\"semver\") \n compliant otherwise an error will be raised.\n \n A new Docker image is *NOT* built for the tag rather it is assumed that the tag points to a Docker image ... | [
{
"param": "repo",
"type": null
},
{
"param": "git_commit",
"type": null
},
{
"param": "git_tag",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repo",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "git_commit",
"type": null,
"docstring": null,
"docstring_toke... |
9250006a48b80656c724a1a8d22778e07b0ba1bb | DmitryUlyanov/typed_print | typed_print/typed_print.py | [
"MIT"
] | Python | apply_regexp | <not_specific> | def apply_regexp(cls, x, re_compiled):
'''
Splits string using regexp and applies the rules from type_map to each part
'''
indices = []
for m in re_compiled.finditer(str(x)):
indices.append(m.start())
indices.append(m.end())
if len(indices) ==... |
Splits string using regexp and applies the rules from type_map to each part
| Splits string using regexp and applies the rules from type_map to each part | [
"Splits",
"string",
"using",
"regexp",
"and",
"applies",
"the",
"rules",
"from",
"type_map",
"to",
"each",
"part"
] | def apply_regexp(cls, x, re_compiled):
indices = []
for m in re_compiled.finditer(str(x)):
indices.append(m.start())
indices.append(m.end())
if len(indices) == 0:
return x
shift = 0
if indices[0] != 0:
indices.insert(0, 0)
... | [
"def",
"apply_regexp",
"(",
"cls",
",",
"x",
",",
"re_compiled",
")",
":",
"indices",
"=",
"[",
"]",
"for",
"m",
"in",
"re_compiled",
".",
"finditer",
"(",
"str",
"(",
"x",
")",
")",
":",
"indices",
".",
"append",
"(",
"m",
".",
"start",
"(",
")"... | Splits string using regexp and applies the rules from type_map to each part | [
"Splits",
"string",
"using",
"regexp",
"and",
"applies",
"the",
"rules",
"from",
"type_map",
"to",
"each",
"part"
] | [
"'''\n Splits string using regexp and applies the rules from type_map to each part\n '''"
] | [
{
"param": "cls",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "re_compiled",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
efa7c8a10e5a64fa17dbc7db428ca71d33830176 | ravenscroftj/timetrack | timetrack/__init__.py | [
"MIT"
] | Python | update_entry | <not_specific> | def update_entry(self, entry_id, time):
"""Find an entry, update its time, rewrite file."""
# identify the line to be updated
line = int(entry_id) - 1
all_data = []
record = None
# read all the data from the log into memory
with open(self.track_file, "r") as f:... | Find an entry, update its time, rewrite file. | Find an entry, update its time, rewrite file. | [
"Find",
"an",
"entry",
"update",
"its",
"time",
"rewrite",
"file",
"."
] | def update_entry(self, entry_id, time):
line = int(entry_id) - 1
all_data = []
record = None
with open(self.track_file, "r") as f:
for lineno, x in enumerate(f):
if lineno != line:
all_data.append(x)
else:
... | [
"def",
"update_entry",
"(",
"self",
",",
"entry_id",
",",
"time",
")",
":",
"line",
"=",
"int",
"(",
"entry_id",
")",
"-",
"1",
"all_data",
"=",
"[",
"]",
"record",
"=",
"None",
"with",
"open",
"(",
"self",
".",
"track_file",
",",
"\"r\"",
")",
"as... | Find an entry, update its time, rewrite file. | [
"Find",
"an",
"entry",
"update",
"its",
"time",
"rewrite",
"file",
"."
] | [
"\"\"\"Find an entry, update its time, rewrite file.\"\"\"",
"# identify the line to be updated",
"# read all the data from the log into memory",
"# if after reading everything we didn't find the line, return error",
"# run live timer or parse updated time",
"# check time added was not less than 1 minute"... | [
{
"param": "self",
"type": null
},
{
"param": "entry_id",
"type": null
},
{
"param": "time",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry_id",
"type": null,
"docstring": null,
"docstring_tokens... |
efa7c8a10e5a64fa17dbc7db428ca71d33830176 | ravenscroftj/timetrack | timetrack/__init__.py | [
"MIT"
] | Python | parse_time | <not_specific> | def parse_time(time):
"""Given the time string, parse and turn into normalised minute count"""
if type(time) in [int,float]:
return time
if time.endswith('m'):
time = time[0:-1]
if time.find('h') != -1:
time = time.replace('h', ':')
if time.find(':') != -1:
hours,... | Given the time string, parse and turn into normalised minute count | Given the time string, parse and turn into normalised minute count | [
"Given",
"the",
"time",
"string",
"parse",
"and",
"turn",
"into",
"normalised",
"minute",
"count"
] | def parse_time(time):
if type(time) in [int,float]:
return time
if time.endswith('m'):
time = time[0:-1]
if time.find('h') != -1:
time = time.replace('h', ':')
if time.find(':') != -1:
hours, minutes = time.split(':')
if minutes.strip() == "":
minutes ... | [
"def",
"parse_time",
"(",
"time",
")",
":",
"if",
"type",
"(",
"time",
")",
"in",
"[",
"int",
",",
"float",
"]",
":",
"return",
"time",
"if",
"time",
".",
"endswith",
"(",
"'m'",
")",
":",
"time",
"=",
"time",
"[",
"0",
":",
"-",
"1",
"]",
"i... | Given the time string, parse and turn into normalised minute count | [
"Given",
"the",
"time",
"string",
"parse",
"and",
"turn",
"into",
"normalised",
"minute",
"count"
] | [
"\"\"\"Given the time string, parse and turn into normalised minute count\"\"\""
] | [
{
"param": "time",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "time",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
efa7c8a10e5a64fa17dbc7db428ca71d33830176 | ravenscroftj/timetrack | timetrack/__init__.py | [
"MIT"
] | Python | human_time | <not_specific> | def human_time(minutes):
"""Returns x hours y minutes for an input of minutes"""
minutes = int(minutes)
hours = minutes // 60
mins = minutes % 60
return "{}h{}m".format(hours, mins) | Returns x hours y minutes for an input of minutes | Returns x hours y minutes for an input of minutes | [
"Returns",
"x",
"hours",
"y",
"minutes",
"for",
"an",
"input",
"of",
"minutes"
] | def human_time(minutes):
minutes = int(minutes)
hours = minutes // 60
mins = minutes % 60
return "{}h{}m".format(hours, mins) | [
"def",
"human_time",
"(",
"minutes",
")",
":",
"minutes",
"=",
"int",
"(",
"minutes",
")",
"hours",
"=",
"minutes",
"//",
"60",
"mins",
"=",
"minutes",
"%",
"60",
"return",
"\"{}h{}m\"",
".",
"format",
"(",
"hours",
",",
"mins",
")"
] | Returns x hours y minutes for an input of minutes | [
"Returns",
"x",
"hours",
"y",
"minutes",
"for",
"an",
"input",
"of",
"minutes"
] | [
"\"\"\"Returns x hours y minutes for an input of minutes\"\"\""
] | [
{
"param": "minutes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "minutes",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
efa7c8a10e5a64fa17dbc7db428ca71d33830176 | ravenscroftj/timetrack | timetrack/__init__.py | [
"MIT"
] | Python | day_remainder | <not_specific> | def day_remainder(records, working_hours=10):
"""Calculate how much of your day is unspent"""
day_minutes = int(working_hours) * 60
total_spent = day_spent(records)
return day_minutes - total_spent | Calculate how much of your day is unspent | Calculate how much of your day is unspent | [
"Calculate",
"how",
"much",
"of",
"your",
"day",
"is",
"unspent"
] | def day_remainder(records, working_hours=10):
day_minutes = int(working_hours) * 60
total_spent = day_spent(records)
return day_minutes - total_spent | [
"def",
"day_remainder",
"(",
"records",
",",
"working_hours",
"=",
"10",
")",
":",
"day_minutes",
"=",
"int",
"(",
"working_hours",
")",
"*",
"60",
"total_spent",
"=",
"day_spent",
"(",
"records",
")",
"return",
"day_minutes",
"-",
"total_spent"
] | Calculate how much of your day is unspent | [
"Calculate",
"how",
"much",
"of",
"your",
"day",
"is",
"unspent"
] | [
"\"\"\"Calculate how much of your day is unspent\"\"\""
] | [
{
"param": "records",
"type": null
},
{
"param": "working_hours",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "records",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "working_hours",
"type": null,
"docstring": null,
"docstrin... |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | live_time | <not_specific> | def live_time(project):
"""Run a timer actively in the window"""
start = datetime.now()
print("Starting timer, press Ctrl + C at any time to end recording...")
running = True
widgets = ['Project:{} '.format(project), Timer(), '']
with ProgressBar(widgets=widgets) as pbar:
while(runni... | Run a timer actively in the window | Run a timer actively in the window | [
"Run",
"a",
"timer",
"actively",
"in",
"the",
"window"
] | def live_time(project):
start = datetime.now()
print("Starting timer, press Ctrl + C at any time to end recording...")
running = True
widgets = ['Project:{} '.format(project), Timer(), '']
with ProgressBar(widgets=widgets) as pbar:
while(running):
try:
time.sleep(... | [
"def",
"live_time",
"(",
"project",
")",
":",
"start",
"=",
"datetime",
".",
"now",
"(",
")",
"print",
"(",
"\"Starting timer, press Ctrl + C at any time to end recording...\"",
")",
"running",
"=",
"True",
"widgets",
"=",
"[",
"'Project:{} '",
".",
"format",
"(",... | Run a timer actively in the window | [
"Run",
"a",
"timer",
"actively",
"in",
"the",
"window"
] | [
"\"\"\"Run a timer actively in the window\"\"\""
] | [
{
"param": "project",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | autocomplete_projects | <not_specific> | def autocomplete_projects(ctx, args, incomplete):
"""Use the default driver to return a list of projects"""
if ctx.obj is None:
ctx.obj = init_context_obj()
driver = ctx.obj['DRIVER']
projects = driver.get_projects()
options = [p for p in projects if (len(incomplete)... | Use the default driver to return a list of projects | Use the default driver to return a list of projects | [
"Use",
"the",
"default",
"driver",
"to",
"return",
"a",
"list",
"of",
"projects"
] | def autocomplete_projects(ctx, args, incomplete):
if ctx.obj is None:
ctx.obj = init_context_obj()
driver = ctx.obj['DRIVER']
projects = driver.get_projects()
options = [p for p in projects if (len(incomplete) < 1) or (incomplete in p) ]
return [f'"{option}"' if " " in option else option fo... | [
"def",
"autocomplete_projects",
"(",
"ctx",
",",
"args",
",",
"incomplete",
")",
":",
"if",
"ctx",
".",
"obj",
"is",
"None",
":",
"ctx",
".",
"obj",
"=",
"init_context_obj",
"(",
")",
"driver",
"=",
"ctx",
".",
"obj",
"[",
"'DRIVER'",
"]",
"projects",
... | Use the default driver to return a list of projects | [
"Use",
"the",
"default",
"driver",
"to",
"return",
"a",
"list",
"of",
"projects"
] | [
"\"\"\"Use the default driver to return a list of projects\"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "incomplete",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": []... |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | add | null | def add(ctx, project, time, comment, date, task):
"""Add a time entry to a given project"""
driver = ctx.obj['DRIVER']
if time == "live":
time = live_time(project)
comment = " ".join(comment)
if date is None:
when = datetime.now()
else:
when = mome... | Add a time entry to a given project | Add a time entry to a given project | [
"Add",
"a",
"time",
"entry",
"to",
"a",
"given",
"project"
] | def add(ctx, project, time, comment, date, task):
driver = ctx.obj['DRIVER']
if time == "live":
time = live_time(project)
comment = " ".join(comment)
if date is None:
when = datetime.now()
else:
when = moment.date(date).datetime
print("Adding {} minutes to {} project".for... | [
"def",
"add",
"(",
"ctx",
",",
"project",
",",
"time",
",",
"comment",
",",
"date",
",",
"task",
")",
":",
"driver",
"=",
"ctx",
".",
"obj",
"[",
"'DRIVER'",
"]",
"if",
"time",
"==",
"\"live\"",
":",
"time",
"=",
"live_time",
"(",
"project",
")",
... | Add a time entry to a given project | [
"Add",
"a",
"time",
"entry",
"to",
"a",
"given",
"project"
] | [
"\"\"\"Add a time entry to a given project\"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "project",
"type": null
},
{
"param": "time",
"type": null
},
{
"param": "comment",
"type": null
},
{
"param": "date",
"type": null
},
{
"param": "task",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens":... |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | parse_time_args | <not_specific> | def parse_time_args(args):
""""Parse week or month args or uses today by default."""
if args.week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, start.day)
end_date = date(end.year, end.month, end.day)
el... | Parse week or month args or uses today by default. | Parse week or month args or uses today by default. | [
"Parse",
"week",
"or",
"month",
"args",
"or",
"uses",
"today",
"by",
"default",
"."
] | def parse_time_args(args):
if args.week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, start.day)
end_date = date(end.year, end.month, end.day)
elif args.month:
end = datetime.now()
delta = ti... | [
"def",
"parse_time_args",
"(",
"args",
")",
":",
"if",
"args",
".",
"week",
":",
"end",
"=",
"datetime",
".",
"now",
"(",
")",
"delta",
"=",
"timedelta",
"(",
"days",
"=",
"7",
")",
"start",
"=",
"end",
"-",
"delta",
"start_date",
"=",
"date",
"(",... | Parse week or month args or uses today by default. | [
"Parse",
"week",
"or",
"month",
"args",
"or",
"uses",
"today",
"by",
"default",
"."
] | [
"\"\"\"\"Parse week or month args or uses today by default.\"\"\""
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | append | null | def append(ctx, entry, time):
"""Append an amount of time to timetrack log"""
if time == "live":
time = live_time(f"Continuing work on entry {entry}")
print("Adding {} minutes to entry {}".format(parse_time(time), entry))
driver = ctx.obj['DRIVER']
driver.upda... | Append an amount of time to timetrack log | Append an amount of time to timetrack log | [
"Append",
"an",
"amount",
"of",
"time",
"to",
"timetrack",
"log"
] | def append(ctx, entry, time):
if time == "live":
time = live_time(f"Continuing work on entry {entry}")
print("Adding {} minutes to entry {}".format(parse_time(time), entry))
driver = ctx.obj['DRIVER']
driver.update_entry(entry, time) | [
"def",
"append",
"(",
"ctx",
",",
"entry",
",",
"time",
")",
":",
"if",
"time",
"==",
"\"live\"",
":",
"time",
"=",
"live_time",
"(",
"f\"Continuing work on entry {entry}\"",
")",
"print",
"(",
"\"Adding {} minutes to entry {}\"",
".",
"format",
"(",
"parse_time... | Append an amount of time to timetrack log | [
"Append",
"an",
"amount",
"of",
"time",
"to",
"timetrack",
"log"
] | [
"\"\"\"Append an amount of time to timetrack log\"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "entry",
"type": null
},
{
"param": "time",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | ls | null | def ls(ctx, project, week, month):
"""Show tasks recorded between a certain time period"""
driver = ctx.obj['DRIVER']
if week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, start.day)
end_date = date(en... | Show tasks recorded between a certain time period | Show tasks recorded between a certain time period | [
"Show",
"tasks",
"recorded",
"between",
"a",
"certain",
"time",
"period"
] | def ls(ctx, project, week, month):
driver = ctx.obj['DRIVER']
if week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, start.day)
end_date = date(end.year, end.month, end.day)
elif month:
end = date... | [
"def",
"ls",
"(",
"ctx",
",",
"project",
",",
"week",
",",
"month",
")",
":",
"driver",
"=",
"ctx",
".",
"obj",
"[",
"'DRIVER'",
"]",
"if",
"week",
":",
"end",
"=",
"datetime",
".",
"now",
"(",
")",
"delta",
"=",
"timedelta",
"(",
"days",
"=",
... | Show tasks recorded between a certain time period | [
"Show",
"tasks",
"recorded",
"between",
"a",
"certain",
"time",
"period"
] | [
"\"\"\"Show tasks recorded between a certain time period\"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "project",
"type": null
},
{
"param": "week",
"type": null
},
{
"param": "month",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens":... |
9fb56308354c5caf1608b33b18b5ac3dbd90a3b4 | ravenscroftj/timetrack | timetrack/cli.py | [
"MIT"
] | Python | report | <not_specific> | def report(ctx, week, month, graph, graph_type):
"""Summarise total time spent per project instead of per day"""
driver = ctx.obj['DRIVER']
if week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, st... | Summarise total time spent per project instead of per day | Summarise total time spent per project instead of per day | [
"Summarise",
"total",
"time",
"spent",
"per",
"project",
"instead",
"of",
"per",
"day"
] | def report(ctx, week, month, graph, graph_type):
driver = ctx.obj['DRIVER']
if week:
end = datetime.now()
delta = timedelta(days=7)
start = end - delta
start_date = date(start.year, start.month, start.day)
end_date = date(end.year, end.month, end.day)
elif month:
... | [
"def",
"report",
"(",
"ctx",
",",
"week",
",",
"month",
",",
"graph",
",",
"graph_type",
")",
":",
"driver",
"=",
"ctx",
".",
"obj",
"[",
"'DRIVER'",
"]",
"if",
"week",
":",
"end",
"=",
"datetime",
".",
"now",
"(",
")",
"delta",
"=",
"timedelta",
... | Summarise total time spent per project instead of per day | [
"Summarise",
"total",
"time",
"spent",
"per",
"project",
"instead",
"of",
"per",
"day"
] | [
"\"\"\"Summarise total time spent per project instead of per day\"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "week",
"type": null
},
{
"param": "month",
"type": null
},
{
"param": "graph",
"type": null
},
{
"param": "graph_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "week",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_from_blob | io.BytesIO | def read_from_blob(self, file_name) -> io.BytesIO:
"""
reads the file_name from blob
and returns ByteIO
"""
try:
# Get a client to interact with the specified blob.
blob_client = self.blob_service_client_for_metadata.get_blob_client(
contai... |
reads the file_name from blob
and returns ByteIO
| reads the file_name from blob
and returns ByteIO | [
"reads",
"the",
"file_name",
"from",
"blob",
"and",
"returns",
"ByteIO"
] | def read_from_blob(self, file_name) -> io.BytesIO:
try:
blob_client = self.blob_service_client_for_metadata.get_blob_client(
container=self.connect_info["metadata_container_name"],
blob=file_name
)
download_stream = blob_client.download_blob()
... | [
"def",
"read_from_blob",
"(",
"self",
",",
"file_name",
")",
"->",
"io",
".",
"BytesIO",
":",
"try",
":",
"blob_client",
"=",
"self",
".",
"blob_service_client_for_metadata",
".",
"get_blob_client",
"(",
"container",
"=",
"self",
".",
"connect_info",
"[",
"\"m... | reads the file_name from blob
and returns ByteIO | [
"reads",
"the",
"file_name",
"from",
"blob",
"and",
"returns",
"ByteIO"
] | [
"\"\"\"\n reads the file_name from blob\n and returns ByteIO\n \"\"\"",
"# Get a client to interact with the specified blob.",
"# Downloads a blob to the StorageStreamDownloader",
"# to read all the content to bytesIO"
] | [
{
"param": "self",
"type": null
},
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_token... |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_json_metadata_from_blob | dict | def read_json_metadata_from_blob(self, json_file) -> dict:
"""
read json file from blob storage
and return dict object
"""
try:
json_buffer = self.read_from_blob(json_file)
# return json.loads(json_content)
return self.get_dict_from_json(json_b... |
read json file from blob storage
and return dict object
| read json file from blob storage
and return dict object | [
"read",
"json",
"file",
"from",
"blob",
"storage",
"and",
"return",
"dict",
"object"
] | def read_json_metadata_from_blob(self, json_file) -> dict:
try:
json_buffer = self.read_from_blob(json_file)
return self.get_dict_from_json(json_buffer)
except Exception as err:
logger.error("%s: %s", type(err), err)
return {} | [
"def",
"read_json_metadata_from_blob",
"(",
"self",
",",
"json_file",
")",
"->",
"dict",
":",
"try",
":",
"json_buffer",
"=",
"self",
".",
"read_from_blob",
"(",
"json_file",
")",
"return",
"self",
".",
"get_dict_from_json",
"(",
"json_buffer",
")",
"except",
... | read json file from blob storage
and return dict object | [
"read",
"json",
"file",
"from",
"blob",
"storage",
"and",
"return",
"dict",
"object"
] | [
"\"\"\"\n read json file from blob storage\n and return dict object\n \"\"\"",
"# return json.loads(json_content)"
] | [
{
"param": "self",
"type": null
},
{
"param": "json_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json_file",
"type": null,
"docstring": null,
"docstring_token... |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_all_datastream2_fields_metadata | dict | def read_all_datastream2_fields_metadata(self) -> dict:
"""
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob storage and returns the dict
"""
return self.read_json_metadata_from_blob(
self.input_config... |
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob storage and returns the dict
| reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob storage and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_all_datastream2_fields_metadata(self) -> dict:
return self.read_json_metadata_from_blob(
self.input_configs["all_datastream2_fields"]
) | [
"def",
"read_all_datastream2_fields_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_blob",
"(",
"self",
".",
"input_configs",
"[",
"\"all_datastream2_fields\"",
"]",
")"
] | reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob storage and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_datastream2_fields.json file,\n containing all the dataset fields avaiable in datastream,\n from blob storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_all_custom_functions_metadata | dict | def read_all_custom_functions_metadata(self) -> dict:
"""
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from blob storage and returns the dict
"""
return self.read_json_metadata_from_blob(
self.inp... |
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from blob storage and returns the dict
| reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from blob storage and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_all_custom_functions_metadata(self) -> dict:
return self.read_json_metadata_from_blob(
self.input_configs["all_custom_functions"]
) | [
"def",
"read_all_custom_functions_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_blob",
"(",
"self",
".",
"input_configs",
"[",
"\"all_custom_functions\"",
"]",
")"
] | reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from blob storage and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_custom_functions.json file,\n containing all the aggregate functions avaiable for datastream fields,\n from blob storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_stream_metadata | dict | def read_stream_metadata(self) -> dict:
"""
reads stream.json file,
containing stream specific details,
from blob storage and returns the dict
"""
# TODO: add info
return self.read_json_metadata_from_blob(self.input_configs["stream_file"]) |
reads stream.json file,
containing stream specific details,
from blob storage and returns the dict
| reads stream.json file,
containing stream specific details,
from blob storage and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_stream_metadata(self) -> dict:
return self.read_json_metadata_from_blob(self.input_configs["stream_file"]) | [
"def",
"read_stream_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_blob",
"(",
"self",
".",
"input_configs",
"[",
"\"stream_file\"",
"]",
")"
] | reads stream.json file,
containing stream specific details,
from blob storage and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads stream.json file,\n containing stream specific details,\n from blob storage and returns the dict\n \"\"\"",
"# TODO: add info"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_provision_metadata | dict | def read_provision_metadata(self) -> dict:
"""
reads provision.json file,
containing the selected aggregate functions,
from blob storage and returns the dict
"""
return self.read_json_metadata_from_blob(self.input_configs["provision_file"]) |
reads provision.json file,
containing the selected aggregate functions,
from blob storage and returns the dict
| reads provision.json file,
containing the selected aggregate functions,
from blob storage and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_provision_metadata(self) -> dict:
return self.read_json_metadata_from_blob(self.input_configs["provision_file"]) | [
"def",
"read_provision_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_blob",
"(",
"self",
".",
"input_configs",
"[",
"\"provision_file\"",
"]",
")"
] | reads provision.json file,
containing the selected aggregate functions,
from blob storage and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"blob",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads provision.json file,\n containing the selected aggregate functions,\n from blob storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b8f9cd8b1566d1aac6fefab4ab7d85134167791 | akamai/datastream-tools | cloud_modules_azure/utils.py | [
"Apache-2.0"
] | Python | read_data_file_from_azure_blob | <not_specific> | def read_data_file_from_azure_blob(
self, filename, file_format, chosen_field_names, custom_columns
):
"""
reads data file from azure blob store
and returns pandas dataframe
"""
data_buffer = self.get_bytes_io_buffer(filename.read())
return self.read_data_fi... |
reads data file from azure blob store
and returns pandas dataframe
| reads data file from azure blob store
and returns pandas dataframe | [
"reads",
"data",
"file",
"from",
"azure",
"blob",
"store",
"and",
"returns",
"pandas",
"dataframe"
] | def read_data_file_from_azure_blob(
self, filename, file_format, chosen_field_names, custom_columns
):
data_buffer = self.get_bytes_io_buffer(filename.read())
return self.read_data_file(
data_buffer, file_format, chosen_field_names, custom_columns
) | [
"def",
"read_data_file_from_azure_blob",
"(",
"self",
",",
"filename",
",",
"file_format",
",",
"chosen_field_names",
",",
"custom_columns",
")",
":",
"data_buffer",
"=",
"self",
".",
"get_bytes_io_buffer",
"(",
"filename",
".",
"read",
"(",
")",
")",
"return",
... | reads data file from azure blob store
and returns pandas dataframe | [
"reads",
"data",
"file",
"from",
"azure",
"blob",
"store",
"and",
"returns",
"pandas",
"dataframe"
] | [
"\"\"\"\n reads data file from azure blob store\n and returns pandas dataframe\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "file_format",
"type": null
},
{
"param": "chosen_field_names",
"type": null
},
{
"param": "custom_columns",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
b16299a04b2a33136b043c377f163c69a5f5769b | akamai/datastream-tools | frontend_modules/provision_ui/create_provision_json.py | [
"Apache-2.0"
] | Python | write_provision_to_file | null | def write_provision_to_file(request, aggregator_obj, fields):
"""
writes the selected info to provision_file
"""
provision_file = "provision.json"
try:
aggregator_obj.cloud_storage_object.upload_file(
provision_file, json.dumps(fields, indent=4).encode("utf-8")
)
... |
writes the selected info to provision_file
| writes the selected info to provision_file | [
"writes",
"the",
"selected",
"info",
"to",
"provision_file"
] | def write_provision_to_file(request, aggregator_obj, fields):
provision_file = "provision.json"
try:
aggregator_obj.cloud_storage_object.upload_file(
provision_file, json.dumps(fields, indent=4).encode("utf-8")
)
messages.success(request, f"updated provision file: {provision_... | [
"def",
"write_provision_to_file",
"(",
"request",
",",
"aggregator_obj",
",",
"fields",
")",
":",
"provision_file",
"=",
"\"provision.json\"",
"try",
":",
"aggregator_obj",
".",
"cloud_storage_object",
".",
"upload_file",
"(",
"provision_file",
",",
"json",
".",
"du... | writes the selected info to provision_file | [
"writes",
"the",
"selected",
"info",
"to",
"provision_file"
] | [
"\"\"\"\n writes the selected info to provision_file\n \"\"\""
] | [
{
"param": "request",
"type": null
},
{
"param": "aggregator_obj",
"type": null
},
{
"param": "fields",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aggregator_obj",
"type": null,
"docstring": null,
"docstri... |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | upload_file | null | def upload_file(self, filename, data):
"""
write binary file to config directory
"""
try:
with open(os.path.join(self.config_dir, filename), "wb") as file_writer:
file_writer.write(data)
logger.debug("write success for file: %s", filename)
... |
write binary file to config directory
| write binary file to config directory | [
"write",
"binary",
"file",
"to",
"config",
"directory"
] | def upload_file(self, filename, data):
try:
with open(os.path.join(self.config_dir, filename), "wb") as file_writer:
file_writer.write(data)
logger.debug("write success for file: %s", filename)
except Exception as err:
logger.error("write failed for fi... | [
"def",
"upload_file",
"(",
"self",
",",
"filename",
",",
"data",
")",
":",
"try",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config_dir",
",",
"filename",
")",
",",
"\"wb\"",
")",
"as",
"file_writer",
":",
"file_writ... | write binary file to config directory | [
"write",
"binary",
"file",
"to",
"config",
"directory"
] | [
"\"\"\"\n write binary file to config directory\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_json_file_to_dict | dict | def read_json_file_to_dict(self, file_to_read: str) -> dict:
"""
Parse a JSON file and returns dict
"""
try:
with io.open(file_to_read, "rb") as json_file_reader:
return self.get_dict_from_json(json_file_reader)
except Exception as err:
lo... |
Parse a JSON file and returns dict
| Parse a JSON file and returns dict | [
"Parse",
"a",
"JSON",
"file",
"and",
"returns",
"dict"
] | def read_json_file_to_dict(self, file_to_read: str) -> dict:
try:
with io.open(file_to_read, "rb") as json_file_reader:
return self.get_dict_from_json(json_file_reader)
except Exception as err:
logger.error("parsing failed for json file: %s", file_to_read)
... | [
"def",
"read_json_file_to_dict",
"(",
"self",
",",
"file_to_read",
":",
"str",
")",
"->",
"dict",
":",
"try",
":",
"with",
"io",
".",
"open",
"(",
"file_to_read",
",",
"\"rb\"",
")",
"as",
"json_file_reader",
":",
"return",
"self",
".",
"get_dict_from_json",... | Parse a JSON file and returns dict | [
"Parse",
"a",
"JSON",
"file",
"and",
"returns",
"dict"
] | [
"\"\"\"\n Parse a JSON file and returns dict\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_to_read",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_to_read",
"type": "str",
"docstring": null,
"docstring_t... |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_all_datastream2_fields_metadata | dict | def read_all_datastream2_fields_metadata(self) -> dict:
"""
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from local disk and returns the dict
"""
if "all_datastream2_fields" in self.input_configs:
return sel... |
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from local disk and returns the dict
| reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from local disk and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | def read_all_datastream2_fields_metadata(self) -> dict:
if "all_datastream2_fields" in self.input_configs:
return self.read_json_file_to_dict(
os.path.join(
self.config_dir, self.input_configs["all_datastream2_fields"]
)
)
retur... | [
"def",
"read_all_datastream2_fields_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"if",
"\"all_datastream2_fields\"",
"in",
"self",
".",
"input_configs",
":",
"return",
"self",
".",
"read_json_file_to_dict",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".... | reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from local disk and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_datastream2_fields.json file,\n containing all the dataset fields avaiable in datastream,\n from local disk and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_all_custom_functions_metadata | dict | def read_all_custom_functions_metadata(self) -> dict:
"""
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from local disk and returns the dict
"""
if "all_custom_functions" in self.input_configs:
ret... |
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from local disk and returns the dict
| reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from local disk and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | def read_all_custom_functions_metadata(self) -> dict:
if "all_custom_functions" in self.input_configs:
return self.read_json_file_to_dict(
os.path.join(
self.config_dir, self.input_configs["all_custom_functions"]
)
)
return {} | [
"def",
"read_all_custom_functions_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"if",
"\"all_custom_functions\"",
"in",
"self",
".",
"input_configs",
":",
"return",
"self",
".",
"read_json_file_to_dict",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
... | reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from local disk and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_custom_functions.json file,\n containing all the aggregate functions avaiable for datastream fields,\n from local disk and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_stream_metadata | dict | def read_stream_metadata(self) -> dict:
"""
reads stream.json file,
containing stream specific details,
from local disk and returns the dict
"""
if "stream_file" in self.input_configs:
return self.read_json_file_to_dict(
os.path.join(self.confi... |
reads stream.json file,
containing stream specific details,
from local disk and returns the dict
| reads stream.json file,
containing stream specific details,
from local disk and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | def read_stream_metadata(self) -> dict:
if "stream_file" in self.input_configs:
return self.read_json_file_to_dict(
os.path.join(self.config_dir,
self.input_configs["stream_file"])
)
return {} | [
"def",
"read_stream_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"if",
"\"stream_file\"",
"in",
"self",
".",
"input_configs",
":",
"return",
"self",
".",
"read_json_file_to_dict",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config_dir",
",",
... | reads stream.json file,
containing stream specific details,
from local disk and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads stream.json file,\n containing stream specific details,\n from local disk and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_provision_metadata | dict | def read_provision_metadata(self) -> dict:
"""
reads provision.json file,
containing the selected aggregate functions,
from local disk and returns the dict
"""
if "provision_file" in self.input_configs:
return self.read_json_file_to_dict(
os.pa... |
reads provision.json file,
containing the selected aggregate functions,
from local disk and returns the dict
| reads provision.json file,
containing the selected aggregate functions,
from local disk and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | def read_provision_metadata(self) -> dict:
if "provision_file" in self.input_configs:
return self.read_json_file_to_dict(
os.path.join(self.config_dir,
self.input_configs["provision_file"])
)
return {} | [
"def",
"read_provision_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"if",
"\"provision_file\"",
"in",
"self",
".",
"input_configs",
":",
"return",
"self",
".",
"read_json_file_to_dict",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config_dir",
... | reads provision.json file,
containing the selected aggregate functions,
from local disk and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"local",
"disk",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads provision.json file,\n containing the selected aggregate functions,\n from local disk and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f995107f1fa3d4d72c2d4bb50576a150e4419c7a | akamai/datastream-tools | aggregation_modules/utils.py | [
"Apache-2.0"
] | Python | read_data_file | pd.DataFrame | def read_data_file(
self, filename_or_buffer, file_format, chosen_field_names, custom_field_names
) -> pd.DataFrame:
"""
reads the content from the provided filename or iobuffer
and returns pandas dataframe
"""
output_dataframe = None
logger.debug("all column... |
reads the content from the provided filename or iobuffer
and returns pandas dataframe
| reads the content from the provided filename or iobuffer
and returns pandas dataframe | [
"reads",
"the",
"content",
"from",
"the",
"provided",
"filename",
"or",
"iobuffer",
"and",
"returns",
"pandas",
"dataframe"
] | def read_data_file(
self, filename_or_buffer, file_format, chosen_field_names, custom_field_names
) -> pd.DataFrame:
output_dataframe = None
logger.debug("all columns in the input file... \n%s",
chosen_field_names)
logger.debug("columns needed for aggregation... ... | [
"def",
"read_data_file",
"(",
"self",
",",
"filename_or_buffer",
",",
"file_format",
",",
"chosen_field_names",
",",
"custom_field_names",
")",
"->",
"pd",
".",
"DataFrame",
":",
"output_dataframe",
"=",
"None",
"logger",
".",
"debug",
"(",
"\"all columns in the inp... | reads the content from the provided filename or iobuffer
and returns pandas dataframe | [
"reads",
"the",
"content",
"from",
"the",
"provided",
"filename",
"or",
"iobuffer",
"and",
"returns",
"pandas",
"dataframe"
] | [
"\"\"\"\n reads the content from the provided filename or iobuffer\n and returns pandas dataframe\n \"\"\"",
"# check if read properly"
] | [
{
"param": "self",
"type": null
},
{
"param": "filename_or_buffer",
"type": null
},
{
"param": "file_format",
"type": null
},
{
"param": "chosen_field_names",
"type": null
},
{
"param": "custom_field_names",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename_or_buffer",
"type": null,
"docstring": null,
"docstr... |
43ccee591b4e4b9180421f50a22917334564aeaa | akamai/datastream-tools | run_aggregations.py | [
"Apache-2.0"
] | Python | parse_inputs | dict | def parse_inputs() -> dict:
"""
parse the input command line arguments
and return dictionary
"""
# TODO: add details of the code functionality
parser = argparse.ArgumentParser(
prog=__file__,
formatter_class=argparse.RawTextHelpFormatter,
description=textwrap.dedent(
... |
parse the input command line arguments
and return dictionary
| parse the input command line arguments
and return dictionary | [
"parse",
"the",
"input",
"command",
"line",
"arguments",
"and",
"return",
"dictionary"
] | def parse_inputs() -> dict:
parser = argparse.ArgumentParser(
prog=__file__,
formatter_class=argparse.RawTextHelpFormatter,
description=textwrap.dedent(
"""\
Helps aggregate data
"""
),
)
parser.add_argument(
"--loglevel",
d... | [
"def",
"parse_inputs",
"(",
")",
"->",
"dict",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"__file__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
",",
"description",
"=",
"textwrap",
".",
"dedent",
"(",
... | parse the input command line arguments
and return dictionary | [
"parse",
"the",
"input",
"command",
"line",
"arguments",
"and",
"return",
"dictionary"
] | [
"\"\"\"\n parse the input command line arguments\n and return dictionary\n \"\"\"",
"# TODO: add details of the code functionality"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
963a36fd91e5ee749d06fd251bdae7cceae95f9e | akamai/datastream-tools | aggregation_modules/stream_parser.py | [
"Apache-2.0"
] | Python | populate_fields | null | def populate_fields(self, stream_buffer, all_ds_fields):
"""
sets self.__chosen_fields containing the dataset ids
and name for the particular stream
"""
try:
self.stream_activation_status = stream_buffer.get(
"activationStatus")
if "config"... |
sets self.__chosen_fields containing the dataset ids
and name for the particular stream
| sets self.__chosen_fields containing the dataset ids
and name for the particular stream | [
"sets",
"self",
".",
"__chosen_fields",
"containing",
"the",
"dataset",
"ids",
"and",
"name",
"for",
"the",
"particular",
"stream"
] | def populate_fields(self, stream_buffer, all_ds_fields):
try:
self.stream_activation_status = stream_buffer.get(
"activationStatus")
if "config" in stream_buffer:
self.stream_format = stream_buffer["config"].get("format")
self.delimiter = s... | [
"def",
"populate_fields",
"(",
"self",
",",
"stream_buffer",
",",
"all_ds_fields",
")",
":",
"try",
":",
"self",
".",
"stream_activation_status",
"=",
"stream_buffer",
".",
"get",
"(",
"\"activationStatus\"",
")",
"if",
"\"config\"",
"in",
"stream_buffer",
":",
... | sets self.__chosen_fields containing the dataset ids
and name for the particular stream | [
"sets",
"self",
".",
"__chosen_fields",
"containing",
"the",
"dataset",
"ids",
"and",
"name",
"for",
"the",
"particular",
"stream"
] | [
"\"\"\"\n sets self.__chosen_fields containing the dataset ids\n and name for the particular stream\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stream_buffer",
"type": null
},
{
"param": "all_ds_fields",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stream_buffer",
"type": null,
"docstring": null,
"docstring_t... |
66978df60da44d0ac052bad086845556ab181111 | akamai/datastream-tools | aggregation_modules/provision_parser.py | [
"Apache-2.0"
] | Python | populate_fields | null | def populate_fields(self, provbuffer, all_custom_functions):
"""
sets the following args by reading the provbuffer
self.fields_to_aggregate containing the dataset fields that are needed to calculate basic aggregations
and self.custom_functions containing the enabled list of custom fuctio... |
sets the following args by reading the provbuffer
self.fields_to_aggregate containing the dataset fields that are needed to calculate basic aggregations
and self.custom_functions containing the enabled list of custom fuctions
| sets the following args by reading the provbuffer
self.fields_to_aggregate containing the dataset fields that are needed to calculate basic aggregations
and self.custom_functions containing the enabled list of custom fuctions | [
"sets",
"the",
"following",
"args",
"by",
"reading",
"the",
"provbuffer",
"self",
".",
"fields_to_aggregate",
"containing",
"the",
"dataset",
"fields",
"that",
"are",
"needed",
"to",
"calculate",
"basic",
"aggregations",
"and",
"self",
".",
"custom_functions",
"co... | def populate_fields(self, provbuffer, all_custom_functions):
logger.debug(f"all_custom_functions: {all_custom_functions}")
self.__data = {k.lower(): v for k, v in provbuffer.items()}
for func_name in self.__data.keys():
if func_name not in ["custom-functions", "aggregation-interval"]... | [
"def",
"populate_fields",
"(",
"self",
",",
"provbuffer",
",",
"all_custom_functions",
")",
":",
"logger",
".",
"debug",
"(",
"f\"all_custom_functions: {all_custom_functions}\"",
")",
"self",
".",
"__data",
"=",
"{",
"k",
".",
"lower",
"(",
")",
":",
"v",
"for... | sets the following args by reading the provbuffer
self.fields_to_aggregate containing the dataset fields that are needed to calculate basic aggregations
and self.custom_functions containing the enabled list of custom fuctions | [
"sets",
"the",
"following",
"args",
"by",
"reading",
"the",
"provbuffer",
"self",
".",
"fields_to_aggregate",
"containing",
"the",
"dataset",
"fields",
"that",
"are",
"needed",
"to",
"calculate",
"basic",
"aggregations",
"and",
"self",
".",
"custom_functions",
"co... | [
"\"\"\"\n sets the following args by reading the provbuffer\n self.fields_to_aggregate containing the dataset fields that are needed to calculate basic aggregations\n and self.custom_functions containing the enabled list of custom fuctions\n \"\"\"",
"# read provision file",
"# const... | [
{
"param": "self",
"type": null
},
{
"param": "provbuffer",
"type": null
},
{
"param": "all_custom_functions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "provbuffer",
"type": null,
"docstring": null,
"docstring_toke... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | parse_inputs | dict | def parse_inputs() -> dict:
"""
parse the input command line arguments
and return dictionary
"""
parser = argparse.ArgumentParser(
prog="loadtoathena.py",
formatter_class=argparse.RawTextHelpFormatter,
description=textwrap.dedent(
"""\
Helps setting u... |
parse the input command line arguments
and return dictionary
| parse the input command line arguments
and return dictionary | [
"parse",
"the",
"input",
"command",
"line",
"arguments",
"and",
"return",
"dictionary"
] | def parse_inputs() -> dict:
parser = argparse.ArgumentParser(
prog="loadtoathena.py",
formatter_class=argparse.RawTextHelpFormatter,
description=textwrap.dedent(
"""\
Helps setting up the athena database, table and view
that in turn helps to query the Data... | [
"def",
"parse_inputs",
"(",
")",
"->",
"dict",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"loadtoathena.py\"",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
",",
"description",
"=",
"textwrap",
".",
"dedent... | parse the input command line arguments
and return dictionary | [
"parse",
"the",
"input",
"command",
"line",
"arguments",
"and",
"return",
"dictionary"
] | [
"\"\"\"\n parse the input command line arguments\n and return dictionary\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | parse_json | dict | def parse_json(file_to_read: str) -> dict:
"""
Parse a JSON file and returns dict
"""
json_data = {}
try:
with open(file_to_read, "r", encoding="UTF-8") as json_file_reader:
json_data = json.load(json_file_reader)
except Exception as err:
logger.error("parsing failed... |
Parse a JSON file and returns dict
| Parse a JSON file and returns dict | [
"Parse",
"a",
"JSON",
"file",
"and",
"returns",
"dict"
] | def parse_json(file_to_read: str) -> dict:
json_data = {}
try:
with open(file_to_read, "r", encoding="UTF-8") as json_file_reader:
json_data = json.load(json_file_reader)
except Exception as err:
logger.error("parsing failed for json file: %s", file_to_read)
logger.error(... | [
"def",
"parse_json",
"(",
"file_to_read",
":",
"str",
")",
"->",
"dict",
":",
"json_data",
"=",
"{",
"}",
"try",
":",
"with",
"open",
"(",
"file_to_read",
",",
"\"r\"",
",",
"encoding",
"=",
"\"UTF-8\"",
")",
"as",
"json_file_reader",
":",
"json_data",
"... | Parse a JSON file and returns dict | [
"Parse",
"a",
"JSON",
"file",
"and",
"returns",
"dict"
] | [
"\"\"\"\n Parse a JSON file and returns dict\n \"\"\""
] | [
{
"param": "file_to_read",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_to_read",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | attach_policy_to_user | null | def attach_policy_to_user(iamclient, user_name, policy_arn):
"""
Attaches a policy to a user.
:param user_name: The name of the user.
:param policy_arn: The Amazon Resource Name (ARN) of the policy.
"""
# TODO:
# check if this is needed
# and to be improved accordingly
try:
i... |
Attaches a policy to a user.
:param user_name: The name of the user.
:param policy_arn: The Amazon Resource Name (ARN) of the policy.
| Attaches a policy to a user. | [
"Attaches",
"a",
"policy",
"to",
"a",
"user",
"."
] | def attach_policy_to_user(iamclient, user_name, policy_arn):
try:
iamclient.User(user_name).attach_policy(PolicyArn=policy_arn)
logger.info("Attached policy %s to user %s.", policy_arn, user_name)
except ClientError:
logger.warning("Couldn't attach policy %s to user %s.",
... | [
"def",
"attach_policy_to_user",
"(",
"iamclient",
",",
"user_name",
",",
"policy_arn",
")",
":",
"try",
":",
"iamclient",
".",
"User",
"(",
"user_name",
")",
".",
"attach_policy",
"(",
"PolicyArn",
"=",
"policy_arn",
")",
"logger",
".",
"info",
"(",
"\"Attac... | Attaches a policy to a user. | [
"Attaches",
"a",
"policy",
"to",
"a",
"user",
"."
] | [
"\"\"\"\n Attaches a policy to a user.\n :param user_name: The name of the user.\n :param policy_arn: The Amazon Resource Name (ARN) of the policy.\n \"\"\"",
"# TODO:",
"# check if this is needed",
"# and to be improved accordingly"
] | [
{
"param": "iamclient",
"type": null
},
{
"param": "user_name",
"type": null
},
{
"param": "policy_arn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iamclient",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_name",
"type": null,
"docstring": "The name of the user."... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | create_datacatalog | <not_specific> | def create_datacatalog(glue_client):
"""
used to create a data catalog
"""
# TODO:
# check if this is needed
# and to be improved accordingly
response = glue_client.create_data_catalog(
Name="string",
Type="LAMBDA" | "GLUE" | "HIVE",
Description="Test catalog",
... |
used to create a data catalog
| used to create a data catalog | [
"used",
"to",
"create",
"a",
"data",
"catalog"
] | def create_datacatalog(glue_client):
response = glue_client.create_data_catalog(
Name="string",
Type="LAMBDA" | "GLUE" | "HIVE",
Description="Test catalog",
Parameters={"string": "string"},
Tags=[
{"Key": "string", "Value": "string"},
],
)
return r... | [
"def",
"create_datacatalog",
"(",
"glue_client",
")",
":",
"response",
"=",
"glue_client",
".",
"create_data_catalog",
"(",
"Name",
"=",
"\"string\"",
",",
"Type",
"=",
"\"LAMBDA\"",
"|",
"\"GLUE\"",
"|",
"\"HIVE\"",
",",
"Description",
"=",
"\"Test catalog\"",
... | used to create a data catalog | [
"used",
"to",
"create",
"a",
"data",
"catalog"
] | [
"\"\"\"\n used to create a data catalog\n \"\"\"",
"# TODO:",
"# check if this is needed",
"# and to be improved accordingly"
] | [
{
"param": "glue_client",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "glue_client",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | create_s3_bucket | None | def create_s3_bucket(dryrun: bool, bucket_name: str, bucket_region: str) -> None:
"""
Create a bucket.
If the bucket already exists and you have access to it, no bucket will be created.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Bucket.create
"""
logg... |
Create a bucket.
If the bucket already exists and you have access to it, no bucket will be created.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Bucket.create
| Create a bucket.
If the bucket already exists and you have access to it, no bucket will be created.
| [
"Create",
"a",
"bucket",
".",
"If",
"the",
"bucket",
"already",
"exists",
"and",
"you",
"have",
"access",
"to",
"it",
"no",
"bucket",
"will",
"be",
"created",
"."
] | def create_s3_bucket(dryrun: bool, bucket_name: str, bucket_region: str) -> None:
logger.info("creating bucket %s in region %s", bucket_name, bucket_region)
if dryrun:
logger.info("in dry run mode.. not running!")
return
response = ""
try:
s3client = boto3.client("s3", region_nam... | [
"def",
"create_s3_bucket",
"(",
"dryrun",
":",
"bool",
",",
"bucket_name",
":",
"str",
",",
"bucket_region",
":",
"str",
")",
"->",
"None",
":",
"logger",
".",
"info",
"(",
"\"creating bucket %s in region %s\"",
",",
"bucket_name",
",",
"bucket_region",
")",
"... | Create a bucket. | [
"Create",
"a",
"bucket",
"."
] | [
"\"\"\"\n Create a bucket.\n If the bucket already exists and you have access to it, no bucket will be created.\n\n https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Bucket.create\n \"\"\"",
"# check if the bucket exists and we have access to it or None.",
"# To c... | [
{
"param": "dryrun",
"type": "bool"
},
{
"param": "bucket_name",
"type": "str"
},
{
"param": "bucket_region",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dryrun",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket_name",
"type": "str",
"docstring": null,
"docstrin... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | create_athena_database | None | def create_athena_database(
dryrun: bool, bucket_region: str, db_name: str, rslt_config: dict
) -> None:
"""
Creates the database if it doesn't exists in Athena
"""
logger.info("creating database: %s", db_name)
# Construct create database string
query_str = f"CREATE DATABASE IF NOT EXISTS `... |
Creates the database if it doesn't exists in Athena
| Creates the database if it doesn't exists in Athena | [
"Creates",
"the",
"database",
"if",
"it",
"doesn",
"'",
"t",
"exists",
"in",
"Athena"
] | def create_athena_database(
dryrun: bool, bucket_region: str, db_name: str, rslt_config: dict
) -> None:
logger.info("creating database: %s", db_name)
query_str = f"CREATE DATABASE IF NOT EXISTS `{db_name}` "
query_str += "\n COMMENT 'Database to store Athena query results'"
query_exec_context = {"... | [
"def",
"create_athena_database",
"(",
"dryrun",
":",
"bool",
",",
"bucket_region",
":",
"str",
",",
"db_name",
":",
"str",
",",
"rslt_config",
":",
"dict",
")",
"->",
"None",
":",
"logger",
".",
"info",
"(",
"\"creating database: %s\"",
",",
"db_name",
")",
... | Creates the database if it doesn't exists in Athena | [
"Creates",
"the",
"database",
"if",
"it",
"doesn",
"'",
"t",
"exists",
"in",
"Athena"
] | [
"\"\"\"\n Creates the database if it doesn't exists in Athena\n \"\"\"",
"# Construct create database string"
] | [
{
"param": "dryrun",
"type": "bool"
},
{
"param": "bucket_region",
"type": "str"
},
{
"param": "db_name",
"type": "str"
},
{
"param": "rslt_config",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dryrun",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket_region",
"type": "str",
"docstring": null,
"docstr... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | construct_query | str | def construct_query(params: dict, field_info: dict) -> str:
"""
returns the formatted create table statement.
"""
query_str = "CREATE EXTERNAL TABLE IF NOT EXISTS "
# concatenate table name
query_str += f'`{params["db_name"]}`.`{params["table_name"]}` ('
# concatenate table columns
quer... |
returns the formatted create table statement.
| returns the formatted create table statement. | [
"returns",
"the",
"formatted",
"create",
"table",
"statement",
"."
] | def construct_query(params: dict, field_info: dict) -> str:
query_str = "CREATE EXTERNAL TABLE IF NOT EXISTS "
query_str += f'`{params["db_name"]}`.`{params["table_name"]}` ('
query_str += "\n "
query_str += get_table_cols(
params["input"]["datasetids"], field_info, params["input"]["data_format"... | [
"def",
"construct_query",
"(",
"params",
":",
"dict",
",",
"field_info",
":",
"dict",
")",
"->",
"str",
":",
"query_str",
"=",
"\"CREATE EXTERNAL TABLE IF NOT EXISTS \"",
"query_str",
"+=",
"f'`{params[\"db_name\"]}`.`{params[\"table_name\"]}` ('",
"query_str",
"+=",
"\"\... | returns the formatted create table statement. | [
"returns",
"the",
"formatted",
"create",
"table",
"statement",
"."
] | [
"\"\"\"\n returns the formatted create table statement.\n \"\"\"",
"# concatenate table name",
"# concatenate table columns",
"# set ROW FORMAT",
"# https://docs.aws.amazon.com/athena/latest/ug/csv-serde.html",
"# space-seperated",
"# double quoted strings",
"# escape charater: \\\\",
"# custo... | [
{
"param": "params",
"type": "dict"
},
{
"param": "field_info",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "params",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field_info",
"type": "dict",
"docstring": null,
"docstrin... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | create_athena_table | None | def create_athena_table(params: dict, field_info: dict) -> None:
"""
Creates the table if it doesn't exist in Athena
"""
logger.info("creating table: `%s`.`%s`",
params["db_name"], params["table_name"])
query_exec_context = {
"Database": params["db_name"],
"Catalog":... |
Creates the table if it doesn't exist in Athena
| Creates the table if it doesn't exist in Athena | [
"Creates",
"the",
"table",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"in",
"Athena"
] | def create_athena_table(params: dict, field_info: dict) -> None:
logger.info("creating table: `%s`.`%s`",
params["db_name"], params["table_name"])
query_exec_context = {
"Database": params["db_name"],
"Catalog": params["catalog_name"],
}
execute_query(
params["dry... | [
"def",
"create_athena_table",
"(",
"params",
":",
"dict",
",",
"field_info",
":",
"dict",
")",
"->",
"None",
":",
"logger",
".",
"info",
"(",
"\"creating table: `%s`.`%s`\"",
",",
"params",
"[",
"\"db_name\"",
"]",
",",
"params",
"[",
"\"table_name\"",
"]",
... | Creates the table if it doesn't exist in Athena | [
"Creates",
"the",
"table",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"in",
"Athena"
] | [
"\"\"\"\n Creates the table if it doesn't exist in Athena\n \"\"\""
] | [
{
"param": "params",
"type": "dict"
},
{
"param": "field_info",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "params",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field_info",
"type": "dict",
"docstring": null,
"docstrin... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | extract_agg_functions | dict | def extract_agg_functions(
dataset_ids: list, field_info: dict, formulas: dict, data_format: str
) -> dict:
"""
returns the subset of aggregated functions for the selected datasets
Example:
```
{
"bytesPerSecond" : "avg(bytes)",
"1xx": "sum(case when statusCode / 100... |
returns the subset of aggregated functions for the selected datasets
Example:
```
{
"bytesPerSecond" : "avg(bytes)",
"1xx": "sum(case when statusCode / 100 = 1 then 1 else 0 end)",
}
```
| returns the subset of aggregated functions for the selected datasets | [
"returns",
"the",
"subset",
"of",
"aggregated",
"functions",
"for",
"the",
"selected",
"datasets"
] | def extract_agg_functions(
dataset_ids: list, field_info: dict, formulas: dict, data_format: str
) -> dict:
result = {}
for col in dataset_ids:
if "agg" not in field_info.get(col, {}):
continue
for func_name in field_info[col]["agg"]:
toadd_flag = True
if ... | [
"def",
"extract_agg_functions",
"(",
"dataset_ids",
":",
"list",
",",
"field_info",
":",
"dict",
",",
"formulas",
":",
"dict",
",",
"data_format",
":",
"str",
")",
"->",
"dict",
":",
"result",
"=",
"{",
"}",
"for",
"col",
"in",
"dataset_ids",
":",
"if",
... | returns the subset of aggregated functions for the selected datasets | [
"returns",
"the",
"subset",
"of",
"aggregated",
"functions",
"for",
"the",
"selected",
"datasets"
] | [
"\"\"\"\n returns the subset of aggregated functions for the selected datasets\n\n Example:\n ```\n {\n \"bytesPerSecond\" : \"avg(bytes)\",\n \"1xx\": \"sum(case when statusCode / 100 = 1 then 1 else 0 end)\",\n }\n ```\n \"\"\"",
"# skip if the column doesn't h... | [
{
"param": "dataset_ids",
"type": "list"
},
{
"param": "field_info",
"type": "dict"
},
{
"param": "formulas",
"type": "dict"
},
{
"param": "data_format",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dataset_ids",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field_info",
"type": "dict",
"docstring": null,
"doc... |
86782b977a1ec5689d92d8607f80c939367898f0 | akamai/datastream-tools | tools/athena/loadtoathena.py | [
"Apache-2.0"
] | Python | create_athena_view | None | def create_athena_view(params: dict, field_info: dict, formulas: dict) -> None:
"""
Creates the view in Athena if it doesn't exists
"""
logger.info('creating view: "%s"."%s"',
params["db_name"], params["view_name"])
query_exec_context = {
"Database": params["db_name"],
... |
Creates the view in Athena if it doesn't exists
| Creates the view in Athena if it doesn't exists | [
"Creates",
"the",
"view",
"in",
"Athena",
"if",
"it",
"doesn",
"'",
"t",
"exists"
] | def create_athena_view(params: dict, field_info: dict, formulas: dict) -> None:
logger.info('creating view: "%s"."%s"',
params["db_name"], params["view_name"])
query_exec_context = {
"Database": params["db_name"],
"Catalog": params["catalog_name"],
}
execute_query(
... | [
"def",
"create_athena_view",
"(",
"params",
":",
"dict",
",",
"field_info",
":",
"dict",
",",
"formulas",
":",
"dict",
")",
"->",
"None",
":",
"logger",
".",
"info",
"(",
"'creating view: \"%s\".\"%s\"'",
",",
"params",
"[",
"\"db_name\"",
"]",
",",
"params"... | Creates the view in Athena if it doesn't exists | [
"Creates",
"the",
"view",
"in",
"Athena",
"if",
"it",
"doesn",
"'",
"t",
"exists"
] | [
"\"\"\"\n Creates the view in Athena if it doesn't exists\n \"\"\""
] | [
{
"param": "params",
"type": "dict"
},
{
"param": "field_info",
"type": "dict"
},
{
"param": "formulas",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "params",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field_info",
"type": "dict",
"docstring": null,
"docstrin... |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | import_dynamic_modules | <not_specific> | def import_dynamic_modules(module_name):
"""
dynamically import cloud services specific modules
"""
# pylint: disable=broad-except
try:
return importlib.import_module(module_name)
except ImportError as err:
# warning
logger.warning("%s: %s", type(err), err)
except Exc... |
dynamically import cloud services specific modules
| dynamically import cloud services specific modules | [
"dynamically",
"import",
"cloud",
"services",
"specific",
"modules"
] | def import_dynamic_modules(module_name):
try:
return importlib.import_module(module_name)
except ImportError as err:
logger.warning("%s: %s", type(err), err)
except Exception as err:
logger.fatal("%s: %s", type(err), err)
sys.exit(err)
return None | [
"def",
"import_dynamic_modules",
"(",
"module_name",
")",
":",
"try",
":",
"return",
"importlib",
".",
"import_module",
"(",
"module_name",
")",
"except",
"ImportError",
"as",
"err",
":",
"logger",
".",
"warning",
"(",
"\"%s: %s\"",
",",
"type",
"(",
"err",
... | dynamically import cloud services specific modules | [
"dynamically",
"import",
"cloud",
"services",
"specific",
"modules"
] | [
"\"\"\"\n dynamically import cloud services specific modules\n \"\"\"",
"# pylint: disable=broad-except",
"# warning",
"# failure on any other exception"
] | [
{
"param": "module_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "module_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | init_cloud_storage_object | null | def init_cloud_storage_object(self):
"""
sets cloud_storage_object for appropriate
cloud service
"""
if self.cloud is None:
self.cloud_storage_object = BaseUtils()
# import cloud modules and return object
# for the respective cloud providers
... |
sets cloud_storage_object for appropriate
cloud service
| sets cloud_storage_object for appropriate
cloud service | [
"sets",
"cloud_storage_object",
"for",
"appropriate",
"cloud",
"service"
] | def init_cloud_storage_object(self):
if self.cloud is None:
self.cloud_storage_object = BaseUtils()
if self.cloud == "azure":
self.azure = import_dynamic_modules("cloud_modules_azure.utils")
self.cloud_storage_object = self.azure.AzureStorageContainer()
if sel... | [
"def",
"init_cloud_storage_object",
"(",
"self",
")",
":",
"if",
"self",
".",
"cloud",
"is",
"None",
":",
"self",
".",
"cloud_storage_object",
"=",
"BaseUtils",
"(",
")",
"if",
"self",
".",
"cloud",
"==",
"\"azure\"",
":",
"self",
".",
"azure",
"=",
"imp... | sets cloud_storage_object for appropriate
cloud service | [
"sets",
"cloud_storage_object",
"for",
"appropriate",
"cloud",
"service"
] | [
"\"\"\"\n sets cloud_storage_object for appropriate\n cloud service\n \"\"\"",
"# import cloud modules and return object",
"# for the respective cloud providers"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_metadata | null | def read_metadata(self, read_provision=True):
"""
Parent function to read all metadata/config files
"""
self.read_all_datastream2_fields()
self.read_all_custom_functions()
self.read_stream_metadata()
if read_provision:
self.read_provision() |
Parent function to read all metadata/config files
| Parent function to read all metadata/config files | [
"Parent",
"function",
"to",
"read",
"all",
"metadata",
"/",
"config",
"files"
] | def read_metadata(self, read_provision=True):
self.read_all_datastream2_fields()
self.read_all_custom_functions()
self.read_stream_metadata()
if read_provision:
self.read_provision() | [
"def",
"read_metadata",
"(",
"self",
",",
"read_provision",
"=",
"True",
")",
":",
"self",
".",
"read_all_datastream2_fields",
"(",
")",
"self",
".",
"read_all_custom_functions",
"(",
")",
"self",
".",
"read_stream_metadata",
"(",
")",
"if",
"read_provision",
":... | Parent function to read all metadata/config files | [
"Parent",
"function",
"to",
"read",
"all",
"metadata",
"/",
"config",
"files"
] | [
"\"\"\"\n Parent function to read all metadata/config files\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "read_provision",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "read_provision",
"type": null,
"docstring": null,
"docstring_... |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_all_datastream2_fields | null | def read_all_datastream2_fields(self):
"""
reads the all_datastream2_fields.json file consisting of
all field related details say, id, field name, functions etc
"""
self.all_fields_map = self.cloud_storage_object.read_all_datastream2_fields_metadata()
for i in self.all_fi... |
reads the all_datastream2_fields.json file consisting of
all field related details say, id, field name, functions etc
| reads the all_datastream2_fields.json file consisting of
all field related details say, id, field name, functions etc | [
"reads",
"the",
"all_datastream2_fields",
".",
"json",
"file",
"consisting",
"of",
"all",
"field",
"related",
"details",
"say",
"id",
"field",
"name",
"functions",
"etc"
] | def read_all_datastream2_fields(self):
self.all_fields_map = self.cloud_storage_object.read_all_datastream2_fields_metadata()
for i in self.all_fields_map:
self.all_fields_map[i]["name"] = self.all_fields_map[i]["name"].lower(
) | [
"def",
"read_all_datastream2_fields",
"(",
"self",
")",
":",
"self",
".",
"all_fields_map",
"=",
"self",
".",
"cloud_storage_object",
".",
"read_all_datastream2_fields_metadata",
"(",
")",
"for",
"i",
"in",
"self",
".",
"all_fields_map",
":",
"self",
".",
"all_fie... | reads the all_datastream2_fields.json file consisting of
all field related details say, id, field name, functions etc | [
"reads",
"the",
"all_datastream2_fields",
".",
"json",
"file",
"consisting",
"of",
"all",
"field",
"related",
"details",
"say",
"id",
"field",
"name",
"functions",
"etc"
] | [
"\"\"\"\n reads the all_datastream2_fields.json file consisting of\n all field related details say, id, field name, functions etc\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_all_custom_functions | null | def read_all_custom_functions(self):
"""
reads all_custom_functions.json file and parse
the functions details
"""
self.all_custom_functions = (
self.cloud_storage_object.read_all_custom_functions_metadata()
)
logger.debug("self.all_custom_functions: %s... |
reads all_custom_functions.json file and parse
the functions details
| reads all_custom_functions.json file and parse
the functions details | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"and",
"parse",
"the",
"functions",
"details"
] | def read_all_custom_functions(self):
self.all_custom_functions = (
self.cloud_storage_object.read_all_custom_functions_metadata()
)
logger.debug("self.all_custom_functions: %s",
self.all_custom_functions) | [
"def",
"read_all_custom_functions",
"(",
"self",
")",
":",
"self",
".",
"all_custom_functions",
"=",
"(",
"self",
".",
"cloud_storage_object",
".",
"read_all_custom_functions_metadata",
"(",
")",
")",
"logger",
".",
"debug",
"(",
"\"self.all_custom_functions: %s\"",
"... | reads all_custom_functions.json file and parse
the functions details | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"and",
"parse",
"the",
"functions",
"details"
] | [
"\"\"\"\n reads all_custom_functions.json file and parse\n the functions details\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_stream_metadata | null | def read_stream_metadata(self):
"""
reads <stream>.json file and parse
stream related details
"""
self.stream_metadata = StreamMetadata()
stream_buffer = self.cloud_storage_object.read_stream_metadata()
self.stream_metadata.populate_fields(
stream_buff... |
reads <stream>.json file and parse
stream related details
| reads .json file and parse
stream related details | [
"reads",
".",
"json",
"file",
"and",
"parse",
"stream",
"related",
"details"
] | def read_stream_metadata(self):
self.stream_metadata = StreamMetadata()
stream_buffer = self.cloud_storage_object.read_stream_metadata()
self.stream_metadata.populate_fields(
stream_buffer, self.all_fields_map) | [
"def",
"read_stream_metadata",
"(",
"self",
")",
":",
"self",
".",
"stream_metadata",
"=",
"StreamMetadata",
"(",
")",
"stream_buffer",
"=",
"self",
".",
"cloud_storage_object",
".",
"read_stream_metadata",
"(",
")",
"self",
".",
"stream_metadata",
".",
"populate_... | reads <stream>.json file and parse
stream related details | [
"reads",
"<stream",
">",
".",
"json",
"file",
"and",
"parse",
"stream",
"related",
"details"
] | [
"\"\"\"\n reads <stream>.json file and parse\n stream related details\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_provision | null | def read_provision(self):
"""
To read the provision file containing
the list of functions to aggregate data
"""
self.provision_metadata = ProvisionMetadata()
prov_buffer = (
self.cloud_storage_object.read_provision_metadata()
)
self.provision_m... |
To read the provision file containing
the list of functions to aggregate data
| To read the provision file containing
the list of functions to aggregate data | [
"To",
"read",
"the",
"provision",
"file",
"containing",
"the",
"list",
"of",
"functions",
"to",
"aggregate",
"data"
] | def read_provision(self):
self.provision_metadata = ProvisionMetadata()
prov_buffer = (
self.cloud_storage_object.read_provision_metadata()
)
self.provision_metadata.populate_fields(
prov_buffer, self.all_custom_functions) | [
"def",
"read_provision",
"(",
"self",
")",
":",
"self",
".",
"provision_metadata",
"=",
"ProvisionMetadata",
"(",
")",
"prov_buffer",
"=",
"(",
"self",
".",
"cloud_storage_object",
".",
"read_provision_metadata",
"(",
")",
")",
"self",
".",
"provision_metadata",
... | To read the provision file containing
the list of functions to aggregate data | [
"To",
"read",
"the",
"provision",
"file",
"containing",
"the",
"list",
"of",
"functions",
"to",
"aggregate",
"data"
] | [
"\"\"\"\n To read the provision file containing\n the list of functions to aggregate data\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | read_input_data | null | def read_input_data(self, input_file, bucket_name=None):
"""
read the input file and sets the dataframe
"""
self.input_file = input_file
# from local dir
if self.cloud is None:
self.dataframe = self.cloud_storage_object.read_data_file_from_local(
... |
read the input file and sets the dataframe
| read the input file and sets the dataframe | [
"read",
"the",
"input",
"file",
"and",
"sets",
"the",
"dataframe"
] | def read_input_data(self, input_file, bucket_name=None):
self.input_file = input_file
if self.cloud is None:
self.dataframe = self.cloud_storage_object.read_data_file_from_local(
self.input_file,
self.stream_metadata.stream_format,
self.stream_... | [
"def",
"read_input_data",
"(",
"self",
",",
"input_file",
",",
"bucket_name",
"=",
"None",
")",
":",
"self",
".",
"input_file",
"=",
"input_file",
"if",
"self",
".",
"cloud",
"is",
"None",
":",
"self",
".",
"dataframe",
"=",
"self",
".",
"cloud_storage_obj... | read the input file and sets the dataframe | [
"read",
"the",
"input",
"file",
"and",
"sets",
"the",
"dataframe"
] | [
"\"\"\"\n read the input file and sets the dataframe\n \"\"\"",
"# from local dir",
"# for azure",
"# for aws"
] | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": null
},
{
"param": "bucket_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": null,
"docstring": null,
"docstring_toke... |
96797cc7b16a8994041e6817163cd4e3cc7f6d98 | akamai/datastream-tools | aggregation_modules/aggregator.py | [
"Apache-2.0"
] | Python | preprocess_dataframe | null | def preprocess_dataframe(self):
"""
pre process the dataframe constructed from the input data
for integer columns sets non integer values to 0
for non integer columns sets "-" to "others"
"""
for column_name in self.provision_metadata.get_provision_field_names():
... |
pre process the dataframe constructed from the input data
for integer columns sets non integer values to 0
for non integer columns sets "-" to "others"
| pre process the dataframe constructed from the input data
for integer columns sets non integer values to 0
for non integer columns sets "-" to "others" | [
"pre",
"process",
"the",
"dataframe",
"constructed",
"from",
"the",
"input",
"data",
"for",
"integer",
"columns",
"sets",
"non",
"integer",
"values",
"to",
"0",
"for",
"non",
"integer",
"columns",
"sets",
"\"",
"-",
"\"",
"to",
"\"",
"others",
"\""
] | def preprocess_dataframe(self):
for column_name in self.provision_metadata.get_provision_field_names():
if self.stream_metadata.get_data_type_for_field(column_name) == "bigint":
self.dataframe[column_name] = custom_functions.convert_to_numeric(
self.dataframe[colu... | [
"def",
"preprocess_dataframe",
"(",
"self",
")",
":",
"for",
"column_name",
"in",
"self",
".",
"provision_metadata",
".",
"get_provision_field_names",
"(",
")",
":",
"if",
"self",
".",
"stream_metadata",
".",
"get_data_type_for_field",
"(",
"column_name",
")",
"==... | pre process the dataframe constructed from the input data
for integer columns sets non integer values to 0
for non integer columns sets "-" to "others" | [
"pre",
"process",
"the",
"dataframe",
"constructed",
"from",
"the",
"input",
"data",
"for",
"integer",
"columns",
"sets",
"non",
"integer",
"values",
"to",
"0",
"for",
"non",
"integer",
"columns",
"sets",
"\"",
"-",
"\"",
"to",
"\"",
"others",
"\""
] | [
"\"\"\"\n pre process the dataframe constructed from the input data\n for integer columns sets non integer values to 0\n for non integer columns sets \"-\" to \"others\"\n \"\"\"",
"# integer fields",
"# string fields"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
598c451b7124eb34126eb807e7428b6d035f6291 | akamai/datastream-tools | aggregation_modules/custom_functions.py | [
"Apache-2.0"
] | Python | convert_time | <not_specific> | def convert_time(epoch_time, time_format="%s", delta=1):
"""
Converts GMT epoch time to the specified time format.
Also rounds off to the nearest minute, hour, day when valid delta value is passed
:param epoch_time: epoch time to be converted
:param time_format: expected output time format
... |
Converts GMT epoch time to the specified time format.
Also rounds off to the nearest minute, hour, day when valid delta value is passed
:param epoch_time: epoch time to be converted
:param time_format: expected output time format
example: "%Y-%m-%d %H:%M:%S", "%s", ...
:par... | Converts GMT epoch time to the specified time format.
Also rounds off to the nearest minute, hour, day when valid delta value is passed | [
"Converts",
"GMT",
"epoch",
"time",
"to",
"the",
"specified",
"time",
"format",
".",
"Also",
"rounds",
"off",
"to",
"the",
"nearest",
"minute",
"hour",
"day",
"when",
"valid",
"delta",
"value",
"is",
"passed"
] | def convert_time(epoch_time, time_format="%s", delta=1):
os.environ["TZ"] = "UTC"
time.tzset()
if delta <= 0:
delta = 1
epoch_rounded = float(epoch_time) - (float(epoch_time) % delta)
return time.strftime(time_format, time.gmtime(float(epoch_rounded))) | [
"def",
"convert_time",
"(",
"epoch_time",
",",
"time_format",
"=",
"\"%s\"",
",",
"delta",
"=",
"1",
")",
":",
"os",
".",
"environ",
"[",
"\"TZ\"",
"]",
"=",
"\"UTC\"",
"time",
".",
"tzset",
"(",
")",
"if",
"delta",
"<=",
"0",
":",
"delta",
"=",
"1... | Converts GMT epoch time to the specified time format. | [
"Converts",
"GMT",
"epoch",
"time",
"to",
"the",
"specified",
"time",
"format",
"."
] | [
"\"\"\"\n Converts GMT epoch time to the specified time format.\n Also rounds off to the nearest minute, hour, day when valid delta value is passed\n :param epoch_time: epoch time to be converted\n :param time_format: expected output time format\n example: \"%Y-%m-%d %H:%M:%S\", ... | [
{
"param": "epoch_time",
"type": null
},
{
"param": "time_format",
"type": null
},
{
"param": "delta",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "time\nexample:\n>>> epoch_time = \"1541399309.143\"\n>>> convert_time(epoch_time)\n'1541399309'\n>>> convert_time(epoch_time, time_format=\"%Y-%m-%d %H:%M:%S %Z\")\n'2018-11-05 06:28:29 UTC'\n>>> convert_t... |
598c451b7124eb34126eb807e7428b6d035f6291 | akamai/datastream-tools | aggregation_modules/custom_functions.py | [
"Apache-2.0"
] | Python | extract_from_ua | <not_specific> | def extract_from_ua(ua_string, to_extract):
"""
extracts requested info from User Agent String
"""
client_info = httpagentparser.detect(ua_string)
if to_extract in client_info:
if client_info[to_extract]["name"] is not None:
return client_info[to_extract]["name"]
return str("... |
extracts requested info from User Agent String
| extracts requested info from User Agent String | [
"extracts",
"requested",
"info",
"from",
"User",
"Agent",
"String"
] | def extract_from_ua(ua_string, to_extract):
client_info = httpagentparser.detect(ua_string)
if to_extract in client_info:
if client_info[to_extract]["name"] is not None:
return client_info[to_extract]["name"]
return str("invalid") | [
"def",
"extract_from_ua",
"(",
"ua_string",
",",
"to_extract",
")",
":",
"client_info",
"=",
"httpagentparser",
".",
"detect",
"(",
"ua_string",
")",
"if",
"to_extract",
"in",
"client_info",
":",
"if",
"client_info",
"[",
"to_extract",
"]",
"[",
"\"name\"",
"]... | extracts requested info from User Agent String | [
"extracts",
"requested",
"info",
"from",
"User",
"Agent",
"String"
] | [
"\"\"\"\n extracts requested info from User Agent String\n \"\"\""
] | [
{
"param": "ua_string",
"type": null
},
{
"param": "to_extract",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ua_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "to_extract",
"type": null,
"docstring": null,
"docstring... |
598c451b7124eb34126eb807e7428b6d035f6291 | akamai/datastream-tools | aggregation_modules/custom_functions.py | [
"Apache-2.0"
] | Python | parse_user_agent | <not_specific> | def parse_user_agent(user_agent):
"""
returns platform, os, browser distribution details.
sample output,
```
"platform": {
"Windows": 30
},
"os": {
"Windows": 30
},
"browser": {
"Chrome": 30
}
```
"""
ua_info = (
"os",
"browser",
... |
returns platform, os, browser distribution details.
sample output,
```
"platform": {
"Windows": 30
},
"os": {
"Windows": 30
},
"browser": {
"Chrome": 30
}
```
| returns platform, os, browser distribution details. | [
"returns",
"platform",
"os",
"browser",
"distribution",
"details",
"."
] | def parse_user_agent(user_agent):
ua_info = (
"os",
"browser",
"platform",
)
client_info = {}
for to_extract in ua_info:
client_info[to_extract] = user_agent.apply(
extract_from_ua, args=(to_extract,))
client_info[to_extract] = json.loads(
... | [
"def",
"parse_user_agent",
"(",
"user_agent",
")",
":",
"ua_info",
"=",
"(",
"\"os\"",
",",
"\"browser\"",
",",
"\"platform\"",
",",
")",
"client_info",
"=",
"{",
"}",
"for",
"to_extract",
"in",
"ua_info",
":",
"client_info",
"[",
"to_extract",
"]",
"=",
"... | returns platform, os, browser distribution details. | [
"returns",
"platform",
"os",
"browser",
"distribution",
"details",
"."
] | [
"\"\"\"\n returns platform, os, browser distribution details.\n sample output,\n ```\n \"platform\": {\n \"Windows\": 30\n },\n \"os\": {\n \"Windows\": 30\n },\n \"browser\": {\n \"Chrome\": 30\n }\n ```\n \"\"\"",
"# convert to json"
] | [
{
"param": "user_agent",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "user_agent",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
598c451b7124eb34126eb807e7428b6d035f6291 | akamai/datastream-tools | aggregation_modules/custom_functions.py | [
"Apache-2.0"
] | Python | parse_unique_count_for_column | <not_specific> | def parse_unique_count_for_column(column_df, column):
"""
returns column specific distribution details.
sample output,
```
"<column_df>": {
"<>": 30
}
```
"""
return {column: get_unique_counts_of_column(column_df)} |
returns column specific distribution details.
sample output,
```
"<column_df>": {
"<>": 30
}
```
| returns column specific distribution details. | [
"returns",
"column",
"specific",
"distribution",
"details",
"."
] | def parse_unique_count_for_column(column_df, column):
return {column: get_unique_counts_of_column(column_df)} | [
"def",
"parse_unique_count_for_column",
"(",
"column_df",
",",
"column",
")",
":",
"return",
"{",
"column",
":",
"get_unique_counts_of_column",
"(",
"column_df",
")",
"}"
] | returns column specific distribution details. | [
"returns",
"column",
"specific",
"distribution",
"details",
"."
] | [
"\"\"\"\n returns column specific distribution details.\n sample output,\n ```\n \"<column_df>\": {\n \"<>\": 30\n }\n ```\n \"\"\""
] | [
{
"param": "column_df",
"type": null
},
{
"param": "column",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "column_df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "column",
"type": null,
"docstring": null,
"docstring_tok... |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_from_s3 | io.BytesIO | def read_from_s3(self, bucket, file_to_read) -> io.BytesIO:
"""
returns an io buffer handle to read from
"""
if self.s3_client is None:
self.set_s3_client()
response = None
try:
logger.debug("reading file: %s from bucket: %s",
... |
returns an io buffer handle to read from
| returns an io buffer handle to read from | [
"returns",
"an",
"io",
"buffer",
"handle",
"to",
"read",
"from"
] | def read_from_s3(self, bucket, file_to_read) -> io.BytesIO:
if self.s3_client is None:
self.set_s3_client()
response = None
try:
logger.debug("reading file: %s from bucket: %s",
file_to_read, bucket)
response = self.s3_client.get_objec... | [
"def",
"read_from_s3",
"(",
"self",
",",
"bucket",
",",
"file_to_read",
")",
"->",
"io",
".",
"BytesIO",
":",
"if",
"self",
".",
"s3_client",
"is",
"None",
":",
"self",
".",
"set_s3_client",
"(",
")",
"response",
"=",
"None",
"try",
":",
"logger",
".",... | returns an io buffer handle to read from | [
"returns",
"an",
"io",
"buffer",
"handle",
"to",
"read",
"from"
] | [
"\"\"\"\n returns an io buffer handle to read from\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "bucket",
"type": null
},
{
"param": "file_to_read",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket",
"type": null,
"docstring": null,
"docstring_tokens":... |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_json_metadata_from_s3 | dict | def read_json_metadata_from_s3(self, json_file) -> dict:
"""
reads json_file from s3 storage
and return dict object
"""
try:
if self.metadata_path is not None:
json_file_path = self.metadata_path + "/" + json_file
json_buffer = self.read_... |
reads json_file from s3 storage
and return dict object
| reads json_file from s3 storage
and return dict object | [
"reads",
"json_file",
"from",
"s3",
"storage",
"and",
"return",
"dict",
"object"
] | def read_json_metadata_from_s3(self, json_file) -> dict:
try:
if self.metadata_path is not None:
json_file_path = self.metadata_path + "/" + json_file
json_buffer = self.read_from_s3(
self.metadata_bucket, json_file_path)
return self.get_dict_f... | [
"def",
"read_json_metadata_from_s3",
"(",
"self",
",",
"json_file",
")",
"->",
"dict",
":",
"try",
":",
"if",
"self",
".",
"metadata_path",
"is",
"not",
"None",
":",
"json_file_path",
"=",
"self",
".",
"metadata_path",
"+",
"\"/\"",
"+",
"json_file",
"json_b... | reads json_file from s3 storage
and return dict object | [
"reads",
"json_file",
"from",
"s3",
"storage",
"and",
"return",
"dict",
"object"
] | [
"\"\"\"\n reads json_file from s3 storage\n and return dict object\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "json_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "json_file",
"type": null,
"docstring": null,
"docstring_token... |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_all_datastream2_fields_metadata | dict | def read_all_datastream2_fields_metadata(self) -> dict:
"""
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob and returns the dict
"""
return self.read_json_metadata_from_s3(
self.input_configs["all_dat... |
reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob and returns the dict
| reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"blob",
"and",
"returns",
"the",
"dict"
] | def read_all_datastream2_fields_metadata(self) -> dict:
return self.read_json_metadata_from_s3(
self.input_configs["all_datastream2_fields"]
) | [
"def",
"read_all_datastream2_fields_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_s3",
"(",
"self",
".",
"input_configs",
"[",
"\"all_datastream2_fields\"",
"]",
")"
] | reads all_datastream2_fields.json file,
containing all the dataset fields avaiable in datastream,
from blob and returns the dict | [
"reads",
"all_datastream2_fields",
".",
"json",
"file",
"containing",
"all",
"the",
"dataset",
"fields",
"avaiable",
"in",
"datastream",
"from",
"blob",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_datastream2_fields.json file,\n containing all the dataset fields avaiable in datastream,\n from blob and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_all_custom_functions_metadata | dict | def read_all_custom_functions_metadata(self) -> dict:
"""
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from s3 storage and returns the dict
"""
return self.read_json_metadata_from_s3(
self.input_... |
reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from s3 storage and returns the dict
| reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from s3 storage and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_all_custom_functions_metadata(self) -> dict:
return self.read_json_metadata_from_s3(
self.input_configs["all_custom_functions"]
) | [
"def",
"read_all_custom_functions_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_s3",
"(",
"self",
".",
"input_configs",
"[",
"\"all_custom_functions\"",
"]",
")"
] | reads all_custom_functions.json file,
containing all the aggregate functions avaiable for datastream fields,
from s3 storage and returns the dict | [
"reads",
"all_custom_functions",
".",
"json",
"file",
"containing",
"all",
"the",
"aggregate",
"functions",
"avaiable",
"for",
"datastream",
"fields",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads all_custom_functions.json file, \n containing all the aggregate functions avaiable for datastream fields,\n from s3 storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_stream_metadata | dict | def read_stream_metadata(self) -> dict:
"""
reads stream.json file,
containing stream specific details,
from s3 storage and returns the dict
"""
return self.read_json_metadata_from_s3(self.input_configs["stream_file"]) |
reads stream.json file,
containing stream specific details,
from s3 storage and returns the dict
| reads stream.json file,
containing stream specific details,
from s3 storage and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_stream_metadata(self) -> dict:
return self.read_json_metadata_from_s3(self.input_configs["stream_file"]) | [
"def",
"read_stream_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_s3",
"(",
"self",
".",
"input_configs",
"[",
"\"stream_file\"",
"]",
")"
] | reads stream.json file,
containing stream specific details,
from s3 storage and returns the dict | [
"reads",
"stream",
".",
"json",
"file",
"containing",
"stream",
"specific",
"details",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads stream.json file,\n containing stream specific details, \n from s3 storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_provision_metadata | dict | def read_provision_metadata(self) -> dict:
"""
reads provision.json file,
containing the selected aggregate functions,
from s3 storage and returns the dict
"""
return self.read_json_metadata_from_s3(self.input_configs["provision_file"]) |
reads provision.json file,
containing the selected aggregate functions,
from s3 storage and returns the dict
| reads provision.json file,
containing the selected aggregate functions,
from s3 storage and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | def read_provision_metadata(self) -> dict:
return self.read_json_metadata_from_s3(self.input_configs["provision_file"]) | [
"def",
"read_provision_metadata",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"read_json_metadata_from_s3",
"(",
"self",
".",
"input_configs",
"[",
"\"provision_file\"",
"]",
")"
] | reads provision.json file,
containing the selected aggregate functions,
from s3 storage and returns the dict | [
"reads",
"provision",
".",
"json",
"file",
"containing",
"the",
"selected",
"aggregate",
"functions",
"from",
"s3",
"storage",
"and",
"returns",
"the",
"dict"
] | [
"\"\"\"\n reads provision.json file, \n containing the selected aggregate functions,\n from s3 storage and returns the dict\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cb1766f2c4d87b3515628a3fa3223c46f7ae311 | akamai/datastream-tools | cloud_modules_aws/utils.py | [
"Apache-2.0"
] | Python | read_data_file_from_s3 | <not_specific> | def read_data_file_from_s3(
self, bucket, filename, file_format, chosen_field_names, custom_columns
):
"""
read input data file and returns a dataframe
"""
data_buffer = self.read_from_s3(bucket, filename)
return self.read_data_file(
data_buffer, file_for... |
read input data file and returns a dataframe
| read input data file and returns a dataframe | [
"read",
"input",
"data",
"file",
"and",
"returns",
"a",
"dataframe"
] | def read_data_file_from_s3(
self, bucket, filename, file_format, chosen_field_names, custom_columns
):
data_buffer = self.read_from_s3(bucket, filename)
return self.read_data_file(
data_buffer, file_format, chosen_field_names, custom_columns
) | [
"def",
"read_data_file_from_s3",
"(",
"self",
",",
"bucket",
",",
"filename",
",",
"file_format",
",",
"chosen_field_names",
",",
"custom_columns",
")",
":",
"data_buffer",
"=",
"self",
".",
"read_from_s3",
"(",
"bucket",
",",
"filename",
")",
"return",
"self",
... | read input data file and returns a dataframe | [
"read",
"input",
"data",
"file",
"and",
"returns",
"a",
"dataframe"
] | [
"\"\"\"\n read input data file and returns a dataframe\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "bucket",
"type": null
},
{
"param": "filename",
"type": null
},
{
"param": "file_format",
"type": null
},
{
"param": "chosen_field_names",
"type": null
},
{
"param": "custom_columns",
"type": null
}
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket",
"type": null,
"docstring": null,
"docstring_tokens":... |
38eaec6f7a68aedd521cacc430afd6a86bcee3b4 | owen2016/DevOps-Practices | python/samples/ops.py | [
"MIT"
] | Python | start | <not_specific> | def start(ServiceName):
'''
Desc: Start GameServer
CLI Example:
opsmod.py ServiceName start
'''
pid = srv_pidfile[ServiceName]
cmd = srv_up[ServiceName]
logging.info('{0} start'.format(ServiceName))
if os.path.exists(pid):
return R('GameServer is a... |
Desc: Start GameServer
CLI Example:
opsmod.py ServiceName start
| Start GameServer
CLI Example:
opsmod.py ServiceName start | [
"Start",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"start"
] | def start(ServiceName):
pid = srv_pidfile[ServiceName]
cmd = srv_up[ServiceName]
logging.info('{0} start'.format(ServiceName))
if os.path.exists(pid):
return R('GameServer is already running !')
else:
proc = Popen(cmd, shell=True)
return G('Start GameServer is successful !'... | [
"def",
"start",
"(",
"ServiceName",
")",
":",
"pid",
"=",
"srv_pidfile",
"[",
"ServiceName",
"]",
"cmd",
"=",
"srv_up",
"[",
"ServiceName",
"]",
"logging",
".",
"info",
"(",
"'{0} start'",
".",
"format",
"(",
"ServiceName",
")",
")",
"if",
"os",
".",
"... | Desc: Start GameServer
CLI Example:
opsmod.py ServiceName start | [
"Desc",
":",
"Start",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"start"
] | [
"'''\n Desc: Start GameServer\n \n CLI Example:\n opsmod.py ServiceName start\n '''"
] | [
{
"param": "ServiceName",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ServiceName",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38eaec6f7a68aedd521cacc430afd6a86bcee3b4 | owen2016/DevOps-Practices | python/samples/ops.py | [
"MIT"
] | Python | stop | <not_specific> | def stop(ServiceName):
'''
Desc: Stop GameServer
CLI Example:
opsmod.py ServiceName stop
'''
pid = srv_pidfile[ServiceName]
cmd = srv_down[ServiceName]
logging.info('{0} stop'.format(ServiceName))
if os.path.exists(pid):
proc = Popen(cmd, shell=Tru... |
Desc: Stop GameServer
CLI Example:
opsmod.py ServiceName stop
| Stop GameServer
CLI Example:
opsmod.py ServiceName stop | [
"Stop",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"stop"
] | def stop(ServiceName):
pid = srv_pidfile[ServiceName]
cmd = srv_down[ServiceName]
logging.info('{0} stop'.format(ServiceName))
if os.path.exists(pid):
proc = Popen(cmd, shell=True)
return G('Stop GameServer is running...,please wait !')
else:
return R('GameServer is already... | [
"def",
"stop",
"(",
"ServiceName",
")",
":",
"pid",
"=",
"srv_pidfile",
"[",
"ServiceName",
"]",
"cmd",
"=",
"srv_down",
"[",
"ServiceName",
"]",
"logging",
".",
"info",
"(",
"'{0} stop'",
".",
"format",
"(",
"ServiceName",
")",
")",
"if",
"os",
".",
"... | Desc: Stop GameServer
CLI Example:
opsmod.py ServiceName stop | [
"Desc",
":",
"Stop",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"stop"
] | [
"'''\n Desc: Stop GameServer\n \n CLI Example:\n opsmod.py ServiceName stop\n '''"
] | [
{
"param": "ServiceName",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ServiceName",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38eaec6f7a68aedd521cacc430afd6a86bcee3b4 | owen2016/DevOps-Practices | python/samples/ops.py | [
"MIT"
] | Python | status | <not_specific> | def status(ServiceName):
'''
Desc: Check GameServer Status
CLI Example:
opsmod.py ServiceName status
'''
cmd = 'ps -ef|grep "{0}"|grep -v grep'.format(ServiceName)
proc = Popen(cmd, stdout=subprocess.PIPE, shell=True)
item = proc.stdout.read().split('\n')[:-2]
... |
Desc: Check GameServer Status
CLI Example:
opsmod.py ServiceName status
| Check GameServer Status
CLI Example:
opsmod.py ServiceName status | [
"Check",
"GameServer",
"Status",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"status"
] | def status(ServiceName):
cmd = 'ps -ef|grep "{0}"|grep -v grep'.format(ServiceName)
proc = Popen(cmd, stdout=subprocess.PIPE, shell=True)
item = proc.stdout.read().split('\n')[:-2]
its = '\n'.join(item)
cot = len(item)
ret = its + '\n' + '*'*80 + '\n' + 'The total of process is {0} !'.format(cot... | [
"def",
"status",
"(",
"ServiceName",
")",
":",
"cmd",
"=",
"'ps -ef|grep \"{0}\"|grep -v grep'",
".",
"format",
"(",
"ServiceName",
")",
"proc",
"=",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"shell",
"=",
"True",
")",
"item"... | Desc: Check GameServer Status
CLI Example:
opsmod.py ServiceName status | [
"Desc",
":",
"Check",
"GameServer",
"Status",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"status"
] | [
"'''\n Desc: Check GameServer Status\n \n CLI Example:\n opsmod.py ServiceName status\n '''"
] | [
{
"param": "ServiceName",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ServiceName",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38eaec6f7a68aedd521cacc430afd6a86bcee3b4 | owen2016/DevOps-Practices | python/samples/ops.py | [
"MIT"
] | Python | update | <not_specific> | def update(ServiceName, Pkg):
'''
Desc: Update GameServer
CLI Example:
opsmod.py ServiceName update Pkg
'''
logging.info('{0} update {1}'.format(ServiceName, Pkg))
if Pkg:
fl = os.path.join(src_path, Pkg)
try:
zfile = zipfile.ZipFile(fl... |
Desc: Update GameServer
CLI Example:
opsmod.py ServiceName update Pkg
| Update GameServer
CLI Example:
opsmod.py ServiceName update Pkg | [
"Update",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"update",
"Pkg"
] | def update(ServiceName, Pkg):
logging.info('{0} update {1}'.format(ServiceName, Pkg))
if Pkg:
fl = os.path.join(src_path, Pkg)
try:
zfile = zipfile.ZipFile(fl,'r')
for filename in zfile.namelist():
zfile.extract(filename, des_path[ServiceName])
... | [
"def",
"update",
"(",
"ServiceName",
",",
"Pkg",
")",
":",
"logging",
".",
"info",
"(",
"'{0} update {1}'",
".",
"format",
"(",
"ServiceName",
",",
"Pkg",
")",
")",
"if",
"Pkg",
":",
"fl",
"=",
"os",
".",
"path",
".",
"join",
"(",
"src_path",
",",
... | Desc: Update GameServer
CLI Example:
opsmod.py ServiceName update Pkg | [
"Desc",
":",
"Update",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"update",
"Pkg"
] | [
"'''\n Desc: Update GameServer\n \n CLI Example:\n opsmod.py ServiceName update Pkg\n '''"
] | [
{
"param": "ServiceName",
"type": null
},
{
"param": "Pkg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ServiceName",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "Pkg",
"type": null,
"docstring": null,
"docstring_toke... |
38eaec6f7a68aedd521cacc430afd6a86bcee3b4 | owen2016/DevOps-Practices | python/samples/ops.py | [
"MIT"
] | Python | backup | <not_specific> | def backup(ServiceName):
'''
Desc: Backup GameServer
CLI Example:
opsmod.py ServiceName backup
'''
logging.info('{0} backup'.format(ServiceName))
bakname = ServiceName + '_' + datetime.datetime.now().strftime('%Y%m%d%H%M%S') + '.zip'
zipname = os.path.join(bd... |
Desc: Backup GameServer
CLI Example:
opsmod.py ServiceName backup
| Backup GameServer
CLI Example:
opsmod.py ServiceName backup | [
"Backup",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"backup"
] | def backup(ServiceName):
logging.info('{0} backup'.format(ServiceName))
bakname = ServiceName + '_' + datetime.datetime.now().strftime('%Y%m%d%H%M%S') + '.zip'
zipname = os.path.join(bdes_path, bakname)
f = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
for bsrc_path in bsrc_path_lt[ServiceN... | [
"def",
"backup",
"(",
"ServiceName",
")",
":",
"logging",
".",
"info",
"(",
"'{0} backup'",
".",
"format",
"(",
"ServiceName",
")",
")",
"bakname",
"=",
"ServiceName",
"+",
"'_'",
"+",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
... | Desc: Backup GameServer
CLI Example:
opsmod.py ServiceName backup | [
"Desc",
":",
"Backup",
"GameServer",
"CLI",
"Example",
":",
"opsmod",
".",
"py",
"ServiceName",
"backup"
] | [
"'''\n Desc: Backup GameServer\n \n CLI Example:\n opsmod.py ServiceName backup\n '''"
] | [
{
"param": "ServiceName",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ServiceName",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b3011075e6e0d7c47e5ece207563c5fa9525989 | mattl1598/snake-game | webapp/routes.py | [
"MIT"
] | Python | static_loader | <not_specific> | def static_loader():
"""
GET:
description: single route for requesting concatenated static files, either JS or CSS
args:
t: type of file, either "js" or "css"
q: filenames of requested files in order, separated by "&" in the url
security: None required
responses:
200: returns the requested js or ... |
GET:
description: single route for requesting concatenated static files, either JS or CSS
args:
t: type of file, either "js" or "css"
q: filenames of requested files in order, separated by "&" in the url
security: None required
responses:
200: returns the requested js or css files all concatenate... | single route for requesting concatenated static files, either JS or CSS
type of file, either "js" or "css"
filenames of requested files in order, separated by "&" in the url
None required
returns the requested js or css files all concatenated together
error not found if the requested filetype is neither js or css | [
"single",
"route",
"for",
"requesting",
"concatenated",
"static",
"files",
"either",
"JS",
"or",
"CSS",
"type",
"of",
"file",
"either",
"\"",
"js",
"\"",
"or",
"\"",
"css",
"\"",
"filenames",
"of",
"requested",
"files",
"in",
"order",
"separated",
"by",
"\... | def static_loader():
mimetype_lookup = {
"js": "text/javascript",
"css": "text/css"
}
args = request.args
filetype = args["t"]
if filetype in ["js", "css"]:
file_list = args["q"].split(" ")
output = []
for file in file_list:
with open(
str(app.config['ROOT_FOLDER'] + "/webapp/static/" + filetype ... | [
"def",
"static_loader",
"(",
")",
":",
"mimetype_lookup",
"=",
"{",
"\"js\"",
":",
"\"text/javascript\"",
",",
"\"css\"",
":",
"\"text/css\"",
"}",
"args",
"=",
"request",
".",
"args",
"filetype",
"=",
"args",
"[",
"\"t\"",
"]",
"if",
"filetype",
"in",
"["... | GET:
description: single route for requesting concatenated static files, either JS or CSS | [
"GET",
":",
"description",
":",
"single",
"route",
"for",
"requesting",
"concatenated",
"static",
"files",
"either",
"JS",
"or",
"CSS"
] | [
"\"\"\"\n\tGET:\n\t\tdescription: single route for requesting concatenated static files, either JS or CSS\n\n\t\targs:\n\t\t\tt: type of file, either \"js\" or \"css\"\n\n\t\t\tq: filenames of requested files in order, separated by \"&\" in the url\n\n\t\tsecurity: None required\n\n\t\tresponses:\n\t\t\t200: return... | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": [
{
"identifier": "authors",
"docstring": null,
"docstring_tokens": [
"None"
]
}
... |
33f751f8d2f15effc728ffb7b7024c45d9b1e3db | shoxsz/MundiApi-NodeJS | mundiapi/models/create_capture_charge_request.py | [
"MIT"
] | Python | from_dictionary | <not_specific> | def from_dictionary(cls,
dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
An instance of this structure class. | [
"Creates",
"an",
"instance",
"of",
"this",
"model",
"from",
"a",
"dictionary",
"Args",
":",
"dictionary",
"(",
"dictionary",
")",
":",
"A",
"dictionary",
"representation",
"of",
"the",
"object",
"as",
"obtained",
"from",
"the",
"deserialization",
"of",
"the",
... | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
code = dictionary.get('code')
amount = dictionary.get('amount')
return cls(code,
amount) | [
"def",
"from_dictionary",
"(",
"cls",
",",
"dictionary",
")",
":",
"if",
"dictionary",
"is",
"None",
":",
"return",
"None",
"code",
"=",
"dictionary",
".",
"get",
"(",
"'code'",
")",
"amount",
"=",
"dictionary",
".",
"get",
"(",
"'amount'",
")",
"return"... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. | [
"Creates",
"an",
"instance",
"of",
"this",
"model",
"from",
"a",
"dictionary",
"Args",
":",
"dictionary",
"(",
"dictionary",
")",
":",
"A",
"dictionary",
"representation",
"of",
"the",
"object",
"as",
"obtained",
"from",
"the",
"deserialization",
"of",
"the",
... | [
"\"\"\"Creates an instance of this model from a dictionary\r\n\r\n Args:\r\n dictionary (dictionary): A dictionary representation of the object as\r\n obtained from the deserialization of the server's response. The keys\r\n MUST match property names in the API description.\r\... | [
{
"param": "cls",
"type": null
},
{
"param": "dictionary",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dictionary",
"type": null,
"docstring": null,
"docstring_token... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_start_at | <not_specific> | def update_subscription_start_at(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /subscriptions/{subscription_id}/start-at.
Updates the start at date fr... | Does a PATCH request to /subscriptions/{subscription_id}/start-at.
Updates the start at date from a subscription
Args:
subscription_id (string): The subscription id
request (UpdateSubscriptionStartAtRequest): Request for updating
the subscription start da... | Does a PATCH request to /subscriptions/{subscription_id}/start-at.
Updates the start at date from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"start",
"-",
"at",
".",
"Updates",
"the",
"start",
"at",
"date",
"from",
"a",
"subscription"
] | def update_subscription_start_at(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/start-at'
_url_path = APIHelper.append_url_with_template_pa... | [
"def",
"update_subscription_start_at",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/start-at'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_paramete... | Does a PATCH request to /subscriptions/{subscription_id}/start-at. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"start",
"-",
"at",
"."
] | [
"\"\"\"Does a PATCH request to /subscriptions/{subscription_id}/start-at.\r\n\r\n Updates the start at date from a subscription\r\n\r\n Args:\r\n subscription_id (string): The subscription id\r\n request (UpdateSubscriptionStartAtRequest): Request for updating\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_card | <not_specific> | def update_subscription_card(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /subscriptions/{subscription_id}/card.
Updates the credit card from a subscription
... | Does a PATCH request to /subscriptions/{subscription_id}/card.
Updates the credit card from a subscription
Args:
subscription_id (string): Subscription id
request (UpdateSubscriptionCardRequest): Request for updating a
card
idempotency_key (s... | Does a PATCH request to /subscriptions/{subscription_id}/card.
Updates the credit card from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"card",
".",
"Updates",
"the",
"credit",
"card",
"from",
"a",
"subscription"
] | def update_subscription_card(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/card'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, ... | [
"def",
"update_subscription_card",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/card'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_parameters",
"... | Does a PATCH request to /subscriptions/{subscription_id}/card. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"card",
"."
] | [
"\"\"\"Does a PATCH request to /subscriptions/{subscription_id}/card.\r\n\r\n Updates the credit card from a subscription\r\n\r\n Args:\r\n subscription_id (string): Subscription id\r\n request (UpdateSubscriptionCardRequest): Request for updating a\r\n card\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_payment_method | <not_specific> | def update_subscription_payment_method(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /subscriptions/{subscription_id}/payment-method.
... | Does a PATCH request to /subscriptions/{subscription_id}/payment-method.
Updates the payment method from a subscription
Args:
subscription_id (string): Subscription id
request (UpdateSubscriptionPaymentMethodRequest): Request for
updating the paymentmetho... | Does a PATCH request to /subscriptions/{subscription_id}/payment-method.
Updates the payment method from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"payment",
"-",
"method",
".",
"Updates",
"the",
"payment",
"method",
"from",
"a",
"subscription"
] | def update_subscription_payment_method(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/payment-method'
_url_path = APIHelp... | [
"def",
"update_subscription_payment_method",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/payment-method'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_templ... | Does a PATCH request to /subscriptions/{subscription_id}/payment-method. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"payment",
"-",
"method",
"."
] | [
"\"\"\"Does a PATCH request to /subscriptions/{subscription_id}/payment-method.\r\n\r\n Updates the payment method from a subscription\r\n\r\n Args:\r\n subscription_id (string): Subscription id\r\n request (UpdateSubscriptionPaymentMethodRequest): Request for\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | create_subscription | <not_specific> | def create_subscription(self,
body,
idempotency_key=None):
"""Does a POST request to /subscriptions.
Creates a new subscription
Args:
body (CreateSubscriptionRequest): Request for creating a
subscripti... | Does a POST request to /subscriptions.
Creates a new subscription
Args:
body (CreateSubscriptionRequest): Request for creating a
subscription
idempotency_key (string, optional): TODO: type description here.
Example:
Returns:
... | Does a POST request to /subscriptions.
Creates a new subscription | [
"Does",
"a",
"POST",
"request",
"to",
"/",
"subscriptions",
".",
"Creates",
"a",
"new",
"subscription"
] | def create_subscription(self,
body,
idempotency_key=None):
_url_path = '/subscriptions'
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_url = APIHelper.clean_url(_query_builder)
_headers = {
... | [
"def",
"create_subscription",
"(",
"self",
",",
"body",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions'",
"_query_builder",
"=",
"Configuration",
".",
"base_uri",
"_query_builder",
"+=",
"_url_path",
"_query_url",
"=",
"APIHelper",... | Does a POST request to /subscriptions. | [
"Does",
"a",
"POST",
"request",
"to",
"/",
"subscriptions",
"."
] | [
"\"\"\"Does a POST request to /subscriptions.\r\n\r\n Creates a new subscription\r\n\r\n Args:\r\n body (CreateSubscriptionRequest): Request for creating a\r\n subscription\r\n idempotency_key (string, optional): TODO: type description here.\r\n Exam... | [
{
"param": "self",
"type": null
},
{
"param": "body",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | create_subscription_item | <not_specific> | def create_subscription_item(self,
subscription_id,
request,
idempotency_key=None):
"""Does a POST request to /subscriptions/{subscription_id}/items.
Creates a new Subscription item
Args:... | Does a POST request to /subscriptions/{subscription_id}/items.
Creates a new Subscription item
Args:
subscription_id (string): Subscription id
request (CreateSubscriptionItemRequest): Request for creating a
subscription item
idempotency_key (... | Does a POST request to /subscriptions/{subscription_id}/items.
Creates a new Subscription item | [
"Does",
"a",
"POST",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"items",
".",
"Creates",
"a",
"new",
"Subscription",
"item"
] | def create_subscription_item(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/items'
_url_path = APIHelper.append_url_with_template_parameters(_url_path,... | [
"def",
"create_subscription_item",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/items'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_parameters",
... | Does a POST request to /subscriptions/{subscription_id}/items. | [
"Does",
"a",
"POST",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"items",
"."
] | [
"\"\"\"Does a POST request to /subscriptions/{subscription_id}/items.\r\n\r\n Creates a new Subscription item\r\n\r\n Args:\r\n subscription_id (string): Subscription id\r\n request (CreateSubscriptionItemRequest): Request for creating a\r\n subscription item\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionItemResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the da... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_metadata | <not_specific> | def update_subscription_metadata(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /Subscriptions/{subscription_id}/metadata.
Updates the metadata from a ... | Does a PATCH request to /Subscriptions/{subscription_id}/metadata.
Updates the metadata from a subscription
Args:
subscription_id (string): The subscription id
request (UpdateMetadataRequest): Request for updating the
subscrption metadata
ide... | Does a PATCH request to /Subscriptions/{subscription_id}/metadata.
Updates the metadata from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"Subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"metadata",
".",
"Updates",
"the",
"metadata",
"from",
"a",
"subscription"
] | def update_subscription_metadata(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/Subscriptions/{subscription_id}/metadata'
_url_path = APIHelper.append_url_with_template_pa... | [
"def",
"update_subscription_metadata",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/Subscriptions/{subscription_id}/metadata'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_paramete... | Does a PATCH request to /Subscriptions/{subscription_id}/metadata. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"Subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"metadata",
"."
] | [
"\"\"\"Does a PATCH request to /Subscriptions/{subscription_id}/metadata.\r\n\r\n Updates the metadata from a subscription\r\n\r\n Args:\r\n subscription_id (string): The subscription id\r\n request (UpdateMetadataRequest): Request for updating the\r\n subscrption ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | cancel_subscription | <not_specific> | def cancel_subscription(self,
subscription_id,
request=None,
idempotency_key=None):
"""Does a DELETE request to /subscriptions/{subscription_id}.
Cancels a subscription
Args:
subscription_i... | Does a DELETE request to /subscriptions/{subscription_id}.
Cancels a subscription
Args:
subscription_id (string): Subscription id
request (CreateCancelSubscriptionRequest, optional): Request for
cancelling a subscription
idempotency_key (stri... | Does a DELETE request to /subscriptions/{subscription_id}.
Cancels a subscription | [
"Does",
"a",
"DELETE",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
".",
"Cancels",
"a",
"subscription"
] | def cancel_subscription(self,
subscription_id,
request=None,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'subs... | [
"def",
"cancel_subscription",
"(",
"self",
",",
"subscription_id",
",",
"request",
"=",
"None",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_parameter... | Does a DELETE request to /subscriptions/{subscription_id}. | [
"Does",
"a",
"DELETE",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"."
] | [
"\"\"\"Does a DELETE request to /subscriptions/{subscription_id}.\r\n\r\n Cancels a subscription\r\n\r\n Args:\r\n subscription_id (string): Subscription id\r\n request (CreateCancelSubscriptionRequest, optional): Request for\r\n cancelling a subscription\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_due_days | <not_specific> | def update_subscription_due_days(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days.
Updates the boleto du... | Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days.
Updates the boleto due days from a subscription
Args:
subscription_id (string): Subscription Id
request (UpdateSubscriptionDueDaysRequest): TODO: type description
here. Example:
... | Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days.
Updates the boleto due days from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"boleto",
"-",
"due",
"-",
"days",
".",
"Updates",
"the",
"boleto",
"due",
"days",
"from",
"a",
"subscription"
] | def update_subscription_due_days(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/boleto-due-days'
_url_path = APIHelper.append_url_with_temp... | [
"def",
"update_subscription_due_days",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/boleto-due-days'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_p... | Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"boleto",
"-",
"due",
"-",
"days",
"."
] | [
"\"\"\"Does a PATCH request to /subscriptions/{subscription_id}/boleto-due-days.\r\n\r\n Updates the boleto due days from a subscription\r\n\r\n Args:\r\n subscription_id (string): Subscription Id\r\n request (UpdateSubscriptionDueDaysRequest): TODO: type description\r\n ... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fb86a1c134a455a5a5297fbedd5b96689a5c4780 | shoxsz/MundiApi-NodeJS | mundiapi/controllers/subscriptions_controller.py | [
"MIT"
] | Python | update_subscription_billing_date | <not_specific> | def update_subscription_billing_date(self,
subscription_id,
request,
idempotency_key=None):
"""Does a PATCH request to /subscriptions/{subscription_id}/billing-date.
Updates ... | Does a PATCH request to /subscriptions/{subscription_id}/billing-date.
Updates the billing date from a subscription
Args:
subscription_id (string): The subscription id
request (UpdateSubscriptionBillingDateRequest): Request for
updating the subscription b... | Does a PATCH request to /subscriptions/{subscription_id}/billing-date.
Updates the billing date from a subscription | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"billing",
"-",
"date",
".",
"Updates",
"the",
"billing",
"date",
"from",
"a",
"subscription"
] | def update_subscription_billing_date(self,
subscription_id,
request,
idempotency_key=None):
_url_path = '/subscriptions/{subscription_id}/billing-date'
_url_path = APIHelper.append_... | [
"def",
"update_subscription_billing_date",
"(",
"self",
",",
"subscription_id",
",",
"request",
",",
"idempotency_key",
"=",
"None",
")",
":",
"_url_path",
"=",
"'/subscriptions/{subscription_id}/billing-date'",
"_url_path",
"=",
"APIHelper",
".",
"append_url_with_template_... | Does a PATCH request to /subscriptions/{subscription_id}/billing-date. | [
"Does",
"a",
"PATCH",
"request",
"to",
"/",
"subscriptions",
"/",
"{",
"subscription_id",
"}",
"/",
"billing",
"-",
"date",
"."
] | [
"\"\"\"Does a PATCH request to /subscriptions/{subscription_id}/billing-date.\r\n\r\n Updates the billing date from a subscription\r\n\r\n Args:\r\n subscription_id (string): The subscription id\r\n request (UpdateSubscriptionBillingDateRequest): Request for\r\n up... | [
{
"param": "self",
"type": null
},
{
"param": "subscription_id",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "idempotency_key",
"type": null
}
] | {
"returns": [
{
"docstring": "Response from the API.",
"docstring_tokens": [
"Response",
"from",
"the",
"API",
"."
],
"type": "GetSubscriptionResponse"
}
],
"raises": [
{
"docstring": "When an error occurs while fetching the data f... |
fcc210153a62ce44322e9fd14471256c2d1b15e8 | shoxsz/MundiApi-NodeJS | mundiapi/models/get_pricing_scheme_response.py | [
"MIT"
] | Python | from_dictionary | <not_specific> | def from_dictionary(cls,
dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
An instance of this structure class. | [
"Creates",
"an",
"instance",
"of",
"this",
"model",
"from",
"a",
"dictionary",
"Args",
":",
"dictionary",
"(",
"dictionary",
")",
":",
"A",
"dictionary",
"representation",
"of",
"the",
"object",
"as",
"obtained",
"from",
"the",
"deserialization",
"of",
"the",
... | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
price = dictionary.get('price')
scheme_type = dictionary.get('scheme_type')
price_brackets = None
if dictionary.get('price_brackets') != None:
price_brackets =... | [
"def",
"from_dictionary",
"(",
"cls",
",",
"dictionary",
")",
":",
"if",
"dictionary",
"is",
"None",
":",
"return",
"None",
"price",
"=",
"dictionary",
".",
"get",
"(",
"'price'",
")",
"scheme_type",
"=",
"dictionary",
".",
"get",
"(",
"'scheme_type'",
")"... | Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. | [
"Creates",
"an",
"instance",
"of",
"this",
"model",
"from",
"a",
"dictionary",
"Args",
":",
"dictionary",
"(",
"dictionary",
")",
":",
"A",
"dictionary",
"representation",
"of",
"the",
"object",
"as",
"obtained",
"from",
"the",
"deserialization",
"of",
"the",
... | [
"\"\"\"Creates an instance of this model from a dictionary\r\n\r\n Args:\r\n dictionary (dictionary): A dictionary representation of the object as\r\n obtained from the deserialization of the server's response. The keys\r\n MUST match property names in the API description.\r\... | [
{
"param": "cls",
"type": null
},
{
"param": "dictionary",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dictionary",
"type": null,
"docstring": null,
"docstring_token... |
40accda727b0a65823adfd7b2d111a5d7a680ee2 | Hephaest/ComputerNetworkApplications | Web Server/WebServer.py | [
"MIT"
] | Python | handle_request | null | def handle_request(tcp_socket, client_ip, client_port):
"""Receive and response to HTTP request message.
Args:
:param tcp_socket: the socket which is created from start_server function.
:param client_ip: IP address of the client.
:param client_port: Port number of the client.
Raise... | Receive and response to HTTP request message.
Args:
:param tcp_socket: the socket which is created from start_server function.
:param client_ip: IP address of the client.
:param client_port: Port number of the client.
Raises:
FileNotFoundError: file does not exist.
| Receive and response to HTTP request message. | [
"Receive",
"and",
"response",
"to",
"HTTP",
"request",
"message",
"."
] | def handle_request(tcp_socket, client_ip, client_port):
print("Client ({ip}: {port}) is coming...".format(ip = client_ip, port = client_port))
try:
msg = tcp_socket.recv(1024).decode()
if not msg:
print("Error! server receive empty HTTP request.")
tcp_socket.close()
... | [
"def",
"handle_request",
"(",
"tcp_socket",
",",
"client_ip",
",",
"client_port",
")",
":",
"print",
"(",
"\"Client ({ip}: {port}) is coming...\"",
".",
"format",
"(",
"ip",
"=",
"client_ip",
",",
"port",
"=",
"client_port",
")",
")",
"try",
":",
"msg",
"=",
... | Receive and response to HTTP request message. | [
"Receive",
"and",
"response",
"to",
"HTTP",
"request",
"message",
"."
] | [
"\"\"\"Receive and response to HTTP request message.\n\n Args:\n :param tcp_socket: the socket which is created from start_server function.\n :param client_ip: IP address of the client.\n :param client_port: Port number of the client.\n\n Raises:\n FileNotFoundError: file does not ... | [
{
"param": "tcp_socket",
"type": null
},
{
"param": "client_ip",
"type": null
},
{
"param": "client_port",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "file does not exist.",
"docstring_tokens": [
"file",
"does",
"not",
"exist",
"."
],
"type": "FileNotFoundError"
}
],
"params": [
{
"identifier": "tcp_socket",
"type": null,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.