hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
access_entries
<not_specific>
def access_entries(self): """Dataset's access entries. :rtype: list of :class:`AccessEntry` :returns: roles granted to entities for this dataset """ return list(self._access_entries)
Dataset's access entries. :rtype: list of :class:`AccessEntry` :returns: roles granted to entities for this dataset
Dataset's access entries.
[ "Dataset", "'", "s", "access", "entries", "." ]
def access_entries(self): return list(self._access_entries)
[ "def", "access_entries", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_access_entries", ")" ]
Dataset's access entries.
[ "Dataset", "'", "s", "access", "entries", "." ]
[ "\"\"\"Dataset's access entries.\n\n :rtype: list of :class:`AccessEntry`\n :returns: roles granted to entities for this dataset\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "roles granted to entities for this dataset", "docstring_tokens": [ "roles", "granted", "to", "entities", "for", "this", "dataset" ], "type": "list of :class:`AccessEntry`" } ], "raises": [], "p...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
access_entries
null
def access_entries(self, value): """Update dataset's access entries :type value: list of :class:`~google.cloud.bigquery.dataset.AccessEntry` :param value: roles granted to entities for this dataset :raises: TypeError if 'value' is not a sequence, or ValueError if ...
Update dataset's access entries :type value: list of :class:`~google.cloud.bigquery.dataset.AccessEntry` :param value: roles granted to entities for this dataset :raises: TypeError if 'value' is not a sequence, or ValueError if any item in the sequence is not an Ac...
Update dataset's access entries
[ "Update", "dataset", "'", "s", "access", "entries" ]
def access_entries(self, value): if not all(isinstance(field, AccessEntry) for field in value): raise ValueError('Values must be AccessEntry instances') self._access_entries = tuple(value)
[ "def", "access_entries", "(", "self", ",", "value", ")", ":", "if", "not", "all", "(", "isinstance", "(", "field", ",", "AccessEntry", ")", "for", "field", "in", "value", ")", ":", "raise", "ValueError", "(", "'Values must be AccessEntry instances'", ")", "s...
Update dataset's access entries
[ "Update", "dataset", "'", "s", "access", "entries" ]
[ "\"\"\"Update dataset's access entries\n\n :type value:\n list of :class:`~google.cloud.bigquery.dataset.AccessEntry`\n :param value: roles granted to entities for this dataset\n\n :raises: TypeError if 'value' is not a sequence, or ValueError if\n any item in the seq...
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "TypeError if 'value' is not a sequence, or ValueError if\nany item in the sequence is not an AccessEntry", "docstring_tokens": [ "TypeError", "if", "'", "value", "'", "is", "not", "a", ...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
labels
<not_specific>
def labels(self): """Labels for the dataset. This method always returns a dict. To change a dataset's labels, modify the dict, then call :meth:`google.cloud.bigquery.client.Client.update_dataset`. To delete a label, set its value to ``None`` before updating. :rtype: dic...
Labels for the dataset. This method always returns a dict. To change a dataset's labels, modify the dict, then call :meth:`google.cloud.bigquery.client.Client.update_dataset`. To delete a label, set its value to ``None`` before updating. :rtype: dict, {str -> str} :retu...
Labels for the dataset. This method always returns a dict. To change a dataset's labels, modify the dict, then call
[ "Labels", "for", "the", "dataset", ".", "This", "method", "always", "returns", "a", "dict", ".", "To", "change", "a", "dataset", "'", "s", "labels", "modify", "the", "dict", "then", "call" ]
def labels(self): return self._properties['labels']
[ "def", "labels", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'labels'", "]" ]
Labels for the dataset.
[ "Labels", "for", "the", "dataset", "." ]
[ "\"\"\"Labels for the dataset.\n\n This method always returns a dict. To change a dataset's labels,\n modify the dict, then call\n :meth:`google.cloud.bigquery.client.Client.update_dataset`. To delete\n a label, set its value to ``None`` before updating.\n\n :rtype: dict, {str -> ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "A dict of the the dataset's labels.", "docstring_tokens": [ "A", "dict", "of", "the", "the", "dataset", "'", "s", "labels", "." ], "type": "dict, {str -> str}" } ], "raise...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
labels
null
def labels(self, value): """Update labels for the dataset. :type value: dict, {str -> str} :param value: new labels :raises: ValueError for invalid value types. """ if not isinstance(value, dict): raise ValueError("Pass a dict") self._properties['lab...
Update labels for the dataset. :type value: dict, {str -> str} :param value: new labels :raises: ValueError for invalid value types.
Update labels for the dataset.
[ "Update", "labels", "for", "the", "dataset", "." ]
def labels(self, value): if not isinstance(value, dict): raise ValueError("Pass a dict") self._properties['labels'] = value
[ "def", "labels", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"Pass a dict\"", ")", "self", ".", "_properties", "[", "'labels'", "]", "=", "value" ]
Update labels for the dataset.
[ "Update", "labels", "for", "the", "dataset", "." ]
[ "\"\"\"Update labels for the dataset.\n\n :type value: dict, {str -> str}\n :param value: new labels\n\n :raises: ValueError for invalid value types.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "ValueError for invalid value types.", "docstring_tokens": [ "ValueError", "for", "invalid", "value", "types", "." ], "type": null } ], "params": [ { "identifier": "self", ...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
from_api_repr
<not_specific>
def from_api_repr(cls, resource): """Factory: construct a dataset given its API representation :type resource: dict :param resource: dataset resource representation returned from the API :rtype: :class:`~google.cloud.bigquery.dataset.Dataset` :returns: Dataset parsed from ``re...
Factory: construct a dataset given its API representation :type resource: dict :param resource: dataset resource representation returned from the API :rtype: :class:`~google.cloud.bigquery.dataset.Dataset` :returns: Dataset parsed from ``resource``.
construct a dataset given its API representation
[ "construct", "a", "dataset", "given", "its", "API", "representation" ]
def from_api_repr(cls, resource): dsr = resource.get('datasetReference') if dsr is None or 'datasetId' not in dsr: raise KeyError('Resource lacks required identity information:' '["datasetReference"]["datasetId"]') dataset_id = dsr['datasetId'] data...
[ "def", "from_api_repr", "(", "cls", ",", "resource", ")", ":", "dsr", "=", "resource", ".", "get", "(", "'datasetReference'", ")", "if", "dsr", "is", "None", "or", "'datasetId'", "not", "in", "dsr", ":", "raise", "KeyError", "(", "'Resource lacks required id...
Factory: construct a dataset given its API representation
[ "Factory", ":", "construct", "a", "dataset", "given", "its", "API", "representation" ]
[ "\"\"\"Factory: construct a dataset given its API representation\n\n :type resource: dict\n :param resource: dataset resource representation returned from the API\n\n :rtype: :class:`~google.cloud.bigquery.dataset.Dataset`\n :returns: Dataset parsed from ``resource``.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "resource", "type": null } ]
{ "returns": [ { "docstring": "Dataset parsed from ``resource``.", "docstring_tokens": [ "Dataset", "parsed", "from", "`", "`", "resource", "`", "`", "." ], "type": ":class:`~google.cloud.bigquery.dataset.Dataset`" ...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
_parse_access_entries
<not_specific>
def _parse_access_entries(access): """Parse a resource fragment into a set of access entries. ``role`` augments the entity type and present **unless** the entity type is ``view``. :type access: list of mappings :param access: each mapping represents a single access entry. ...
Parse a resource fragment into a set of access entries. ``role`` augments the entity type and present **unless** the entity type is ``view``. :type access: list of mappings :param access: each mapping represents a single access entry. :rtype: list of :class:`~google.cloud.bigq...
Parse a resource fragment into a set of access entries.
[ "Parse", "a", "resource", "fragment", "into", "a", "set", "of", "access", "entries", "." ]
def _parse_access_entries(access): result = [] for entry in access: entry = entry.copy() role = entry.pop('role', None) entity_type, entity_id = entry.popitem() if len(entry) != 0: raise ValueError('Entry has unexpected keys remaining.', en...
[ "def", "_parse_access_entries", "(", "access", ")", ":", "result", "=", "[", "]", "for", "entry", "in", "access", ":", "entry", "=", "entry", ".", "copy", "(", ")", "role", "=", "entry", ".", "pop", "(", "'role'", ",", "None", ")", "entity_type", ","...
Parse a resource fragment into a set of access entries.
[ "Parse", "a", "resource", "fragment", "into", "a", "set", "of", "access", "entries", "." ]
[ "\"\"\"Parse a resource fragment into a set of access entries.\n\n ``role`` augments the entity type and present **unless** the entity\n type is ``view``.\n\n :type access: list of mappings\n :param access: each mapping represents a single access entry.\n\n :rtype: list of :class:...
[ { "param": "access", "type": null } ]
{ "returns": [ { "docstring": "a list of parsed entries.", "docstring_tokens": [ "a", "list", "of", "parsed", "entries", "." ], "type": "list of :class:`~google.cloud.bigquery.dataset.AccessEntry`" } ], "raises": [ { "docstr...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
_set_properties
null
def _set_properties(self, api_response): """Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call. """ self._properties.clear() cleaned = api_response.copy() access = cleaned.p...
Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call.
Update properties from resource in body of ``api_response``
[ "Update", "properties", "from", "resource", "in", "body", "of", "`", "`", "api_response", "`", "`" ]
def _set_properties(self, api_response): self._properties.clear() cleaned = api_response.copy() access = cleaned.pop('access', ()) self.access_entries = self._parse_access_entries(access) if 'creationTime' in cleaned: cleaned['creationTime'] = float(cleaned['creationT...
[ "def", "_set_properties", "(", "self", ",", "api_response", ")", ":", "self", ".", "_properties", ".", "clear", "(", ")", "cleaned", "=", "api_response", ".", "copy", "(", ")", "access", "=", "cleaned", ".", "pop", "(", "'access'", ",", "(", ")", ")", ...
Update properties from resource in body of ``api_response``
[ "Update", "properties", "from", "resource", "in", "body", "of", "`", "`", "api_response", "`", "`" ]
[ "\"\"\"Update properties from resource in body of ``api_response``\n\n :type api_response: dict\n :param api_response: response returned from an API call.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "api_response", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "api_response", "type": null, "docstring": "response returned from a...
eb7372876c1ffd979cbd807189c2f1600bc1354a
zero-master/bigquery
google/cloud/bigquery/dataset.py
[ "Apache-2.0" ]
Python
_build_access_resource
<not_specific>
def _build_access_resource(self): """Generate a resource fragment for dataset's access entries.""" result = [] for entry in self.access_entries: info = {entry.entity_type: entry.entity_id} if entry.role is not None: info['role'] = entry.role re...
Generate a resource fragment for dataset's access entries.
Generate a resource fragment for dataset's access entries.
[ "Generate", "a", "resource", "fragment", "for", "dataset", "'", "s", "access", "entries", "." ]
def _build_access_resource(self): result = [] for entry in self.access_entries: info = {entry.entity_type: entry.entity_id} if entry.role is not None: info['role'] = entry.role result.append(info) return result
[ "def", "_build_access_resource", "(", "self", ")", ":", "result", "=", "[", "]", "for", "entry", "in", "self", ".", "access_entries", ":", "info", "=", "{", "entry", ".", "entity_type", ":", "entry", ".", "entity_id", "}", "if", "entry", ".", "role", "...
Generate a resource fragment for dataset's access entries.
[ "Generate", "a", "resource", "fragment", "for", "dataset", "'", "s", "access", "entries", "." ]
[ "\"\"\"Generate a resource fragment for dataset's access entries.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c0af22c5f578a1f6c042e8515ae3703140038f0c
zero-master/bigquery
google/cloud/bigquery/_helpers.py
[ "Apache-2.0" ]
Python
_rows_from_json
<not_specific>
def _rows_from_json(values, schema): """Convert JSON row data to rows with appropriate types.""" field_to_index = _field_to_index_mapping(schema) return [Row(_row_tuple_from_json(r, schema), field_to_index) for r in values]
Convert JSON row data to rows with appropriate types.
Convert JSON row data to rows with appropriate types.
[ "Convert", "JSON", "row", "data", "to", "rows", "with", "appropriate", "types", "." ]
def _rows_from_json(values, schema): field_to_index = _field_to_index_mapping(schema) return [Row(_row_tuple_from_json(r, schema), field_to_index) for r in values]
[ "def", "_rows_from_json", "(", "values", ",", "schema", ")", ":", "field_to_index", "=", "_field_to_index_mapping", "(", "schema", ")", "return", "[", "Row", "(", "_row_tuple_from_json", "(", "r", ",", "schema", ")", ",", "field_to_index", ")", "for", "r", "...
Convert JSON row data to rows with appropriate types.
[ "Convert", "JSON", "row", "data", "to", "rows", "with", "appropriate", "types", "." ]
[ "\"\"\"Convert JSON row data to rows with appropriate types.\"\"\"" ]
[ { "param": "values", "type": null }, { "param": "schema", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "values", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "schema", "type": null, "docstring": null, "docstring_tokens...
c0af22c5f578a1f6c042e8515ae3703140038f0c
zero-master/bigquery
google/cloud/bigquery/_helpers.py
[ "Apache-2.0" ]
Python
_item_to_row
<not_specific>
def _item_to_row(iterator, resource): """Convert a JSON row to the native object. .. note:: This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller. :type iterator: :class:`~google.api_core.page_iterator.Ite...
Convert a JSON row to the native object. .. note:: This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller. :type iterator: :class:`~google.api_core.page_iterator.Iterator` :param iterator: The iterator that...
Convert a JSON row to the native object. note:. This assumes that the ``schema`` attribute has been added to the iterator after being created, which should be done by the caller.
[ "Convert", "a", "JSON", "row", "to", "the", "native", "object", ".", "note", ":", ".", "This", "assumes", "that", "the", "`", "`", "schema", "`", "`", "attribute", "has", "been", "added", "to", "the", "iterator", "after", "being", "created", "which", "...
def _item_to_row(iterator, resource): return Row(_row_tuple_from_json(resource, iterator.schema), iterator._field_to_index)
[ "def", "_item_to_row", "(", "iterator", ",", "resource", ")", ":", "return", "Row", "(", "_row_tuple_from_json", "(", "resource", ",", "iterator", ".", "schema", ")", ",", "iterator", ".", "_field_to_index", ")" ]
Convert a JSON row to the native object.
[ "Convert", "a", "JSON", "row", "to", "the", "native", "object", "." ]
[ "\"\"\"Convert a JSON row to the native object.\n\n .. note::\n\n This assumes that the ``schema`` attribute has been\n added to the iterator after being created, which\n should be done by the caller.\n\n :type iterator: :class:`~google.api_core.page_iterator.Iterator`\n :param iterato...
[ { "param": "iterator", "type": null }, { "param": "resource", "type": null } ]
{ "returns": [ { "docstring": "The next row in the page.", "docstring_tokens": [ "The", "next", "row", "in", "the", "page", "." ], "type": ":class:`~google.cloud.bigquery.Row`" } ], "raises": [], "params": [ { "ide...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
path
<not_specific>
def path(self): """URL path for the table's APIs. :rtype: str :returns: the path based on project, dataset and table IDs. """ return '/projects/%s/datasets/%s/tables/%s' % ( self._project, self._dataset_id, self._table_id)
URL path for the table's APIs. :rtype: str :returns: the path based on project, dataset and table IDs.
URL path for the table's APIs.
[ "URL", "path", "for", "the", "table", "'", "s", "APIs", "." ]
def path(self): return '/projects/%s/datasets/%s/tables/%s' % ( self._project, self._dataset_id, self._table_id)
[ "def", "path", "(", "self", ")", ":", "return", "'/projects/%s/datasets/%s/tables/%s'", "%", "(", "self", ".", "_project", ",", "self", ".", "_dataset_id", ",", "self", ".", "_table_id", ")" ]
URL path for the table's APIs.
[ "URL", "path", "for", "the", "table", "'", "s", "APIs", "." ]
[ "\"\"\"URL path for the table's APIs.\n\n :rtype: str\n :returns: the path based on project, dataset and table IDs.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "the path based on project, dataset and table IDs.", "docstring_tokens": [ "the", "path", "based", "on", "project", "dataset", "and", "table", "IDs", "." ], "type": "str" } ]...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
view_query
null
def view_query(self, value): """Update SQL query defining the table as a view. :type value: str :param value: new query :raises: ValueError for invalid value types. """ if not isinstance(value, six.string_types): raise ValueError("Pass a string") vie...
Update SQL query defining the table as a view. :type value: str :param value: new query :raises: ValueError for invalid value types.
Update SQL query defining the table as a view.
[ "Update", "SQL", "query", "defining", "the", "table", "as", "a", "view", "." ]
def view_query(self, value): if not isinstance(value, six.string_types): raise ValueError("Pass a string") view = self._properties.get('view') if view is None: view = self._properties['view'] = {} view['query'] = value if view.get('useLegacySql') is None: ...
[ "def", "view_query", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "raise", "ValueError", "(", "\"Pass a string\"", ")", "view", "=", "self", ".", "_properties", ".", "get", "(", ...
Update SQL query defining the table as a view.
[ "Update", "SQL", "query", "defining", "the", "table", "as", "a", "view", "." ]
[ "\"\"\"Update SQL query defining the table as a view.\n\n :type value: str\n :param value: new query\n\n :raises: ValueError for invalid value types.\n \"\"\"", "# The service defaults useLegacySql to True, but this", "# client uses Standard SQL by default." ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "ValueError for invalid value types.", "docstring_tokens": [ "ValueError", "for", "invalid", "value", "types", "." ], "type": null } ], "params": [ { "identifier": "self", ...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
view_use_legacy_sql
<not_specific>
def view_use_legacy_sql(self): """Specifies whether to execute the view with Legacy or Standard SQL. The default is False for views (use Standard SQL). If this table is not a view, None is returned. :rtype: bool or ``NoneType`` :returns: The boolean for view.useLegacySql, or No...
Specifies whether to execute the view with Legacy or Standard SQL. The default is False for views (use Standard SQL). If this table is not a view, None is returned. :rtype: bool or ``NoneType`` :returns: The boolean for view.useLegacySql, or None if not a view.
Specifies whether to execute the view with Legacy or Standard SQL. The default is False for views (use Standard SQL). If this table is not a view, None is returned.
[ "Specifies", "whether", "to", "execute", "the", "view", "with", "Legacy", "or", "Standard", "SQL", ".", "The", "default", "is", "False", "for", "views", "(", "use", "Standard", "SQL", ")", ".", "If", "this", "table", "is", "not", "a", "view", "None", "...
def view_use_legacy_sql(self): view = self._properties.get('view') if view is not None: return view.get('useLegacySql', True)
[ "def", "view_use_legacy_sql", "(", "self", ")", ":", "view", "=", "self", ".", "_properties", ".", "get", "(", "'view'", ")", "if", "view", "is", "not", "None", ":", "return", "view", ".", "get", "(", "'useLegacySql'", ",", "True", ")" ]
Specifies whether to execute the view with Legacy or Standard SQL.
[ "Specifies", "whether", "to", "execute", "the", "view", "with", "Legacy", "or", "Standard", "SQL", "." ]
[ "\"\"\"Specifies whether to execute the view with Legacy or Standard SQL.\n\n The default is False for views (use Standard SQL).\n If this table is not a view, None is returned.\n\n :rtype: bool or ``NoneType``\n :returns: The boolean for view.useLegacySql, or None if not a view.\n ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The boolean for view.useLegacySql, or None if not a view.", "docstring_tokens": [ "The", "boolean", "for", "view", ".", "useLegacySql", "or", "None", "if", "not", "a", "view",...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
external_data_configuration
<not_specific>
def external_data_configuration(self): """Configuration for an external data source. If not set, None is returned. :rtype: :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType`` :returns: The external configuration, or None (the default). """ return self._exter...
Configuration for an external data source. If not set, None is returned. :rtype: :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType`` :returns: The external configuration, or None (the default).
Configuration for an external data source. If not set, None is returned.
[ "Configuration", "for", "an", "external", "data", "source", ".", "If", "not", "set", "None", "is", "returned", "." ]
def external_data_configuration(self): return self._external_config
[ "def", "external_data_configuration", "(", "self", ")", ":", "return", "self", ".", "_external_config" ]
Configuration for an external data source.
[ "Configuration", "for", "an", "external", "data", "source", "." ]
[ "\"\"\"Configuration for an external data source.\n\n If not set, None is returned.\n\n :rtype: :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType``\n :returns: The external configuration, or None (the default).\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The external configuration, or None (the default).", "docstring_tokens": [ "The", "external", "configuration", "or", "None", "(", "the", "default", ")", "." ], "type": ":class:`~g...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
external_data_configuration
null
def external_data_configuration(self, value): """Sets the configuration for an external data source. :type value: :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType`` :param value: The ExternalConfig, or None to unset. """ if not (value is None or isinstan...
Sets the configuration for an external data source. :type value: :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType`` :param value: The ExternalConfig, or None to unset.
Sets the configuration for an external data source.
[ "Sets", "the", "configuration", "for", "an", "external", "data", "source", "." ]
def external_data_configuration(self, value): if not (value is None or isinstance(value, ExternalConfig)): raise ValueError("Pass an ExternalConfig or None") self._external_config = value
[ "def", "external_data_configuration", "(", "self", ",", "value", ")", ":", "if", "not", "(", "value", "is", "None", "or", "isinstance", "(", "value", ",", "ExternalConfig", ")", ")", ":", "raise", "ValueError", "(", "\"Pass an ExternalConfig or None\"", ")", "...
Sets the configuration for an external data source.
[ "Sets", "the", "configuration", "for", "an", "external", "data", "source", "." ]
[ "\"\"\"Sets the configuration for an external data source.\n\n :type value:\n :class:`~google.cloud.bigquery.ExternalConfig`, or ``NoneType``\n :param value: The ExternalConfig, or None to unset.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": "The ExternalConfig, or None to ...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
from_api_repr
<not_specific>
def from_api_repr(cls, resource): """Factory: construct a table given its API representation :type resource: dict :param resource: table resource representation returned from the API :type dataset: :class:`google.cloud.bigquery.Dataset` :param dataset: The dataset containing t...
Factory: construct a table given its API representation :type resource: dict :param resource: table resource representation returned from the API :type dataset: :class:`google.cloud.bigquery.Dataset` :param dataset: The dataset containing the table. :rtype: :class:`google.clo...
construct a table given its API representation
[ "construct", "a", "table", "given", "its", "API", "representation" ]
def from_api_repr(cls, resource): from google.cloud.bigquery import dataset if ('tableReference' not in resource or 'tableId' not in resource['tableReference']): raise KeyError('Resource lacks required identity information:' '["tableReference"]["tab...
[ "def", "from_api_repr", "(", "cls", ",", "resource", ")", ":", "from", "google", ".", "cloud", ".", "bigquery", "import", "dataset", "if", "(", "'tableReference'", "not", "in", "resource", "or", "'tableId'", "not", "in", "resource", "[", "'tableReference'", ...
Factory: construct a table given its API representation
[ "Factory", ":", "construct", "a", "table", "given", "its", "API", "representation" ]
[ "\"\"\"Factory: construct a table given its API representation\n\n :type resource: dict\n :param resource: table resource representation returned from the API\n\n :type dataset: :class:`google.cloud.bigquery.Dataset`\n :param dataset: The dataset containing the table.\n\n :rtype:...
[ { "param": "cls", "type": null }, { "param": "resource", "type": null } ]
{ "returns": [ { "docstring": "Table parsed from ``resource``.", "docstring_tokens": [ "Table", "parsed", "from", "`", "`", "resource", "`", "`", "." ], "type": ":class:`google.cloud.bigquery.table.Table`" } ], ...
6af789c9ce9b9feb018a27efb50e7cf4471619ea
zero-master/bigquery
google/cloud/bigquery/table.py
[ "Apache-2.0" ]
Python
_set_properties
null
def _set_properties(self, api_response): """Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call """ self._properties.clear() cleaned = api_response.copy() schema = cleaned.po...
Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call
Update properties from resource in body of ``api_response``
[ "Update", "properties", "from", "resource", "in", "body", "of", "`", "`", "api_response", "`", "`" ]
def _set_properties(self, api_response): self._properties.clear() cleaned = api_response.copy() schema = cleaned.pop('schema', {'fields': ()}) self.schema = _parse_schema_resource(schema) ec = cleaned.pop('externalDataConfiguration', None) if ec: self.external...
[ "def", "_set_properties", "(", "self", ",", "api_response", ")", ":", "self", ".", "_properties", ".", "clear", "(", ")", "cleaned", "=", "api_response", ".", "copy", "(", ")", "schema", "=", "cleaned", ".", "pop", "(", "'schema'", ",", "{", "'fields'", ...
Update properties from resource in body of ``api_response``
[ "Update", "properties", "from", "resource", "in", "body", "of", "`", "`", "api_response", "`", "`" ]
[ "\"\"\"Update properties from resource in body of ``api_response``\n\n :type api_response: dict\n :param api_response: response returned from an API call\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "api_response", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "api_response", "type": null, "docstring": "response returned from a...
f4dc32e7e10153b8e20101075705c8ff8f9d97c0
zero-master/bigquery
google/cloud/bigquery/dbapi/cursor.py
[ "Apache-2.0" ]
Python
_try_fetch
<not_specific>
def _try_fetch(self, size=None): """Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started. """ if self._query_job is None: raise exceptions.InterfaceError( 'No query results: execute() must be called before fetch....
Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started.
Try to start fetching data, if not yet started. Mutates self to indicate that iteration has started.
[ "Try", "to", "start", "fetching", "data", "if", "not", "yet", "started", ".", "Mutates", "self", "to", "indicate", "that", "iteration", "has", "started", "." ]
def _try_fetch(self, size=None): if self._query_job is None: raise exceptions.InterfaceError( 'No query results: execute() must be called before fetch.') is_dml = ( self._query_job.statement_type and self._query_job.statement_type.upper() != 'SELECT') ...
[ "def", "_try_fetch", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "_query_job", "is", "None", ":", "raise", "exceptions", ".", "InterfaceError", "(", "'No query results: execute() must be called before fetch.'", ")", "is_dml", "=", "(", "s...
Try to start fetching data, if not yet started.
[ "Try", "to", "start", "fetching", "data", "if", "not", "yet", "started", "." ]
[ "\"\"\"Try to start fetching data, if not yet started.\n\n Mutates self to indicate that iteration has started.\n \"\"\"", "# TODO(tswast): pass in page size to list_rows based on arraysize" ]
[ { "param": "self", "type": null }, { "param": "size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": [...
a7b499be4792437d93fe3b690e00a381439c553e
stribny/flask-api-quickstart
app/auth/service.py
[ "MIT" ]
Python
login_user
<not_specific>
def login_user(username, password): """Generate a new auth token for the user""" saved_user = User.query.filter_by(username=username).first() if saved_user and check_password(password, saved_user.password): token = encode_auth_token(saved_user.id) return token else: raise Invalid...
Generate a new auth token for the user
Generate a new auth token for the user
[ "Generate", "a", "new", "auth", "token", "for", "the", "user" ]
def login_user(username, password): saved_user = User.query.filter_by(username=username).first() if saved_user and check_password(password, saved_user.password): token = encode_auth_token(saved_user.id) return token else: raise InvalidCredentialsError()
[ "def", "login_user", "(", "username", ",", "password", ")", ":", "saved_user", "=", "User", ".", "query", ".", "filter_by", "(", "username", "=", "username", ")", ".", "first", "(", ")", "if", "saved_user", "and", "check_password", "(", "password", ",", ...
Generate a new auth token for the user
[ "Generate", "a", "new", "auth", "token", "for", "the", "user" ]
[ "\"\"\"Generate a new auth token for the user\"\"\"" ]
[ { "param": "username", "type": null }, { "param": "password", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "username", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "password", "type": null, "docstring": null, "docstring_to...
a7b499be4792437d93fe3b690e00a381439c553e
stribny/flask-api-quickstart
app/auth/service.py
[ "MIT" ]
Python
encode_auth_token
<not_specific>
def encode_auth_token(user_id): """Create a token with user_id and expiration date using secret key""" exp_days = app.config.get("AUTH_TOKEN_EXPIRATION_DAYS") exp_seconds = app.config.get("AUTH_TOKEN_EXPIRATION_SECONDS") exp_date = now() + datetime.timedelta( days=exp_days, seconds=exp_seconds ...
Create a token with user_id and expiration date using secret key
Create a token with user_id and expiration date using secret key
[ "Create", "a", "token", "with", "user_id", "and", "expiration", "date", "using", "secret", "key" ]
def encode_auth_token(user_id): exp_days = app.config.get("AUTH_TOKEN_EXPIRATION_DAYS") exp_seconds = app.config.get("AUTH_TOKEN_EXPIRATION_SECONDS") exp_date = now() + datetime.timedelta( days=exp_days, seconds=exp_seconds ) payload = {"exp": exp_date, "iat": now(), "sub": user_id} retu...
[ "def", "encode_auth_token", "(", "user_id", ")", ":", "exp_days", "=", "app", ".", "config", ".", "get", "(", "\"AUTH_TOKEN_EXPIRATION_DAYS\"", ")", "exp_seconds", "=", "app", ".", "config", ".", "get", "(", "\"AUTH_TOKEN_EXPIRATION_SECONDS\"", ")", "exp_date", ...
Create a token with user_id and expiration date using secret key
[ "Create", "a", "token", "with", "user_id", "and", "expiration", "date", "using", "secret", "key" ]
[ "\"\"\"Create a token with user_id and expiration date using secret key\"\"\"" ]
[ { "param": "user_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7b499be4792437d93fe3b690e00a381439c553e
stribny/flask-api-quickstart
app/auth/service.py
[ "MIT" ]
Python
decode_auth_token
<not_specific>
def decode_auth_token(token): """Convert token to original payload using secret key if the token is valid""" try: payload = jwt.decode(token, app.config["SECRET_KEY"], algorithms="HS256") return payload except jwt.ExpiredSignatureError as ex: raise TokenExpiredError() from ex exc...
Convert token to original payload using secret key if the token is valid
Convert token to original payload using secret key if the token is valid
[ "Convert", "token", "to", "original", "payload", "using", "secret", "key", "if", "the", "token", "is", "valid" ]
def decode_auth_token(token): try: payload = jwt.decode(token, app.config["SECRET_KEY"], algorithms="HS256") return payload except jwt.ExpiredSignatureError as ex: raise TokenExpiredError() from ex except jwt.InvalidTokenError as ex: raise InvalidTokenError() from ex
[ "def", "decode_auth_token", "(", "token", ")", ":", "try", ":", "payload", "=", "jwt", ".", "decode", "(", "token", ",", "app", ".", "config", "[", "\"SECRET_KEY\"", "]", ",", "algorithms", "=", "\"HS256\"", ")", "return", "payload", "except", "jwt", "."...
Convert token to original payload using secret key if the token is valid
[ "Convert", "token", "to", "original", "payload", "using", "secret", "key", "if", "the", "token", "is", "valid" ]
[ "\"\"\"Convert token to original payload using secret key if the token is valid\"\"\"" ]
[ { "param": "token", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "token", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
15bcae2decb5041e4367b1d53e6c25d679f41edd
stribny/flask-api-quickstart
app/auth/helpers.py
[ "MIT" ]
Python
auth_required
<not_specific>
def auth_required(f): """Decorator to require auth token on marked endpoint""" @wraps(f) def decorated_function(*args, **kwargs): token = get_token_from_header() if not token: raise InvalidTokenError() if is_token_blacklisted(token): raise TokenExpiredError(...
Decorator to require auth token on marked endpoint
Decorator to require auth token on marked endpoint
[ "Decorator", "to", "require", "auth", "token", "on", "marked", "endpoint" ]
def auth_required(f): @wraps(f) def decorated_function(*args, **kwargs): token = get_token_from_header() if not token: raise InvalidTokenError() if is_token_blacklisted(token): raise TokenExpiredError() token_payload = decode_auth_token(token) curr...
[ "def", "auth_required", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated_function", "(", "*", "args", ",", "**", "kwargs", ")", ":", "token", "=", "get_token_from_header", "(", ")", "if", "not", "token", ":", "raise", "InvalidTokenError...
Decorator to require auth token on marked endpoint
[ "Decorator", "to", "require", "auth", "token", "on", "marked", "endpoint" ]
[ "\"\"\"Decorator to require auth token on marked endpoint\"\"\"" ]
[ { "param": "f", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2596cb1730f91fe173ae7ae965553d769ab2defc
stribny/flask-api-quickstart
tests/conftest.py
[ "MIT" ]
Python
client
null
def client(): """Create Flask's test client to interact with the application""" client = create_app().test_client() set_up() yield client tear_down()
Create Flask's test client to interact with the application
Create Flask's test client to interact with the application
[ "Create", "Flask", "'", "s", "test", "client", "to", "interact", "with", "the", "application" ]
def client(): client = create_app().test_client() set_up() yield client tear_down()
[ "def", "client", "(", ")", ":", "client", "=", "create_app", "(", ")", ".", "test_client", "(", ")", "set_up", "(", ")", "yield", "client", "tear_down", "(", ")" ]
Create Flask's test client to interact with the application
[ "Create", "Flask", "'", "s", "test", "client", "to", "interact", "with", "the", "application" ]
[ "\"\"\"Create Flask's test client to interact with the application\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a80e994a2cd957969d578b0bd7c1a87eb69d5141
robertmitchellv/pyjanitor
janitor/utils.py
[ "MIT" ]
Python
_data_checks_pivot_longer
<not_specific>
def _data_checks_pivot_longer( df, index, column_names, names_to, values_to, names_sep, names_pattern, dtypes, ): """ This function raises errors or warnings if the arguments have the wrong python type, or if an unneeded argument is provided. It also raises an error mess...
This function raises errors or warnings if the arguments have the wrong python type, or if an unneeded argument is provided. It also raises an error message if `names_pattern` is a list/tuple of regular expressions, and `names_to` is not a list/tuple, and the lengths do not match. This function is ...
This function raises errors or warnings if the arguments have the wrong python type, or if an unneeded argument is provided. It also raises an error message if `names_pattern` is a list/tuple of regular expressions, and `names_to` is not a list/tuple, and the lengths do not match. This function is executed before proce...
[ "This", "function", "raises", "errors", "or", "warnings", "if", "the", "arguments", "have", "the", "wrong", "python", "type", "or", "if", "an", "unneeded", "argument", "is", "provided", ".", "It", "also", "raises", "an", "error", "message", "if", "`", "nam...
def _data_checks_pivot_longer( df, index, column_names, names_to, values_to, names_sep, names_pattern, dtypes, ): if any( ( isinstance(df.index, pd.MultiIndex), isinstance(df.columns, pd.MultiIndex), ), ): raise ValueError( ...
[ "def", "_data_checks_pivot_longer", "(", "df", ",", "index", ",", "column_names", ",", "names_to", ",", "values_to", ",", "names_sep", ",", "names_pattern", ",", "dtypes", ",", ")", ":", "if", "any", "(", "(", "isinstance", "(", "df", ".", "index", ",", ...
This function raises errors or warnings if the arguments have the wrong python type, or if an unneeded argument is provided.
[ "This", "function", "raises", "errors", "or", "warnings", "if", "the", "arguments", "have", "the", "wrong", "python", "type", "or", "if", "an", "unneeded", "argument", "is", "provided", "." ]
[ "\"\"\"\n This function raises errors or warnings if the arguments have the wrong\n python type, or if an unneeded argument is provided. It also raises an\n error message if `names_pattern` is a list/tuple of regular expressions,\n and `names_to` is not a list/tuple, and the lengths do not match.\n T...
[ { "param": "df", "type": null }, { "param": "index", "type": null }, { "param": "column_names", "type": null }, { "param": "names_to", "type": null }, { "param": "values_to", "type": null }, { "param": "names_sep", "type": null }, { "param"...
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": null, "docstring": null, "docstring_tokens": []...
a80e994a2cd957969d578b0bd7c1a87eb69d5141
robertmitchellv/pyjanitor
janitor/utils.py
[ "MIT" ]
Python
_data_checks_pivot_wider
<not_specific>
def _data_checks_pivot_wider( df, index, names_from, values_from, names_sort, flatten_levels, values_from_first, names_prefix, names_sep, fill_value, ): """ This function raises errors if the arguments have the wrong python type, or if the column does not exist in th...
This function raises errors if the arguments have the wrong python type, or if the column does not exist in the dataframe. This function is executed before proceeding to the computation phase. Type annotations are not provided because this function is where type checking happens.
This function raises errors if the arguments have the wrong python type, or if the column does not exist in the dataframe. This function is executed before proceeding to the computation phase. Type annotations are not provided because this function is where type checking happens.
[ "This", "function", "raises", "errors", "if", "the", "arguments", "have", "the", "wrong", "python", "type", "or", "if", "the", "column", "does", "not", "exist", "in", "the", "dataframe", ".", "This", "function", "is", "executed", "before", "proceeding", "to"...
def _data_checks_pivot_wider( df, index, names_from, values_from, names_sort, flatten_levels, values_from_first, names_prefix, names_sep, fill_value, ): if index is not None: if isinstance(index, str): index = [index] check("index", index, [list]) ...
[ "def", "_data_checks_pivot_wider", "(", "df", ",", "index", ",", "names_from", ",", "values_from", ",", "names_sort", ",", "flatten_levels", ",", "values_from_first", ",", "names_prefix", ",", "names_sep", ",", "fill_value", ",", ")", ":", "if", "index", "is", ...
This function raises errors if the arguments have the wrong python type, or if the column does not exist in the dataframe.
[ "This", "function", "raises", "errors", "if", "the", "arguments", "have", "the", "wrong", "python", "type", "or", "if", "the", "column", "does", "not", "exist", "in", "the", "dataframe", "." ]
[ "\"\"\"\n This function raises errors if the arguments have the wrong\n python type, or if the column does not exist in the dataframe.\n This function is executed before proceeding to the computation phase.\n Type annotations are not provided because this function is where type\n checking happens.\n ...
[ { "param": "df", "type": null }, { "param": "index", "type": null }, { "param": "names_from", "type": null }, { "param": "values_from", "type": null }, { "param": "names_sort", "type": null }, { "param": "flatten_levels", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": null, "docstring": null, "docstring_tokens": []...
a80e994a2cd957969d578b0bd7c1a87eb69d5141
robertmitchellv/pyjanitor
janitor/utils.py
[ "MIT" ]
Python
_computations_pivot_wider
pd.DataFrame
def _computations_pivot_wider( df: pd.DataFrame, index: Optional[Union[List, str]] = None, names_from: Optional[Union[List, str]] = None, values_from: Optional[Union[List, str]] = None, names_sort: Optional[bool] = False, flatten_levels: Optional[bool] = True, values_from_first: Optional[boo...
This is the main workhorse of the `pivot_wider` function. If `values_from` is a list, then every item in `values_from` will be added to the front of each output column. This option can be turned off with the `values_from_first` argument, in which case, the `names_from` variables (or `names_prefix`,...
This is the main workhorse of the `pivot_wider` function. If `values_from` is a list, then every item in `values_from` will be added to the front of each output column.
[ "This", "is", "the", "main", "workhorse", "of", "the", "`", "pivot_wider", "`", "function", ".", "If", "`", "values_from", "`", "is", "a", "list", "then", "every", "item", "in", "`", "values_from", "`", "will", "be", "added", "to", "the", "front", "of"...
def _computations_pivot_wider( df: pd.DataFrame, index: Optional[Union[List, str]] = None, names_from: Optional[Union[List, str]] = None, values_from: Optional[Union[List, str]] = None, names_sort: Optional[bool] = False, flatten_levels: Optional[bool] = True, values_from_first: Optional[boo...
[ "def", "_computations_pivot_wider", "(", "df", ":", "pd", ".", "DataFrame", ",", "index", ":", "Optional", "[", "Union", "[", "List", ",", "str", "]", "]", "=", "None", ",", "names_from", ":", "Optional", "[", "Union", "[", "List", ",", "str", "]", "...
This is the main workhorse of the `pivot_wider` function.
[ "This", "is", "the", "main", "workhorse", "of", "the", "`", "pivot_wider", "`", "function", "." ]
[ "\"\"\"\n This is the main workhorse of the `pivot_wider` function.\n If `values_from` is a list, then every item in `values_from`\n will be added to the front of each output column. This option\n can be turned off with the `values_from_first` argument, in\n which case, the `names_from` variables (or...
[ { "param": "df", "type": "pd.DataFrame" }, { "param": "index", "type": "Optional[Union[List, str]]" }, { "param": "names_from", "type": "Optional[Union[List, str]]" }, { "param": "values_from", "type": "Optional[Union[List, str]]" }, { "param": "names_sort", "...
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": "pd.DataFrame", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "Optional[Union[List, str]]", "docstring": ...
5cf9a7b02ed2d8959945f5d02e7497b63042bf60
fgrunewald/vermouth-martinize
vermouth/processors/canonicalize_modifications.py
[ "Apache-2.0" ]
Python
semantic_feasibility
<not_specific>
def semantic_feasibility(self, node1, node2): """ Returns True iff node1 and node2 should be considered equal. This means they are both either marked as PTM_atom, or not. If they both are PTM atoms, the elements need to match, and otherwise, the atomnames must match. """ ...
Returns True iff node1 and node2 should be considered equal. This means they are both either marked as PTM_atom, or not. If they both are PTM atoms, the elements need to match, and otherwise, the atomnames must match.
Returns True iff node1 and node2 should be considered equal. This means they are both either marked as PTM_atom, or not. If they both are PTM atoms, the elements need to match, and otherwise, the atomnames must match.
[ "Returns", "True", "iff", "node1", "and", "node2", "should", "be", "considered", "equal", ".", "This", "means", "they", "are", "both", "either", "marked", "as", "PTM_atom", "or", "not", ".", "If", "they", "both", "are", "PTM", "atoms", "the", "elements", ...
def semantic_feasibility(self, node1, node2): node1 = self.G1.nodes[node1] node2 = self.G2.nodes[node2] if node1.get('PTM_atom', False) == node2['PTM_atom']: if node2['PTM_atom']: return node1['element'] == node2['element'] else: return nod...
[ "def", "semantic_feasibility", "(", "self", ",", "node1", ",", "node2", ")", ":", "node1", "=", "self", ".", "G1", ".", "nodes", "[", "node1", "]", "node2", "=", "self", ".", "G2", ".", "nodes", "[", "node2", "]", "if", "node1", ".", "get", "(", ...
Returns True iff node1 and node2 should be considered equal.
[ "Returns", "True", "iff", "node1", "and", "node2", "should", "be", "considered", "equal", "." ]
[ "\"\"\"\n Returns True iff node1 and node2 should be considered equal. This means\n they are both either marked as PTM_atom, or not. If they both are PTM\n atoms, the elements need to match, and otherwise, the atomnames must\n match.\n \"\"\"", "# elements must match", "# atom...
[ { "param": "self", "type": null }, { "param": "node1", "type": null }, { "param": "node2", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node1", "type": null, "docstring": null, "docstring_tokens": ...
5cf9a7b02ed2d8959945f5d02e7497b63042bf60
fgrunewald/vermouth-martinize
vermouth/processors/canonicalize_modifications.py
[ "Apache-2.0" ]
Python
fix_ptm
<not_specific>
def fix_ptm(molecule): ''' Canonizes all PTM atoms in molecule, and labels the relevant residues with which PTMs were recognized. Modifies ``molecule`` such that atomnames of PTM atoms are corrected, and the relevant residues have been labeled with which PTMs were recognized. Parameters ---...
Canonizes all PTM atoms in molecule, and labels the relevant residues with which PTMs were recognized. Modifies ``molecule`` such that atomnames of PTM atoms are corrected, and the relevant residues have been labeled with which PTMs were recognized. Parameters ---------- molecule : network...
Canonizes all PTM atoms in molecule, and labels the relevant residues with which PTMs were recognized. Modifies ``molecule`` such that atomnames of PTM atoms are corrected, and the relevant residues have been labeled with which PTMs were recognized. Parameters molecule : networkx.Graph Must not have missing atoms, an...
[ "Canonizes", "all", "PTM", "atoms", "in", "molecule", "and", "labels", "the", "relevant", "residues", "with", "which", "PTMs", "were", "recognized", ".", "Modifies", "`", "`", "molecule", "`", "`", "such", "that", "atomnames", "of", "PTM", "atoms", "are", ...
def fix_ptm(molecule): PTM_atoms = find_PTM_atoms(molecule) def key_func(ptm_atoms): node_idxs = ptm_atoms[-1] return sorted(molecule.nodes[idx]['resid'] for idx in node_idxs) ptm_atoms = sorted(PTM_atoms, key=key_func) resid_to_idxs = defaultdict(list) for n_idx in molecule: ...
[ "def", "fix_ptm", "(", "molecule", ")", ":", "PTM_atoms", "=", "find_PTM_atoms", "(", "molecule", ")", "def", "key_func", "(", "ptm_atoms", ")", ":", "node_idxs", "=", "ptm_atoms", "[", "-", "1", "]", "return", "sorted", "(", "molecule", ".", "nodes", "[...
Canonizes all PTM atoms in molecule, and labels the relevant residues with which PTMs were recognized.
[ "Canonizes", "all", "PTM", "atoms", "in", "molecule", "and", "labels", "the", "relevant", "residues", "with", "which", "PTMs", "were", "recognized", "." ]
[ "'''\n Canonizes all PTM atoms in molecule, and labels the relevant residues with\n which PTMs were recognized. Modifies ``molecule`` such that atomnames of\n PTM atoms are corrected, and the relevant residues have been labeled with\n which PTMs were recognized.\n\n Parameters\n ----------\n mo...
[ { "param": "molecule", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "molecule", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
copy
<not_specific>
def copy(self): """ Creates a copy of the molecule. Returns ------- Molecule """ return self.subgraph(self.nodes)
Creates a copy of the molecule. Returns ------- Molecule
Creates a copy of the molecule. Returns Molecule
[ "Creates", "a", "copy", "of", "the", "molecule", ".", "Returns", "Molecule" ]
def copy(self): return self.subgraph(self.nodes)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "subgraph", "(", "self", ".", "nodes", ")" ]
Creates a copy of the molecule.
[ "Creates", "a", "copy", "of", "the", "molecule", "." ]
[ "\"\"\"\n Creates a copy of the molecule.\n\n Returns\n -------\n Molecule\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
subgraph
<not_specific>
def subgraph(self, nodes): """ Creates a subgraph from the molecule. Returns ------- Molecule """ subgraph = self.__class__() subgraph.meta = copy.copy(self.meta) subgraph._force_field = self._force_field subgraph.nrexcl = self.nrexcl ...
Creates a subgraph from the molecule. Returns ------- Molecule
Creates a subgraph from the molecule. Returns Molecule
[ "Creates", "a", "subgraph", "from", "the", "molecule", ".", "Returns", "Molecule" ]
def subgraph(self, nodes): subgraph = self.__class__() subgraph.meta = copy.copy(self.meta) subgraph._force_field = self._force_field subgraph.nrexcl = self.nrexcl node_copies = [(node, copy.copy(self.nodes[node])) for node in nodes] subgraph.add_nodes_from(node_copies) ...
[ "def", "subgraph", "(", "self", ",", "nodes", ")", ":", "subgraph", "=", "self", ".", "__class__", "(", ")", "subgraph", ".", "meta", "=", "copy", ".", "copy", "(", "self", ".", "meta", ")", "subgraph", ".", "_force_field", "=", "self", ".", "_force_...
Creates a subgraph from the molecule.
[ "Creates", "a", "subgraph", "from", "the", "molecule", "." ]
[ "\"\"\"\n Creates a subgraph from the molecule.\n\n\n Returns\n -------\n Molecule\n \"\"\"", "#edges_to_add = [", "# (node, node2)", "# for node in nodes", "# for node2 in set(self[node]) & nodes", "#]" ]
[ { "param": "self", "type": null }, { "param": "nodes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nodes", "type": null, "docstring": null, "docstring_tokens": ...
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
find_atoms
null
def find_atoms(self, **attrs): """ Yields all indices of atoms that match `attrs` Parameters ---------- **attrs: collections.abc.Mapping The attributes and their desired values. Yields ------ collections.abc.Hashable All atom indi...
Yields all indices of atoms that match `attrs` Parameters ---------- **attrs: collections.abc.Mapping The attributes and their desired values. Yields ------ collections.abc.Hashable All atom indices that match the specified `attrs` ...
Yields all indices of atoms that match `attrs` Parameters collections.abc.Mapping The attributes and their desired values. Yields collections.abc.Hashable All atom indices that match the specified `attrs`
[ "Yields", "all", "indices", "of", "atoms", "that", "match", "`", "attrs", "`", "Parameters", "collections", ".", "abc", ".", "Mapping", "The", "attributes", "and", "their", "desired", "values", ".", "Yields", "collections", ".", "abc", ".", "Hashable", "All"...
def find_atoms(self, **attrs): for node_idx in self: node = self.nodes[node_idx] if all(node.get(attr, None) == val for attr, val in attrs.items()): yield node_idx
[ "def", "find_atoms", "(", "self", ",", "**", "attrs", ")", ":", "for", "node_idx", "in", "self", ":", "node", "=", "self", ".", "nodes", "[", "node_idx", "]", "if", "all", "(", "node", ".", "get", "(", "attr", ",", "None", ")", "==", "val", "for"...
Yields all indices of atoms that match `attrs` Parameters
[ "Yields", "all", "indices", "of", "atoms", "that", "match", "`", "attrs", "`", "Parameters" ]
[ "\"\"\"\n Yields all indices of atoms that match `attrs`\n\n Parameters\n ----------\n **attrs: collections.abc.Mapping\n The attributes and their desired values.\n\n Yields\n ------\n collections.abc.Hashable\n All atom indices that match the s...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
merge_molecule
<not_specific>
def merge_molecule(self, molecule): """ Add the atoms and the interactions of a molecule at the end of this one. Atom and residue index of the new atoms are offset to follow the last atom of this molecule. Parameters ---------- molecule: Molecule ...
Add the atoms and the interactions of a molecule at the end of this one. Atom and residue index of the new atoms are offset to follow the last atom of this molecule. Parameters ---------- molecule: Molecule The molecule to merge at the end. ...
Add the atoms and the interactions of a molecule at the end of this one. Atom and residue index of the new atoms are offset to follow the last atom of this molecule. Parameters Molecule The molecule to merge at the end. Returns dict A dict mapping the node indices of the added `molecule` to their new indices in th...
[ "Add", "the", "atoms", "and", "the", "interactions", "of", "a", "molecule", "at", "the", "end", "of", "this", "one", ".", "Atom", "and", "residue", "index", "of", "the", "new", "atoms", "are", "offset", "to", "follow", "the", "last", "atom", "of", "thi...
def merge_molecule(self, molecule): if self.force_field != molecule.force_field: raise ValueError( 'Cannot merge molecules with different force fields.' ) if self.nrexcl is None and not self: self.nrexcl = molecule.nrexcl if self.nrexcl != mole...
[ "def", "merge_molecule", "(", "self", ",", "molecule", ")", ":", "if", "self", ".", "force_field", "!=", "molecule", ".", "force_field", ":", "raise", "ValueError", "(", "'Cannot merge molecules with different force fields.'", ")", "if", "self", ".", "nrexcl", "is...
Add the atoms and the interactions of a molecule at the end of this one.
[ "Add", "the", "atoms", "and", "the", "interactions", "of", "a", "molecule", "at", "the", "end", "of", "this", "one", "." ]
[ "\"\"\"\n Add the atoms and the interactions of a molecule at the end of this\n one.\n\n Atom and residue index of the new atoms are offset to follow the last\n atom of this molecule.\n\n Parameters\n ----------\n molecule: Molecule\n The molecule to merge...
[ { "param": "self", "type": null }, { "param": "molecule", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "molecule", "type": null, "docstring": null, "docstring_tokens...
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
share_moltype_with
<not_specific>
def share_moltype_with(self, other): """ Checks whether `other` has the same shape as this molecule. Parameters ---------- other: Molecule Returns ------- bool True iff other has the same shape as this molecule. """ # TODO: Te...
Checks whether `other` has the same shape as this molecule. Parameters ---------- other: Molecule Returns ------- bool True iff other has the same shape as this molecule.
Checks whether `other` has the same shape as this molecule. Parameters Molecule Returns bool True iff other has the same shape as this molecule.
[ "Checks", "whether", "`", "other", "`", "has", "the", "same", "shape", "as", "this", "molecule", ".", "Parameters", "Molecule", "Returns", "bool", "True", "iff", "other", "has", "the", "same", "shape", "as", "this", "molecule", "." ]
def share_moltype_with(self, other): return nx.is_isomorphic(self, other)
[ "def", "share_moltype_with", "(", "self", ",", "other", ")", ":", "return", "nx", ".", "is_isomorphic", "(", "self", ",", "other", ")" ]
Checks whether `other` has the same shape as this molecule.
[ "Checks", "whether", "`", "other", "`", "has", "the", "same", "shape", "as", "this", "molecule", "." ]
[ "\"\"\"\n Checks whether `other` has the same shape as this molecule.\n\n Parameters\n ----------\n other: Molecule\n\n Returns\n -------\n bool\n True iff other has the same shape as this molecule.\n \"\"\"", "# TODO: Test the node attributes, th...
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": null, "docstring_tokens": ...
0f3bed160874cc1941170df0be9afab7be41b644
fgrunewald/vermouth-martinize
vermouth/molecule.py
[ "Apache-2.0" ]
Python
iter_residues
<not_specific>
def iter_residues(self): """ Returns a generator over the nodes of this molecules residues. Returns ------- collections.abc.Generator """ residue_graph = graph_utils.make_residue_graph(self) return (tuple(residue_graph.nodes[res]['graph'].nodes) for res i...
Returns a generator over the nodes of this molecules residues. Returns ------- collections.abc.Generator
Returns a generator over the nodes of this molecules residues. Returns
[ "Returns", "a", "generator", "over", "the", "nodes", "of", "this", "molecules", "residues", ".", "Returns" ]
def iter_residues(self): residue_graph = graph_utils.make_residue_graph(self) return (tuple(residue_graph.nodes[res]['graph'].nodes) for res in residue_graph.nodes)
[ "def", "iter_residues", "(", "self", ")", ":", "residue_graph", "=", "graph_utils", ".", "make_residue_graph", "(", "self", ")", "return", "(", "tuple", "(", "residue_graph", ".", "nodes", "[", "res", "]", "[", "'graph'", "]", ".", "nodes", ")", "for", "...
Returns a generator over the nodes of this molecules residues.
[ "Returns", "a", "generator", "over", "the", "nodes", "of", "this", "molecules", "residues", "." ]
[ "\"\"\"\n Returns a generator over the nodes of this molecules residues.\n\n Returns\n -------\n collections.abc.Generator\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
db67c030ad391a4039c568318b46339dcb9f23cd
Naroj/notifly
test/test_notify.py
[ "MIT" ]
Python
conduct_notify
<not_specific>
def conduct_notify(domain, addr, notify_opcode=True): """ Conduct DNS NOTIFY object and event queue based on function input The result can be fetched from the returned queue object Notification opcode can be switched off to test behavior of this scenario """ notify = dns.message.make_query(doma...
Conduct DNS NOTIFY object and event queue based on function input The result can be fetched from the returned queue object Notification opcode can be switched off to test behavior of this scenario
Conduct DNS NOTIFY object and event queue based on function input The result can be fetched from the returned queue object Notification opcode can be switched off to test behavior of this scenario
[ "Conduct", "DNS", "NOTIFY", "object", "and", "event", "queue", "based", "on", "function", "input", "The", "result", "can", "be", "fetched", "from", "the", "returned", "queue", "object", "Notification", "opcode", "can", "be", "switched", "off", "to", "test", ...
def conduct_notify(domain, addr, notify_opcode=True): notify = dns.message.make_query(domain, dns.rdatatype.SOA) if notify_opcode: notify.set_opcode(dns.opcode.NOTIFY) logging.debug("sending '%s' to parser", notify.question) wire = notify.to_wire() udp_server = server.AsyncUDP(is_test=True) ...
[ "def", "conduct_notify", "(", "domain", ",", "addr", ",", "notify_opcode", "=", "True", ")", ":", "notify", "=", "dns", ".", "message", ".", "make_query", "(", "domain", ",", "dns", ".", "rdatatype", ".", "SOA", ")", "if", "notify_opcode", ":", "notify",...
Conduct DNS NOTIFY object and event queue based on function input The result can be fetched from the returned queue object Notification opcode can be switched off to test behavior of this scenario
[ "Conduct", "DNS", "NOTIFY", "object", "and", "event", "queue", "based", "on", "function", "input", "The", "result", "can", "be", "fetched", "from", "the", "returned", "queue", "object", "Notification", "opcode", "can", "be", "switched", "off", "to", "test", ...
[ "\"\"\" \n Conduct DNS NOTIFY object and event queue based on function input\n The result can be fetched from the returned queue object\n Notification opcode can be switched off to test behavior of this scenario\n \"\"\"" ]
[ { "param": "domain", "type": null }, { "param": "addr", "type": null }, { "param": "notify_opcode", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "domain", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addr", "type": null, "docstring": null, "docstring_tokens":...
362f993ebb51e9e320e0ddaff794f1658a765005
Naroj/notifly
endpoints/axfr_gateway.py
[ "MIT" ]
Python
serial_query
<not_specific>
def serial_query(domain, nameservers): """ Get serial from one of the DNS masters """ request = dns.message.make_query(domain, dns.rdatatype.SOA) for ns in nameservers: logging.info("asking nameserver: " + ns) try: req = dns.query.udp(request, ns) break ...
Get serial from one of the DNS masters
Get serial from one of the DNS masters
[ "Get", "serial", "from", "one", "of", "the", "DNS", "masters" ]
def serial_query(domain, nameservers): request = dns.message.make_query(domain, dns.rdatatype.SOA) for ns in nameservers: logging.info("asking nameserver: " + ns) try: req = dns.query.udp(request, ns) break except Exception as query_error: req = None ...
[ "def", "serial_query", "(", "domain", ",", "nameservers", ")", ":", "request", "=", "dns", ".", "message", ".", "make_query", "(", "domain", ",", "dns", ".", "rdatatype", ".", "SOA", ")", "for", "ns", "in", "nameservers", ":", "logging", ".", "info", "...
Get serial from one of the DNS masters
[ "Get", "serial", "from", "one", "of", "the", "DNS", "masters" ]
[ "\"\"\"\n Get serial from one of the DNS masters\n \"\"\"" ]
[ { "param": "domain", "type": null }, { "param": "nameservers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "domain", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nameservers", "type": null, "docstring": null, "docstring_t...
a8f407dd7928137f31fd43ff61be70f27ee67fbb
Naroj/notifly
endpoints/mailer_endpoint.py
[ "MIT" ]
Python
accept_notification
<not_specific>
def accept_notification(): content = request.data """ pass content on to your unicorn army """ email = { 'from_email' : request.headers.get('from_email'), 'to_email' : request.headers.get('to_email'), 'subject' : request.headers.get('subject'), 'body' : str(content) ...
pass content on to your unicorn army
pass content on to your unicorn army
[ "pass", "content", "on", "to", "your", "unicorn", "army" ]
def accept_notification(): content = request.data email = { 'from_email' : request.headers.get('from_email'), 'to_email' : request.headers.get('to_email'), 'subject' : request.headers.get('subject'), 'body' : str(content) } try: send_mail(**email) except: ...
[ "def", "accept_notification", "(", ")", ":", "content", "=", "request", ".", "data", "email", "=", "{", "'from_email'", ":", "request", ".", "headers", ".", "get", "(", "'from_email'", ")", ",", "'to_email'", ":", "request", ".", "headers", ".", "get", "...
pass content on to your unicorn army
[ "pass", "content", "on", "to", "your", "unicorn", "army" ]
[ "\"\"\"\n pass content on to your unicorn army\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d1099eb810855b93bf67806df71812f7c4850b63
Naroj/notifly
test/test_config.py
[ "MIT" ]
Python
parser
<not_specific>
def parser(config_as_string): """ Return config object based on string input """ config_file = tempfile.mktemp() with open(config_file, 'w') as file_p: file_p.write(config_as_string) logging.debug("mock config written to %s", config_file) config = server.load_config(config_file) ...
Return config object based on string input
Return config object based on string input
[ "Return", "config", "object", "based", "on", "string", "input" ]
def parser(config_as_string): config_file = tempfile.mktemp() with open(config_file, 'w') as file_p: file_p.write(config_as_string) logging.debug("mock config written to %s", config_file) config = server.load_config(config_file) os.unlink(config_file) return config
[ "def", "parser", "(", "config_as_string", ")", ":", "config_file", "=", "tempfile", ".", "mktemp", "(", ")", "with", "open", "(", "config_file", ",", "'w'", ")", "as", "file_p", ":", "file_p", ".", "write", "(", "config_as_string", ")", "logging", ".", "...
Return config object based on string input
[ "Return", "config", "object", "based", "on", "string", "input" ]
[ "\"\"\"\n Return config object based on string input\n \"\"\"" ]
[ { "param": "config_as_string", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config_as_string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
health_check
null
def health_check(self, request, addr): """ keeps DNSDIST happy Forward query to system resolvers (upstream) send resolver answer downstream """ res = dns.resolver.Resolver(configure=True) health_query = res.query(request.origin, request.rdtype) health_resp...
keeps DNSDIST happy Forward query to system resolvers (upstream) send resolver answer downstream
keeps DNSDIST happy Forward query to system resolvers (upstream) send resolver answer downstream
[ "keeps", "DNSDIST", "happy", "Forward", "query", "to", "system", "resolvers", "(", "upstream", ")", "send", "resolver", "answer", "downstream" ]
def health_check(self, request, addr): res = dns.resolver.Resolver(configure=True) health_query = res.query(request.origin, request.rdtype) health_resp = health_query.response health_resp.id = request.query_id self.transport.sendto(health_resp.to_wire(), addr)
[ "def", "health_check", "(", "self", ",", "request", ",", "addr", ")", ":", "res", "=", "dns", ".", "resolver", ".", "Resolver", "(", "configure", "=", "True", ")", "health_query", "=", "res", ".", "query", "(", "request", ".", "origin", ",", "request",...
keeps DNSDIST happy Forward query to system resolvers (upstream) send resolver answer downstream
[ "keeps", "DNSDIST", "happy", "Forward", "query", "to", "system", "resolvers", "(", "upstream", ")", "send", "resolver", "answer", "downstream" ]
[ "\"\"\"\n keeps DNSDIST happy\n Forward query to system resolvers (upstream)\n send resolver answer downstream\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "addr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
unpack_from_wire
<not_specific>
def unpack_from_wire(self, data): """ Parse binary payload from wire return a request object with meaningful aspects from DNS packet """ payload = dns.message.from_wire(data) request = collections.namedtuple( 'Request', [ 'request', ...
Parse binary payload from wire return a request object with meaningful aspects from DNS packet
Parse binary payload from wire return a request object with meaningful aspects from DNS packet
[ "Parse", "binary", "payload", "from", "wire", "return", "a", "request", "object", "with", "meaningful", "aspects", "from", "DNS", "packet" ]
def unpack_from_wire(self, data): payload = dns.message.from_wire(data) request = collections.namedtuple( 'Request', [ 'request', 'query_id', 'rdtype', 'origin', 'opcode_int', 'opcode_text' ...
[ "def", "unpack_from_wire", "(", "self", ",", "data", ")", ":", "payload", "=", "dns", ".", "message", ".", "from_wire", "(", "data", ")", "request", "=", "collections", ".", "namedtuple", "(", "'Request'", ",", "[", "'request'", ",", "'query_id'", ",", "...
Parse binary payload from wire return a request object with meaningful aspects from DNS packet
[ "Parse", "binary", "payload", "from", "wire", "return", "a", "request", "object", "with", "meaningful", "aspects", "from", "DNS", "packet" ]
[ "\"\"\"\n Parse binary payload from wire\n return a request object with meaningful aspects from DNS packet\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
handle_request
<not_specific>
def handle_request(self, request, addr): """ Take a parsed request (from self.unpack_from_wire) Perform checks on content and either process a NOTIFY or pass it to self.health_check trailling dots from origins are always removed when self.is_test (boolean) is True we won't send a...
Take a parsed request (from self.unpack_from_wire) Perform checks on content and either process a NOTIFY or pass it to self.health_check trailling dots from origins are always removed when self.is_test (boolean) is True we won't send a UDP response but return binary response instead ...
Take a parsed request (from self.unpack_from_wire) Perform checks on content and either process a NOTIFY or pass it to self.health_check trailling dots from origins are always removed when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
[ "Take", "a", "parsed", "request", "(", "from", "self", ".", "unpack_from_wire", ")", "Perform", "checks", "on", "content", "and", "either", "process", "a", "NOTIFY", "or", "pass", "it", "to", "self", ".", "health_check", "trailling", "dots", "from", "origins...
def handle_request(self, request, addr): if request is None: logging.error('no data received') return try: if isinstance(EVENT_QUEUE, mp.queues.Queue): event_queue = EVENT_QUEUE except NameError: if self.is_test: eve...
[ "def", "handle_request", "(", "self", ",", "request", ",", "addr", ")", ":", "if", "request", "is", "None", ":", "logging", ".", "error", "(", "'no data received'", ")", "return", "try", ":", "if", "isinstance", "(", "EVENT_QUEUE", ",", "mp", ".", "queue...
Take a parsed request (from self.unpack_from_wire) Perform checks on content and either process a NOTIFY or pass it to self.health_check trailling dots from origins are always removed when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
[ "Take", "a", "parsed", "request", "(", "from", "self", ".", "unpack_from_wire", ")", "Perform", "checks", "on", "content", "and", "either", "process", "a", "NOTIFY", "or", "pass", "it", "to", "self", ".", "health_check", "trailling", "dots", "from", "origins...
[ "\"\"\"\n Take a parsed request (from self.unpack_from_wire)\n Perform checks on content and either process a NOTIFY or pass it to self.health_check\n trailling dots from origins are always removed\n when self.is_test (boolean) is True we won't send a UDP response but return binary respo...
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "addr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
datagram_received
<not_specific>
def datagram_received(self, data, addr): """ this method is called on each incoming UDP packet by asyncio module """ try: source_ip = addr[0] except KeyError: logging.error('incomplete packet received, no src IP found') return try: ...
this method is called on each incoming UDP packet by asyncio module
this method is called on each incoming UDP packet by asyncio module
[ "this", "method", "is", "called", "on", "each", "incoming", "UDP", "packet", "by", "asyncio", "module" ]
def datagram_received(self, data, addr): try: source_ip = addr[0] except KeyError: logging.error('incomplete packet received, no src IP found') return try: addr[1] except KeyError: logging.error('incomplete packet received, no s...
[ "def", "datagram_received", "(", "self", ",", "data", ",", "addr", ")", ":", "try", ":", "source_ip", "=", "addr", "[", "0", "]", "except", "KeyError", ":", "logging", ".", "error", "(", "'incomplete packet received, no src IP found'", ")", "return", "try", ...
this method is called on each incoming UDP packet by asyncio module
[ "this", "method", "is", "called", "on", "each", "incoming", "UDP", "packet", "by", "asyncio", "module" ]
[ "\"\"\"\n this method is called on each incoming UDP packet by asyncio module\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null }, { "param": "addr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
run
null
def run(self): """ process entry method daemonize async event loop """ loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) endpoint = loop.create_datagram_endpoint( AsyncUDP, local_addr=( CONF['local_ip'], ...
process entry method daemonize async event loop
process entry method daemonize async event loop
[ "process", "entry", "method", "daemonize", "async", "event", "loop" ]
def run(self): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) endpoint = loop.create_datagram_endpoint( AsyncUDP, local_addr=( CONF['local_ip'], CONF['local_port'] ) ) server = loop.run_until_compl...
[ "def", "run", "(", "self", ")", ":", "loop", "=", "asyncio", ".", "new_event_loop", "(", ")", "asyncio", ".", "set_event_loop", "(", "loop", ")", "endpoint", "=", "loop", ".", "create_datagram_endpoint", "(", "AsyncUDP", ",", "local_addr", "=", "(", "CONF"...
process entry method daemonize async event loop
[ "process", "entry", "method", "daemonize", "async", "event", "loop" ]
[ "\"\"\"\n process entry method\n daemonize async event loop\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
proc_manager
null
def proc_manager(**kwargs): """ Manage nameserver processes classes: dict of process categories properties: dict of class arguments passed as **kwargs runtime: list of running processes """ if 'classes' in kwargs.keys(): classes = kwargs['classes'] else: sys.exit(1) i...
Manage nameserver processes classes: dict of process categories properties: dict of class arguments passed as **kwargs runtime: list of running processes
Manage nameserver processes classes: dict of process categories properties: dict of class arguments passed as **kwargs runtime: list of running processes
[ "Manage", "nameserver", "processes", "classes", ":", "dict", "of", "process", "categories", "properties", ":", "dict", "of", "class", "arguments", "passed", "as", "**", "kwargs", "runtime", ":", "list", "of", "running", "processes" ]
def proc_manager(**kwargs): if 'classes' in kwargs.keys(): classes = kwargs['classes'] else: sys.exit(1) if 'properties' in kwargs.keys(): properties = kwargs['properties'] else: properties = {} if 'runtime' in kwargs.keys(): runtime = kwargs['runtime'] el...
[ "def", "proc_manager", "(", "**", "kwargs", ")", ":", "if", "'classes'", "in", "kwargs", ".", "keys", "(", ")", ":", "classes", "=", "kwargs", "[", "'classes'", "]", "else", ":", "sys", ".", "exit", "(", "1", ")", "if", "'properties'", "in", "kwargs"...
Manage nameserver processes classes: dict of process categories properties: dict of class arguments passed as **kwargs runtime: list of running processes
[ "Manage", "nameserver", "processes", "classes", ":", "dict", "of", "process", "categories", "properties", ":", "dict", "of", "class", "arguments", "passed", "as", "**", "kwargs", "runtime", ":", "list", "of", "running", "processes" ]
[ "\"\"\"\n Manage nameserver processes\n classes: dict of process categories\n properties: dict of class arguments passed as **kwargs\n runtime: list of running processes\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
parse_config_file
<not_specific>
def parse_config_file(config): """ Load config file (primarily for endpoints) """ fail = False with open(config, 'r') as fp: content = yaml.load(fp.read()) if 'endpoints' not in content.keys(): return for title, items in content['endpoints'].items(): if not 'url' in i...
Load config file (primarily for endpoints)
Load config file (primarily for endpoints)
[ "Load", "config", "file", "(", "primarily", "for", "endpoints", ")" ]
def parse_config_file(config): fail = False with open(config, 'r') as fp: content = yaml.load(fp.read()) if 'endpoints' not in content.keys(): return for title, items in content['endpoints'].items(): if not 'url' in items.keys(): fail = True logging.error(...
[ "def", "parse_config_file", "(", "config", ")", ":", "fail", "=", "False", "with", "open", "(", "config", ",", "'r'", ")", "as", "fp", ":", "content", "=", "yaml", ".", "load", "(", "fp", ".", "read", "(", ")", ")", "if", "'endpoints'", "not", "in"...
Load config file (primarily for endpoints)
[ "Load", "config", "file", "(", "primarily", "for", "endpoints", ")" ]
[ "\"\"\"\n Load config file (primarily for endpoints)\n \"\"\"" ]
[ { "param": "config", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f9fc4240ee487a844dbd72ba7adcf33e5d2fd4c3
Naroj/notifly
notifly/server.py
[ "MIT" ]
Python
load_config
<not_specific>
def load_config(config_file=None): """ Parse config file and load parameters from CLI the config file is always leading """ params = parameter_parser() if params.conf: conf_file = parse_config_file(params.conf) else: if config_file: conf_file = parse_config_file(c...
Parse config file and load parameters from CLI the config file is always leading
Parse config file and load parameters from CLI the config file is always leading
[ "Parse", "config", "file", "and", "load", "parameters", "from", "CLI", "the", "config", "file", "is", "always", "leading" ]
def load_config(config_file=None): params = parameter_parser() if params.conf: conf_file = parse_config_file(params.conf) else: if config_file: conf_file = parse_config_file(config_file) try: local_ip = conf_file['net']['local_ip'] except KeyError: local_i...
[ "def", "load_config", "(", "config_file", "=", "None", ")", ":", "params", "=", "parameter_parser", "(", ")", "if", "params", ".", "conf", ":", "conf_file", "=", "parse_config_file", "(", "params", ".", "conf", ")", "else", ":", "if", "config_file", ":", ...
Parse config file and load parameters from CLI the config file is always leading
[ "Parse", "config", "file", "and", "load", "parameters", "from", "CLI", "the", "config", "file", "is", "always", "leading" ]
[ "\"\"\"\n Parse config file and load parameters from CLI\n the config file is always leading\n \"\"\"" ]
[ { "param": "config_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a570acec03c79ca6c4dcc4d6056fd42d9b37aa3b
PhilippMaxx/stylegan2
run_projector2.py
[ "BSD-Source-Code" ]
Python
crop
<not_specific>
def crop (img, size): """crop img central and resize to size""" w, h = img.size # Get dimensions mx = min(w, h) left = (w - mx)/2 top = (h - mx)/2 right = (w + mx)/2 bottom = (h + mx)/2 img_crop = img.crop((left, top, right, bottom)) return img_crop.resize(size, resample=Image.BI...
crop img central and resize to size
crop img central and resize to size
[ "crop", "img", "central", "and", "resize", "to", "size" ]
def crop (img, size): w, h = img.size mx = min(w, h) left = (w - mx)/2 top = (h - mx)/2 right = (w + mx)/2 bottom = (h + mx)/2 img_crop = img.crop((left, top, right, bottom)) return img_crop.resize(size, resample=Image.BILINEAR)
[ "def", "crop", "(", "img", ",", "size", ")", ":", "w", ",", "h", "=", "img", ".", "size", "mx", "=", "min", "(", "w", ",", "h", ")", "left", "=", "(", "w", "-", "mx", ")", "/", "2", "top", "=", "(", "h", "-", "mx", ")", "/", "2", "rig...
crop img central and resize to size
[ "crop", "img", "central", "and", "resize", "to", "size" ]
[ "\"\"\"crop img central and resize to size\"\"\"", "# Get dimensions" ]
[ { "param": "img", "type": null }, { "param": "size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "img", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": []...
2c970d028da771c2194f5788063717cd90480f1a
saurabhshri/auth0-python
auth0/v3/authentication/logout.py
[ "MIT" ]
Python
logout
<not_specific>
def logout(self, client_id, return_to, federated=False): """Logout Use this endpoint to logout a user. If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:...
Logout Use this endpoint to logout a user. If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list: Args: client_id (str): The client_id of your a...
Logout Use this endpoint to logout a user. If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list.
[ "Logout", "Use", "this", "endpoint", "to", "logout", "a", "user", ".", "If", "you", "want", "to", "navigate", "the", "user", "to", "a", "specific", "URL", "after", "the", "logout", "set", "that", "URL", "at", "the", "returnTo", "parameter", ".", "The", ...
def logout(self, client_id, return_to, federated=False): return_to = quote_plus(return_to) if federated is True: return self.get( 'https://{}/v2/logout?federated&client_id={}&returnTo={}'.format( self.domain, client_id, return_to), headers=...
[ "def", "logout", "(", "self", ",", "client_id", ",", "return_to", ",", "federated", "=", "False", ")", ":", "return_to", "=", "quote_plus", "(", "return_to", ")", "if", "federated", "is", "True", ":", "return", "self", ".", "get", "(", "'https://{}/v2/logo...
Logout Use this endpoint to logout a user.
[ "Logout", "Use", "this", "endpoint", "to", "logout", "a", "user", "." ]
[ "\"\"\"Logout\n\n Use this endpoint to logout a user. If you want to navigate the user to a\n specific URL after the logout, set that URL at the returnTo parameter.\n The URL should be included in any the appropriate Allowed Logout URLs list:\n\n Args:\n client_id (str): The c...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "return_to", "type": null }, { "param": "federated", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": "The client_id of your appli...
9d2179a73243477612ce14cbb856839257392f90
saurabhshri/auth0-python
auth0/v3/authentication/get_token.py
[ "MIT" ]
Python
authorization_code
<not_specific>
def authorization_code(self, client_id, client_secret, code, redirect_uri, grant_type='authorization_code'): """Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API. Use this endpoint to exchange an Authorization...
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token. Args: grant_type (str): Denotes the flow you're using. For authorization code use autho...
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token. grant_type (str): Denotes the flow you're using. For authorization code use authorization_code client_id (str): your application's client Id c...
[ "Authorization", "code", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "regular", "web", "apps", "utilize", "in", "order", "to", "access", "an", "API", ".", "Use", "this", "endpoint", "to", "exchange", "an", "Authorization", "Code"...
def authorization_code(self, client_id, client_secret, code, redirect_uri, grant_type='authorization_code'): return self.post( 'https://%s/oauth/token' % self.domain, data={ 'client_id': client_id, 'client_secret': client_secret,...
[ "def", "authorization_code", "(", "self", ",", "client_id", ",", "client_secret", ",", "code", ",", "redirect_uri", ",", "grant_type", "=", "'authorization_code'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/token'", "%", "self", ".", "domai...
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.
[ "Authorization", "code", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "regular", "web", "apps", "utilize", "in", "order", "to", "access", "an", "API", "." ]
[ "\"\"\"Authorization code grant\n\n This is the OAuth 2.0 grant that regular web apps utilize in order\n to access an API. Use this endpoint to exchange an Authorization Code\n for a Token.\n\n Args:\n grant_type (str): Denotes the flow you're using. For authorization code\n ...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "client_secret", "type": null }, { "param": "code", "type": null }, { "param": "redirect_uri", "type": null }, { "param": "grant_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
9d2179a73243477612ce14cbb856839257392f90
saurabhshri/auth0-python
auth0/v3/authentication/get_token.py
[ "MIT" ]
Python
authorization_code_pkce
<not_specific>
def authorization_code_pkce(self, client_id, code_verifier, code, redirect_uri, grant_type='authorization_code'): """Authorization code pkce grant This is the OAuth 2.0 grant that mobile apps utilize in order to access an API. Use this endpoint to exchange an Aut...
Authorization code pkce grant This is the OAuth 2.0 grant that mobile apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token. Args: grant_type (str): Denotes the flow you're using. For authorization code pkce use authoriz...
Authorization code pkce grant This is the OAuth 2.0 grant that mobile apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token. grant_type (str): Denotes the flow you're using. For authorization code pkce use authorization_code client_id (str): your application's client ...
[ "Authorization", "code", "pkce", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "mobile", "apps", "utilize", "in", "order", "to", "access", "an", "API", ".", "Use", "this", "endpoint", "to", "exchange", "an", "Authorization", "Code"...
def authorization_code_pkce(self, client_id, code_verifier, code, redirect_uri, grant_type='authorization_code'): return self.post( 'https://%s/oauth/token' % self.domain, data={ 'client_id': client_id, 'code_verifier': code...
[ "def", "authorization_code_pkce", "(", "self", ",", "client_id", ",", "code_verifier", ",", "code", ",", "redirect_uri", ",", "grant_type", "=", "'authorization_code'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/token'", "%", "self", ".", "...
Authorization code pkce grant This is the OAuth 2.0 grant that mobile apps utilize in order to access an API.
[ "Authorization", "code", "pkce", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "mobile", "apps", "utilize", "in", "order", "to", "access", "an", "API", "." ]
[ "\"\"\"Authorization code pkce grant\n\n This is the OAuth 2.0 grant that mobile apps utilize in order to access an API.\n Use this endpoint to exchange an Authorization Code for a Token.\n\n Args:\n grant_type (str): Denotes the flow you're using. For authorization code pkce\n ...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "code_verifier", "type": null }, { "param": "code", "type": null }, { "param": "redirect_uri", "type": null }, { "param": "grant_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
9d2179a73243477612ce14cbb856839257392f90
saurabhshri/auth0-python
auth0/v3/authentication/get_token.py
[ "MIT" ]
Python
client_credentials
<not_specific>
def client_credentials(self, client_id, client_secret, audience, grant_type='client_credentials'): """Client credentials grant This is the OAuth 2.0 grant that server processes utilize in order to access an API. Use this endpoint to directly request an access_...
Client credentials grant This is the OAuth 2.0 grant that server processes utilize in order to access an API. Use this endpoint to directly request an access_token by using the Application Credentials (a Client Id and a Client Secret). Args: grant_type (str): Denote...
Client credentials grant This is the OAuth 2.0 grant that server processes utilize in order to access an API. Use this endpoint to directly request an access_token by using the Application Credentials (a Client Id and a Client Secret). grant_type (str): Denotes the flow you're using. For client credentials use client_...
[ "Client", "credentials", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "server", "processes", "utilize", "in", "order", "to", "access", "an", "API", ".", "Use", "this", "endpoint", "to", "directly", "request", "an", "access_token", ...
def client_credentials(self, client_id, client_secret, audience, grant_type='client_credentials'): return self.post( 'https://%s/oauth/token' % self.domain, data={ 'client_id': client_id, 'client_secret': client_secret, ...
[ "def", "client_credentials", "(", "self", ",", "client_id", ",", "client_secret", ",", "audience", ",", "grant_type", "=", "'client_credentials'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/token'", "%", "self", ".", "domain", ",", "data", ...
Client credentials grant This is the OAuth 2.0 grant that server processes utilize in order to access an API.
[ "Client", "credentials", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "server", "processes", "utilize", "in", "order", "to", "access", "an", "API", "." ]
[ "\"\"\"Client credentials grant\n\n This is the OAuth 2.0 grant that server processes utilize in\n order to access an API. Use this endpoint to directly request\n an access_token by using the Application Credentials (a Client Id and\n a Client Secret).\n\n Args:\n grant...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "client_secret", "type": null }, { "param": "audience", "type": null }, { "param": "grant_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
9d2179a73243477612ce14cbb856839257392f90
saurabhshri/auth0-python
auth0/v3/authentication/get_token.py
[ "MIT" ]
Python
login
<not_specific>
def login(self, client_id, client_secret, username, password, scope, realm, audience, grant_type='http://auth0.com/oauth/grant-type/password-realm'): """Calls oauth/token endpoint with password-realm grant type This is the OAuth 2.0 grant that highly trusted apps utilize in order ...
Calls oauth/token endpoint with password-realm grant type This is the OAuth 2.0 grant that highly trusted apps utilize in order to access an API. In this flow the end-user is asked to fill in credentials (username/password) typically using an interactive form in the user-agent (browser...
Calls oauth/token endpoint with password-realm grant type This is the OAuth 2.0 grant that highly trusted apps utilize in order to access an API. In this flow the end-user is asked to fill in credentials (username/password) typically using an interactive form in the user-agent (browser). This information is later on se...
[ "Calls", "oauth", "/", "token", "endpoint", "with", "password", "-", "realm", "grant", "type", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "highly", "trusted", "apps", "utilize", "in", "order", "to", "access", "an", "API", ".", "In", ...
def login(self, client_id, client_secret, username, password, scope, realm, audience, grant_type='http://auth0.com/oauth/grant-type/password-realm'): return self.post( 'https://%s/oauth/token' % self.domain, data={ 'client_id': client_id, 'us...
[ "def", "login", "(", "self", ",", "client_id", ",", "client_secret", ",", "username", ",", "password", ",", "scope", ",", "realm", ",", "audience", ",", "grant_type", "=", "'http://auth0.com/oauth/grant-type/password-realm'", ")", ":", "return", "self", ".", "po...
Calls oauth/token endpoint with password-realm grant type This is the OAuth 2.0 grant that highly trusted apps utilize in order to access an API.
[ "Calls", "oauth", "/", "token", "endpoint", "with", "password", "-", "realm", "grant", "type", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "highly", "trusted", "apps", "utilize", "in", "order", "to", "access", "an", "API", "." ]
[ "\"\"\"Calls oauth/token endpoint with password-realm grant type\n\n\n This is the OAuth 2.0 grant that highly trusted apps utilize in order\n to access an API. In this flow the end-user is asked to fill in credentials\n (username/password) typically using an interactive form in the user-agent\...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "client_secret", "type": null }, { "param": "username", "type": null }, { "param": "password", "type": null }, { "param": "scope", "type": null }, { "para...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
9d2179a73243477612ce14cbb856839257392f90
saurabhshri/auth0-python
auth0/v3/authentication/get_token.py
[ "MIT" ]
Python
refresh_token
<not_specific>
def refresh_token(self, client_id, client_secret, refresh_token, grant_type='refresh_token'): """Calls oauth/token endpoint with refresh token grant type Use this endpoint to refresh an access token, using the refresh token you got during authorization. Args: grant_type (str): Deno...
Calls oauth/token endpoint with refresh token grant type Use this endpoint to refresh an access token, using the refresh token you got during authorization. Args: grant_type (str): Denotes the flow you're using. For refresh token use refresh_token client_id (str): ...
Calls oauth/token endpoint with refresh token grant type Use this endpoint to refresh an access token, using the refresh token you got during authorization. grant_type (str): Denotes the flow you're using. For refresh token use refresh_token client_id (str): your application's client Id client_secret (str): your app...
[ "Calls", "oauth", "/", "token", "endpoint", "with", "refresh", "token", "grant", "type", "Use", "this", "endpoint", "to", "refresh", "an", "access", "token", "using", "the", "refresh", "token", "you", "got", "during", "authorization", ".", "grant_type", "(", ...
def refresh_token(self, client_id, client_secret, refresh_token, grant_type='refresh_token'): return self.post( 'https://%s/oauth/token' % self.domain, data={ 'client_id': client_id, 'client_secret': client_secret, 'refresh_token': refresh_...
[ "def", "refresh_token", "(", "self", ",", "client_id", ",", "client_secret", ",", "refresh_token", ",", "grant_type", "=", "'refresh_token'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/token'", "%", "self", ".", "domain", ",", "data", "="...
Calls oauth/token endpoint with refresh token grant type Use this endpoint to refresh an access token, using the refresh token you got during authorization.
[ "Calls", "oauth", "/", "token", "endpoint", "with", "refresh", "token", "grant", "type", "Use", "this", "endpoint", "to", "refresh", "an", "access", "token", "using", "the", "refresh", "token", "you", "got", "during", "authorization", "." ]
[ "\"\"\"Calls oauth/token endpoint with refresh token grant type\n\n Use this endpoint to refresh an access token, using the refresh token you got during authorization.\n\n Args:\n grant_type (str): Denotes the flow you're using. For refresh token\n use refresh_token\n\n ...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "client_secret", "type": null }, { "param": "refresh_token", "type": null }, { "param": "grant_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
982c82a70fdf85a8c67760fdc10088d6e3e7cc75
saurabhshri/auth0-python
auth0/v3/management/rules.py
[ "MIT" ]
Python
all
<not_specific>
def all(self, stage='login_success', enabled=True, fields=None, include_fields=True, page=None, per_page=None, include_totals=False): """Retrieves a list of all rules. Args: stage (str, optional): Retrieves rules that match the execution stage (defaults to login...
Retrieves a list of all rules. Args: stage (str, optional): Retrieves rules that match the execution stage (defaults to login_success). enabled (bool, optional): If provided, retrieves rules that match the value, otherwise all rules are retrieved. ...
Retrieves a list of all rules.
[ "Retrieves", "a", "list", "of", "all", "rules", "." ]
def all(self, stage='login_success', enabled=True, fields=None, include_fields=True, page=None, per_page=None, include_totals=False): params = { 'stage': stage, 'fields': fields and ','.join(fields) or None, 'include_fields': str(include_fields).lower(), ...
[ "def", "all", "(", "self", ",", "stage", "=", "'login_success'", ",", "enabled", "=", "True", ",", "fields", "=", "None", ",", "include_fields", "=", "True", ",", "page", "=", "None", ",", "per_page", "=", "None", ",", "include_totals", "=", "False", "...
Retrieves a list of all rules.
[ "Retrieves", "a", "list", "of", "all", "rules", "." ]
[ "\"\"\"Retrieves a list of all rules.\n\n Args:\n stage (str, optional): Retrieves rules that match the execution\n stage (defaults to login_success).\n\n enabled (bool, optional): If provided, retrieves rules that match\n the value, otherwise all rules ar...
[ { "param": "self", "type": null }, { "param": "stage", "type": null }, { "param": "enabled", "type": null }, { "param": "fields", "type": null }, { "param": "include_fields", "type": null }, { "param": "page", "type": null }, { "param": "pe...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stage", "type": null, "docstring": "Retrieves rules that match the ...
bffd9f532d356a3bd8673bd94cabe15cc5a3ddbf
saurabhshri/auth0-python
auth0/v3/management/tickets.py
[ "MIT" ]
Python
create_email_verification
<not_specific>
def create_email_verification(self, body): """Create an email verification ticket. Args: body (dict): Please see: https://auth0.com/docs/api/v2#!/Tickets/post_email_verification """ return self.client.post(self._url('email-verification'), data=body)
Create an email verification ticket. Args: body (dict): Please see: https://auth0.com/docs/api/v2#!/Tickets/post_email_verification
Create an email verification ticket.
[ "Create", "an", "email", "verification", "ticket", "." ]
def create_email_verification(self, body): return self.client.post(self._url('email-verification'), data=body)
[ "def", "create_email_verification", "(", "self", ",", "body", ")", ":", "return", "self", ".", "client", ".", "post", "(", "self", ".", "_url", "(", "'email-verification'", ")", ",", "data", "=", "body", ")" ]
Create an email verification ticket.
[ "Create", "an", "email", "verification", "ticket", "." ]
[ "\"\"\"Create an email verification ticket.\n\n Args:\n body (dict): Please see: https://auth0.com/docs/api/v2#!/Tickets/post_email_verification\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "body", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "body", "type": null, "docstring": null, "docstring_tokens": [...
91b473881a5e794ea5b84ff7d4737cc2668bfd8f
saurabhshri/auth0-python
auth0/v3/authentication/passwordless.py
[ "MIT" ]
Python
email
<not_specific>
def email(self, client_id, email, send='link', auth_params=None): """Start flow sending an email. Given the user email address, it will send an email with: - A link (default, send:"link"). You can then authenticate with this user opening the link and he will be automatically logg...
Start flow sending an email. Given the user email address, it will send an email with: - A link (default, send:"link"). You can then authenticate with this user opening the link and he will be automatically logged in to the application. Optionally, you can append/override ...
Start flow sending an email. Given the user email address, it will send an email with. A link (default, send:"link"). You can then authenticate with this user opening the link and he will be automatically logged in to the application. Optionally, you can append/override parameters to the link (like scope, redirect_uri...
[ "Start", "flow", "sending", "an", "email", ".", "Given", "the", "user", "email", "address", "it", "will", "send", "an", "email", "with", ".", "A", "link", "(", "default", "send", ":", "\"", "link", "\"", ")", ".", "You", "can", "then", "authenticate", ...
def email(self, client_id, email, send='link', auth_params=None): return self.post( 'https://%s/passwordless/start' % self.domain, data={ 'client_id': client_id, 'connection': 'email', 'email': email, 'send': send, ...
[ "def", "email", "(", "self", ",", "client_id", ",", "email", ",", "send", "=", "'link'", ",", "auth_params", "=", "None", ")", ":", "return", "self", ".", "post", "(", "'https://%s/passwordless/start'", "%", "self", ".", "domain", ",", "data", "=", "{", ...
Start flow sending an email.
[ "Start", "flow", "sending", "an", "email", "." ]
[ "\"\"\"Start flow sending an email.\n\n Given the user email address, it will send an email with:\n\n - A link (default, send:\"link\"). You can then authenticate with\n this user opening the link and he will be automatically logged in\n to the application. Optionally, you can ...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "email", "type": null }, { "param": "send", "type": null }, { "param": "auth_params", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": "Client Id of the applicatio...
91b473881a5e794ea5b84ff7d4737cc2668bfd8f
saurabhshri/auth0-python
auth0/v3/authentication/passwordless.py
[ "MIT" ]
Python
sms
<not_specific>
def sms(self, client_id, phone_number): """Start flow sending a SMS message. """ return self.post( 'https://%s/passwordless/start' % self.domain, data={ 'client_id': client_id, 'connection': 'sms', 'phone_number': phone_num...
Start flow sending a SMS message.
Start flow sending a SMS message.
[ "Start", "flow", "sending", "a", "SMS", "message", "." ]
def sms(self, client_id, phone_number): return self.post( 'https://%s/passwordless/start' % self.domain, data={ 'client_id': client_id, 'connection': 'sms', 'phone_number': phone_number, }, headers={'Content-Type': '...
[ "def", "sms", "(", "self", ",", "client_id", ",", "phone_number", ")", ":", "return", "self", ".", "post", "(", "'https://%s/passwordless/start'", "%", "self", ".", "domain", ",", "data", "=", "{", "'client_id'", ":", "client_id", ",", "'connection'", ":", ...
Start flow sending a SMS message.
[ "Start", "flow", "sending", "a", "SMS", "message", "." ]
[ "\"\"\"Start flow sending a SMS message.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "phone_number", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
91b473881a5e794ea5b84ff7d4737cc2668bfd8f
saurabhshri/auth0-python
auth0/v3/authentication/passwordless.py
[ "MIT" ]
Python
sms_login
<not_specific>
def sms_login(self, client_id, phone_number, code, scope='openid'): """Login using phone number/verification code. """ return self.post( 'https://%s/oauth/ro' % self.domain, data={ 'client_id': client_id, 'connection': 'sms', ...
Login using phone number/verification code.
Login using phone number/verification code.
[ "Login", "using", "phone", "number", "/", "verification", "code", "." ]
def sms_login(self, client_id, phone_number, code, scope='openid'): return self.post( 'https://%s/oauth/ro' % self.domain, data={ 'client_id': client_id, 'connection': 'sms', 'grant_type': 'password', 'username': phone_numbe...
[ "def", "sms_login", "(", "self", ",", "client_id", ",", "phone_number", ",", "code", ",", "scope", "=", "'openid'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/ro'", "%", "self", ".", "domain", ",", "data", "=", "{", "'client_id'", "...
Login using phone number/verification code.
[ "Login", "using", "phone", "number", "/", "verification", "code", "." ]
[ "\"\"\"Login using phone number/verification code.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "phone_number", "type": null }, { "param": "code", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
2fd87ad945a762799675d764187f24ccc512f265
saurabhshri/auth0-python
auth0/v3/authentication/enterprise.py
[ "MIT" ]
Python
wsfed_metadata
<not_specific>
def wsfed_metadata(self): """Returns the WS-Federation Metadata. """ url = 'https://%s/wsfed/FederationMetadata' \ '/2007-06/FederationMetadata.xml' return self.get(url=url % self.domain)
Returns the WS-Federation Metadata.
Returns the WS-Federation Metadata.
[ "Returns", "the", "WS", "-", "Federation", "Metadata", "." ]
def wsfed_metadata(self): url = 'https://%s/wsfed/FederationMetadata' \ '/2007-06/FederationMetadata.xml' return self.get(url=url % self.domain)
[ "def", "wsfed_metadata", "(", "self", ")", ":", "url", "=", "'https://%s/wsfed/FederationMetadata'", "'/2007-06/FederationMetadata.xml'", "return", "self", ".", "get", "(", "url", "=", "url", "%", "self", ".", "domain", ")" ]
Returns the WS-Federation Metadata.
[ "Returns", "the", "WS", "-", "Federation", "Metadata", "." ]
[ "\"\"\"Returns the WS-Federation Metadata.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
da017ab6754b69725461c9edbea2c87ed88f482c
saurabhshri/auth0-python
auth0/v3/authentication/database.py
[ "MIT" ]
Python
login
<not_specific>
def login(self, client_id, username, password, connection, id_token=None, grant_type='password', device=None, scope='openid'): """Login using username and password Given the user credentials and the connection specified, it will do the authentication on the provider and return a d...
Login using username and password Given the user credentials and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token. This endpoint only works for database connections, passwordless connections, Active Directory/LD...
Login using username and password Given the user credentials and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token. This endpoint only works for database connections, passwordless connections, Active Directory/LDAP, Windows Azure AD and ADFS.
[ "Login", "using", "username", "and", "password", "Given", "the", "user", "credentials", "and", "the", "connection", "specified", "it", "will", "do", "the", "authentication", "on", "the", "provider", "and", "return", "a", "dict", "with", "the", "access_token", ...
def login(self, client_id, username, password, connection, id_token=None, grant_type='password', device=None, scope='openid'): warnings.warn("/oauth/ro will be deprecated in future releases", DeprecationWarning) return self.post( 'https://%s/oauth/ro' % self.domain, ...
[ "def", "login", "(", "self", ",", "client_id", ",", "username", ",", "password", ",", "connection", ",", "id_token", "=", "None", ",", "grant_type", "=", "'password'", ",", "device", "=", "None", ",", "scope", "=", "'openid'", ")", ":", "warnings", ".", ...
Login using username and password Given the user credentials and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token.
[ "Login", "using", "username", "and", "password", "Given", "the", "user", "credentials", "and", "the", "connection", "specified", "it", "will", "do", "the", "authentication", "on", "the", "provider", "and", "return", "a", "dict", "with", "the", "access_token", ...
[ "\"\"\"Login using username and password\n\n Given the user credentials and the connection specified, it will do\n the authentication on the provider and return a dict with the\n access_token and id_token. This endpoint only works for database\n connections, passwordless connections, Act...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "username", "type": null }, { "param": "password", "type": null }, { "param": "connection", "type": null }, { "param": "id_token", "type": null }, { "para...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
da017ab6754b69725461c9edbea2c87ed88f482c
saurabhshri/auth0-python
auth0/v3/authentication/database.py
[ "MIT" ]
Python
signup
<not_specific>
def signup(self, client_id, email, password, connection): """Signup using username and password. """ return self.post( 'https://%s/dbconnections/signup' % self.domain, data={ 'client_id': client_id, 'email': email, 'passwor...
Signup using username and password.
Signup using username and password.
[ "Signup", "using", "username", "and", "password", "." ]
def signup(self, client_id, email, password, connection): return self.post( 'https://%s/dbconnections/signup' % self.domain, data={ 'client_id': client_id, 'email': email, 'password': password, 'connection': connection, ...
[ "def", "signup", "(", "self", ",", "client_id", ",", "email", ",", "password", ",", "connection", ")", ":", "return", "self", ".", "post", "(", "'https://%s/dbconnections/signup'", "%", "self", ".", "domain", ",", "data", "=", "{", "'client_id'", ":", "cli...
Signup using username and password.
[ "Signup", "using", "username", "and", "password", "." ]
[ "\"\"\"Signup using username and password.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "email", "type": null }, { "param": "password", "type": null }, { "param": "connection", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
da017ab6754b69725461c9edbea2c87ed88f482c
saurabhshri/auth0-python
auth0/v3/authentication/database.py
[ "MIT" ]
Python
change_password
<not_specific>
def change_password(self, client_id, email, connection, password=None): """Asks to change a password for a given user. """ return self.post( 'https://%s/dbconnections/change_password' % self.domain, data={ 'client_id': client_id, 'email': ...
Asks to change a password for a given user.
Asks to change a password for a given user.
[ "Asks", "to", "change", "a", "password", "for", "a", "given", "user", "." ]
def change_password(self, client_id, email, connection, password=None): return self.post( 'https://%s/dbconnections/change_password' % self.domain, data={ 'client_id': client_id, 'email': email, 'password': password, 'connec...
[ "def", "change_password", "(", "self", ",", "client_id", ",", "email", ",", "connection", ",", "password", "=", "None", ")", ":", "return", "self", ".", "post", "(", "'https://%s/dbconnections/change_password'", "%", "self", ".", "domain", ",", "data", "=", ...
Asks to change a password for a given user.
[ "Asks", "to", "change", "a", "password", "for", "a", "given", "user", "." ]
[ "\"\"\"Asks to change a password for a given user.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "email", "type": null }, { "param": "connection", "type": null }, { "param": "password", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
eb57bd933c9a276e5d2f2794ba9bc02d67d98aa6
saurabhshri/auth0-python
auth0/v3/authentication/authorize_client.py
[ "MIT" ]
Python
authorize
<not_specific>
def authorize(self, client_id, audience=None, state=None, redirect_uri=None, response_type='code', scope='openid'): """Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API. """ params = { 'client_id': ...
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.
[ "Authorization", "code", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "regular", "web", "apps", "utilize", "in", "order", "to", "access", "an", "API", "." ]
def authorize(self, client_id, audience=None, state=None, redirect_uri=None, response_type='code', scope='openid'): params = { 'client_id': client_id, 'audience': audience, 'response_type': response_type, 'scope': scope, 'state': stat...
[ "def", "authorize", "(", "self", ",", "client_id", ",", "audience", "=", "None", ",", "state", "=", "None", ",", "redirect_uri", "=", "None", ",", "response_type", "=", "'code'", ",", "scope", "=", "'openid'", ")", ":", "params", "=", "{", "'client_id'",...
Authorization code grant This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.
[ "Authorization", "code", "grant", "This", "is", "the", "OAuth", "2", ".", "0", "grant", "that", "regular", "web", "apps", "utilize", "in", "order", "to", "access", "an", "API", "." ]
[ "\"\"\"Authorization code grant\n\n This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "audience", "type": null }, { "param": "state", "type": null }, { "param": "redirect_uri", "type": null }, { "param": "response_type", "type": null }, { "...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_id", "type": null, "docstring": null, "docstring_token...
1df6b24ffe2ea86ce6151c8e27563cf20f0e0d94
saurabhshri/auth0-python
auth0/v3/authentication/users.py
[ "MIT" ]
Python
tokeninfo
<not_specific>
def tokeninfo(self, jwt): """Returns user profile based on the user's jwt Validates a JSON Web Token (signature and expiration) and returns the user information associated with the user id (sub property) of the token. Args: jwt (str): User's jwt Returns: ...
Returns user profile based on the user's jwt Validates a JSON Web Token (signature and expiration) and returns the user information associated with the user id (sub property) of the token. Args: jwt (str): User's jwt Returns: The user profile.
Returns user profile based on the user's jwt Validates a JSON Web Token (signature and expiration) and returns the user information associated with the user id (sub property) of the token.
[ "Returns", "user", "profile", "based", "on", "the", "user", "'", "s", "jwt", "Validates", "a", "JSON", "Web", "Token", "(", "signature", "and", "expiration", ")", "and", "returns", "the", "user", "information", "associated", "with", "the", "user", "id", "(...
def tokeninfo(self, jwt): warnings.warn("/tokeninfo will be deprecated in future releases", DeprecationWarning) return self.post( url='https://%s/tokeninfo' % self.domain, data={'id_token': jwt}, headers={'Content-Type': 'application/json'} )
[ "def", "tokeninfo", "(", "self", ",", "jwt", ")", ":", "warnings", ".", "warn", "(", "\"/tokeninfo will be deprecated in future releases\"", ",", "DeprecationWarning", ")", "return", "self", ".", "post", "(", "url", "=", "'https://%s/tokeninfo'", "%", "self", ".",...
Returns user profile based on the user's jwt Validates a JSON Web Token (signature and expiration) and returns the user information associated with the user id (sub property) of the token.
[ "Returns", "user", "profile", "based", "on", "the", "user", "'", "s", "jwt", "Validates", "a", "JSON", "Web", "Token", "(", "signature", "and", "expiration", ")", "and", "returns", "the", "user", "information", "associated", "with", "the", "user", "id", "(...
[ "\"\"\"Returns user profile based on the user's jwt\n\n Validates a JSON Web Token (signature and expiration) and returns the\n user information associated with the user id (sub property) of\n the token.\n\n Args:\n jwt (str): User's jwt\n\n Returns:\n The us...
[ { "param": "self", "type": null }, { "param": "jwt", "type": null } ]
{ "returns": [ { "docstring": "The user profile.", "docstring_tokens": [ "The", "user", "profile", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_to...
4f612897a00f1a21f83a7b04b54b2df9c05f174e
saurabhshri/auth0-python
auth0/v3/authentication/social.py
[ "MIT" ]
Python
login
<not_specific>
def login(self, client_id, access_token, connection, scope='openid'): """Login using a social provider's access token Given the social provider's access_token and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token...
Login using a social provider's access token Given the social provider's access_token and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token. Currently, this endpoint only works for Facebook, Google, Twitter and W...
Login using a social provider's access token Given the social provider's access_token and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token. Currently, this endpoint only works for Facebook, Google, Twitter and Weibo.
[ "Login", "using", "a", "social", "provider", "'", "s", "access", "token", "Given", "the", "social", "provider", "'", "s", "access_token", "and", "the", "connection", "specified", "it", "will", "do", "the", "authentication", "on", "the", "provider", "and", "r...
def login(self, client_id, access_token, connection, scope='openid'): return self.post( 'https://%s/oauth/access_token' % self.domain, data={ 'client_id': client_id, 'access_token': access_token, 'connection': connection, 's...
[ "def", "login", "(", "self", ",", "client_id", ",", "access_token", ",", "connection", ",", "scope", "=", "'openid'", ")", ":", "return", "self", ".", "post", "(", "'https://%s/oauth/access_token'", "%", "self", ".", "domain", ",", "data", "=", "{", "'clie...
Login using a social provider's access token Given the social provider's access_token and the connection specified, it will do the authentication on the provider and return a dict with the access_token and id_token.
[ "Login", "using", "a", "social", "provider", "'", "s", "access", "token", "Given", "the", "social", "provider", "'", "s", "access_token", "and", "the", "connection", "specified", "it", "will", "do", "the", "authentication", "on", "the", "provider", "and", "r...
[ "\"\"\"Login using a social provider's access token\n\n Given the social provider's access_token and the connection specified,\n it will do the authentication on the provider and return a dict with\n the access_token and id_token. Currently, this endpoint only works for\n Facebook, Googl...
[ { "param": "self", "type": null }, { "param": "client_id", "type": null }, { "param": "access_token", "type": null }, { "param": "connection", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [ { "docstring": "A dict with 'access_token' and 'id_token' keys.", "docstring_tokens": [ "A", "dict", "with", "'", "access_token", "'", "and", "'", "id_token", "'", "keys", "." ], ...
08045b75fdcbb63796e07bc6474576d83823f501
UManitoba-BMS/UM-BMID
run/logreg_analysis.py
[ "Apache-2.0" ]
Python
report_results
<not_specific>
def report_results(data, labels, return_threshold=False, threshold=-1.0): """Reports the classification results to the logger Parameters ---------- data : array_like The features for each sample in the data labels : list, array_like The binary class labels for each sample in...
Reports the classification results to the logger Parameters ---------- data : array_like The features for each sample in the data labels : list, array_like The binary class labels for each sample in the data return_threshold : bool If True, will also return the thre...
Reports the classification results to the logger
[ "Reports", "the", "classification", "results", "to", "the", "logger" ]
def report_results(data, labels, return_threshold=False, threshold=-1.0): pred_probs = logreg.predict_proba(data) threshold, acc, sens, spec = get_best_acc(labels, pred_probs, fixed_threshold=threshold) roc_score = roc_auc_score(labels, pred_probs) logger.in...
[ "def", "report_results", "(", "data", ",", "labels", ",", "return_threshold", "=", "False", ",", "threshold", "=", "-", "1.0", ")", ":", "pred_probs", "=", "logreg", ".", "predict_proba", "(", "data", ")", "threshold", ",", "acc", ",", "sens", ",", "spec...
Reports the classification results to the logger
[ "Reports", "the", "classification", "results", "to", "the", "logger" ]
[ "\"\"\"Reports the classification results to the logger\r\n\r\n Parameters\r\n ----------\r\n data : array_like\r\n The features for each sample in the data\r\n labels : list, array_like\r\n The binary class labels for each sample in the data\r\n return_threshold : bool\r\n If Tr...
[ { "param": "data", "type": null }, { "param": "labels", "type": null }, { "param": "return_threshold", "type": null }, { "param": "threshold", "type": null } ]
{ "returns": [ { "docstring": "The threshold - only returned if return_threshold", "docstring_tokens": [ "The", "threshold", "-", "only", "returned", "if", "return_threshold" ], "type": "float\r" }, { "docstring": "The a...
1ade3897924bb38a11c07a1571aabea13369d913
UManitoba-BMS/UM-BMID
umbmid/sigproc.py
[ "Apache-2.0" ]
Python
iczt
<not_specific>
def iczt(fd_data, ini_t, fin_t, n_time_pts, ini_f, fin_f): """Compute the ICZT of the fd_data, transforming to the time-domain. NOTE: Currently supports 1D or 2D fd_data arrays, and will perform the transform along the 0th axis of a 2D array Parameters ---------- fd_data : array_like ...
Compute the ICZT of the fd_data, transforming to the time-domain. NOTE: Currently supports 1D or 2D fd_data arrays, and will perform the transform along the 0th axis of a 2D array Parameters ---------- fd_data : array_like The frequency-domain array to be transformed via the ICZT t...
Compute the ICZT of the fd_data, transforming to the time-domain. NOTE: Currently supports 1D or 2D fd_data arrays, and will perform the transform along the 0th axis of a 2D array
[ "Compute", "the", "ICZT", "of", "the", "fd_data", "transforming", "to", "the", "time", "-", "domain", ".", "NOTE", ":", "Currently", "supports", "1D", "or", "2D", "fd_data", "arrays", "and", "will", "perform", "the", "transform", "along", "the", "0th", "ax...
def iczt(fd_data, ini_t, fin_t, n_time_pts, ini_f, fin_f): n_freqs = fd_data.shape[0] time_to_angle = (2 * np.pi) / np.max(get_scan_times(ini_f, fin_f, n_freqs)) theta_naught = ini_t * time_to_angle phi_naught = (fin_t - ini_t) * time_to_angle / (n_time_pts - 1) exp_theta_naught = np.exp(-1j * the...
[ "def", "iczt", "(", "fd_data", ",", "ini_t", ",", "fin_t", ",", "n_time_pts", ",", "ini_f", ",", "fin_f", ")", ":", "n_freqs", "=", "fd_data", ".", "shape", "[", "0", "]", "time_to_angle", "=", "(", "2", "*", "np", ".", "pi", ")", "/", "np", ".",...
Compute the ICZT of the fd_data, transforming to the time-domain.
[ "Compute", "the", "ICZT", "of", "the", "fd_data", "transforming", "to", "the", "time", "-", "domain", "." ]
[ "\"\"\"Compute the ICZT of the fd_data, transforming to the time-domain.\r\n\r\n NOTE: Currently supports 1D or 2D fd_data arrays, and will perform\r\n the transform along the 0th axis of a 2D array\r\n\r\n Parameters\r\n ----------\r\n fd_data : array_like\r\n The frequency-domain array to be...
[ { "param": "fd_data", "type": null }, { "param": "ini_t", "type": null }, { "param": "fin_t", "type": null }, { "param": "n_time_pts", "type": null }, { "param": "ini_f", "type": null }, { "param": "fin_f", "type": null } ]
{ "returns": [ { "docstring": "Array of the transformed data", "docstring_tokens": [ "Array", "of", "the", "transformed", "data" ], "type": "array_like\r" } ], "raises": [], "params": [ { "identifier": "fd_data", "type": nul...
f639c8bf36c2b41293b50b01fc3c60edef26baeb
UManitoba-BMS/UM-BMID
umbmid/loadsave.py
[ "Apache-2.0" ]
Python
load_fd_data
<not_specific>
def load_fd_data(data_path): """Load raw .txt file into array of complex freq-domain s-params Loads a raw data .txt file and returns the measured complex S-parameters in the frequency domain. Parameters ---------- data_path : str Path to the data file to load Returns ...
Load raw .txt file into array of complex freq-domain s-params Loads a raw data .txt file and returns the measured complex S-parameters in the frequency domain. Parameters ---------- data_path : str Path to the data file to load Returns ------- fd_data : array_like ...
Load raw .txt file into array of complex freq-domain s-params Loads a raw data .txt file and returns the measured complex S-parameters in the frequency domain.
[ "Load", "raw", ".", "txt", "file", "into", "array", "of", "complex", "freq", "-", "domain", "s", "-", "params", "Loads", "a", "raw", "data", ".", "txt", "file", "and", "returns", "the", "measured", "complex", "S", "-", "parameters", "in", "the", "frequ...
def load_fd_data(data_path): raw_data = np.genfromtxt(data_path, dtype=float, delimiter='') num_freqs, num_scan_positions = raw_data.shape num_scan_positions //= 2 fd_data = np.zeros([num_freqs, num_scan_positions], dtype=complex) for scan_position in range(num_scan_positions): fd_data[:, sc...
[ "def", "load_fd_data", "(", "data_path", ")", ":", "raw_data", "=", "np", ".", "genfromtxt", "(", "data_path", ",", "dtype", "=", "float", ",", "delimiter", "=", "''", ")", "num_freqs", ",", "num_scan_positions", "=", "raw_data", ".", "shape", "num_scan_posi...
Load raw .txt file into array of complex freq-domain s-params Loads a raw data .txt file and returns the measured complex S-parameters in the frequency domain.
[ "Load", "raw", ".", "txt", "file", "into", "array", "of", "complex", "freq", "-", "domain", "s", "-", "params", "Loads", "a", "raw", "data", ".", "txt", "file", "and", "returns", "the", "measured", "complex", "S", "-", "parameters", "in", "the", "frequ...
[ "\"\"\"Load raw .txt file into array of complex freq-domain s-params\r\n\r\n Loads a raw data .txt file and returns the measured complex\r\n S-parameters in the frequency domain.\r\n\r\n Parameters\r\n ----------\r\n data_path : str\r\n Path to the data file to load\r\n\r\n Returns\r\n -...
[ { "param": "data_path", "type": null } ]
{ "returns": [ { "docstring": "The measured complex S-parameters in the frequency domain", "docstring_tokens": [ "The", "measured", "complex", "S", "-", "parameters", "in", "the", "frequency", "domain" ], "type...
f639c8bf36c2b41293b50b01fc3c60edef26baeb
UManitoba-BMS/UM-BMID
umbmid/loadsave.py
[ "Apache-2.0" ]
Python
save_mat
null
def save_mat(var, var_name, path): """Saves the var to the path as a .mat file Parameters ---------- var : The variable to be saved var_name : str Str used as the name for the var in the .mat file path : str The full path to the saved .mat file """ ...
Saves the var to the path as a .mat file Parameters ---------- var : The variable to be saved var_name : str Str used as the name for the var in the .mat file path : str The full path to the saved .mat file
Saves the var to the path as a .mat file
[ "Saves", "the", "var", "to", "the", "path", "as", "a", ".", "mat", "file" ]
def save_mat(var, var_name, path): scio.savemat(path, {var_name: var})
[ "def", "save_mat", "(", "var", ",", "var_name", ",", "path", ")", ":", "scio", ".", "savemat", "(", "path", ",", "{", "var_name", ":", "var", "}", ")" ]
Saves the var to the path as a .mat file
[ "Saves", "the", "var", "to", "the", "path", "as", "a", ".", "mat", "file" ]
[ "\"\"\"Saves the var to the path as a .mat file\r\n\r\n Parameters\r\n ----------\r\n var :\r\n The variable to be saved\r\n var_name : str\r\n Str used as the name for the var in the .mat file\r\n path : str\r\n The full path to the saved .mat file\r\n \"\"\"" ]
[ { "param": "var", "type": null }, { "param": "var_name", "type": null }, { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "var", "type": null, "docstring": "The variable to be saved", "docstring_tokens": [ "The", "variable", "to", "be", "saved" ], "default": null, "is_optional": false }...
f639c8bf36c2b41293b50b01fc3c60edef26baeb
UManitoba-BMS/UM-BMID
umbmid/loadsave.py
[ "Apache-2.0" ]
Python
load_pickle
<not_specific>
def load_pickle(path): """Loads the .pickle file located at path Parameters ---------- path : str The full path to the .pickle file that will be loaded Returns ------- loaded_var : The loaded variable """ with open(path, 'rb') as handle: load...
Loads the .pickle file located at path Parameters ---------- path : str The full path to the .pickle file that will be loaded Returns ------- loaded_var : The loaded variable
Loads the .pickle file located at path
[ "Loads", "the", ".", "pickle", "file", "located", "at", "path" ]
def load_pickle(path): with open(path, 'rb') as handle: loaded_var = pickle.load(handle) return loaded_var
[ "def", "load_pickle", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "handle", ":", "loaded_var", "=", "pickle", ".", "load", "(", "handle", ")", "return", "loaded_var" ]
Loads the .pickle file located at path
[ "Loads", "the", ".", "pickle", "file", "located", "at", "path" ]
[ "\"\"\"Loads the .pickle file located at path\r\n\r\n Parameters\r\n ----------\r\n path : str\r\n The full path to the .pickle file that will be loaded\r\n\r\n Returns\r\n -------\r\n loaded_var :\r\n The loaded variable\r\n \"\"\"" ]
[ { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "The loaded variable", "docstring_tokens": [ "The", "loaded", "variable" ], "type": "" } ], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": "The full path to the .pickle file ...
bf6eebff89d87098295186239a330616761a4bb3
UManitoba-BMS/UM-BMID
run/make_clean_files.py
[ "Apache-2.0" ]
Python
make_clean_files
null
def make_clean_files(gen='one', cal_type='emp', sparams='s11', logger=null_logger): """Makes and saves the clean .mat and .pickle files Parameters ---------- gen : str The generation of data to be used, must be in ['one', 'two'] cal_type : str The type ...
Makes and saves the clean .mat and .pickle files Parameters ---------- gen : str The generation of data to be used, must be in ['one', 'two'] cal_type : str The type of calibration to be performed, must be in ['emp', 'adi' sparams : str The type of sparam t...
Makes and saves the clean .mat and .pickle files
[ "Makes", "and", "saves", "the", "clean", ".", "mat", "and", ".", "pickle", "files" ]
def make_clean_files(gen='one', cal_type='emp', sparams='s11', logger=null_logger): assert gen in ['one', 'two', 'three'], \ "Error: gen must be in ['one', 'two', 'three']" assert sparams in ['s11', 's21'], \ "Error: sparams must be in ['s11', 's21']" logger.info('\tImpo...
[ "def", "make_clean_files", "(", "gen", "=", "'one'", ",", "cal_type", "=", "'emp'", ",", "sparams", "=", "'s11'", ",", "logger", "=", "null_logger", ")", ":", "assert", "gen", "in", "[", "'one'", ",", "'two'", ",", "'three'", "]", ",", "\"Error: gen must...
Makes and saves the clean .mat and .pickle files
[ "Makes", "and", "saves", "the", "clean", ".", "mat", "and", ".", "pickle", "files" ]
[ "\"\"\"Makes and saves the clean .mat and .pickle files\r\n\r\n Parameters\r\n ----------\r\n gen : str\r\n The generation of data to be used, must be in ['one', 'two']\r\n cal_type : str\r\n The type of calibration to be performed, must be in\r\n ['emp', 'adi'\r\n sparams : str\...
[ { "param": "gen", "type": null }, { "param": "cal_type", "type": null }, { "param": "sparams", "type": null }, { "param": "logger", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gen", "type": null, "docstring": "The generation of data to be used, must be in ['one', 'two']", "docstring_tokens": [ "The", "generation", "of", "data", "to", "be", "use...
f16e11cbccc8b3aac8f9ff39ebae022c2798e2bf
UManitoba-BMS/UM-BMID
umbmid/ai/logreg.py
[ "Apache-2.0" ]
Python
_param_grad
<not_specific>
def _param_grad(self, features, labels, preds, n_samples): """Get the gradient of the cost func with respect to each param Parameters ---------- features : array_like The features for each sample used during training labels : array_like Binary cla...
Get the gradient of the cost func with respect to each param Parameters ---------- features : array_like The features for each sample used during training labels : array_like Binary class labels (0s and 1s) for each sample preds : array_like ...
Get the gradient of the cost func with respect to each param
[ "Get", "the", "gradient", "of", "the", "cost", "func", "with", "respect", "to", "each", "param" ]
def _param_grad(self, features, labels, preds, n_samples): features = self._reshape_features(features) param_grad = (1 / n_samples) * np.sum((preds - labels)[:, None] * features, axis=0) return param_grad
[ "def", "_param_grad", "(", "self", ",", "features", ",", "labels", ",", "preds", ",", "n_samples", ")", ":", "features", "=", "self", ".", "_reshape_features", "(", "features", ")", "param_grad", "=", "(", "1", "/", "n_samples", ")", "*", "np", ".", "s...
Get the gradient of the cost func with respect to each param
[ "Get", "the", "gradient", "of", "the", "cost", "func", "with", "respect", "to", "each", "param" ]
[ "\"\"\"Get the gradient of the cost func with respect to each param\r\n\r\n Parameters\r\n ----------\r\n features : array_like\r\n The features for each sample used during training\r\n labels : array_like\r\n Binary class labels (0s and 1s) for each sample\r\n ...
[ { "param": "self", "type": null }, { "param": "features", "type": null }, { "param": "labels", "type": null }, { "param": "preds", "type": null }, { "param": "n_samples", "type": null } ]
{ "returns": [ { "docstring": "The gradient of the cost function with respect to each param", "docstring_tokens": [ "The", "gradient", "of", "the", "cost", "function", "with", "respect", "to", "each", "param" ...
f16e11cbccc8b3aac8f9ff39ebae022c2798e2bf
UManitoba-BMS/UM-BMID
umbmid/ai/logreg.py
[ "Apache-2.0" ]
Python
_reshape_features
<not_specific>
def _reshape_features(features): """Reshapes features by concatenating unity feature Parameters ---------- features : array_like The features that will be reshaped Returns ------- features : array_like The features, with a vect...
Reshapes features by concatenating unity feature Parameters ---------- features : array_like The features that will be reshaped Returns ------- features : array_like The features, with a vector of unity feature concatenated ...
Reshapes features by concatenating unity feature
[ "Reshapes", "features", "by", "concatenating", "unity", "feature" ]
def _reshape_features(features): n_samples = np.size(features, axis=0) features = np.append(features, np.ones([n_samples, ])[:, None], axis=1) return features
[ "def", "_reshape_features", "(", "features", ")", ":", "n_samples", "=", "np", ".", "size", "(", "features", ",", "axis", "=", "0", ")", "features", "=", "np", ".", "append", "(", "features", ",", "np", ".", "ones", "(", "[", "n_samples", ",", "]", ...
Reshapes features by concatenating unity feature
[ "Reshapes", "features", "by", "concatenating", "unity", "feature" ]
[ "\"\"\"Reshapes features by concatenating unity feature\r\n\r\n Parameters\r\n ----------\r\n features : array_like\r\n The features that will be reshaped\r\n\r\n Returns\r\n -------\r\n features : array_like\r\n The features, with a vector of unity fe...
[ { "param": "features", "type": null } ]
{ "returns": [ { "docstring": "The features, with a vector of unity feature concatenated\nat the end", "docstring_tokens": [ "The", "features", "with", "a", "vector", "of", "unity", "feature", "concatenated", "at", ...
f16e11cbccc8b3aac8f9ff39ebae022c2798e2bf
UManitoba-BMS/UM-BMID
umbmid/ai/logreg.py
[ "Apache-2.0" ]
Python
predict_proba
<not_specific>
def predict_proba(self, features): """Predict the scores for each sample in the features arr Parameters ---------- features : array_like The features for each sample Returns ------- prob_preds : array_like The predicted logisti...
Predict the scores for each sample in the features arr Parameters ---------- features : array_like The features for each sample Returns ------- prob_preds : array_like The predicted logistic regression scores for each sample ...
Predict the scores for each sample in the features arr
[ "Predict", "the", "scores", "for", "each", "sample", "in", "the", "features", "arr" ]
def predict_proba(self, features): features = self._reshape_features(features) prob_preds = 1 / (1 + np.exp(-features @ self.params)) return prob_preds
[ "def", "predict_proba", "(", "self", ",", "features", ")", ":", "features", "=", "self", ".", "_reshape_features", "(", "features", ")", "prob_preds", "=", "1", "/", "(", "1", "+", "np", ".", "exp", "(", "-", "features", "@", "self", ".", "params", "...
Predict the scores for each sample in the features arr
[ "Predict", "the", "scores", "for", "each", "sample", "in", "the", "features", "arr" ]
[ "\"\"\"Predict the scores for each sample in the features arr\r\n\r\n Parameters\r\n ----------\r\n features : array_like\r\n The features for each sample\r\n\r\n Returns\r\n -------\r\n prob_preds : array_like\r\n The predicted logistic regression sco...
[ { "param": "self", "type": null }, { "param": "features", "type": null } ]
{ "returns": [ { "docstring": "The predicted logistic regression scores for each sample\nin the features array", "docstring_tokens": [ "The", "predicted", "logistic", "regression", "scores", "for", "each", "sample", "in", ...
f16e11cbccc8b3aac8f9ff39ebae022c2798e2bf
UManitoba-BMS/UM-BMID
umbmid/ai/logreg.py
[ "Apache-2.0" ]
Python
predict_labels
<not_specific>
def predict_labels(self, features): """Predict the class labels for each sample in the features arr Parameters ---------- features : array_like The features for each sample Returns ------- label-preds : array_like The predicted...
Predict the class labels for each sample in the features arr Parameters ---------- features : array_like The features for each sample Returns ------- label-preds : array_like The predicted class labels for each sample in the features ...
Predict the class labels for each sample in the features arr
[ "Predict", "the", "class", "labels", "for", "each", "sample", "in", "the", "features", "arr" ]
def predict_labels(self, features): label_preds = np.round(self.predict_proba(features)).astype(int) return label_preds
[ "def", "predict_labels", "(", "self", ",", "features", ")", ":", "label_preds", "=", "np", ".", "round", "(", "self", ".", "predict_proba", "(", "features", ")", ")", ".", "astype", "(", "int", ")", "return", "label_preds" ]
Predict the class labels for each sample in the features arr
[ "Predict", "the", "class", "labels", "for", "each", "sample", "in", "the", "features", "arr" ]
[ "\"\"\"Predict the class labels for each sample in the features arr\r\n\r\n Parameters\r\n ----------\r\n features : array_like\r\n The features for each sample\r\n\r\n Returns\r\n -------\r\n label-preds : array_like\r\n The predicted class labels for...
[ { "param": "self", "type": null }, { "param": "features", "type": null } ]
{ "returns": [ { "docstring": "The predicted class labels for each sample in the features\narray", "docstring_tokens": [ "The", "predicted", "class", "labels", "for", "each", "sample", "in", "the", "features", "arr...
f16e11cbccc8b3aac8f9ff39ebae022c2798e2bf
UManitoba-BMS/UM-BMID
umbmid/ai/logreg.py
[ "Apache-2.0" ]
Python
fit
null
def fit(self, features, labels, learn_rate=0.01, max_iter=10000): """Train (grad descent) the model to learn the model parameters Parameters ---------- features : array_like The features for each sample labels : array_like The binary class labels ...
Train (grad descent) the model to learn the model parameters Parameters ---------- features : array_like The features for each sample labels : array_like The binary class labels (0s or 1s) learn_rate : float The learning rate used for...
Train (grad descent) the model to learn the model parameters
[ "Train", "(", "grad", "descent", ")", "the", "model", "to", "learn", "the", "model", "parameters" ]
def fit(self, features, labels, learn_rate=0.01, max_iter=10000): n_samples = np.size(features, axis=0) cost_change = 1e9 threshold = 1e-5 n_iter = 0 costs = [] while cost_change > threshold and n_iter < max_iter: n_iter += 1 preds = self.predict...
[ "def", "fit", "(", "self", ",", "features", ",", "labels", ",", "learn_rate", "=", "0.01", ",", "max_iter", "=", "10000", ")", ":", "n_samples", "=", "np", ".", "size", "(", "features", ",", "axis", "=", "0", ")", "cost_change", "=", "1e9", "threshol...
Train (grad descent) the model to learn the model parameters
[ "Train", "(", "grad", "descent", ")", "the", "model", "to", "learn", "the", "model", "parameters" ]
[ "\"\"\"Train (grad descent) the model to learn the model parameters\r\n\r\n Parameters\r\n ----------\r\n features : array_like\r\n The features for each sample\r\n labels : array_like\r\n The binary class labels (0s or 1s)\r\n learn_rate : float\r\n ...
[ { "param": "self", "type": null }, { "param": "features", "type": null }, { "param": "labels", "type": null }, { "param": "learn_rate", "type": null }, { "param": "max_iter", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "features", "type": null, "docstring": "The features for each sample...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
import_metadata
<not_specific>
def import_metadata(gen='one'): """Load the metadata of each expt as a dict, return as list of dicts Loads the -metadata.csv files for each experimental session and creates a list of the metadata dict for each individual experiment. Parameters ---------- gen : str The generati...
Load the metadata of each expt as a dict, return as list of dicts Loads the -metadata.csv files for each experimental session and creates a list of the metadata dict for each individual experiment. Parameters ---------- gen : str The generation of data to import, must be in ['one',...
Load the metadata of each expt as a dict, return as list of dicts Loads the -metadata.csv files for each experimental session and creates a list of the metadata dict for each individual experiment.
[ "Load", "the", "metadata", "of", "each", "expt", "as", "a", "dict", "return", "as", "list", "of", "dicts", "Loads", "the", "-", "metadata", ".", "csv", "files", "for", "each", "experimental", "session", "and", "creates", "a", "list", "of", "the", "metada...
def import_metadata(gen='one'): assert gen in ['one', 'two', 'three'], \ "Error: gen must be in ['one', 'two', 'three']" this_data_dir = os.path.join(__DATA_DIR, 'gen-%s/raw/' % gen) metadata = [] for expt_session in os.listdir(this_data_dir): if os.path.isdir(os.path.join(this_data_di...
[ "def", "import_metadata", "(", "gen", "=", "'one'", ")", ":", "assert", "gen", "in", "[", "'one'", ",", "'two'", ",", "'three'", "]", ",", "\"Error: gen must be in ['one', 'two', 'three']\"", "this_data_dir", "=", "os", ".", "path", ".", "join", "(", "__DATA_D...
Load the metadata of each expt as a dict, return as list of dicts Loads the -metadata.csv files for each experimental session and creates a list of the metadata dict for each individual experiment.
[ "Load", "the", "metadata", "of", "each", "expt", "as", "a", "dict", "return", "as", "list", "of", "dicts", "Loads", "the", "-", "metadata", ".", "csv", "files", "for", "each", "experimental", "session", "and", "creates", "a", "list", "of", "the", "metada...
[ "\"\"\"Load the metadata of each expt as a dict, return as list of dicts\r\n\r\n Loads the -metadata.csv files for each experimental session and\r\n creates a list of the metadata dict for each individual experiment.\r\n\r\n Parameters\r\n ----------\r\n gen : str\r\n The generation of data to...
[ { "param": "gen", "type": null } ]
{ "returns": [ { "docstring": "List of the metadata dict for each expt", "docstring_tokens": [ "List", "of", "the", "metadata", "dict", "for", "each", "expt" ], "type": "list\r" } ], "raises": [], "params": [ { ...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
import_fd_dataset
<not_specific>
def import_fd_dataset(gen='one', sparams='s11', logger=null_logger): """Load the freq-domain s-params of each sample in the dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, and returns as an array. Parameters ---------- gen : str...
Load the freq-domain s-params of each sample in the dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, and returns as an array. Parameters ---------- gen : str The generation of dataset to use, must be in ['one', 'two'] sp...
Load the freq-domain s-params of each sample in the dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, and returns as an array.
[ "Load", "the", "freq", "-", "domain", "s", "-", "params", "of", "each", "sample", "in", "the", "dataset", "Loads", "the", ".", "txt", "raw", "data", "files", "of", "the", "measured", "S", "-", "parameters", "in", "the", "frequency", "domain", "for", "e...
def import_fd_dataset(gen='one', sparams='s11', logger=null_logger): assert sparams in ['s11', 's21'], \ "Error: sparams must be in ['s11', 's21']" assert gen in ['one', 'two', 'three'], \ "Error: gen must be in ['one', 'two', 'three']" this_data_dir = os.path.join(__DATA_DIR, 'gen-%s/raw/' ...
[ "def", "import_fd_dataset", "(", "gen", "=", "'one'", ",", "sparams", "=", "'s11'", ",", "logger", "=", "null_logger", ")", ":", "assert", "sparams", "in", "[", "'s11'", ",", "'s21'", "]", ",", "\"Error: sparams must be in ['s11', 's21']\"", "assert", "gen", "...
Load the freq-domain s-params of each sample in the dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, and returns as an array.
[ "Load", "the", "freq", "-", "domain", "s", "-", "params", "of", "each", "sample", "in", "the", "dataset", "Loads", "the", ".", "txt", "raw", "data", "files", "of", "the", "measured", "S", "-", "parameters", "in", "the", "frequency", "domain", "for", "e...
[ "\"\"\"Load the freq-domain s-params of each sample in the dataset\r\n\r\n Loads the .txt raw data files of the measured S-parameters in the\r\n frequency domain for each scan, and returns as an array.\r\n\r\n Parameters\r\n ----------\r\n gen : str\r\n The generation of dataset to use, must b...
[ { "param": "gen", "type": null }, { "param": "sparams", "type": null }, { "param": "logger", "type": null } ]
{ "returns": [ { "docstring": "The S-parameters in the frequency-domain for each scan", "docstring_tokens": [ "The", "S", "-", "parameters", "in", "the", "frequency", "-", "domain", "for", "each", "scan" ...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
import_fd_cal_dataset
<not_specific>
def import_fd_cal_dataset(cal_type='emp', prune=True, gen='two', sparams='s11', logger=null_logger): """Load the calibrated freq-domain s-params of each expt in dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, then subt...
Load the calibrated freq-domain s-params of each expt in dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, then subtracts off a calibration scan (either empty-chamber calibration or adipose calibration) and returns as an array Paramete...
Load the calibrated freq-domain s-params of each expt in dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, then subtracts off a calibration scan (either empty-chamber calibration or adipose calibration) and returns as an array
[ "Load", "the", "calibrated", "freq", "-", "domain", "s", "-", "params", "of", "each", "expt", "in", "dataset", "Loads", "the", ".", "txt", "raw", "data", "files", "of", "the", "measured", "S", "-", "parameters", "in", "the", "frequency", "domain", "for",...
def import_fd_cal_dataset(cal_type='emp', prune=True, gen='two', sparams='s11', logger=null_logger): assert cal_type in ['emp', 'adi'], \ "Error: cal_type must be in ['emp', 'adi']" assert gen in ['one', 'two', 'three'], \ "Error: gen must be in ['one', 'two', 'three']"...
[ "def", "import_fd_cal_dataset", "(", "cal_type", "=", "'emp'", ",", "prune", "=", "True", ",", "gen", "=", "'two'", ",", "sparams", "=", "'s11'", ",", "logger", "=", "null_logger", ")", ":", "assert", "cal_type", "in", "[", "'emp'", ",", "'adi'", "]", ...
Load the calibrated freq-domain s-params of each expt in dataset Loads the .txt raw data files of the measured S-parameters in the frequency domain for each scan, then subtracts off a calibration scan (either empty-chamber calibration or adipose calibration) and returns as an array
[ "Load", "the", "calibrated", "freq", "-", "domain", "s", "-", "params", "of", "each", "expt", "in", "dataset", "Loads", "the", ".", "txt", "raw", "data", "files", "of", "the", "measured", "S", "-", "parameters", "in", "the", "frequency", "domain", "for",...
[ "\"\"\"Load the calibrated freq-domain s-params of each expt in dataset\r\n\r\n Loads the .txt raw data files of the measured S-parameters in the\r\n frequency domain for each scan, then subtracts off a calibration\r\n scan (either empty-chamber calibration or adipose calibration) and\r\n returns as an ...
[ { "param": "cal_type", "type": null }, { "param": "prune", "type": null }, { "param": "gen", "type": null }, { "param": "sparams", "type": null }, { "param": "logger", "type": null } ]
{ "returns": [ { "docstring": "Array of calibrated data", "docstring_tokens": [ "Array", "of", "calibrated", "data" ], "type": "array_like\r" }, { "docstring": "List of calibrated metadata", "docstring_tokens": [ "List", "...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
convert_to_idft_dataset
<not_specific>
def convert_to_idft_dataset(fd_dataset): """Convert the freq-domain data to the time-domain via the IDFT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the IDFT. Parameters ---------- fd_dataset : array_like The measured S-parameters in...
Convert the freq-domain data to the time-domain via the IDFT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the IDFT. Parameters ---------- fd_dataset : array_like The measured S-parameters in the frequency domain for each sample in...
Convert the freq-domain data to the time-domain via the IDFT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the IDFT.
[ "Convert", "the", "freq", "-", "domain", "data", "to", "the", "time", "-", "domain", "via", "the", "IDFT", "Converts", "each", "sample", "in", "the", "fd_dataset", "from", "the", "frequency", "-", "domain", "to", "the", "time", "-", "domain", "via", "the...
def convert_to_idft_dataset(fd_dataset): idft_dataset = np.zeros_like(fd_dataset) for expt_idx in range(fd_dataset.shape[0]): print('\t\tWorking on expt [%4d / %4d]' % (expt_idx + 1, fd_dataset.shape[0])) idft_dataset[expt_idx, :, :] = np.fft....
[ "def", "convert_to_idft_dataset", "(", "fd_dataset", ")", ":", "idft_dataset", "=", "np", ".", "zeros_like", "(", "fd_dataset", ")", "for", "expt_idx", "in", "range", "(", "fd_dataset", ".", "shape", "[", "0", "]", ")", ":", "print", "(", "'\\t\\tWorking on ...
Convert the freq-domain data to the time-domain via the IDFT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the IDFT.
[ "Convert", "the", "freq", "-", "domain", "data", "to", "the", "time", "-", "domain", "via", "the", "IDFT", "Converts", "each", "sample", "in", "the", "fd_dataset", "from", "the", "frequency", "-", "domain", "to", "the", "time", "-", "domain", "via", "the...
[ "\"\"\"Convert the freq-domain data to the time-domain via the IDFT\r\n\r\n Converts each sample in the fd_dataset from the frequency-domain\r\n to the time-domain via the IDFT.\r\n\r\n Parameters\r\n ----------\r\n fd_dataset : array_like\r\n The measured S-parameters in the frequency domain ...
[ { "param": "fd_dataset", "type": null } ]
{ "returns": [ { "docstring": "The time-domain representation of the data for each sample in\nthe dataset, obtained via the IDFT", "docstring_tokens": [ "The", "time", "-", "domain", "representation", "of", "the", "data", "for", ...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
convert_to_iczt_dataset
<not_specific>
def convert_to_iczt_dataset(fd_dataset, num_time_pts=1024, start_time=0.0, stop_time=6e-9, ini_freq=1e9, fin_freq=8e9, logger=null_logger): """Convert the freq-domain data to the time-domain via the ICZT Converts each sample in the fd_dataset from th...
Convert the freq-domain data to the time-domain via the ICZT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the ICZT Parameters ---------- fd_dataset : array_like The measured S-parameters in the frequency domain for each sample in th...
Convert the freq-domain data to the time-domain via the ICZT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the ICZT
[ "Convert", "the", "freq", "-", "domain", "data", "to", "the", "time", "-", "domain", "via", "the", "ICZT", "Converts", "each", "sample", "in", "the", "fd_dataset", "from", "the", "frequency", "-", "domain", "to", "the", "time", "-", "domain", "via", "the...
def convert_to_iczt_dataset(fd_dataset, num_time_pts=1024, start_time=0.0, stop_time=6e-9, ini_freq=1e9, fin_freq=8e9, logger=null_logger): iczt_dataset = np.zeros([fd_dataset.shape[0], num_time_pts, fd_dataset.shape[2]], dtype=com...
[ "def", "convert_to_iczt_dataset", "(", "fd_dataset", ",", "num_time_pts", "=", "1024", ",", "start_time", "=", "0.0", ",", "stop_time", "=", "6e-9", ",", "ini_freq", "=", "1e9", ",", "fin_freq", "=", "8e9", ",", "logger", "=", "null_logger", ")", ":", "icz...
Convert the freq-domain data to the time-domain via the ICZT Converts each sample in the fd_dataset from the frequency-domain to the time-domain via the ICZT
[ "Convert", "the", "freq", "-", "domain", "data", "to", "the", "time", "-", "domain", "via", "the", "ICZT", "Converts", "each", "sample", "in", "the", "fd_dataset", "from", "the", "frequency", "-", "domain", "to", "the", "time", "-", "domain", "via", "the...
[ "\"\"\"Convert the freq-domain data to the time-domain via the ICZT\r\n\r\n Converts each sample in the fd_dataset from the frequency-domain to\r\n the time-domain via the ICZT\r\n\r\n Parameters\r\n ----------\r\n fd_dataset : array_like\r\n The measured S-parameters in the frequency domain fo...
[ { "param": "fd_dataset", "type": null }, { "param": "num_time_pts", "type": null }, { "param": "start_time", "type": null }, { "param": "stop_time", "type": null }, { "param": "ini_freq", "type": null }, { "param": "fin_freq", "type": null }, {...
{ "returns": [ { "docstring": "The time-domain representation of the data for each sample in\nthe dataset, obtained via the ICZT", "docstring_tokens": [ "The", "time", "-", "domain", "representation", "of", "the", "data", "for", ...
c19a6546db1a67d42eefab88e56889d899c05654
UManitoba-BMS/UM-BMID
umbmid/build.py
[ "Apache-2.0" ]
Python
import_metadata_df
<not_specific>
def import_metadata_df(gen='one'): """Loads the metadata and returns as a pandas dataframe. Parameters ---------- gen : str The generation of data, must be in ['one', 'two'] Returns ------- metadata : The metadata of the experiments, returned as a pandas datafram...
Loads the metadata and returns as a pandas dataframe. Parameters ---------- gen : str The generation of data, must be in ['one', 'two'] Returns ------- metadata : The metadata of the experiments, returned as a pandas dataframe.
Loads the metadata and returns as a pandas dataframe.
[ "Loads", "the", "metadata", "and", "returns", "as", "a", "pandas", "dataframe", "." ]
def import_metadata_df(gen='one'): assert gen in ['one', 'two', 'three'], \ "Error: gen must be in ['one', 'two']" metadata = import_metadata(gen=gen) metadata_df = pd.DataFrame() for metadata_info in metadata[0].keys(): metadata_df[metadata_info] = get_info_piece_list(metadata, ...
[ "def", "import_metadata_df", "(", "gen", "=", "'one'", ")", ":", "assert", "gen", "in", "[", "'one'", ",", "'two'", ",", "'three'", "]", ",", "\"Error: gen must be in ['one', 'two']\"", "metadata", "=", "import_metadata", "(", "gen", "=", "gen", ")", "metadata...
Loads the metadata and returns as a pandas dataframe.
[ "Loads", "the", "metadata", "and", "returns", "as", "a", "pandas", "dataframe", "." ]
[ "\"\"\"Loads the metadata and returns as a pandas dataframe.\r\n\r\n Parameters\r\n ----------\r\n gen : str\r\n The generation of data, must be in ['one', 'two']\r\n\r\n Returns\r\n -------\r\n metadata :\r\n The metadata of the experiments, returned as a pandas dataframe.\r\n \"...
[ { "param": "gen", "type": null } ]
{ "returns": [ { "docstring": "The metadata of the experiments, returned as a pandas dataframe.", "docstring_tokens": [ "The", "metadata", "of", "the", "experiments", "returned", "as", "a", "pandas", "dataframe", "...
2bada3ded817f932f969344da632b1155beecaac
UManitoba-BMS/UM-BMID
run/simple_data_use_ex.py
[ "Apache-2.0" ]
Python
plot_td_sinogram
null
def plot_td_sinogram(td_data, ini_t=0, fin_t=6e-9, title='', save_fig=False, save_str='', transparent=False, dpi=300, cmap='inferno'): """Plots a time-domain sinogram Displays a sinogram in the time domain (transferred to the time domain via the ICZT). Parameters -...
Plots a time-domain sinogram Displays a sinogram in the time domain (transferred to the time domain via the ICZT). Parameters ---------- td_data : array_like S-parameters in the time domain ini_t : float The initial time-point in the time-domain, in seconds ...
Plots a time-domain sinogram Displays a sinogram in the time domain (transferred to the time domain via the ICZT).
[ "Plots", "a", "time", "-", "domain", "sinogram", "Displays", "a", "sinogram", "in", "the", "time", "domain", "(", "transferred", "to", "the", "time", "domain", "via", "the", "ICZT", ")", "." ]
def plot_td_sinogram(td_data, ini_t=0, fin_t=6e-9, title='', save_fig=False, save_str='', transparent=False, dpi=300, cmap='inferno'): td_data = np.abs(td_data) n_time_pts = np.size(td_data, axis=0) scan_times = np.linspace(ini_t, fin_t, n_time_pts) plot_extent = [1, 360, scan_t...
[ "def", "plot_td_sinogram", "(", "td_data", ",", "ini_t", "=", "0", ",", "fin_t", "=", "6e-9", ",", "title", "=", "''", ",", "save_fig", "=", "False", ",", "save_str", "=", "''", ",", "transparent", "=", "False", ",", "dpi", "=", "300", ",", "cmap", ...
Plots a time-domain sinogram Displays a sinogram in the time domain (transferred to the time domain via the ICZT).
[ "Plots", "a", "time", "-", "domain", "sinogram", "Displays", "a", "sinogram", "in", "the", "time", "domain", "(", "transferred", "to", "the", "time", "domain", "via", "the", "ICZT", ")", "." ]
[ "\"\"\"Plots a time-domain sinogram\r\n\r\n Displays a sinogram in the time domain (transferred to the time domain\r\n via the ICZT).\r\n\r\n Parameters\r\n ----------\r\n td_data : array_like\r\n S-parameters in the time domain\r\n ini_t : float\r\n The initial time-point in...
[ { "param": "td_data", "type": null }, { "param": "ini_t", "type": null }, { "param": "fin_t", "type": null }, { "param": "title", "type": null }, { "param": "save_fig", "type": null }, { "param": "save_str", "type": null }, { "param": "tran...
{ "returns": [], "raises": [], "params": [ { "identifier": "td_data", "type": null, "docstring": "S-parameters in the time domain", "docstring_tokens": [ "S", "-", "parameters", "in", "the", "time", "domain" ], "defaul...
bc87fbbc330580f6eca05643f6a72dc6ab8a1a8a
UManitoba-BMS/UM-BMID
umbmid/ai/preprocessing.py
[ "Apache-2.0" ]
Python
shuffle_arrays
<not_specific>
def shuffle_arrays(arrays_list, rand_seed=0, return_seed=False): """Shuffle arrays to maintain inter-array ordering Shuffles each array in the list of arrays, arrays_list, such that the inter-array order is maintained (i.e., the zeroth element of the all arrays before shuffling corresponds to the ...
Shuffle arrays to maintain inter-array ordering Shuffles each array in the list of arrays, arrays_list, such that the inter-array order is maintained (i.e., the zeroth element of the all arrays before shuffling corresponds to the nth element of all arrays after shuffling) Parameters --...
Shuffle arrays to maintain inter-array ordering Shuffles each array in the list of arrays, arrays_list, such that the inter-array order is maintained Parameters arrays_list : list List containing each array that will be shuffled rand_seed : int The seed to use for shuffling each array return_seed : bool If True, will...
[ "Shuffle", "arrays", "to", "maintain", "inter", "-", "array", "ordering", "Shuffles", "each", "array", "in", "the", "list", "of", "arrays", "arrays_list", "such", "that", "the", "inter", "-", "array", "order", "is", "maintained", "Parameters", "arrays_list", "...
def shuffle_arrays(arrays_list, rand_seed=0, return_seed=False): shuffled_arrs = [] for array in arrays_list: np.random.seed(rand_seed) if type(array) == list: shuffled_arr = [ii for ii in array] else: shuffled_arr = array * np.ones_like(array) n...
[ "def", "shuffle_arrays", "(", "arrays_list", ",", "rand_seed", "=", "0", ",", "return_seed", "=", "False", ")", ":", "shuffled_arrs", "=", "[", "]", "for", "array", "in", "arrays_list", ":", "np", ".", "random", ".", "seed", "(", "rand_seed", ")", "if", ...
Shuffle arrays to maintain inter-array ordering Shuffles each array in the list of arrays, arrays_list, such that the inter-array order is maintained (i.e., the zeroth element of the all arrays before shuffling corresponds to the nth element of all arrays after shuffling)
[ "Shuffle", "arrays", "to", "maintain", "inter", "-", "array", "ordering", "Shuffles", "each", "array", "in", "the", "list", "of", "arrays", "arrays_list", "such", "that", "the", "inter", "-", "array", "order", "is", "maintained", "(", "i", ".", "e", ".", ...
[ "\"\"\"Shuffle arrays to maintain inter-array ordering\r\n\r\n Shuffles each array in the list of arrays, arrays_list, such that\r\n the inter-array order is maintained (i.e., the zeroth element of\r\n the all arrays before shuffling corresponds to the nth element of\r\n all arrays after shuffling)\r\n\...
[ { "param": "arrays_list", "type": null }, { "param": "rand_seed", "type": null }, { "param": "return_seed", "type": null } ]
{ "returns": [ { "docstring": "List containing the shuffled arrays", "docstring_tokens": [ "List", "containing", "the", "shuffled", "arrays" ], "type": "list\r" }, { "docstring": "The seed that was used to shuffle the arrays", "do...
bc87fbbc330580f6eca05643f6a72dc6ab8a1a8a
UManitoba-BMS/UM-BMID
umbmid/ai/preprocessing.py
[ "Apache-2.0" ]
Python
normalize_samples
<not_specific>
def normalize_samples(data): """Normalizes each sample in data to have unity maximum Parameters ---------- data : array_like 3D array of the features for each sample (assumes 2D features) Returns ------- normalized_data : array_like Array of the features for each...
Normalizes each sample in data to have unity maximum Parameters ---------- data : array_like 3D array of the features for each sample (assumes 2D features) Returns ------- normalized_data : array_like Array of the features for each sample, normalized so that the ...
Normalizes each sample in data to have unity maximum
[ "Normalizes", "each", "sample", "in", "data", "to", "have", "unity", "maximum" ]
def normalize_samples(data): assert len(np.shape(data)) == 3, 'Error: data must have 3 dim' normalized_data = np.ones_like(data) for sample_idx in range(np.size(data, axis=0)): normalized_data[sample_idx, :, :] = (data[sample_idx, :, :] / np.max(data[sa...
[ "def", "normalize_samples", "(", "data", ")", ":", "assert", "len", "(", "np", ".", "shape", "(", "data", ")", ")", "==", "3", ",", "'Error: data must have 3 dim'", "normalized_data", "=", "np", ".", "ones_like", "(", "data", ")", "for", "sample_idx", "in"...
Normalizes each sample in data to have unity maximum
[ "Normalizes", "each", "sample", "in", "data", "to", "have", "unity", "maximum" ]
[ "\"\"\"Normalizes each sample in data to have unity maximum\r\n\r\n Parameters\r\n ----------\r\n data : array_like\r\n 3D array of the features for each sample (assumes 2D features)\r\n\r\n Returns\r\n -------\r\n normalized_data : array_like\r\n Array of the features for each sampl...
[ { "param": "data", "type": null } ]
{ "returns": [ { "docstring": "Array of the features for each sample, normalized so that the\nmax value is unity for each sample", "docstring_tokens": [ "Array", "of", "the", "features", "for", "each", "sample", "normalized", "so"...
3243e21a9c4078aa92c64e7b50929f848f7511dd
UManitoba-BMS/UM-BMID
umbmid/content.py
[ "Apache-2.0" ]
Python
report_metadata_content
null
def report_metadata_content(metadata, logger=null_logger): """Report major metadata info to a logger Reports the BI-RADS class, tumor size, and adipose-id distributions for all samples whose metadata is in the metadata list, and for only positive samples, and only negative samples. Paramete...
Report major metadata info to a logger Reports the BI-RADS class, tumor size, and adipose-id distributions for all samples whose metadata is in the metadata list, and for only positive samples, and only negative samples. Parameters ---------- metadata : list List containing th...
Report major metadata info to a logger Reports the BI-RADS class, tumor size, and adipose-id distributions for all samples whose metadata is in the metadata list, and for only positive samples, and only negative samples.
[ "Report", "major", "metadata", "info", "to", "a", "logger", "Reports", "the", "BI", "-", "RADS", "class", "tumor", "size", "and", "adipose", "-", "id", "distributions", "for", "all", "samples", "whose", "metadata", "is", "in", "the", "metadata", "list", "a...
def report_metadata_content(metadata, logger=null_logger): num_samples = len(metadata) birads = get_info_piece_list(metadata, 'birads') tum_sizes = get_info_piece_list(metadata, 'tum_rad') adipose_ids = get_adipose_shell_ids(metadata) labels = get_class_labels(metadata) num_pos, num_neg = int(...
[ "def", "report_metadata_content", "(", "metadata", ",", "logger", "=", "null_logger", ")", ":", "num_samples", "=", "len", "(", "metadata", ")", "birads", "=", "get_info_piece_list", "(", "metadata", ",", "'birads'", ")", "tum_sizes", "=", "get_info_piece_list", ...
Report major metadata info to a logger Reports the BI-RADS class, tumor size, and adipose-id distributions for all samples whose metadata is in the metadata list, and for only positive samples, and only negative samples.
[ "Report", "major", "metadata", "info", "to", "a", "logger", "Reports", "the", "BI", "-", "RADS", "class", "tumor", "size", "and", "adipose", "-", "id", "distributions", "for", "all", "samples", "whose", "metadata", "is", "in", "the", "metadata", "list", "a...
[ "\"\"\"Report major metadata info to a logger\r\n\r\n Reports the BI-RADS class, tumor size, and adipose-id\r\n distributions for all samples whose metadata is in the metadata\r\n list, and for only positive samples, and only negative samples.\r\n\r\n Parameters\r\n ----------\r\n metadata : list\...
[ { "param": "metadata", "type": null }, { "param": "logger", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metadata", "type": null, "docstring": "List containing the metadata dict for each sample", "docstring_tokens": [ "List", "containing", "the", "metadata", "dict", "for", "...
a592b212e774e0748cf957c12292f8855a5d81a5
matthewturk/jupyterlab_dosbox
jupyterlab_dosbox/utils.py
[ "BSD-3-Clause" ]
Python
make_zipfile
<not_specific>
def make_zipfile(filenames, prefix_directory = ""): """ This accepts either a list of strings, in which case the files will be added to an in-memory zipfile from those named files, or a set of dictionary entries, where the dictionary keys are the filenames and the values are the contents of those fi...
This accepts either a list of strings, in which case the files will be added to an in-memory zipfile from those named files, or a set of dictionary entries, where the dictionary keys are the filenames and the values are the contents of those files.
This accepts either a list of strings, in which case the files will be added to an in-memory zipfile from those named files, or a set of dictionary entries, where the dictionary keys are the filenames and the values are the contents of those files.
[ "This", "accepts", "either", "a", "list", "of", "strings", "in", "which", "case", "the", "files", "will", "be", "added", "to", "an", "in", "-", "memory", "zipfile", "from", "those", "named", "files", "or", "a", "set", "of", "dictionary", "entries", "wher...
def make_zipfile(filenames, prefix_directory = ""): if isinstance(filenames, list): filenames = {_: None for _ in filenames} dirnames = set() for fn in filenames: dirnames.add(os.path.dirname(fn)) base = os.path.commonpath(list(dirnames)) if '.' in dirnames: dirnames.remove('.') ...
[ "def", "make_zipfile", "(", "filenames", ",", "prefix_directory", "=", "\"\"", ")", ":", "if", "isinstance", "(", "filenames", ",", "list", ")", ":", "filenames", "=", "{", "_", ":", "None", "for", "_", "in", "filenames", "}", "dirnames", "=", "set", "...
This accepts either a list of strings, in which case the files will be added to an in-memory zipfile from those named files, or a set of dictionary entries, where the dictionary keys are the filenames and the values are the contents of those files.
[ "This", "accepts", "either", "a", "list", "of", "strings", "in", "which", "case", "the", "files", "will", "be", "added", "to", "an", "in", "-", "memory", "zipfile", "from", "those", "named", "files", "or", "a", "set", "of", "dictionary", "entries", "wher...
[ "\"\"\"\n This accepts either a list of strings, in which case the files will be\n added to an in-memory zipfile from those named files, or a set of\n dictionary entries, where the dictionary keys are the filenames and the\n values are the contents of those files.\n \"\"\"", "# First we need to fig...
[ { "param": "filenames", "type": null }, { "param": "prefix_directory", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filenames", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prefix_directory", "type": null, "docstring": null, "doc...
a592b212e774e0748cf957c12292f8855a5d81a5
matthewturk/jupyterlab_dosbox
jupyterlab_dosbox/utils.py
[ "BSD-3-Clause" ]
Python
recompress_zipfile
<not_specific>
def recompress_zipfile(input_filename, prefix_directory = ""): """ This accepts an input filename of a zip file that needs to be converted to something that is just ZIP_STORED, and it returns the bytes of the new version. It does keep it all in memory, though! """ output_bytes = {} with zip...
This accepts an input filename of a zip file that needs to be converted to something that is just ZIP_STORED, and it returns the bytes of the new version. It does keep it all in memory, though!
This accepts an input filename of a zip file that needs to be converted to something that is just ZIP_STORED, and it returns the bytes of the new version. It does keep it all in memory, though!
[ "This", "accepts", "an", "input", "filename", "of", "a", "zip", "file", "that", "needs", "to", "be", "converted", "to", "something", "that", "is", "just", "ZIP_STORED", "and", "it", "returns", "the", "bytes", "of", "the", "new", "version", ".", "It", "do...
def recompress_zipfile(input_filename, prefix_directory = ""): output_bytes = {} with zipfile.ZipFile(input_filename, "r") as f: for fn in f.namelist(): output_bytes[fn] = f.read(fn) return make_zipfile(output_bytes, prefix_directory)
[ "def", "recompress_zipfile", "(", "input_filename", ",", "prefix_directory", "=", "\"\"", ")", ":", "output_bytes", "=", "{", "}", "with", "zipfile", ".", "ZipFile", "(", "input_filename", ",", "\"r\"", ")", "as", "f", ":", "for", "fn", "in", "f", ".", "...
This accepts an input filename of a zip file that needs to be converted to something that is just ZIP_STORED, and it returns the bytes of the new version.
[ "This", "accepts", "an", "input", "filename", "of", "a", "zip", "file", "that", "needs", "to", "be", "converted", "to", "something", "that", "is", "just", "ZIP_STORED", "and", "it", "returns", "the", "bytes", "of", "the", "new", "version", "." ]
[ "\"\"\"\n This accepts an input filename of a zip file that needs to be converted\n to something that is just ZIP_STORED, and it returns the bytes of the new\n version. It does keep it all in memory, though!\n \"\"\"" ]
[ { "param": "input_filename", "type": null }, { "param": "prefix_directory", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prefix_directory", "type": null, "docstring": null, ...
6e162f0b37486e03e4d720c459952dd9d961a07a
lukacsg/openlostcat
openlostcat/operators/filter_operators.py
[ "Apache-2.0" ]
Python
__choose_wrapper_quantifier
<not_specific>
def __choose_wrapper_quantifier(filter_operators): """wrapper quantifier of 'and' will default to ALL if each subexpression defaults to ALL, otherwise it will default to ANY :param filter_operators: operands :return: default wrapper quantifier ALL/ANY """ return ALL if a...
wrapper quantifier of 'and' will default to ALL if each subexpression defaults to ALL, otherwise it will default to ANY :param filter_operators: operands :return: default wrapper quantifier ALL/ANY
wrapper quantifier of 'and' will default to ALL if each subexpression defaults to ALL, otherwise it will default to ANY
[ "wrapper", "quantifier", "of", "'", "and", "'", "will", "default", "to", "ALL", "if", "each", "subexpression", "defaults", "to", "ALL", "otherwise", "it", "will", "default", "to", "ANY" ]
def __choose_wrapper_quantifier(filter_operators): return ALL if all([issubclass(op.wrapper_quantifier, ALL) for op in filter_operators]) else ANY
[ "def", "__choose_wrapper_quantifier", "(", "filter_operators", ")", ":", "return", "ALL", "if", "all", "(", "[", "issubclass", "(", "op", ".", "wrapper_quantifier", ",", "ALL", ")", "for", "op", "in", "filter_operators", "]", ")", "else", "ANY" ]
wrapper quantifier of 'and' will default to ALL if each subexpression defaults to ALL, otherwise it will default to ANY
[ "wrapper", "quantifier", "of", "'", "and", "'", "will", "default", "to", "ALL", "if", "each", "subexpression", "defaults", "to", "ALL", "otherwise", "it", "will", "default", "to", "ANY" ]
[ "\"\"\"wrapper quantifier of 'and' will default to ALL if each subexpression defaults to ALL,\n otherwise it will default to ANY\n\n :param filter_operators: operands\n :return: default wrapper quantifier ALL/ANY\n \"\"\"" ]
[ { "param": "filter_operators", "type": null } ]
{ "returns": [ { "docstring": "default wrapper quantifier ALL/ANY", "docstring_tokens": [ "default", "wrapper", "quantifier", "ALL", "/", "ANY" ], "type": null } ], "raises": [], "params": [ { "identifier": "filter_operato...
6e162f0b37486e03e4d720c459952dd9d961a07a
lukacsg/openlostcat
openlostcat/operators/filter_operators.py
[ "Apache-2.0" ]
Python
__choose_wrapper_quantifier
<not_specific>
def __choose_wrapper_quantifier(filter_operators): """wrapper quantifier of 'or' will default to ALL if at least one subexpression defaults to ALL, otherwise it will default to ANY :param filter_operators: operands :return: default wrapper quantifier ALL/ANY """ return A...
wrapper quantifier of 'or' will default to ALL if at least one subexpression defaults to ALL, otherwise it will default to ANY :param filter_operators: operands :return: default wrapper quantifier ALL/ANY
wrapper quantifier of 'or' will default to ALL if at least one subexpression defaults to ALL, otherwise it will default to ANY
[ "wrapper", "quantifier", "of", "'", "or", "'", "will", "default", "to", "ALL", "if", "at", "least", "one", "subexpression", "defaults", "to", "ALL", "otherwise", "it", "will", "default", "to", "ANY" ]
def __choose_wrapper_quantifier(filter_operators): return ALL if any([issubclass(op.wrapper_quantifier, ALL) for op in filter_operators]) else ANY
[ "def", "__choose_wrapper_quantifier", "(", "filter_operators", ")", ":", "return", "ALL", "if", "any", "(", "[", "issubclass", "(", "op", ".", "wrapper_quantifier", ",", "ALL", ")", "for", "op", "in", "filter_operators", "]", ")", "else", "ANY" ]
wrapper quantifier of 'or' will default to ALL if at least one subexpression defaults to ALL, otherwise it will default to ANY
[ "wrapper", "quantifier", "of", "'", "or", "'", "will", "default", "to", "ALL", "if", "at", "least", "one", "subexpression", "defaults", "to", "ALL", "otherwise", "it", "will", "default", "to", "ANY" ]
[ "\"\"\"wrapper quantifier of 'or' will default to ALL if at least one subexpression defaults to ALL,\n otherwise it will default to ANY\n\n :param filter_operators: operands\n :return: default wrapper quantifier ALL/ANY\n \"\"\"" ]
[ { "param": "filter_operators", "type": null } ]
{ "returns": [ { "docstring": "default wrapper quantifier ALL/ANY", "docstring_tokens": [ "default", "wrapper", "quantifier", "ALL", "/", "ANY" ], "type": null } ], "raises": [], "params": [ { "identifier": "filter_operato...
6e162f0b37486e03e4d720c459952dd9d961a07a
lukacsg/openlostcat
openlostcat/operators/filter_operators.py
[ "Apache-2.0" ]
Python
__parse_single_value
<not_specific>
def __parse_single_value(dat): """Gets a single value from dat :param dat: value as string, bool or int (or None as null) :return: value in string """ switcher = { bool: lambda b: "yes" if b else "no", int: lambda i: str(i), str: lambda s: s, ...
Gets a single value from dat :param dat: value as string, bool or int (or None as null) :return: value in string
Gets a single value from dat
[ "Gets", "a", "single", "value", "from", "dat" ]
def __parse_single_value(dat): switcher = { bool: lambda b: "yes" if b else "no", int: lambda i: str(i), str: lambda s: s, type(None): lambda x: None, list: lambda x: error("Array is not allowed here: ", x), dict: lambda x: error("Key-value...
[ "def", "__parse_single_value", "(", "dat", ")", ":", "switcher", "=", "{", "bool", ":", "lambda", "b", ":", "\"yes\"", "if", "b", "else", "\"no\"", ",", "int", ":", "lambda", "i", ":", "str", "(", "i", ")", ",", "str", ":", "lambda", "s", ":", "s...
Gets a single value from dat
[ "Gets", "a", "single", "value", "from", "dat" ]
[ "\"\"\"Gets a single value from dat\n\n :param dat: value as string, bool or int (or None as null)\n :return: value in string\n \"\"\"" ]
[ { "param": "dat", "type": null } ]
{ "returns": [ { "docstring": "value in string", "docstring_tokens": [ "value", "in", "string" ], "type": null } ], "raises": [], "params": [ { "identifier": "dat", "type": null, "docstring": "value as string, bool or int (or None as ...
b05db6a03078b659c891ef9052c37c8508dc3fbf
lukacsg/openlostcat
openlostcat/categorycatalog.py
[ "Apache-2.0" ]
Python
apply_fm_evaluation
<not_specific>
def apply_fm_evaluation(self, tag_bundle_set): """Categorizes a location (by its tag bundle set) with the first-matching category strategy (single output) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching categories ""...
Categorizes a location (by its tag bundle set) with the first-matching category strategy (single output) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching categories
Categorizes a location (by its tag bundle set) with the first-matching category strategy (single output)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "with", "the", "first", "-", "matching", "category", "strategy", "(", "single", "output", ")" ]
def apply_fm_evaluation(self, tag_bundle_set): for num, category in enumerate(self.categories): (is_matching_category, op_result_meta_info) = category.apply(tag_bundle_set) if is_matching_category: return (num, category.name, op_result_meta_info) if self.debug else (num, ...
[ "def", "apply_fm_evaluation", "(", "self", ",", "tag_bundle_set", ")", ":", "for", "num", ",", "category", "in", "enumerate", "(", "self", ".", "categories", ")", ":", "(", "is_matching_category", ",", "op_result_meta_info", ")", "=", "category", ".", "apply",...
Categorizes a location (by its tag bundle set) with the first-matching category strategy (single output)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "with", "the", "first", "-", "matching", "category", "strategy", "(", "single", "output", ")" ]
[ "\"\"\"Categorizes a location (by its tag bundle set) with the first-matching category strategy (single output)\n\n :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized\n :return: list of matching categories\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tag_bundle_set", "type": null } ]
{ "returns": [ { "docstring": "list of matching categories", "docstring_tokens": [ "list", "of", "matching", "categories" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
b05db6a03078b659c891ef9052c37c8508dc3fbf
lukacsg/openlostcat
openlostcat/categorycatalog.py
[ "Apache-2.0" ]
Python
apply_all_evaluation
<not_specific>
def apply_all_evaluation(self, tag_bundle_set): """Categorizes a location (by its tag bundle set) with the all-matching category strategy (possible multiple output) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching cat...
Categorizes a location (by its tag bundle set) with the all-matching category strategy (possible multiple output) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching categories
Categorizes a location (by its tag bundle set) with the all-matching category strategy (possible multiple output)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "with", "the", "all", "-", "matching", "category", "strategy", "(", "possible", "multiple", "output", ")" ]
def apply_all_evaluation(self, tag_bundle_set): categories_list = [] for num, category in enumerate(self.categories): (is_matching_category, op_result_meta_info) = category.apply(tag_bundle_set) if is_matching_category: categories_list.append( ...
[ "def", "apply_all_evaluation", "(", "self", ",", "tag_bundle_set", ")", ":", "categories_list", "=", "[", "]", "for", "num", ",", "category", "in", "enumerate", "(", "self", ".", "categories", ")", ":", "(", "is_matching_category", ",", "op_result_meta_info", ...
Categorizes a location (by its tag bundle set) with the all-matching category strategy (possible multiple output)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "with", "the", "all", "-", "matching", "category", "strategy", "(", "possible", "multiple", "output", ")" ]
[ "\"\"\"Categorizes a location (by its tag bundle set) with the all-matching category strategy\n (possible multiple output)\n\n :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized\n :return: list of matching categories\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tag_bundle_set", "type": null } ]
{ "returns": [ { "docstring": "list of matching categories", "docstring_tokens": [ "list", "of", "matching", "categories" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
b05db6a03078b659c891ef9052c37c8508dc3fbf
lukacsg/openlostcat
openlostcat/categorycatalog.py
[ "Apache-2.0" ]
Python
apply
<not_specific>
def apply(self, tag_bundle_set): """Categorizes a location (by its tag bundle set) according to the given strategy (stored in the catalog) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching categories """ ...
Categorizes a location (by its tag bundle set) according to the given strategy (stored in the catalog) :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized :return: list of matching categories
Categorizes a location (by its tag bundle set) according to the given strategy (stored in the catalog)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "according", "to", "the", "given", "strategy", "(", "stored", "in", "the", "catalog", ")" ]
def apply(self, tag_bundle_set): evaluation_switcher = { "firstMatching": self.apply_fm_evaluation, "all": self.apply_all_evaluation } return evaluation_switcher.get(self.evaluationStrategy, lambda x: error("Unsupported evaluation st...
[ "def", "apply", "(", "self", ",", "tag_bundle_set", ")", ":", "evaluation_switcher", "=", "{", "\"firstMatching\"", ":", "self", ".", "apply_fm_evaluation", ",", "\"all\"", ":", "self", ".", "apply_all_evaluation", "}", "return", "evaluation_switcher", ".", "get",...
Categorizes a location (by its tag bundle set) according to the given strategy (stored in the catalog)
[ "Categorizes", "a", "location", "(", "by", "its", "tag", "bundle", "set", ")", "according", "to", "the", "given", "strategy", "(", "stored", "in", "the", "catalog", ")" ]
[ "\"\"\"Categorizes a location (by its tag bundle set) according to the given strategy (stored in the catalog)\n \n :param tag_bundle_set: set of dicts of tags of osm objects at the location to be categorized\n :return: list of matching categories\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tag_bundle_set", "type": null } ]
{ "returns": [ { "docstring": "list of matching categories", "docstring_tokens": [ "list", "of", "matching", "categories" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, ...
04a97335fc5ebf997dc66c61c24acf4073d65dd5
lukacsg/openlostcat
openlostcat/utils.py
[ "Apache-2.0" ]
Python
to_tag_bundle
<not_specific>
def to_tag_bundle(tag_dict): """Convert the original tag dictionary to immutable (our 'bundle' representation) :param tag_dict: :return: """ return immutabledict(tag_dict)
Convert the original tag dictionary to immutable (our 'bundle' representation) :param tag_dict: :return:
Convert the original tag dictionary to immutable (our 'bundle' representation)
[ "Convert", "the", "original", "tag", "dictionary", "to", "immutable", "(", "our", "'", "bundle", "'", "representation", ")" ]
def to_tag_bundle(tag_dict): return immutabledict(tag_dict)
[ "def", "to_tag_bundle", "(", "tag_dict", ")", ":", "return", "immutabledict", "(", "tag_dict", ")" ]
Convert the original tag dictionary to immutable (our 'bundle' representation)
[ "Convert", "the", "original", "tag", "dictionary", "to", "immutable", "(", "our", "'", "bundle", "'", "representation", ")" ]
[ "\"\"\"Convert the original tag dictionary to immutable (our 'bundle' representation)\n\n :param tag_dict:\n :return:\n \"\"\"" ]
[ { "param": "tag_dict", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "tag_dict", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
04a97335fc5ebf997dc66c61c24acf4073d65dd5
lukacsg/openlostcat
openlostcat/utils.py
[ "Apache-2.0" ]
Python
to_tag_bundle_set
<not_specific>
def to_tag_bundle_set(tag_dict_list): """Convert the original set of tag dictionaries to immutable (our 'bundle' representation) :param tag_dict_list: :return: """ return {to_tag_bundle(tag_dict) for tag_dict in tag_dict_list}
Convert the original set of tag dictionaries to immutable (our 'bundle' representation) :param tag_dict_list: :return:
Convert the original set of tag dictionaries to immutable (our 'bundle' representation)
[ "Convert", "the", "original", "set", "of", "tag", "dictionaries", "to", "immutable", "(", "our", "'", "bundle", "'", "representation", ")" ]
def to_tag_bundle_set(tag_dict_list): return {to_tag_bundle(tag_dict) for tag_dict in tag_dict_list}
[ "def", "to_tag_bundle_set", "(", "tag_dict_list", ")", ":", "return", "{", "to_tag_bundle", "(", "tag_dict", ")", "for", "tag_dict", "in", "tag_dict_list", "}" ]
Convert the original set of tag dictionaries to immutable (our 'bundle' representation)
[ "Convert", "the", "original", "set", "of", "tag", "dictionaries", "to", "immutable", "(", "our", "'", "bundle", "'", "representation", ")" ]
[ "\"\"\"Convert the original set of tag dictionaries to immutable (our 'bundle' representation)\n\n :param tag_dict_list:\n :return:\n \"\"\"" ]
[ { "param": "tag_dict_list", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "tag_dict_list", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": nul...
f3275b98ca3c92b6f1d5082657ecc4942c92aab0
ithaaswin/TeachersPetBot
src/cal.py
[ "MIT" ]
Python
display_events
null
async def display_events(ctx): ''' sends the embed to the channel and edits it to update it as well ''' global MSG # recreate the embed from the database update_calendar(ctx) # if it was never created, send the first message if not MSG: MSG = await ctx.send(embed=CALENDAR_EMBED) els...
sends the embed to the channel and edits it to update it as well
sends the embed to the channel and edits it to update it as well
[ "sends", "the", "embed", "to", "the", "channel", "and", "edits", "it", "to", "update", "it", "as", "well" ]
async def display_events(ctx): global MSG update_calendar(ctx) if not MSG: MSG = await ctx.send(embed=CALENDAR_EMBED) else: await MSG.edit(embed=CALENDAR_EMBED)
[ "async", "def", "display_events", "(", "ctx", ")", ":", "global", "MSG", "update_calendar", "(", "ctx", ")", "if", "not", "MSG", ":", "MSG", "=", "await", "ctx", ".", "send", "(", "embed", "=", "CALENDAR_EMBED", ")", "else", ":", "await", "MSG", ".", ...
sends the embed to the channel and edits it to update it as well
[ "sends", "the", "embed", "to", "the", "channel", "and", "edits", "it", "to", "update", "it", "as", "well" ]
[ "''' sends the embed to the channel and edits it to update it as well '''", "# recreate the embed from the database", "# if it was never created, send the first message", "# otherwise, edit the saved message from earlier" ]
[ { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f3275b98ca3c92b6f1d5082657ecc4942c92aab0
ithaaswin/TeachersPetBot
src/cal.py
[ "MIT" ]
Python
update_calendar
null
def update_calendar(ctx): ''' create the calendar embed, it is a global so also updates it ''' global CALENDAR_EMBED # create an Embed with a title and description of color 'currently BLUE' CALENDAR_EMBED = discord.Embed(title="The Course Calendar, sire", description="All of the class assignmen...
create the calendar embed, it is a global so also updates it
create the calendar embed, it is a global so also updates it
[ "create", "the", "calendar", "embed", "it", "is", "a", "global", "so", "also", "updates", "it" ]
def update_calendar(ctx): global CALENDAR_EMBED CALENDAR_EMBED = discord.Embed(title="The Course Calendar, sire", description="All of the class assignments and exams!", color=0x0000FF) assignments = [] for title, link, desc, date in db.select_query( 'SELECT title, link, desc, date FR...
[ "def", "update_calendar", "(", "ctx", ")", ":", "global", "CALENDAR_EMBED", "CALENDAR_EMBED", "=", "discord", ".", "Embed", "(", "title", "=", "\"The Course Calendar, sire\"", ",", "description", "=", "\"All of the class assignments and exams!\"", ",", "color", "=", "...
create the calendar embed, it is a global so also updates it
[ "create", "the", "calendar", "embed", "it", "is", "a", "global", "so", "also", "updates", "it" ]
[ "''' create the calendar embed, it is a global so also updates it '''", "# create an Embed with a title and description of color 'currently BLUE'", "# make a list that contains the string representing the", "# event that has the comparison item as the first index", "# which is the date, we are comparing as ...
[ { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b4369cfea4919134cace184629106f641511fd75
ithaaswin/TeachersPetBot
src/profanity.py
[ "MIT" ]
Python
check_profanity
<not_specific>
def check_profanity(msg): ''' check if message contains profanity through profanity module ''' if msg in custom_words: return True return profanity.contains_profanity(msg)
check if message contains profanity through profanity module
check if message contains profanity through profanity module
[ "check", "if", "message", "contains", "profanity", "through", "profanity", "module" ]
def check_profanity(msg): if msg in custom_words: return True return profanity.contains_profanity(msg)
[ "def", "check_profanity", "(", "msg", ")", ":", "if", "msg", "in", "custom_words", ":", "return", "True", "return", "profanity", ".", "contains_profanity", "(", "msg", ")" ]
check if message contains profanity through profanity module
[ "check", "if", "message", "contains", "profanity", "through", "profanity", "module" ]
[ "''' check if message contains profanity through profanity module '''" ]
[ { "param": "msg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "msg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b4369cfea4919134cace184629106f641511fd75
ithaaswin/TeachersPetBot
src/profanity.py
[ "MIT" ]
Python
censor_profanity
<not_specific>
def censor_profanity(msg): ''' take action on the profanity by censoring it ''' if msg in custom_words: msg = '****' return profanity.censor(msg)
take action on the profanity by censoring it
take action on the profanity by censoring it
[ "take", "action", "on", "the", "profanity", "by", "censoring", "it" ]
def censor_profanity(msg): if msg in custom_words: msg = '****' return profanity.censor(msg)
[ "def", "censor_profanity", "(", "msg", ")", ":", "if", "msg", "in", "custom_words", ":", "msg", "=", "'****'", "return", "profanity", ".", "censor", "(", "msg", ")" ]
take action on the profanity by censoring it
[ "take", "action", "on", "the", "profanity", "by", "censoring", "it" ]
[ "''' take action on the profanity by censoring it '''" ]
[ { "param": "msg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "msg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }