partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
Sections.get_sections_with_students_in_course
Return list of sections including students for the passed course ID.
uw_canvas/sections.py
def get_sections_with_students_in_course(self, course_id, params={}): """ Return list of sections including students for the passed course ID. """ include = params.get("include", []) if "students" not in include: include.append("students") params["include"] = ...
def get_sections_with_students_in_course(self, course_id, params={}): """ Return list of sections including students for the passed course ID. """ include = params.get("include", []) if "students" not in include: include.append("students") params["include"] = ...
[ "Return", "list", "of", "sections", "including", "students", "for", "the", "passed", "course", "ID", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L46-L55
[ "def", "get_sections_with_students_in_course", "(", "self", ",", "course_id", ",", "params", "=", "{", "}", ")", ":", "include", "=", "params", ".", "get", "(", "\"include\"", ",", "[", "]", ")", "if", "\"students\"", "not", "in", "include", ":", "include"...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Sections.get_sections_with_students_in_course_by_sis_id
Return list of sections including students for the passed sis ID.
uw_canvas/sections.py
def get_sections_with_students_in_course_by_sis_id(self, sis_course_id, params={}): """ Return list of sections including students for the passed sis ID. """ return self.get_sections_with_students_in_course( self._sis_id(...
def get_sections_with_students_in_course_by_sis_id(self, sis_course_id, params={}): """ Return list of sections including students for the passed sis ID. """ return self.get_sections_with_students_in_course( self._sis_id(...
[ "Return", "list", "of", "sections", "including", "students", "for", "the", "passed", "sis", "ID", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L57-L63
[ "def", "get_sections_with_students_in_course_by_sis_id", "(", "self", ",", "sis_course_id", ",", "params", "=", "{", "}", ")", ":", "return", "self", ".", "get_sections_with_students_in_course", "(", "self", ".", "_sis_id", "(", "sis_course_id", ",", "sis_field", "=...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Sections.create_section
Create a canvas section in the given course id. https://canvas.instructure.com/doc/api/sections.html#method.sections.create
uw_canvas/sections.py
def create_section(self, course_id, name, sis_section_id): """ Create a canvas section in the given course id. https://canvas.instructure.com/doc/api/sections.html#method.sections.create """ url = COURSES_API.format(course_id) + "/sections" body = {"course_section": {"na...
def create_section(self, course_id, name, sis_section_id): """ Create a canvas section in the given course id. https://canvas.instructure.com/doc/api/sections.html#method.sections.create """ url = COURSES_API.format(course_id) + "/sections" body = {"course_section": {"na...
[ "Create", "a", "canvas", "section", "in", "the", "given", "course", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L65-L75
[ "def", "create_section", "(", "self", ",", "course_id", ",", "name", ",", "sis_section_id", ")", ":", "url", "=", "COURSES_API", ".", "format", "(", "course_id", ")", "+", "\"/sections\"", "body", "=", "{", "\"course_section\"", ":", "{", "\"name\"", ":", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Sections.update_section
Update a canvas section with the given section id. https://canvas.instructure.com/doc/api/sections.html#method.sections.update
uw_canvas/sections.py
def update_section(self, section_id, name, sis_section_id): """ Update a canvas section with the given section id. https://canvas.instructure.com/doc/api/sections.html#method.sections.update """ url = SECTIONS_API.format(section_id) body = {"course_section": {}} ...
def update_section(self, section_id, name, sis_section_id): """ Update a canvas section with the given section id. https://canvas.instructure.com/doc/api/sections.html#method.sections.update """ url = SECTIONS_API.format(section_id) body = {"course_section": {}} ...
[ "Update", "a", "canvas", "section", "with", "the", "given", "section", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sections.py#L77-L92
[ "def", "update_section", "(", "self", ",", "section_id", ",", "name", ",", "sis_section_id", ")", ":", "url", "=", "SECTIONS_API", ".", "format", "(", "section_id", ")", "body", "=", "{", "\"course_section\"", ":", "{", "}", "}", "if", "name", ":", "body...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Quizzes.get_quizzes
List quizzes for a given course https://canvas.instructure.com/doc/api/quizzes.html#method.quizzes_api.index
uw_canvas/quizzes.py
def get_quizzes(self, course_id): """ List quizzes for a given course https://canvas.instructure.com/doc/api/quizzes.html#method.quizzes_api.index """ url = QUIZZES_API.format(course_id) data = self._get_resource(url) quizzes = [] for datum in data: ...
def get_quizzes(self, course_id): """ List quizzes for a given course https://canvas.instructure.com/doc/api/quizzes.html#method.quizzes_api.index """ url = QUIZZES_API.format(course_id) data = self._get_resource(url) quizzes = [] for datum in data: ...
[ "List", "quizzes", "for", "a", "given", "course" ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/quizzes.py#L17-L28
[ "def", "get_quizzes", "(", "self", ",", "course_id", ")", ":", "url", "=", "QUIZZES_API", ".", "format", "(", "course_id", ")", "data", "=", "self", ".", "_get_resource", "(", "url", ")", "quizzes", "=", "[", "]", "for", "datum", "in", "data", ":", "...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.get_account
Return account resource for given canvas account id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show
uw_canvas/accounts.py
def get_account(self, account_id): """ Return account resource for given canvas account id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show """ url = ACCOUNTS_API.format(account_id) return CanvasAccount(data=self._get_resource(url))
def get_account(self, account_id): """ Return account resource for given canvas account id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show """ url = ACCOUNTS_API.format(account_id) return CanvasAccount(data=self._get_resource(url))
[ "Return", "account", "resource", "for", "given", "canvas", "account", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L8-L15
[ "def", "get_account", "(", "self", ",", "account_id", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "return", "CanvasAccount", "(", "data", "=", "self", ".", "_get_resource", "(", "url", ")", ")" ]
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.get_sub_accounts
Return list of subaccounts within the account with the passed canvas id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts
uw_canvas/accounts.py
def get_sub_accounts(self, account_id, params={}): """ Return list of subaccounts within the account with the passed canvas id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts """ url = ACCOUNTS_API.format(account_id) + "/sub_accounts" ...
def get_sub_accounts(self, account_id, params={}): """ Return list of subaccounts within the account with the passed canvas id. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts """ url = ACCOUNTS_API.format(account_id) + "/sub_accounts" ...
[ "Return", "list", "of", "subaccounts", "within", "the", "account", "with", "the", "passed", "canvas", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L23-L36
[ "def", "get_sub_accounts", "(", "self", ",", "account_id", ",", "params", "=", "{", "}", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "+", "\"/sub_accounts\"", "accounts", "=", "[", "]", "for", "datum", "in", "self", ".", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.update_account
Update the passed account. Returns the updated account. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update
uw_canvas/accounts.py
def update_account(self, account): """ Update the passed account. Returns the updated account. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update """ url = ACCOUNTS_API.format(account.account_id) body = {"account": {"name": account.name}} ...
def update_account(self, account): """ Update the passed account. Returns the updated account. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update """ url = ACCOUNTS_API.format(account.account_id) body = {"account": {"name": account.name}} ...
[ "Update", "the", "passed", "account", ".", "Returns", "the", "updated", "account", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L60-L69
[ "def", "update_account", "(", "self", ",", "account", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account", ".", "account_id", ")", "body", "=", "{", "\"account\"", ":", "{", "\"name\"", ":", "account", ".", "name", "}", "}", "return", "...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.update_sis_id
Updates the SIS ID for the account identified by the passed account ID. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update
uw_canvas/accounts.py
def update_sis_id(self, account_id, sis_account_id): """ Updates the SIS ID for the account identified by the passed account ID. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update """ if account_id == self._canvas_account_id: raise Exception(...
def update_sis_id(self, account_id, sis_account_id): """ Updates the SIS ID for the account identified by the passed account ID. https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update """ if account_id == self._canvas_account_id: raise Exception(...
[ "Updates", "the", "SIS", "ID", "for", "the", "account", "identified", "by", "the", "passed", "account", "ID", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L71-L83
[ "def", "update_sis_id", "(", "self", ",", "account_id", ",", "sis_account_id", ")", ":", "if", "account_id", "==", "self", ".", "_canvas_account_id", ":", "raise", "Exception", "(", "\"SIS ID cannot be updated for the root account\"", ")", "url", "=", "ACCOUNTS_API", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.get_auth_settings
Return the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show_sso_settings
uw_canvas/accounts.py
def get_auth_settings(self, account_id): """ Return the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show_sso_settings """ url = ACCOUNTS_API.format(account_id) + "/ss...
def get_auth_settings(self, account_id): """ Return the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show_sso_settings """ url = ACCOUNTS_API.format(account_id) + "/ss...
[ "Return", "the", "authentication", "settings", "for", "the", "passed", "account_id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L85-L92
[ "def", "get_auth_settings", "(", "self", ",", "account_id", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "+", "\"/sso_settings\"", "return", "CanvasSSOSettings", "(", "data", "=", "self", ".", "_get_resource", "(", "url", ")", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Accounts.update_auth_settings
Update the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.update_sso_settings
uw_canvas/accounts.py
def update_auth_settings(self, account_id, auth_settings): """ Update the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.update_sso_settings """ url = ACCOUNTS_API.forma...
def update_auth_settings(self, account_id, auth_settings): """ Update the authentication settings for the passed account_id. https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.update_sso_settings """ url = ACCOUNTS_API.forma...
[ "Update", "the", "authentication", "settings", "for", "the", "passed", "account_id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/accounts.py#L94-L102
[ "def", "update_auth_settings", "(", "self", ",", "account_id", ",", "auth_settings", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "+", "\"/sso_settings\"", "data", "=", "self", ".", "_put_resource", "(", "url", ",", "auth_settin...
9845faf33d49a8f06908efc22640c001116d6ea2
test
settlement_schmertmann
Calculates the settlement of a shallow foundation (Schmertmann, 19XX). :param sp: Soil Profile object :param fd: Foundation object :param load: :param youngs_modulus_soil: The Young's modulus of the soil. :param kwargs: :return: float, the settlement.
geofound/settlement.py
def settlement_schmertmann(sp, fd, load, youngs_modulus_soil, **kwargs): """ Calculates the settlement of a shallow foundation (Schmertmann, 19XX). :param sp: Soil Profile object :param fd: Foundation object :param load: :param youngs_modulus_soil: The Young's modulus of the soil. :param kw...
def settlement_schmertmann(sp, fd, load, youngs_modulus_soil, **kwargs): """ Calculates the settlement of a shallow foundation (Schmertmann, 19XX). :param sp: Soil Profile object :param fd: Foundation object :param load: :param youngs_modulus_soil: The Young's modulus of the soil. :param kw...
[ "Calculates", "the", "settlement", "of", "a", "shallow", "foundation", "(", "Schmertmann", "19XX", ")", "." ]
eng-tools/geofound
python
https://github.com/eng-tools/geofound/blob/6b1b097d5db998907bdcb5b4798fb4629674c770/geofound/settlement.py#L6-L74
[ "def", "settlement_schmertmann", "(", "sp", ",", "fd", ",", "load", ",", "youngs_modulus_soil", ",", "*", "*", "kwargs", ")", ":", "length", "=", "float", "(", "fd", ".", "length", ")", "breadth", "=", "float", "(", "fd", ".", "width", ")", "depth", ...
6b1b097d5db998907bdcb5b4798fb4629674c770
test
Terms.get_all_terms
Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index
uw_canvas/terms.py
def get_all_terms(self): """ Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index """ if not self._canvas_account_id: raise MissingAccountID() params = {"workflow_state": 'all', 'per_page'...
def get_all_terms(self): """ Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index """ if not self._canvas_account_id: raise MissingAccountID() params = {"workflow_state": 'all', 'per_page'...
[ "Return", "all", "of", "the", "terms", "in", "the", "account", ".", "https", ":", "//", "canvas", ".", "instructure", ".", "com", "/", "doc", "/", "api", "/", "enrollment_terms", ".", "html#method", ".", "terms_api", ".", "index" ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/terms.py#L7-L23
[ "def", "get_all_terms", "(", "self", ")", ":", "if", "not", "self", ".", "_canvas_account_id", ":", "raise", "MissingAccountID", "(", ")", "params", "=", "{", "\"workflow_state\"", ":", "'all'", ",", "'per_page'", ":", "500", "}", "url", "=", "ACCOUNTS_API",...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Terms.get_term_by_sis_id
Return a term resource for the passed SIS ID.
uw_canvas/terms.py
def get_term_by_sis_id(self, sis_term_id): """ Return a term resource for the passed SIS ID. """ for term in self.get_all_terms(): if term.sis_term_id == sis_term_id: return term
def get_term_by_sis_id(self, sis_term_id): """ Return a term resource for the passed SIS ID. """ for term in self.get_all_terms(): if term.sis_term_id == sis_term_id: return term
[ "Return", "a", "term", "resource", "for", "the", "passed", "SIS", "ID", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/terms.py#L25-L31
[ "def", "get_term_by_sis_id", "(", "self", ",", "sis_term_id", ")", ":", "for", "term", "in", "self", ".", "get_all_terms", "(", ")", ":", "if", "term", ".", "sis_term_id", "==", "sis_term_id", ":", "return", "term" ]
9845faf33d49a8f06908efc22640c001116d6ea2
test
Terms.update_term_overrides
Update an existing enrollment term for the passed SIS ID. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms.update
uw_canvas/terms.py
def update_term_overrides(self, sis_term_id, overrides={}): """ Update an existing enrollment term for the passed SIS ID. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms.update """ if not self._canvas_account_id: raise MissingAccountID() ...
def update_term_overrides(self, sis_term_id, overrides={}): """ Update an existing enrollment term for the passed SIS ID. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms.update """ if not self._canvas_account_id: raise MissingAccountID() ...
[ "Update", "an", "existing", "enrollment", "term", "for", "the", "passed", "SIS", "ID", ".", "https", ":", "//", "canvas", ".", "instructure", ".", "com", "/", "doc", "/", "api", "/", "enrollment_terms", ".", "html#method", ".", "terms", ".", "update" ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/terms.py#L33-L46
[ "def", "update_term_overrides", "(", "self", ",", "sis_term_id", ",", "overrides", "=", "{", "}", ")", ":", "if", "not", "self", ".", "_canvas_account_id", ":", "raise", "MissingAccountID", "(", ")", "url", "=", "ACCOUNTS_API", ".", "format", "(", "self", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
log
Produces console output. :param out_str: Output string :param o2: Additional output string :param o3: Additional output string :param o4: Additional output string :return: None
geofound/output.py
def log(out_str, o2="", o3="", o4=""): """ Produces console output. :param out_str: Output string :param o2: Additional output string :param o3: Additional output string :param o4: Additional output string :return: None """ print(out_str, o2, o3, o4)
def log(out_str, o2="", o3="", o4=""): """ Produces console output. :param out_str: Output string :param o2: Additional output string :param o3: Additional output string :param o4: Additional output string :return: None """ print(out_str, o2, o3, o4)
[ "Produces", "console", "output", ".", ":", "param", "out_str", ":", "Output", "string", ":", "param", "o2", ":", "Additional", "output", "string", ":", "param", "o3", ":", "Additional", "output", "string", ":", "param", "o4", ":", "Additional", "output", "...
eng-tools/geofound
python
https://github.com/eng-tools/geofound/blob/6b1b097d5db998907bdcb5b4798fb4629674c770/geofound/output.py#L3-L12
[ "def", "log", "(", "out_str", ",", "o2", "=", "\"\"", ",", "o3", "=", "\"\"", ",", "o4", "=", "\"\"", ")", ":", "print", "(", "out_str", ",", "o2", ",", "o3", ",", "o4", ")" ]
6b1b097d5db998907bdcb5b4798fb4629674c770
test
SISImport.import_str
Imports a CSV string. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create
uw_canvas/sis_import.py
def import_str(self, csv, params={}): """ Imports a CSV string. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create """ if not self._canvas_account_id: raise MissingAccountID() params["import_type"] = SISImportModel.CSV_IMPO...
def import_str(self, csv, params={}): """ Imports a CSV string. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create """ if not self._canvas_account_id: raise MissingAccountID() params["import_type"] = SISImportModel.CSV_IMPO...
[ "Imports", "a", "CSV", "string", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sis_import.py#L18-L32
[ "def", "import_str", "(", "self", ",", "csv", ",", "params", "=", "{", "}", ")", ":", "if", "not", "self", ".", "_canvas_account_id", ":", "raise", "MissingAccountID", "(", ")", "params", "[", "\"import_type\"", "]", "=", "SISImportModel", ".", "CSV_IMPORT...
9845faf33d49a8f06908efc22640c001116d6ea2
test
SISImport.import_dir
Imports a directory of CSV files. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create
uw_canvas/sis_import.py
def import_dir(self, dir_path, params={}): """ Imports a directory of CSV files. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create """ if not self._canvas_account_id: raise MissingAccountID() body = self._build_archive(dir...
def import_dir(self, dir_path, params={}): """ Imports a directory of CSV files. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create """ if not self._canvas_account_id: raise MissingAccountID() body = self._build_archive(dir...
[ "Imports", "a", "directory", "of", "CSV", "files", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sis_import.py#L34-L49
[ "def", "import_dir", "(", "self", ",", "dir_path", ",", "params", "=", "{", "}", ")", ":", "if", "not", "self", ".", "_canvas_account_id", ":", "raise", "MissingAccountID", "(", ")", "body", "=", "self", ".", "_build_archive", "(", "dir_path", ")", "para...
9845faf33d49a8f06908efc22640c001116d6ea2
test
SISImport.get_import_status
Get the status of an already created SIS import. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.show
uw_canvas/sis_import.py
def get_import_status(self, sis_import): """ Get the status of an already created SIS import. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.show """ if not self._canvas_account_id: raise MissingAccountID() url = SIS_IMPORTS_A...
def get_import_status(self, sis_import): """ Get the status of an already created SIS import. https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.show """ if not self._canvas_account_id: raise MissingAccountID() url = SIS_IMPORTS_A...
[ "Get", "the", "status", "of", "an", "already", "created", "SIS", "import", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sis_import.py#L51-L63
[ "def", "get_import_status", "(", "self", ",", "sis_import", ")", ":", "if", "not", "self", ".", "_canvas_account_id", ":", "raise", "MissingAccountID", "(", ")", "url", "=", "SIS_IMPORTS_API", ".", "format", "(", "self", ".", "_canvas_account_id", ")", "+", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
SISImport._build_archive
Creates a zip archive from files in path.
uw_canvas/sis_import.py
def _build_archive(self, dir_path): """ Creates a zip archive from files in path. """ zip_path = os.path.join(dir_path, "import.zip") archive = zipfile.ZipFile(zip_path, "w") for filename in CSV_FILES: filepath = os.path.join(dir_path, filename) ...
def _build_archive(self, dir_path): """ Creates a zip archive from files in path. """ zip_path = os.path.join(dir_path, "import.zip") archive = zipfile.ZipFile(zip_path, "w") for filename in CSV_FILES: filepath = os.path.join(dir_path, filename) ...
[ "Creates", "a", "zip", "archive", "from", "files", "in", "path", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/sis_import.py#L75-L93
[ "def", "_build_archive", "(", "self", ",", "dir_path", ")", ":", "zip_path", "=", "os", ".", "path", ".", "join", "(", "dir_path", ",", "\"import.zip\"", ")", "archive", "=", "zipfile", ".", "ZipFile", "(", "zip_path", ",", "\"w\"", ")", "for", "filename...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Assignments.get_assignments
List assignments for a given course https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.index
uw_canvas/assignments.py
def get_assignments(self, course_id): """ List assignments for a given course https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.index """ url = ASSIGNMENTS_API.format(course_id) data = self._get_resource(url) assignments = [] ...
def get_assignments(self, course_id): """ List assignments for a given course https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.index """ url = ASSIGNMENTS_API.format(course_id) data = self._get_resource(url) assignments = [] ...
[ "List", "assignments", "for", "a", "given", "course" ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/assignments.py#L9-L20
[ "def", "get_assignments", "(", "self", ",", "course_id", ")", ":", "url", "=", "ASSIGNMENTS_API", ".", "format", "(", "course_id", ")", "data", "=", "self", ".", "_get_resource", "(", "url", ")", "assignments", "=", "[", "]", "for", "datum", "in", "data"...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Assignments.update_assignment
Modify an existing assignment. https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.update
uw_canvas/assignments.py
def update_assignment(self, assignment): """ Modify an existing assignment. https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.update """ url = ASSIGNMENTS_API.format(assignment.course_id) + "/{}".format( assignment.assignment_id) ...
def update_assignment(self, assignment): """ Modify an existing assignment. https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.update """ url = ASSIGNMENTS_API.format(assignment.course_id) + "/{}".format( assignment.assignment_id) ...
[ "Modify", "an", "existing", "assignment", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/assignments.py#L30-L40
[ "def", "update_assignment", "(", "self", ",", "assignment", ")", ":", "url", "=", "ASSIGNMENTS_API", ".", "format", "(", "assignment", ".", "course_id", ")", "+", "\"/{}\"", ".", "format", "(", "assignment", ".", "assignment_id", ")", "data", "=", "self", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.get_available_reports
Returns the list of reports for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports
uw_canvas/reports.py
def get_available_reports(self, account_id): """ Returns the list of reports for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports """ url = ACCOUNTS_API.format(account_id) + "/reports" report_typ...
def get_available_reports(self, account_id): """ Returns the list of reports for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.available_reports """ url = ACCOUNTS_API.format(account_id) + "/reports" report_typ...
[ "Returns", "the", "list", "of", "reports", "for", "the", "canvas", "account", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L23-L34
[ "def", "get_available_reports", "(", "self", ",", "account_id", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "+", "\"/reports\"", "report_types", "=", "[", "]", "for", "datum", "in", "self", ".", "_get_resource", "(", "url", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.get_reports_by_type
Shows all reports of the passed report_type that have been run for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.index
uw_canvas/reports.py
def get_reports_by_type(self, account_id, report_type): """ Shows all reports of the passed report_type that have been run for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.index """ url = ACCOUNTS_API.format(ac...
def get_reports_by_type(self, account_id, report_type): """ Shows all reports of the passed report_type that have been run for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.index """ url = ACCOUNTS_API.format(ac...
[ "Shows", "all", "reports", "of", "the", "passed", "report_type", "that", "have", "been", "run", "for", "the", "canvas", "account", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L36-L51
[ "def", "get_reports_by_type", "(", "self", ",", "account_id", ",", "report_type", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "account_id", ")", "+", "\"/reports/{}\"", ".", "format", "(", "report_type", ")", "reports", "=", "[", "]", "for", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.create_report
Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create
uw_canvas/reports.py
def create_report(self, report_type, account_id, term_id=None, params={}): """ Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create """ if term_id is not None: params["enrollm...
def create_report(self, report_type, account_id, term_id=None, params={}): """ Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create """ if term_id is not None: params["enrollm...
[ "Generates", "a", "report", "instance", "for", "the", "canvas", "account", "id", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L53-L68
[ "def", "create_report", "(", "self", ",", "report_type", ",", "account_id", ",", "term_id", "=", "None", ",", "params", "=", "{", "}", ")", ":", "if", "term_id", "is", "not", "None", ":", "params", "[", "\"enrollment_term_id\"", "]", "=", "term_id", "url...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.create_course_provisioning_report
Convenience method for create_report, for creating a course provisioning report.
uw_canvas/reports.py
def create_course_provisioning_report(self, account_id, term_id=None, params={}): """ Convenience method for create_report, for creating a course provisioning report. """ params["courses"] = True return self.create_report(ReportTy...
def create_course_provisioning_report(self, account_id, term_id=None, params={}): """ Convenience method for create_report, for creating a course provisioning report. """ params["courses"] = True return self.create_report(ReportTy...
[ "Convenience", "method", "for", "create_report", "for", "creating", "a", "course", "provisioning", "report", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L70-L78
[ "def", "create_course_provisioning_report", "(", "self", ",", "account_id", ",", "term_id", "=", "None", ",", "params", "=", "{", "}", ")", ":", "params", "[", "\"courses\"", "]", "=", "True", "return", "self", ".", "create_report", "(", "ReportType", ".", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.create_course_sis_export_report
Convenience method for create_report, for creating a course sis export report.
uw_canvas/reports.py
def create_course_sis_export_report(self, account_id, term_id=None, params={}): """ Convenience method for create_report, for creating a course sis export report. """ params["courses"] = True return self.create_report(ReportType.SIS...
def create_course_sis_export_report(self, account_id, term_id=None, params={}): """ Convenience method for create_report, for creating a course sis export report. """ params["courses"] = True return self.create_report(ReportType.SIS...
[ "Convenience", "method", "for", "create_report", "for", "creating", "a", "course", "sis", "export", "report", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L110-L118
[ "def", "create_course_sis_export_report", "(", "self", ",", "account_id", ",", "term_id", "=", "None", ",", "params", "=", "{", "}", ")", ":", "params", "[", "\"courses\"", "]", "=", "True", "return", "self", ".", "create_report", "(", "ReportType", ".", "...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.create_unused_courses_report
Convenience method for create_report, for creating an unused courses report.
uw_canvas/reports.py
def create_unused_courses_report(self, account_id, term_id=None): """ Convenience method for create_report, for creating an unused courses report. """ return self.create_report(ReportType.UNUSED_COURSES, account_id, term_id)
def create_unused_courses_report(self, account_id, term_id=None): """ Convenience method for create_report, for creating an unused courses report. """ return self.create_report(ReportType.UNUSED_COURSES, account_id, term_id)
[ "Convenience", "method", "for", "create_report", "for", "creating", "an", "unused", "courses", "report", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L120-L126
[ "def", "create_unused_courses_report", "(", "self", ",", "account_id", ",", "term_id", "=", "None", ")", ":", "return", "self", ".", "create_report", "(", "ReportType", ".", "UNUSED_COURSES", ",", "account_id", ",", "term_id", ")" ]
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.get_report_data
Returns a completed report as a list of csv strings.
uw_canvas/reports.py
def get_report_data(self, report): """ Returns a completed report as a list of csv strings. """ if report.report_id is None or report.status is None: raise ReportFailureException(report) interval = getattr(settings, 'CANVAS_REPORT_POLLING_INTERVAL', 5) while ...
def get_report_data(self, report): """ Returns a completed report as a list of csv strings. """ if report.report_id is None or report.status is None: raise ReportFailureException(report) interval = getattr(settings, 'CANVAS_REPORT_POLLING_INTERVAL', 5) while ...
[ "Returns", "a", "completed", "report", "as", "a", "list", "of", "csv", "strings", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L128-L147
[ "def", "get_report_data", "(", "self", ",", "report", ")", ":", "if", "report", ".", "report_id", "is", "None", "or", "report", ".", "status", "is", "None", ":", "raise", "ReportFailureException", "(", "report", ")", "interval", "=", "getattr", "(", "setti...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.get_report_status
Returns the status of a report. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.show
uw_canvas/reports.py
def get_report_status(self, report): """ Returns the status of a report. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.show """ if (report.account_id is None or report.type is None or report.report_id is None): rai...
def get_report_status(self, report): """ Returns the status of a report. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.show """ if (report.account_id is None or report.type is None or report.report_id is None): rai...
[ "Returns", "the", "status", "of", "a", "report", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L149-L164
[ "def", "get_report_status", "(", "self", ",", "report", ")", ":", "if", "(", "report", ".", "account_id", "is", "None", "or", "report", ".", "type", "is", "None", "or", "report", ".", "report_id", "is", "None", ")", ":", "raise", "ReportFailureException", ...
9845faf33d49a8f06908efc22640c001116d6ea2
test
Reports.delete_report
Deletes a generated report instance. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy
uw_canvas/reports.py
def delete_report(self, report): """ Deletes a generated report instance. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy """ url = ACCOUNTS_API.format(report.account_id) + "/reports/{}/{}".format( report.type, report.report...
def delete_report(self, report): """ Deletes a generated report instance. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.destroy """ url = ACCOUNTS_API.format(report.account_id) + "/reports/{}/{}".format( report.type, report.report...
[ "Deletes", "a", "generated", "report", "instance", "." ]
uw-it-aca/uw-restclients-canvas
python
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/reports.py#L166-L176
[ "def", "delete_report", "(", "self", ",", "report", ")", ":", "url", "=", "ACCOUNTS_API", ".", "format", "(", "report", ".", "account_id", ")", "+", "\"/reports/{}/{}\"", ".", "format", "(", "report", ".", "type", ",", "report", ".", "report_id", ")", "r...
9845faf33d49a8f06908efc22640c001116d6ea2
test
crop_image
Crop an image given the top left corner. :param img: The image :param start_y: The top left corner y coord :param start_x: The top left corner x coord :param h: The result height :param w: The result width :return: The cropped image.
opendatalake/detection/utils.py
def crop_image(img, start_y, start_x, h, w): """ Crop an image given the top left corner. :param img: The image :param start_y: The top left corner y coord :param start_x: The top left corner x coord :param h: The result height :param w: The result width :return: The cropped image. "...
def crop_image(img, start_y, start_x, h, w): """ Crop an image given the top left corner. :param img: The image :param start_y: The top left corner y coord :param start_x: The top left corner x coord :param h: The result height :param w: The result width :return: The cropped image. "...
[ "Crop", "an", "image", "given", "the", "top", "left", "corner", ".", ":", "param", "img", ":", "The", "image", ":", "param", "start_y", ":", "The", "top", "left", "corner", "y", "coord", ":", "param", "start_x", ":", "The", "top", "left", "corner", "...
penguinmenac3/opendatalake
python
https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L758-L768
[ "def", "crop_image", "(", "img", ",", "start_y", ",", "start_x", ",", "h", ",", "w", ")", ":", "return", "img", "[", "start_y", ":", "start_y", "+", "h", ",", "start_x", ":", "start_x", "+", "w", ",", ":", "]", ".", "copy", "(", ")" ]
77c888377095e1812a16982c8efbd2f6b1697a33
test
move_detections
Move detections in direction dx, dy. :param label: The label dict containing all detection lists. :param dy: The delta in y direction as a number. :param dx: The delta in x direction as a number. :return:
opendatalake/detection/utils.py
def move_detections(label, dy, dx): """ Move detections in direction dx, dy. :param label: The label dict containing all detection lists. :param dy: The delta in y direction as a number. :param dx: The delta in x direction as a number. :return: """ for k in label.keys(): if k.st...
def move_detections(label, dy, dx): """ Move detections in direction dx, dy. :param label: The label dict containing all detection lists. :param dy: The delta in y direction as a number. :param dx: The delta in x direction as a number. :return: """ for k in label.keys(): if k.st...
[ "Move", "detections", "in", "direction", "dx", "dy", "." ]
penguinmenac3/opendatalake
python
https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L771-L784
[ "def", "move_detections", "(", "label", ",", "dy", ",", "dx", ")", ":", "for", "k", "in", "label", ".", "keys", "(", ")", ":", "if", "k", ".", "startswith", "(", "\"detection\"", ")", ":", "detections", "=", "label", "[", "k", "]", "for", "detectio...
77c888377095e1812a16982c8efbd2f6b1697a33
test
hflip_detections
Horizontally flip detections according to an image flip. :param label: The label dict containing all detection lists. :param w: The width of the image as a number. :return:
opendatalake/detection/utils.py
def hflip_detections(label, w): """ Horizontally flip detections according to an image flip. :param label: The label dict containing all detection lists. :param w: The width of the image as a number. :return: """ for k in label.keys(): if k.startswith("detection"): detec...
def hflip_detections(label, w): """ Horizontally flip detections according to an image flip. :param label: The label dict containing all detection lists. :param w: The width of the image as a number. :return: """ for k in label.keys(): if k.startswith("detection"): detec...
[ "Horizontally", "flip", "detections", "according", "to", "an", "image", "flip", "." ]
penguinmenac3/opendatalake
python
https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L787-L801
[ "def", "hflip_detections", "(", "label", ",", "w", ")", ":", "for", "k", "in", "label", ".", "keys", "(", ")", ":", "if", "k", ".", "startswith", "(", "\"detection\"", ")", ":", "detections", "=", "label", "[", "k", "]", "for", "detection", "in", "...
77c888377095e1812a16982c8efbd2f6b1697a33
test
augment_detections
Augment the detection dataset. In your hyper_parameters.problem.augmentation add configurations to enable features. Supports "enable_horizontal_flip", "enable_micro_translation", "random_crop" : {"shape": { "width", "height" }} and "enable_texture_augmentation". Make sure to also set the "steps" otherwise ...
opendatalake/detection/utils.py
def augment_detections(hyper_params, feature, label): """ Augment the detection dataset. In your hyper_parameters.problem.augmentation add configurations to enable features. Supports "enable_horizontal_flip", "enable_micro_translation", "random_crop" : {"shape": { "width", "height" }} and "enable_t...
def augment_detections(hyper_params, feature, label): """ Augment the detection dataset. In your hyper_parameters.problem.augmentation add configurations to enable features. Supports "enable_horizontal_flip", "enable_micro_translation", "random_crop" : {"shape": { "width", "height" }} and "enable_t...
[ "Augment", "the", "detection", "dataset", "." ]
penguinmenac3/opendatalake
python
https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L804-L926
[ "def", "augment_detections", "(", "hyper_params", ",", "feature", ",", "label", ")", ":", "# Do not augment these ways:", "# 1) Rotation is not possible", "# 3) Scaling is not possible, because it ruins depth perception", "# However, random crops can improve performance. (Training speed an...
77c888377095e1812a16982c8efbd2f6b1697a33
test
get_dict_from_obj
Edit to get the dict even when the object is a GenericRelatedObjectManager. Added the try except.
inplaceeditform/commons.py
def get_dict_from_obj(obj): ''' Edit to get the dict even when the object is a GenericRelatedObjectManager. Added the try except. ''' obj_dict = obj.__dict__ obj_dict_result = obj_dict.copy() for key, value in obj_dict.items(): if key.endswith('_id'): key2 = key.replace('...
def get_dict_from_obj(obj): ''' Edit to get the dict even when the object is a GenericRelatedObjectManager. Added the try except. ''' obj_dict = obj.__dict__ obj_dict_result = obj_dict.copy() for key, value in obj_dict.items(): if key.endswith('_id'): key2 = key.replace('...
[ "Edit", "to", "get", "the", "dict", "even", "when", "the", "object", "is", "a", "GenericRelatedObjectManager", ".", "Added", "the", "try", "except", "." ]
django-inplaceedit/django-inplaceedit
python
https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/commons.py#L35-L57
[ "def", "get_dict_from_obj", "(", "obj", ")", ":", "obj_dict", "=", "obj", ".", "__dict__", "obj_dict_result", "=", "obj_dict", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "obj_dict", ".", "items", "(", ")", ":", "if", "key", ".", "endswith...
7ba18e7906f56c56395ca07e2486755062efce00
test
BaseAdaptorField.get_config
Get the arguments given to the template tag element and complete these with the ones from the settings.py if necessary.
inplaceeditform/fields.py
def get_config(self, request, **kwargs): """ Get the arguments given to the template tag element and complete these with the ones from the settings.py if necessary. """ config = kwargs config_from_settings = deepcopy(inplace_settings.DEFAULT_INPLACE_EDIT_OPTIONS) ...
def get_config(self, request, **kwargs): """ Get the arguments given to the template tag element and complete these with the ones from the settings.py if necessary. """ config = kwargs config_from_settings = deepcopy(inplace_settings.DEFAULT_INPLACE_EDIT_OPTIONS) ...
[ "Get", "the", "arguments", "given", "to", "the", "template", "tag", "element", "and", "complete", "these", "with", "the", "ones", "from", "the", "settings", ".", "py", "if", "necessary", "." ]
django-inplaceedit/django-inplaceedit
python
https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/fields.py#L92-L109
[ "def", "get_config", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "config", "=", "kwargs", "config_from_settings", "=", "deepcopy", "(", "inplace_settings", ".", "DEFAULT_INPLACE_EDIT_OPTIONS", ")", "config_one_by_one", "=", "inplace_settings", ...
7ba18e7906f56c56395ca07e2486755062efce00
test
BaseAdaptorField.empty_value
Get the text to display when the field is empty.
inplaceeditform/fields.py
def empty_value(self): ''' Get the text to display when the field is empty. ''' edit_empty_value = self.config.get('edit_empty_value', False) if edit_empty_value: return edit_empty_value else: return unicode(inplace_settings.INPLACEEDIT_EDIT_EMPTY_...
def empty_value(self): ''' Get the text to display when the field is empty. ''' edit_empty_value = self.config.get('edit_empty_value', False) if edit_empty_value: return edit_empty_value else: return unicode(inplace_settings.INPLACEEDIT_EDIT_EMPTY_...
[ "Get", "the", "text", "to", "display", "when", "the", "field", "is", "empty", "." ]
django-inplaceedit/django-inplaceedit
python
https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/fields.py#L143-L151
[ "def", "empty_value", "(", "self", ")", ":", "edit_empty_value", "=", "self", ".", "config", ".", "get", "(", "'edit_empty_value'", ",", "False", ")", "if", "edit_empty_value", ":", "return", "edit_empty_value", "else", ":", "return", "unicode", "(", "inplace_...
7ba18e7906f56c56395ca07e2486755062efce00
test
do_eval
Usage: {% eval %}1 + 1{% endeval %}
inplaceeditform/templatetags/inplace_edit.py
def do_eval(parser, token): "Usage: {% eval %}1 + 1{% endeval %}" nodelist = parser.parse(('endeval',)) class EvalNode(template.Node): def render(self, context): return template.Template(nodelist.render(context)).render(template.Context(context)) parser.delete_first_token() ret...
def do_eval(parser, token): "Usage: {% eval %}1 + 1{% endeval %}" nodelist = parser.parse(('endeval',)) class EvalNode(template.Node): def render(self, context): return template.Template(nodelist.render(context)).render(template.Context(context)) parser.delete_first_token() ret...
[ "Usage", ":", "{", "%", "eval", "%", "}", "1", "+", "1", "{", "%", "endeval", "%", "}" ]
django-inplaceedit/django-inplaceedit
python
https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/templatetags/inplace_edit.py#L123-L132
[ "def", "do_eval", "(", "parser", ",", "token", ")", ":", "nodelist", "=", "parser", ".", "parse", "(", "(", "'endeval'", ",", ")", ")", "class", "EvalNode", "(", "template", ".", "Node", ")", ":", "def", "render", "(", "self", ",", "context", ")", ...
7ba18e7906f56c56395ca07e2486755062efce00
test
parse_args_kwargs
Parse uniformly args and kwargs from a templatetag Usage:: For parsing a template like this: {% footag my_contents,height=10,zoom=20 as myvar %} You simply do this: @register.tag def footag(parser, token): args, kwargs = parse_args_kwargs(parser, token)
inplaceeditform/tag_utils.py
def parse_args_kwargs(parser, token): """ Parse uniformly args and kwargs from a templatetag Usage:: For parsing a template like this: {% footag my_contents,height=10,zoom=20 as myvar %} You simply do this: @register.tag def footag(parser, token): args, kwargs = ...
def parse_args_kwargs(parser, token): """ Parse uniformly args and kwargs from a templatetag Usage:: For parsing a template like this: {% footag my_contents,height=10,zoom=20 as myvar %} You simply do this: @register.tag def footag(parser, token): args, kwargs = ...
[ "Parse", "uniformly", "args", "and", "kwargs", "from", "a", "templatetag" ]
django-inplaceedit/django-inplaceedit
python
https://github.com/django-inplaceedit/django-inplaceedit/blob/7ba18e7906f56c56395ca07e2486755062efce00/inplaceeditform/tag_utils.py#L22-L63
[ "def", "parse_args_kwargs", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "contents", ".", "split", "(", "' '", ")", "if", "len", "(", "bits", ")", "<=", "1", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'%s' takes at...
7ba18e7906f56c56395ca07e2486755062efce00
test
PrometheusExporterScript.create_metrics
Create and register metrics from a list of MetricConfigs.
prometheus_aioexporter/script.py
def create_metrics( self, metric_configs: Iterable[MetricConfig]) -> Dict[str, Metric]: """Create and register metrics from a list of MetricConfigs.""" return self.registry.create_metrics(metric_configs)
def create_metrics( self, metric_configs: Iterable[MetricConfig]) -> Dict[str, Metric]: """Create and register metrics from a list of MetricConfigs.""" return self.registry.create_metrics(metric_configs)
[ "Create", "and", "register", "metrics", "from", "a", "list", "of", "MetricConfigs", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L93-L96
[ "def", "create_metrics", "(", "self", ",", "metric_configs", ":", "Iterable", "[", "MetricConfig", "]", ")", "->", "Dict", "[", "str", ",", "Metric", "]", ":", "return", "self", ".", "registry", ".", "create_metrics", "(", "metric_configs", ")" ]
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporterScript._setup_logging
Setup logging for the application and aiohttp.
prometheus_aioexporter/script.py
def _setup_logging(self, log_level: str): """Setup logging for the application and aiohttp.""" level = getattr(logging, log_level) names = ( 'aiohttp.access', 'aiohttp.internal', 'aiohttp.server', 'aiohttp.web', self.name) for name in names: setup_logg...
def _setup_logging(self, log_level: str): """Setup logging for the application and aiohttp.""" level = getattr(logging, log_level) names = ( 'aiohttp.access', 'aiohttp.internal', 'aiohttp.server', 'aiohttp.web', self.name) for name in names: setup_logg...
[ "Setup", "logging", "for", "the", "application", "and", "aiohttp", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L130-L137
[ "def", "_setup_logging", "(", "self", ",", "log_level", ":", "str", ")", ":", "level", "=", "getattr", "(", "logging", ",", "log_level", ")", "names", "=", "(", "'aiohttp.access'", ",", "'aiohttp.internal'", ",", "'aiohttp.server'", ",", "'aiohttp.web'", ",", ...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporterScript._configure_registry
Configure the MetricRegistry.
prometheus_aioexporter/script.py
def _configure_registry(self, include_process_stats: bool = False): """Configure the MetricRegistry.""" if include_process_stats: self.registry.register_additional_collector( ProcessCollector(registry=None))
def _configure_registry(self, include_process_stats: bool = False): """Configure the MetricRegistry.""" if include_process_stats: self.registry.register_additional_collector( ProcessCollector(registry=None))
[ "Configure", "the", "MetricRegistry", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L139-L143
[ "def", "_configure_registry", "(", "self", ",", "include_process_stats", ":", "bool", "=", "False", ")", ":", "if", "include_process_stats", ":", "self", ".", "registry", ".", "register_additional_collector", "(", "ProcessCollector", "(", "registry", "=", "None", ...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporterScript._get_exporter
Return a :class:`PrometheusExporter` configured with args.
prometheus_aioexporter/script.py
def _get_exporter(self, args: argparse.Namespace) -> PrometheusExporter: """Return a :class:`PrometheusExporter` configured with args.""" exporter = PrometheusExporter( self.name, self.description, args.host, args.port, self.registry) exporter.app.on_startup.append(self.on_applicatio...
def _get_exporter(self, args: argparse.Namespace) -> PrometheusExporter: """Return a :class:`PrometheusExporter` configured with args.""" exporter = PrometheusExporter( self.name, self.description, args.host, args.port, self.registry) exporter.app.on_startup.append(self.on_applicatio...
[ "Return", "a", ":", "class", ":", "PrometheusExporter", "configured", "with", "args", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/script.py#L145-L151
[ "def", "_get_exporter", "(", "self", ",", "args", ":", "argparse", ".", "Namespace", ")", "->", "PrometheusExporter", ":", "exporter", "=", "PrometheusExporter", "(", "self", ".", "name", ",", "self", ".", "description", ",", "args", ".", "host", ",", "arg...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
MetricsRegistry.create_metrics
Create Prometheus metrics from a list of MetricConfigs.
prometheus_aioexporter/metric.py
def create_metrics(self, configs: Iterable[MetricConfig]) -> Dict[str, Metric]: """Create Prometheus metrics from a list of MetricConfigs.""" metrics: Dict[str, Metric] = { config.name: self._register_metric(config) for config in configs } s...
def create_metrics(self, configs: Iterable[MetricConfig]) -> Dict[str, Metric]: """Create Prometheus metrics from a list of MetricConfigs.""" metrics: Dict[str, Metric] = { config.name: self._register_metric(config) for config in configs } s...
[ "Create", "Prometheus", "metrics", "from", "a", "list", "of", "MetricConfigs", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/metric.py#L80-L88
[ "def", "create_metrics", "(", "self", ",", "configs", ":", "Iterable", "[", "MetricConfig", "]", ")", "->", "Dict", "[", "str", ",", "Metric", "]", ":", "metrics", ":", "Dict", "[", "str", ",", "Metric", "]", "=", "{", "config", ".", "name", ":", "...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
MetricsRegistry.get_metric
Return a metric, optionally configured with labels.
prometheus_aioexporter/metric.py
def get_metric( self, name: str, labels: Union[Dict[str, str], None] = None) -> Metric: """Return a metric, optionally configured with labels.""" metric = self._metrics[name] if labels: return metric.labels(**labels) return metric
def get_metric( self, name: str, labels: Union[Dict[str, str], None] = None) -> Metric: """Return a metric, optionally configured with labels.""" metric = self._metrics[name] if labels: return metric.labels(**labels) return metric
[ "Return", "a", "metric", "optionally", "configured", "with", "labels", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/metric.py#L90-L98
[ "def", "get_metric", "(", "self", ",", "name", ":", "str", ",", "labels", ":", "Union", "[", "Dict", "[", "str", ",", "str", "]", ",", "None", "]", "=", "None", ")", "->", "Metric", ":", "metric", "=", "self", ".", "_metrics", "[", "name", "]", ...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporter.run
Run the :class:`aiohttp.web.Application` for the exporter.
prometheus_aioexporter/web.py
def run(self): """Run the :class:`aiohttp.web.Application` for the exporter.""" run_app( self.app, host=self.host, port=self.port, print=lambda *args, **kargs: None, access_log_format='%a "%r" %s %b "%{Referrer}i" "%{User-Agent}i"')
def run(self): """Run the :class:`aiohttp.web.Application` for the exporter.""" run_app( self.app, host=self.host, port=self.port, print=lambda *args, **kargs: None, access_log_format='%a "%r" %s %b "%{Referrer}i" "%{User-Agent}i"')
[ "Run", "the", ":", "class", ":", "aiohttp", ".", "web", ".", "Application", "for", "the", "exporter", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/web.py#L62-L69
[ "def", "run", "(", "self", ")", ":", "run_app", "(", "self", ".", "app", ",", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "print", "=", "lambda", "*", "args", ",", "*", "*", "kargs", ":", "None", ",", "access_l...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporter._make_application
Setup an :class:`aiohttp.web.Application`.
prometheus_aioexporter/web.py
def _make_application(self) -> Application: """Setup an :class:`aiohttp.web.Application`.""" app = Application() app['exporter'] = self app.router.add_get('/', self._handle_home) app.router.add_get('/metrics', self._handle_metrics) app.on_startup.append(self._log_startup_...
def _make_application(self) -> Application: """Setup an :class:`aiohttp.web.Application`.""" app = Application() app['exporter'] = self app.router.add_get('/', self._handle_home) app.router.add_get('/metrics', self._handle_metrics) app.on_startup.append(self._log_startup_...
[ "Setup", "an", ":", "class", ":", "aiohttp", ".", "web", ".", "Application", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/web.py#L71-L78
[ "def", "_make_application", "(", "self", ")", "->", "Application", ":", "app", "=", "Application", "(", ")", "app", "[", "'exporter'", "]", "=", "self", "app", ".", "router", ".", "add_get", "(", "'/'", ",", "self", ".", "_handle_home", ")", "app", "."...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporter._handle_home
Home page request handler.
prometheus_aioexporter/web.py
async def _handle_home(self, request: Request) -> Response: """Home page request handler.""" if self.description: title = f'{self.name} - {self.description}' else: title = self.name text = dedent( f'''<!DOCTYPE html> <html> <...
async def _handle_home(self, request: Request) -> Response: """Home page request handler.""" if self.description: title = f'{self.name} - {self.description}' else: title = self.name text = dedent( f'''<!DOCTYPE html> <html> <...
[ "Home", "page", "request", "handler", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/web.py#L84-L106
[ "async", "def", "_handle_home", "(", "self", ",", "request", ":", "Request", ")", "->", "Response", ":", "if", "self", ".", "description", ":", "title", "=", "f'{self.name} - {self.description}'", "else", ":", "title", "=", "self", ".", "name", "text", "=", ...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
PrometheusExporter._handle_metrics
Handler for metrics.
prometheus_aioexporter/web.py
async def _handle_metrics(self, request: Request) -> Response: """Handler for metrics.""" if self._update_handler: await self._update_handler(self.registry.get_metrics()) response = Response(body=self.registry.generate_metrics()) response.content_type = CONTENT_TYPE_LATEST ...
async def _handle_metrics(self, request: Request) -> Response: """Handler for metrics.""" if self._update_handler: await self._update_handler(self.registry.get_metrics()) response = Response(body=self.registry.generate_metrics()) response.content_type = CONTENT_TYPE_LATEST ...
[ "Handler", "for", "metrics", "." ]
albertodonato/prometheus-aioexporter
python
https://github.com/albertodonato/prometheus-aioexporter/blob/e1b85544ce72bfaae9182597709a2ecede8c8242/prometheus_aioexporter/web.py#L108-L114
[ "async", "def", "_handle_metrics", "(", "self", ",", "request", ":", "Request", ")", "->", "Response", ":", "if", "self", ".", "_update_handler", ":", "await", "self", ".", "_update_handler", "(", "self", ".", "registry", ".", "get_metrics", "(", ")", ")",...
e1b85544ce72bfaae9182597709a2ecede8c8242
test
wa
A free-text query resolver by Wolfram|Alpha. Returns the first result, if available.
wolframalpha/pmxbot.py
def wa(client, event, channel, nick, rest): """ A free-text query resolver by Wolfram|Alpha. Returns the first result, if available. """ client = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key']) res = client.query(rest) return next(res.results).text
def wa(client, event, channel, nick, rest): """ A free-text query resolver by Wolfram|Alpha. Returns the first result, if available. """ client = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key']) res = client.query(rest) return next(res.results).text
[ "A", "free", "-", "text", "query", "resolver", "by", "Wolfram|Alpha", ".", "Returns", "the", "first", "result", "if", "available", "." ]
jaraco/wolframalpha
python
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/pmxbot.py#L11-L18
[ "def", "wa", "(", "client", ",", "event", ",", "channel", ",", "nick", ",", "rest", ")", ":", "client", "=", "wolframalpha", ".", "Client", "(", "pmxbot", ".", "config", "[", "'Wolfram|Alpha API key'", "]", ")", "res", "=", "client", ".", "query", "(",...
50bf2e047b698e308a9a88770a23e7e210aa5bcb
test
fix_HTTPMessage
Python 2 uses a deprecated method signature and doesn't provide the forward compatibility. Add it.
wolframalpha/compat.py
def fix_HTTPMessage(): """ Python 2 uses a deprecated method signature and doesn't provide the forward compatibility. Add it. """ if six.PY3: return http_client.HTTPMessage.get_content_type = http_client.HTTPMessage.gettype http_client.HTTPMessage.get_param = http_client.HTTPMessage.getparam
def fix_HTTPMessage(): """ Python 2 uses a deprecated method signature and doesn't provide the forward compatibility. Add it. """ if six.PY3: return http_client.HTTPMessage.get_content_type = http_client.HTTPMessage.gettype http_client.HTTPMessage.get_param = http_client.HTTPMessage.getparam
[ "Python", "2", "uses", "a", "deprecated", "method", "signature", "and", "doesn", "t", "provide", "the", "forward", "compatibility", ".", "Add", "it", "." ]
jaraco/wolframalpha
python
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/compat.py#L5-L15
[ "def", "fix_HTTPMessage", "(", ")", ":", "if", "six", ".", "PY3", ":", "return", "http_client", ".", "HTTPMessage", ".", "get_content_type", "=", "http_client", ".", "HTTPMessage", ".", "gettype", "http_client", ".", "HTTPMessage", ".", "get_param", "=", "http...
50bf2e047b698e308a9a88770a23e7e210aa5bcb
test
Client.query
Query Wolfram|Alpha using the v2.0 API Allows for arbitrary parameters to be passed in the query. For example, to pass assumptions: client.query(input='pi', assumption='*C.pi-_*NamedConstant-') To pass multiple assumptions, pass multiple items as params: param...
wolframalpha/__init__.py
def query(self, input, params=(), **kwargs): """ Query Wolfram|Alpha using the v2.0 API Allows for arbitrary parameters to be passed in the query. For example, to pass assumptions: client.query(input='pi', assumption='*C.pi-_*NamedConstant-') To pass multiple assum...
def query(self, input, params=(), **kwargs): """ Query Wolfram|Alpha using the v2.0 API Allows for arbitrary parameters to be passed in the query. For example, to pass assumptions: client.query(input='pi', assumption='*C.pi-_*NamedConstant-') To pass multiple assum...
[ "Query", "Wolfram|Alpha", "using", "the", "v2", ".", "0", "API" ]
jaraco/wolframalpha
python
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/__init__.py#L24-L56
[ "def", "query", "(", "self", ",", "input", ",", "params", "=", "(", ")", ",", "*", "*", "kwargs", ")", ":", "data", "=", "dict", "(", "input", "=", "input", ",", "appid", "=", "self", ".", "app_id", ",", ")", "data", "=", "itertools", ".", "cha...
50bf2e047b698e308a9a88770a23e7e210aa5bcb
test
Result.info
The pods, assumptions, and warnings of this result.
wolframalpha/__init__.py
def info(self): """ The pods, assumptions, and warnings of this result. """ return itertools.chain(self.pods, self.assumptions, self.warnings)
def info(self): """ The pods, assumptions, and warnings of this result. """ return itertools.chain(self.pods, self.assumptions, self.warnings)
[ "The", "pods", "assumptions", "and", "warnings", "of", "this", "result", "." ]
jaraco/wolframalpha
python
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/__init__.py#L181-L185
[ "def", "info", "(", "self", ")", ":", "return", "itertools", ".", "chain", "(", "self", ".", "pods", ",", "self", ".", "assumptions", ",", "self", ".", "warnings", ")" ]
50bf2e047b698e308a9a88770a23e7e210aa5bcb
test
Result.results
The pods that hold the response to a simple, discrete query.
wolframalpha/__init__.py
def results(self): """ The pods that hold the response to a simple, discrete query. """ return ( pod for pod in self.pods if pod.primary or pod.title == 'Result' )
def results(self): """ The pods that hold the response to a simple, discrete query. """ return ( pod for pod in self.pods if pod.primary or pod.title == 'Result' )
[ "The", "pods", "that", "hold", "the", "response", "to", "a", "simple", "discrete", "query", "." ]
jaraco/wolframalpha
python
https://github.com/jaraco/wolframalpha/blob/50bf2e047b698e308a9a88770a23e7e210aa5bcb/wolframalpha/__init__.py#L206-L215
[ "def", "results", "(", "self", ")", ":", "return", "(", "pod", "for", "pod", "in", "self", ".", "pods", "if", "pod", ".", "primary", "or", "pod", ".", "title", "==", "'Result'", ")" ]
50bf2e047b698e308a9a88770a23e7e210aa5bcb
test
ApiClient.encode
Add request content data to request body, set Content-type header. Should be overridden by subclasses if not using JSON encoding. Args: request (HTTPRequest): The request object. data (dict, None): Data to be encoded. Returns: HTTPRequest: The request objec...
nerd/client.py
def encode(request, data): """ Add request content data to request body, set Content-type header. Should be overridden by subclasses if not using JSON encoding. Args: request (HTTPRequest): The request object. data (dict, None): Data to be encoded. Returns: ...
def encode(request, data): """ Add request content data to request body, set Content-type header. Should be overridden by subclasses if not using JSON encoding. Args: request (HTTPRequest): The request object. data (dict, None): Data to be encoded. Returns: ...
[ "Add", "request", "content", "data", "to", "request", "body", "set", "Content", "-", "type", "header", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L45-L63
[ "def", "encode", "(", "request", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "request", "request", ".", "add_header", "(", "'Content-Type'", ",", "'application/json'", ")", "request", ".", "data", "=", "json", ".", "dumps", "(", "da...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
ApiClient.call_api
Call API. This returns object containing data, with error details if applicable. Args: method (str): The HTTP method to use. url (str): Resource location relative to the base URL. headers (dict or None): Extra request headers to set. params (dict or None...
nerd/client.py
def call_api( self, method, url, headers=None, params=None, data=None, files=None, timeout=None, ): """ Call API. This returns object containing data, with error details if applicable. Args: ...
def call_api( self, method, url, headers=None, params=None, data=None, files=None, timeout=None, ): """ Call API. This returns object containing data, with error details if applicable. Args: ...
[ "Call", "API", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L93-L141
[ "def", "call_api", "(", "self", ",", "method", ",", "url", ",", "headers", "=", "None", ",", "params", "=", "None", ",", "data", "=", "None", ",", "files", "=", "None", ",", "timeout", "=", "None", ",", ")", ":", "method", "=", "method", ".", "up...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
ApiClient.get
Call the API with a GET request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser.
nerd/client.py
def get(self, url, params=None, **kwargs): """ Call the API with a GET request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser. """ return self...
def get(self, url, params=None, **kwargs): """ Call the API with a GET request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser. """ return self...
[ "Call", "the", "API", "with", "a", "GET", "request", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L143-L158
[ "def", "get", "(", "self", ",", "url", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "call_api", "(", "\"GET\"", ",", "url", ",", "params", "=", "params", ",", "*", "*", "kwargs", ")" ]
cd5c6e10c6c4e653669e11d735d5773766986bda
test
ApiClient.delete
Call the API with a DELETE request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser.
nerd/client.py
def delete(self, url, params=None, **kwargs): """ Call the API with a DELETE request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser. """ retur...
def delete(self, url, params=None, **kwargs): """ Call the API with a DELETE request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. Returns: ResultParser or ErrorParser. """ retur...
[ "Call", "the", "API", "with", "a", "DELETE", "request", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L160-L175
[ "def", "delete", "(", "self", ",", "url", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "call_api", "(", "\"DELETE\"", ",", "url", ",", "params", "=", "params", ",", "*", "*", "kwargs", ")" ]
cd5c6e10c6c4e653669e11d735d5773766986bda
test
ApiClient.put
Call the API with a PUT request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. files (dict or None: Files to be passed to the request. Returns: ...
nerd/client.py
def put(self, url, params=None, data=None, files=None, **kwargs): """ Call the API with a PUT request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. ...
def put(self, url, params=None, data=None, files=None, **kwargs): """ Call the API with a PUT request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. ...
[ "Call", "the", "API", "with", "a", "PUT", "request", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L177-L196
[ "def", "put", "(", "self", ",", "url", ",", "params", "=", "None", ",", "data", "=", "None", ",", "files", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "call_api", "(", "\"PUT\"", ",", "url", ",", "params", "=", "params"...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
ApiClient.post
Call the API with a POST request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. files (dict or None: Files to be passed to the request. Returns: ...
nerd/client.py
def post(self, url, params=None, data=None, files=None, **kwargs): """ Call the API with a POST request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. ...
def post(self, url, params=None, data=None, files=None, **kwargs): """ Call the API with a POST request. Args: url (str): Resource location relative to the base URL. params (dict or None): Query-string parameters. data (dict or None): Request body contents. ...
[ "Call", "the", "API", "with", "a", "POST", "request", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/client.py#L198-L217
[ "def", "post", "(", "self", ",", "url", ",", "params", "=", "None", ",", "data", "=", "None", ",", "files", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "call_api", "(", "\"POST\"", ",", "url", ",", "params", "=", "param...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient._process_query
Process query recursively, if the text is too long, it is split and processed bit a bit. Args: query (sdict): Text to be processed. prepared (bool): True when the query is ready to be submitted via POST request. Returns: str: Body ready to be subm...
nerd/nerd_client.py
def _process_query(self, query, prepared=False): """ Process query recursively, if the text is too long, it is split and processed bit a bit. Args: query (sdict): Text to be processed. prepared (bool): True when the query is ready to be submitted via POST req...
def _process_query(self, query, prepared=False): """ Process query recursively, if the text is too long, it is split and processed bit a bit. Args: query (sdict): Text to be processed. prepared (bool): True when the query is ready to be submitted via POST req...
[ "Process", "query", "recursively", "if", "the", "text", "is", "too", "long", "it", "is", "split", "and", "processed", "bit", "a", "bit", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L39-L133
[ "def", "_process_query", "(", "self", ",", "query", ",", "prepared", "=", "False", ")", ":", "# Exit condition and POST", "if", "prepared", "is", "True", ":", "files", "=", "{", "'query'", ":", "str", "(", "query", ")", "}", "logger", ".", "debug", "(", ...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient._group_sentences
Split sentences in groups, given a specific group length. Args: total_nb_sentences (int): Total available sentences. group_length (int): Limit of length for each group. Returns: list: Contains groups (lists) of sentences.
nerd/nerd_client.py
def _group_sentences(total_nb_sentences, group_length): """ Split sentences in groups, given a specific group length. Args: total_nb_sentences (int): Total available sentences. group_length (int): Limit of length for each group. Returns: list: Contains group...
def _group_sentences(total_nb_sentences, group_length): """ Split sentences in groups, given a specific group length. Args: total_nb_sentences (int): Total available sentences. group_length (int): Limit of length for each group. Returns: list: Contains group...
[ "Split", "sentences", "in", "groups", "given", "a", "specific", "group", "length", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L136-L160
[ "def", "_group_sentences", "(", "total_nb_sentences", ",", "group_length", ")", ":", "sentences_groups", "=", "[", "]", "current_sentence_group", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "total_nb_sentences", ")", ":", "if", "i", "%", "group_...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.disambiguate_pdf
Call the disambiguation service in order to process a pdf file . Args: pdf (file): PDF file to be disambiguated. language (str): language of text (if known) Returns: dict, int: API response and API status.
nerd/nerd_client.py
def disambiguate_pdf(self, file, language=None, entities=None): """ Call the disambiguation service in order to process a pdf file . Args: pdf (file): PDF file to be disambiguated. language (str): language of text (if known) Returns: dict, int: API response ...
def disambiguate_pdf(self, file, language=None, entities=None): """ Call the disambiguation service in order to process a pdf file . Args: pdf (file): PDF file to be disambiguated. language (str): language of text (if known) Returns: dict, int: API response ...
[ "Call", "the", "disambiguation", "service", "in", "order", "to", "process", "a", "pdf", "file", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L162-L202
[ "def", "disambiguate_pdf", "(", "self", ",", "file", ",", "language", "=", "None", ",", "entities", "=", "None", ")", ":", "body", "=", "{", "\"customisation\"", ":", "\"generic\"", "}", "if", "language", ":", "body", "[", "'language'", "]", "=", "{", ...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.disambiguate_terms
Call the disambiguation service in order to get meanings. Args: terms (obj): list of objects of term, weight language (str): language of text, english if not specified entities (list): list of entities or mentions to be supplied by the use...
nerd/nerd_client.py
def disambiguate_terms(self, terms, language="en", entities=None): """ Call the disambiguation service in order to get meanings. Args: terms (obj): list of objects of term, weight language (str): language of text, english if not specified entities (li...
def disambiguate_terms(self, terms, language="en", entities=None): """ Call the disambiguation service in order to get meanings. Args: terms (obj): list of objects of term, weight language (str): language of text, english if not specified entities (li...
[ "Call", "the", "disambiguation", "service", "in", "order", "to", "get", "meanings", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L204-L243
[ "def", "disambiguate_terms", "(", "self", ",", "terms", ",", "language", "=", "\"en\"", ",", "entities", "=", "None", ")", ":", "body", "=", "{", "\"termVector\"", ":", "terms", ",", "\"entities\"", ":", "[", "]", ",", "\"onlyNER\"", ":", "\"false\"", ",...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.disambiguate_text
Call the disambiguation service in order to get meanings. Args: text (str): Text to be disambiguated. language (str): language of text (if known) entities (list): list of entities or mentions to be supplied by the user. Returns: dict, int...
nerd/nerd_client.py
def disambiguate_text(self, text, language=None, entities=None): """ Call the disambiguation service in order to get meanings. Args: text (str): Text to be disambiguated. language (str): language of text (if known) entities (list): list of entities or mentions to be ...
def disambiguate_text(self, text, language=None, entities=None): """ Call the disambiguation service in order to get meanings. Args: text (str): Text to be disambiguated. language (str): language of text (if known) entities (list): list of entities or mentions to be ...
[ "Call", "the", "disambiguation", "service", "in", "order", "to", "get", "meanings", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L245-L276
[ "def", "disambiguate_text", "(", "self", ",", "text", ",", "language", "=", "None", ",", "entities", "=", "None", ")", ":", "body", "=", "{", "\"text\"", ":", "text", ",", "\"entities\"", ":", "[", "]", ",", "\"onlyNER\"", ":", "\"false\"", ",", "\"cus...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.disambiguate_query
Call the disambiguation service in order to disambiguate a search query. Args: text (str): Query to be disambiguated. language (str): language of text (if known) entities (list): list of entities or mentions to be supplied by the user. Returns: ...
nerd/nerd_client.py
def disambiguate_query(self, query, language=None, entities=None): """ Call the disambiguation service in order to disambiguate a search query. Args: text (str): Query to be disambiguated. language (str): language of text (if known) entities (list): list of entities ...
def disambiguate_query(self, query, language=None, entities=None): """ Call the disambiguation service in order to disambiguate a search query. Args: text (str): Query to be disambiguated. language (str): language of text (if known) entities (list): list of entities ...
[ "Call", "the", "disambiguation", "service", "in", "order", "to", "disambiguate", "a", "search", "query", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L278-L318
[ "def", "disambiguate_query", "(", "self", ",", "query", ",", "language", "=", "None", ",", "entities", "=", "None", ")", ":", "body", "=", "{", "\"shortText\"", ":", "query", ",", "\"entities\"", ":", "[", "]", ",", "\"onlyNER\"", ":", "\"false\"", ",", ...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.segment
Call the segmenter in order to split text in sentences. Args: text (str): Text to be segmented. Returns: dict, int: A dict containing a list of dicts with the offsets of each sentence; an integer representing the response code.
nerd/nerd_client.py
def segment(self, text): """ Call the segmenter in order to split text in sentences. Args: text (str): Text to be segmented. Returns: dict, int: A dict containing a list of dicts with the offsets of each sentence; an integer representing the response cod...
def segment(self, text): """ Call the segmenter in order to split text in sentences. Args: text (str): Text to be segmented. Returns: dict, int: A dict containing a list of dicts with the offsets of each sentence; an integer representing the response cod...
[ "Call", "the", "segmenter", "in", "order", "to", "split", "text", "in", "sentences", "." ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L320-L337
[ "def", "segment", "(", "self", ",", "text", ")", ":", "files", "=", "{", "'text'", ":", "text", "}", "res", ",", "status_code", "=", "self", ".", "post", "(", "self", ".", "segmentation_service", ",", "files", "=", "files", ")", "if", "status_code", ...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.get_language
Recognise the language of the text in input Args: id (str): The text whose the language needs to be recognised Returns: dict, int: A dict containing the recognised language and the confidence score.
nerd/nerd_client.py
def get_language(self, text): """ Recognise the language of the text in input Args: id (str): The text whose the language needs to be recognised Returns: dict, int: A dict containing the recognised language and the confidence score. """ ...
def get_language(self, text): """ Recognise the language of the text in input Args: id (str): The text whose the language needs to be recognised Returns: dict, int: A dict containing the recognised language and the confidence score. """ ...
[ "Recognise", "the", "language", "of", "the", "text", "in", "input" ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L339-L355
[ "def", "get_language", "(", "self", ",", "text", ")", ":", "files", "=", "{", "'text'", ":", "text", "}", "res", ",", "status_code", "=", "self", ".", "post", "(", "self", ".", "language_service", ",", "files", "=", "files", ")", "if", "status_code", ...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
NerdClient.get_concept
Fetch the concept from the Knowledge base Args: id (str): The concept id to be fetched, it can be Wikipedia page id or Wikiedata id. Returns: dict, int: A dict containing the concept information; an integer representing the response code.
nerd/nerd_client.py
def get_concept(self, conceptId, lang='en'): """ Fetch the concept from the Knowledge base Args: id (str): The concept id to be fetched, it can be Wikipedia page id or Wikiedata id. Returns: dict, int: A dict containing the concept information; an inte...
def get_concept(self, conceptId, lang='en'): """ Fetch the concept from the Knowledge base Args: id (str): The concept id to be fetched, it can be Wikipedia page id or Wikiedata id. Returns: dict, int: A dict containing the concept information; an inte...
[ "Fetch", "the", "concept", "from", "the", "Knowledge", "base" ]
hirmeos/entity-fishing-client-python
python
https://github.com/hirmeos/entity-fishing-client-python/blob/cd5c6e10c6c4e653669e11d735d5773766986bda/nerd/nerd_client.py#L357-L375
[ "def", "get_concept", "(", "self", ",", "conceptId", ",", "lang", "=", "'en'", ")", ":", "url", "=", "urljoin", "(", "self", ".", "concept_service", "+", "'/'", ",", "conceptId", ")", "res", ",", "status_code", "=", "self", ".", "get", "(", "url", ",...
cd5c6e10c6c4e653669e11d735d5773766986bda
test
MDREnsemble.fit
Constructs the MDR ensemble from the provided training data Parameters ---------- features: array-like {n_samples, n_features} Feature matrix classes: array-like {n_samples} List of class labels for prediction Returns ------- None
mdr/mdr_ensemble.py
def fit(self, features, classes): """Constructs the MDR ensemble from the provided training data Parameters ---------- features: array-like {n_samples, n_features} Feature matrix classes: array-like {n_samples} List of class labels for prediction ...
def fit(self, features, classes): """Constructs the MDR ensemble from the provided training data Parameters ---------- features: array-like {n_samples, n_features} Feature matrix classes: array-like {n_samples} List of class labels for prediction ...
[ "Constructs", "the", "MDR", "ensemble", "from", "the", "provided", "training", "data" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr_ensemble.py#L71-L91
[ "def", "fit", "(", "self", ",", "features", ",", "classes", ")", ":", "self", ".", "ensemble", ".", "fit", "(", "features", ",", "classes", ")", "# Construct the feature map from the ensemble predictions", "unique_rows", "=", "list", "(", "set", "(", "[", "tup...
768565deb10467d04a960d27e000ab38b7aa8a62
test
MDREnsemble.score
Estimates the accuracy of the predictions from the MDR ensemble Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from classes: array-like {n_samples} List of true class labels Returns ------- ac...
mdr/mdr_ensemble.py
def score(self, features, classes, scoring_function=None, **scoring_function_kwargs): """Estimates the accuracy of the predictions from the MDR ensemble Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from classes: array-l...
def score(self, features, classes, scoring_function=None, **scoring_function_kwargs): """Estimates the accuracy of the predictions from the MDR ensemble Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from classes: array-l...
[ "Estimates", "the", "accuracy", "of", "the", "predictions", "from", "the", "MDR", "ensemble" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr_ensemble.py#L128-L149
[ "def", "score", "(", "self", ",", "features", ",", "classes", ",", "scoring_function", "=", "None", ",", "*", "*", "scoring_function_kwargs", ")", ":", "new_feature", "=", "self", ".", "ensemble", ".", "predict", "(", "features", ")", "if", "scoring_function...
768565deb10467d04a960d27e000ab38b7aa8a62
test
MDRBase.fit
Constructs the MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels Returns ------- self: A copy ...
mdr/mdr.py
def fit(self, features, class_labels): """Constructs the MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels ...
def fit(self, features, class_labels): """Constructs the MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels ...
[ "Constructs", "the", "MDR", "feature", "map", "from", "the", "provided", "training", "data", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L59-L100
[ "def", "fit", "(", "self", ",", "features", ",", "class_labels", ")", ":", "unique_labels", "=", "sorted", "(", "np", ".", "unique", "(", "class_labels", ")", ")", "if", "len", "(", "unique_labels", ")", "!=", "2", ":", "raise", "ValueError", "(", "'MD...
768565deb10467d04a960d27e000ab38b7aa8a62
test
MDR.fit_transform
Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels Re...
mdr/mdr.py
def fit_transform(self, features, class_labels): """Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {...
def fit_transform(self, features, class_labels): """Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {...
[ "Convenience", "function", "that", "fits", "the", "provided", "data", "then", "constructs", "a", "new", "feature", "from", "the", "provided", "features", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L137-L154
[ "def", "fit_transform", "(", "self", ",", "features", ",", "class_labels", ")", ":", "self", ".", "fit", "(", "features", ",", "class_labels", ")", "return", "self", ".", "transform", "(", "features", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
MDRClassifier.fit_predict
Convenience function that fits the provided data then constructs predictions from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels Retu...
mdr/mdr.py
def fit_predict(self, features, class_labels): """Convenience function that fits the provided data then constructs predictions from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_sa...
def fit_predict(self, features, class_labels): """Convenience function that fits the provided data then constructs predictions from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_sa...
[ "Convenience", "function", "that", "fits", "the", "provided", "data", "then", "constructs", "predictions", "from", "the", "provided", "features", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L191-L208
[ "def", "fit_predict", "(", "self", ",", "features", ",", "class_labels", ")", ":", "self", ".", "fit", "(", "features", ",", "class_labels", ")", "return", "self", ".", "predict", "(", "features", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
MDRClassifier.score
Estimates the accuracy of the predictions from the constructed feature. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from class_labels: array-like {n_samples} List of true class labels Returns -----...
mdr/mdr.py
def score(self, features, class_labels, scoring_function=None, **scoring_function_kwargs): """Estimates the accuracy of the predictions from the constructed feature. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from cla...
def score(self, features, class_labels, scoring_function=None, **scoring_function_kwargs): """Estimates the accuracy of the predictions from the constructed feature. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from cla...
[ "Estimates", "the", "accuracy", "of", "the", "predictions", "from", "the", "constructed", "feature", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L210-L234
[ "def", "score", "(", "self", ",", "features", ",", "class_labels", ",", "scoring_function", "=", "None", ",", "*", "*", "scoring_function_kwargs", ")", ":", "if", "self", ".", "feature_map", "is", "None", ":", "raise", "ValueError", "(", "'The MDR model must b...
768565deb10467d04a960d27e000ab38b7aa8a62
test
ContinuousMDR.fit
Constructs the Continuous MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples} List of target values for prediction Returns ------- ...
mdr/continuous_mdr.py
def fit(self, features, targets): """Constructs the Continuous MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples} List of target values for pre...
def fit(self, features, targets): """Constructs the Continuous MDR feature map from the provided training data. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples} List of target values for pre...
[ "Constructs", "the", "Continuous", "MDR", "feature", "map", "from", "the", "provided", "training", "data", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/continuous_mdr.py#L57-L93
[ "def", "fit", "(", "self", ",", "features", ",", "targets", ")", ":", "self", ".", "feature_map", "=", "defaultdict", "(", "lambda", ":", "self", ".", "default_label", ")", "self", ".", "overall_mean_trait_value", "=", "np", ".", "mean", "(", "targets", ...
768565deb10467d04a960d27e000ab38b7aa8a62
test
ContinuousMDR.transform
Uses the Continuous MDR feature map to construct a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to transform Returns ---------- array-like: {n_samples} Constructed featu...
mdr/continuous_mdr.py
def transform(self, features): """Uses the Continuous MDR feature map to construct a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to transform Returns ---------- array-like:...
def transform(self, features): """Uses the Continuous MDR feature map to construct a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to transform Returns ---------- array-like:...
[ "Uses", "the", "Continuous", "MDR", "feature", "map", "to", "construct", "a", "new", "feature", "from", "the", "provided", "features", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/continuous_mdr.py#L95-L119
[ "def", "transform", "(", "self", ",", "features", ")", ":", "new_feature", "=", "np", ".", "zeros", "(", "features", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "int", ")", "for", "row_i", "in", "range", "(", "features", ".", "shape"...
768565deb10467d04a960d27e000ab38b7aa8a62
test
ContinuousMDR.fit_transform
Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples} List of true target values Return...
mdr/continuous_mdr.py
def fit_transform(self, features, targets): """Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples}...
def fit_transform(self, features, targets): """Convenience function that fits the provided data then constructs a new feature from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix targets: array-like {n_samples}...
[ "Convenience", "function", "that", "fits", "the", "provided", "data", "then", "constructs", "a", "new", "feature", "from", "the", "provided", "features", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/continuous_mdr.py#L121-L138
[ "def", "fit_transform", "(", "self", ",", "features", ",", "targets", ")", ":", "self", ".", "fit", "(", "features", ",", "targets", ")", "return", "self", ".", "transform", "(", "features", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
ContinuousMDR.score
Estimates the quality of the ContinuousMDR model using a t-statistic. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from targets: array-like {n_samples} List of true target values Returns ------- ...
mdr/continuous_mdr.py
def score(self, features, targets): """Estimates the quality of the ContinuousMDR model using a t-statistic. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from targets: array-like {n_samples} List of true tar...
def score(self, features, targets): """Estimates the quality of the ContinuousMDR model using a t-statistic. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix to predict from targets: array-like {n_samples} List of true tar...
[ "Estimates", "the", "quality", "of", "the", "ContinuousMDR", "model", "using", "a", "t", "-", "statistic", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/continuous_mdr.py#L140-L168
[ "def", "score", "(", "self", ",", "features", ",", "targets", ")", ":", "if", "self", ".", "feature_map", "is", "None", ":", "raise", "ValueError", "(", "'The Continuous MDR model must be fit before score() can be called.'", ")", "group_0_trait_values", "=", "[", "]...
768565deb10467d04a960d27e000ab38b7aa8a62
test
entropy
Calculates the entropy, H(X), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the entropy base: integer (default: 2) The base in which to calculate entropy Returns ---------- entropy: float The entropy calcul...
mdr/utils/utils.py
def entropy(X, base=2): """Calculates the entropy, H(X), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the entropy base: integer (default: 2) The base in which to calculate entropy Returns ---------- entropy: f...
def entropy(X, base=2): """Calculates the entropy, H(X), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the entropy base: integer (default: 2) The base in which to calculate entropy Returns ---------- entropy: f...
[ "Calculates", "the", "entropy", "H", "(", "X", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L29-L45
[ "def", "entropy", "(", "X", ",", "base", "=", "2", ")", ":", "return", "scipy", ".", "stats", ".", "entropy", "(", "list", "(", "Counter", "(", "X", ")", ".", "values", "(", ")", ")", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
joint_entropy
Calculates the joint entropy, H(X,Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the joint entropy Y: array-like (# samples) An array of values for which to compute the joint entropy base: integer (default: 2) Th...
mdr/utils/utils.py
def joint_entropy(X, Y, base=2): """Calculates the joint entropy, H(X,Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the joint entropy Y: array-like (# samples) An array of values for which to compute the joint entropy ...
def joint_entropy(X, Y, base=2): """Calculates the joint entropy, H(X,Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the joint entropy Y: array-like (# samples) An array of values for which to compute the joint entropy ...
[ "Calculates", "the", "joint", "entropy", "H", "(", "X", "Y", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L47-L66
[ "def", "joint_entropy", "(", "X", ",", "Y", ",", "base", "=", "2", ")", ":", "X_Y", "=", "[", "'{}{}'", ".", "format", "(", "x", ",", "y", ")", "for", "x", ",", "y", "in", "zip", "(", "X", ",", "Y", ")", "]", "return", "entropy", "(", "X_Y"...
768565deb10467d04a960d27e000ab38b7aa8a62
test
conditional_entropy
Calculates the conditional entropy, H(X|Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the conditional entropy Y: array-like (# samples) An array of values for which to compute the conditional entropy base: integer (defa...
mdr/utils/utils.py
def conditional_entropy(X, Y, base=2): """Calculates the conditional entropy, H(X|Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the conditional entropy Y: array-like (# samples) An array of values for which to compute t...
def conditional_entropy(X, Y, base=2): """Calculates the conditional entropy, H(X|Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the conditional entropy Y: array-like (# samples) An array of values for which to compute t...
[ "Calculates", "the", "conditional", "entropy", "H", "(", "X|Y", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L68-L86
[ "def", "conditional_entropy", "(", "X", ",", "Y", ",", "base", "=", "2", ")", ":", "return", "joint_entropy", "(", "X", ",", "Y", ",", "base", "=", "base", ")", "-", "entropy", "(", "Y", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
mutual_information
Calculates the mutual information between two variables, I(X;Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the mutual information Y: array-like (# samples) An array of values for which to compute the mutual information ...
mdr/utils/utils.py
def mutual_information(X, Y, base=2): """Calculates the mutual information between two variables, I(X;Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the mutual information Y: array-like (# samples) An array of values for...
def mutual_information(X, Y, base=2): """Calculates the mutual information between two variables, I(X;Y), in the given base Parameters ---------- X: array-like (# samples) An array of values for which to compute the mutual information Y: array-like (# samples) An array of values for...
[ "Calculates", "the", "mutual", "information", "between", "two", "variables", "I", "(", "X", ";", "Y", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L88-L106
[ "def", "mutual_information", "(", "X", ",", "Y", ",", "base", "=", "2", ")", ":", "return", "entropy", "(", "Y", ",", "base", "=", "base", ")", "-", "conditional_entropy", "(", "Y", ",", "X", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
two_way_information_gain
Calculates the two-way information gain between three variables, I(X;Y;Z), in the given base IG(X;Y;Z) indicates the information gained about variable Z by the joint variable X_Y, after removing the information that X and Y have about Z individually. Thus, two-way information gain measures the synergistic ...
mdr/utils/utils.py
def two_way_information_gain(X, Y, Z, base=2): """Calculates the two-way information gain between three variables, I(X;Y;Z), in the given base IG(X;Y;Z) indicates the information gained about variable Z by the joint variable X_Y, after removing the information that X and Y have about Z individually. Thus, ...
def two_way_information_gain(X, Y, Z, base=2): """Calculates the two-way information gain between three variables, I(X;Y;Z), in the given base IG(X;Y;Z) indicates the information gained about variable Z by the joint variable X_Y, after removing the information that X and Y have about Z individually. Thus, ...
[ "Calculates", "the", "two", "-", "way", "information", "gain", "between", "three", "variables", "I", "(", "X", ";", "Y", ";", "Z", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L108-L135
[ "def", "two_way_information_gain", "(", "X", ",", "Y", ",", "Z", ",", "base", "=", "2", ")", ":", "X_Y", "=", "[", "'{}{}'", ".", "format", "(", "x", ",", "y", ")", "for", "x", ",", "y", "in", "zip", "(", "X", ",", "Y", ")", "]", "return", ...
768565deb10467d04a960d27e000ab38b7aa8a62
test
three_way_information_gain
Calculates the three-way information gain between three variables, I(W;X;Y;Z), in the given base IG(W;X;Y;Z) indicates the information gained about variable Z by the joint variable W_X_Y, after removing the information that W, X, and Y have about Z individually and jointly in pairs. Thus, 3-way information gai...
mdr/utils/utils.py
def three_way_information_gain(W, X, Y, Z, base=2): """Calculates the three-way information gain between three variables, I(W;X;Y;Z), in the given base IG(W;X;Y;Z) indicates the information gained about variable Z by the joint variable W_X_Y, after removing the information that W, X, and Y have about Z ind...
def three_way_information_gain(W, X, Y, Z, base=2): """Calculates the three-way information gain between three variables, I(W;X;Y;Z), in the given base IG(W;X;Y;Z) indicates the information gained about variable Z by the joint variable W_X_Y, after removing the information that W, X, and Y have about Z ind...
[ "Calculates", "the", "three", "-", "way", "information", "gain", "between", "three", "variables", "I", "(", "W", ";", "X", ";", "Y", ";", "Z", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L137-L171
[ "def", "three_way_information_gain", "(", "W", ",", "X", ",", "Y", ",", "Z", ",", "base", "=", "2", ")", ":", "W_X_Y", "=", "[", "'{}{}{}'", ".", "format", "(", "w", ",", "x", ",", "y", ")", "for", "w", ",", "x", ",", "y", "in", "zip", "(", ...
768565deb10467d04a960d27e000ab38b7aa8a62
test
_mdr_predict
Fits a MDR model to variables X and Y with the given labels, then returns the resulting predictions This is a convenience method that should only be used internally. Parameters ---------- X: array-like (# samples) An array of values corresponding to one feature in the MDR model Y: array-li...
mdr/utils/utils.py
def _mdr_predict(X, Y, labels): """Fits a MDR model to variables X and Y with the given labels, then returns the resulting predictions This is a convenience method that should only be used internally. Parameters ---------- X: array-like (# samples) An array of values corresponding to one f...
def _mdr_predict(X, Y, labels): """Fits a MDR model to variables X and Y with the given labels, then returns the resulting predictions This is a convenience method that should only be used internally. Parameters ---------- X: array-like (# samples) An array of values corresponding to one f...
[ "Fits", "a", "MDR", "model", "to", "variables", "X", "and", "Y", "with", "the", "given", "labels", "then", "returns", "the", "resulting", "predictions" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L173-L193
[ "def", "_mdr_predict", "(", "X", ",", "Y", ",", "labels", ")", ":", "return", "MDR", "(", ")", ".", "fit_predict", "(", "np", ".", "column_stack", "(", "(", "X", ",", "Y", ")", ")", ",", "labels", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
mdr_entropy
Calculates the MDR entropy, H(XY), in the given base MDR entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions. Parameters ---------- X: array-like (# samples) An array of values corresponding to one f...
mdr/utils/utils.py
def mdr_entropy(X, Y, labels, base=2): """Calculates the MDR entropy, H(XY), in the given base MDR entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions. Parameters ---------- X: array-like (# samples) ...
def mdr_entropy(X, Y, labels, base=2): """Calculates the MDR entropy, H(XY), in the given base MDR entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions. Parameters ---------- X: array-like (# samples) ...
[ "Calculates", "the", "MDR", "entropy", "H", "(", "XY", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L195-L218
[ "def", "mdr_entropy", "(", "X", ",", "Y", ",", "labels", ",", "base", "=", "2", ")", ":", "return", "entropy", "(", "_mdr_predict", "(", "X", ",", "Y", ",", "labels", ")", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
mdr_conditional_entropy
Calculates the MDR conditional entropy, H(XY|labels), in the given base MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions conditional on the provided labels. Parameters ---------- X: array-...
mdr/utils/utils.py
def mdr_conditional_entropy(X, Y, labels, base=2): """Calculates the MDR conditional entropy, H(XY|labels), in the given base MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions conditional on the pro...
def mdr_conditional_entropy(X, Y, labels, base=2): """Calculates the MDR conditional entropy, H(XY|labels), in the given base MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating the entropy of the resulting model's predictions conditional on the pro...
[ "Calculates", "the", "MDR", "conditional", "entropy", "H", "(", "XY|labels", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L220-L243
[ "def", "mdr_conditional_entropy", "(", "X", ",", "Y", ",", "labels", ",", "base", "=", "2", ")", ":", "return", "conditional_entropy", "(", "_mdr_predict", "(", "X", ",", "Y", ",", "labels", ")", ",", "labels", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
mdr_mutual_information
Calculates the MDR mutual information, I(XY;labels), in the given base MDR mutual information is calculated by combining variables X and Y into a single MDR model then calculating the mutual information between the resulting model's predictions and the labels. Parameters ---------- X: array-like (...
mdr/utils/utils.py
def mdr_mutual_information(X, Y, labels, base=2): """Calculates the MDR mutual information, I(XY;labels), in the given base MDR mutual information is calculated by combining variables X and Y into a single MDR model then calculating the mutual information between the resulting model's predictions and the l...
def mdr_mutual_information(X, Y, labels, base=2): """Calculates the MDR mutual information, I(XY;labels), in the given base MDR mutual information is calculated by combining variables X and Y into a single MDR model then calculating the mutual information between the resulting model's predictions and the l...
[ "Calculates", "the", "MDR", "mutual", "information", "I", "(", "XY", ";", "labels", ")", "in", "the", "given", "base" ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L245-L268
[ "def", "mdr_mutual_information", "(", "X", ",", "Y", ",", "labels", ",", "base", "=", "2", ")", ":", "return", "mutual_information", "(", "_mdr_predict", "(", "X", ",", "Y", ",", "labels", ")", ",", "labels", ",", "base", "=", "base", ")" ]
768565deb10467d04a960d27e000ab38b7aa8a62
test
n_way_models
Fits a MDR model to all n-way combinations of the features in X. Note that this function performs an exhaustive search through all feature combinations and can be computationally expensive. Parameters ---------- mdr_instance: object An instance of the MDR type to use. X: array-like (# rows...
mdr/utils/utils.py
def n_way_models(mdr_instance, X, y, n=[2], feature_names=None): """Fits a MDR model to all n-way combinations of the features in X. Note that this function performs an exhaustive search through all feature combinations and can be computationally expensive. Parameters ---------- mdr_instance: obje...
def n_way_models(mdr_instance, X, y, n=[2], feature_names=None): """Fits a MDR model to all n-way combinations of the features in X. Note that this function performs an exhaustive search through all feature combinations and can be computationally expensive. Parameters ---------- mdr_instance: obje...
[ "Fits", "a", "MDR", "model", "to", "all", "n", "-", "way", "combinations", "of", "the", "features", "in", "X", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L270-L307
[ "def", "n_way_models", "(", "mdr_instance", ",", "X", ",", "y", ",", "n", "=", "[", "2", "]", ",", "feature_names", "=", "None", ")", ":", "if", "feature_names", "is", "None", ":", "feature_names", "=", "list", "(", "range", "(", "X", ".", "shape", ...
768565deb10467d04a960d27e000ab38b7aa8a62
test
plot_mdr_grid
Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models. This function is currently incomplete. Parameters ---------- mdr_instance: object A fitted instance of the MDR type to visualize. Returns ---------- fig: matplotlib.figure Figure o...
mdr/utils/utils.py
def plot_mdr_grid(mdr_instance): """Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models. This function is currently incomplete. Parameters ---------- mdr_instance: object A fitted instance of the MDR type to visualize. Returns ---------- ...
def plot_mdr_grid(mdr_instance): """Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models. This function is currently incomplete. Parameters ---------- mdr_instance: object A fitted instance of the MDR type to visualize. Returns ---------- ...
[ "Visualizes", "the", "MDR", "grid", "of", "a", "given", "fitted", "MDR", "instance", ".", "Only", "works", "for", "2", "-", "way", "MDR", "models", ".", "This", "function", "is", "currently", "incomplete", "." ]
EpistasisLab/scikit-mdr
python
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/utils/utils.py#L309-L363
[ "def", "plot_mdr_grid", "(", "mdr_instance", ")", ":", "var1_levels", "=", "list", "(", "set", "(", "[", "variables", "[", "0", "]", "for", "variables", "in", "mdr_instance", ".", "feature_map", "]", ")", ")", "var2_levels", "=", "list", "(", "set", "(",...
768565deb10467d04a960d27e000ab38b7aa8a62
test
makemigrations
等价于 django makemigrations 操作
fantasy/cli.py
def makemigrations(migrations_root): """等价于 django makemigrations 操作""" from flask_migrate import (Migrate, init as migrate_init, migrate as migrate_exec) migrations_root = migrations_root or os.path.join( os.environ.get('FANTASY_MIGRATION_PATH', ...
def makemigrations(migrations_root): """等价于 django makemigrations 操作""" from flask_migrate import (Migrate, init as migrate_init, migrate as migrate_exec) migrations_root = migrations_root or os.path.join( os.environ.get('FANTASY_MIGRATION_PATH', ...
[ "等价于", "django", "makemigrations", "操作" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/cli.py#L29-L77
[ "def", "makemigrations", "(", "migrations_root", ")", ":", "from", "flask_migrate", "import", "(", "Migrate", ",", "init", "as", "migrate_init", ",", "migrate", "as", "migrate_exec", ")", "migrations_root", "=", "migrations_root", "or", "os", ".", "path", ".", ...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
migrate
等价于 django migrate 操作
fantasy/cli.py
def migrate(migrations_root): """等价于 django migrate 操作""" from flask_migrate import Migrate, upgrade as migrate_upgrade from flask_sqlalchemy import SQLAlchemy from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database db = SQLAlchemy() dsn = ma...
def migrate(migrations_root): """等价于 django migrate 操作""" from flask_migrate import Migrate, upgrade as migrate_upgrade from flask_sqlalchemy import SQLAlchemy from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database db = SQLAlchemy() dsn = ma...
[ "等价于", "django", "migrate", "操作" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/cli.py#L83-L110
[ "def", "migrate", "(", "migrations_root", ")", ":", "from", "flask_migrate", "import", "Migrate", ",", "upgrade", "as", "migrate_upgrade", "from", "flask_sqlalchemy", "import", "SQLAlchemy", "from", "sqlalchemy", ".", "engine", ".", "url", "import", "make_url", "f...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
requirements
编译全新依赖文件
fantasy/cli.py
def requirements(work_dir, hive_root, with_requirements, with_dockerfile, active_module, active_module_file): """编译全新依赖文件""" import sys sys.path.insert(0, hive_root) hive_root = os.path.abspath(os.path.expanduser(hive_root)) work_dir = work_dir or os.path.join( os.environ....
def requirements(work_dir, hive_root, with_requirements, with_dockerfile, active_module, active_module_file): """编译全新依赖文件""" import sys sys.path.insert(0, hive_root) hive_root = os.path.abspath(os.path.expanduser(hive_root)) work_dir = work_dir or os.path.join( os.environ....
[ "编译全新依赖文件" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/cli.py#L124-L314
[ "def", "requirements", "(", "work_dir", ",", "hive_root", ",", "with_requirements", ",", "with_dockerfile", ",", "active_module", ",", "active_module_file", ")", ":", "import", "sys", "sys", ".", "path", ".", "insert", "(", "0", ",", "hive_root", ")", "hive_ro...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
queue
启动队列服务[开发中]
fantasy/cli.py
def queue(celery_arguments): """启动队列服务[开发中]""" if not app.celery: return click.echo( click.style('No celery config found,skip start...', fg='yellow')) celery = app.celery celery.autodiscover_tasks() argv = celery_arguments.split() argv.insert(0, 'worker') argv.insert(0...
def queue(celery_arguments): """启动队列服务[开发中]""" if not app.celery: return click.echo( click.style('No celery config found,skip start...', fg='yellow')) celery = app.celery celery.autodiscover_tasks() argv = celery_arguments.split() argv.insert(0, 'worker') argv.insert(0...
[ "启动队列服务", "[", "开发中", "]" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/cli.py#L321-L335
[ "def", "queue", "(", "celery_arguments", ")", ":", "if", "not", "app", ".", "celery", ":", "return", "click", ".", "echo", "(", "click", ".", "style", "(", "'No celery config found,skip start...', ", "f", "='", "y", "ellow'))", "", "", "celery", "=", "app"...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
smart_database
尝试对数据库做初始化操作
fantasy/__init__.py
def smart_database(app): """尝试对数据库做初始化操作""" from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database # 如果数据库不存在,则尝试创建数据 dsn = make_url(app.config['SQLALCHEMY_DATABASE_URI']) if not database_exists(dsn): create_database(dsn) pass ...
def smart_database(app): """尝试对数据库做初始化操作""" from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database # 如果数据库不存在,则尝试创建数据 dsn = make_url(app.config['SQLALCHEMY_DATABASE_URI']) if not database_exists(dsn): create_database(dsn) pass ...
[ "尝试对数据库做初始化操作" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/__init__.py#L50-L61
[ "def", "smart_database", "(", "app", ")", ":", "from", "sqlalchemy", ".", "engine", ".", "url", "import", "make_url", "from", "sqlalchemy_utils", "import", "database_exists", ",", "create_database", "# 如果数据库不存在,则尝试创建数据", "dsn", "=", "make_url", "(", "app", ".", ...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
smart_migrate
如果存在migration且指定为primary_node则执行migrate操作
fantasy/__init__.py
def smart_migrate(app, migrations_root): """如果存在migration且指定为primary_node则执行migrate操作""" db = app.db if os.path.exists(migrations_root) and \ os.environ['FANTASY_PRIMARY_NODE'] != 'no': from flask_migrate import (Migrate, upgrade as migrate_upgrade) ...
def smart_migrate(app, migrations_root): """如果存在migration且指定为primary_node则执行migrate操作""" db = app.db if os.path.exists(migrations_root) and \ os.environ['FANTASY_PRIMARY_NODE'] != 'no': from flask_migrate import (Migrate, upgrade as migrate_upgrade) ...
[ "如果存在migration且指定为primary_node则执行migrate操作" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/__init__.py#L64-L77
[ "def", "smart_migrate", "(", "app", ",", "migrations_root", ")", ":", "db", "=", "app", ".", "db", "if", "os", ".", "path", ".", "exists", "(", "migrations_root", ")", "and", "os", ".", "environ", "[", "'FANTASY_PRIMARY_NODE'", "]", "!=", "'no'", ":", ...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
smart_account
尝试使用内置方式构建账户
fantasy/__init__.py
def smart_account(app): """尝试使用内置方式构建账户""" if os.environ['FANTASY_ACTIVE_ACCOUNT'] == 'no': return from flask_security import SQLAlchemyUserDatastore, Security account_module_name, account_class_name = os.environ[ 'FANTASY_ACCOUNT_MODEL'].rsplit('.', 1) account_module = importlib....
def smart_account(app): """尝试使用内置方式构建账户""" if os.environ['FANTASY_ACTIVE_ACCOUNT'] == 'no': return from flask_security import SQLAlchemyUserDatastore, Security account_module_name, account_class_name = os.environ[ 'FANTASY_ACCOUNT_MODEL'].rsplit('.', 1) account_module = importlib....
[ "尝试使用内置方式构建账户" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/__init__.py#L80-L105
[ "def", "smart_account", "(", "app", ")", ":", "if", "os", ".", "environ", "[", "'FANTASY_ACTIVE_ACCOUNT'", "]", "==", "'no'", ":", "return", "from", "flask_security", "import", "SQLAlchemyUserDatastore", ",", "Security", "account_module_name", ",", "account_class_na...
0fe92059bd868f14da84235beb05b217b1d46e4a
test
load_tasks
装载任务,解决celery无法自动装载的问题
fantasy/__init__.py
def load_tasks(app, entry_file=None): """装载任务,解决celery无法自动装载的问题""" from celery import Task tasks_txt = os.path.join(os.path.dirname(entry_file), 'migrations', 'tasks.txt') if not os.path.exists(tasks_txt): import sys print('Tasks file not found:%s' % tasks_t...
def load_tasks(app, entry_file=None): """装载任务,解决celery无法自动装载的问题""" from celery import Task tasks_txt = os.path.join(os.path.dirname(entry_file), 'migrations', 'tasks.txt') if not os.path.exists(tasks_txt): import sys print('Tasks file not found:%s' % tasks_t...
[ "装载任务,解决celery无法自动装载的问题" ]
wangwenpei/fantasy
python
https://github.com/wangwenpei/fantasy/blob/0fe92059bd868f14da84235beb05b217b1d46e4a/fantasy/__init__.py#L141-L171
[ "def", "load_tasks", "(", "app", ",", "entry_file", "=", "None", ")", ":", "from", "celery", "import", "Task", "tasks_txt", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "entry_file", ")", ",", "'migrations'", ",", ...
0fe92059bd868f14da84235beb05b217b1d46e4a