repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
mitsei/dlkit
dlkit/json_/proxy/sessions.py
ProxySession.get_proxy
def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - au...
python
def get_proxy(self, input_): """Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - au...
[ "def", "get_proxy", "(", "self", ",", "input_", ")", ":", "if", "input_", ".", "_http_request", "is", "not", "None", ":", "authentication", "=", "Authentication", "(", ")", "authentication", ".", "set_django_user", "(", "input_", ".", "_http_request", ".", "...
Gets a proxy. arg: input (osid.proxy.ProxyCondition): a proxy condition return: (osid.proxy.Proxy) - a proxy raise: NullArgument - ``input`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure raise: Unsu...
[ "Gets", "a", "proxy", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/proxy/sessions.py#L45-L65
mfitzp/biocyc
biocyc/biocyc.py
to_plain_text
def to_plain_text(str): ''' Return a plain-text version of a given string This is a dumb approach that tags and then removing entity markers but this is fine for the content from biocyc where entities are β etc. Stripping in this way turns these into plaintext 'beta' which is preferable ...
python
def to_plain_text(str): ''' Return a plain-text version of a given string This is a dumb approach that tags and then removing entity markers but this is fine for the content from biocyc where entities are β etc. Stripping in this way turns these into plaintext 'beta' which is preferable ...
[ "def", "to_plain_text", "(", "str", ")", ":", "str", "=", "strip_tags_re", ".", "sub", "(", "''", ",", "str", ")", "str", "=", "strip_entities_re", ".", "sub", "(", "''", ",", "str", ")", "return", "str" ]
Return a plain-text version of a given string This is a dumb approach that tags and then removing entity markers but this is fine for the content from biocyc where entities are β etc. Stripping in this way turns these into plaintext 'beta' which is preferable to unicode
[ "Return", "a", "plain", "-", "text", "version", "of", "a", "given", "string" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L99-L112
mfitzp/biocyc
biocyc/biocyc.py
BioCyc.get_from_cache
def get_from_cache(self, org_id, id): ''' Get an object from the cache Use all cache folders available (primary first, then secondary in order) and look for the ID in the dir if found unpickle and return the object, else return False FIXME: Check for expiry of o...
python
def get_from_cache(self, org_id, id): ''' Get an object from the cache Use all cache folders available (primary first, then secondary in order) and look for the ID in the dir if found unpickle and return the object, else return False FIXME: Check for expiry of o...
[ "def", "get_from_cache", "(", "self", ",", "org_id", ",", "id", ")", ":", "current_time", "=", "datetime", ".", "now", "(", ")", "# Check memory cache first", "if", "id", "in", "self", ".", "memory_cache", "[", "org_id", "]", ":", "obj", "=", "self", "."...
Get an object from the cache Use all cache folders available (primary first, then secondary in order) and look for the ID in the dir if found unpickle and return the object, else return False FIXME: Check for expiry of object! Return false is expired (will auto-refetch and over...
[ "Get", "an", "object", "from", "the", "cache", "Use", "all", "cache", "folders", "available", "(", "primary", "first", "then", "secondary", "in", "order", ")", "and", "look", "for", "the", "ID", "in", "the", "dir", "if", "found", "unpickle", "and", "retu...
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L338-L379
mfitzp/biocyc
biocyc/biocyc.py
BioCyc.cache
def cache(self, obj): ''' Store an object in the cache (this allows temporarily assigning a new cache for exploring the DB without affecting the stored version ''' # Check cache path exists for current obj write_path = os.path.join( self.cache_path, obj.org_id ) i...
python
def cache(self, obj): ''' Store an object in the cache (this allows temporarily assigning a new cache for exploring the DB without affecting the stored version ''' # Check cache path exists for current obj write_path = os.path.join( self.cache_path, obj.org_id ) i...
[ "def", "cache", "(", "self", ",", "obj", ")", ":", "# Check cache path exists for current obj", "write_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "cache_path", ",", "obj", ".", "org_id", ")", "if", "not", "os", ".", "path", ".", "exist...
Store an object in the cache (this allows temporarily assigning a new cache for exploring the DB without affecting the stored version
[ "Store", "an", "object", "in", "the", "cache", "(", "this", "allows", "temporarily", "assigning", "a", "new", "cache", "for", "exploring", "the", "DB", "without", "affecting", "the", "stored", "version" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L381-L396
mfitzp/biocyc
biocyc/biocyc.py
BioCyc.get_for_org
def get_for_org(self, org_id, ids, skip_cache=False): ''' Returns objects for the given identifiers If called with a list returns a list, else returns a single entity ''' t = type(ids) if t != list: ids = [ids] objs = [] ...
python
def get_for_org(self, org_id, ids, skip_cache=False): ''' Returns objects for the given identifiers If called with a list returns a list, else returns a single entity ''' t = type(ids) if t != list: ids = [ids] objs = [] ...
[ "def", "get_for_org", "(", "self", ",", "org_id", ",", "ids", ",", "skip_cache", "=", "False", ")", ":", "t", "=", "type", "(", "ids", ")", "if", "t", "!=", "list", ":", "ids", "=", "[", "ids", "]", "objs", "=", "[", "]", "for", "id", "in", "...
Returns objects for the given identifiers If called with a list returns a list, else returns a single entity
[ "Returns", "objects", "for", "the", "given", "identifiers", "If", "called", "with", "a", "list", "returns", "a", "list", "else", "returns", "a", "single", "entity" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L401-L436
mfitzp/biocyc
biocyc/biocyc.py
BioCycEntityBase.import_from_xml
def import_from_xml(self, xml): ''' Standard imports for all types of object These must fail gracefully, skip if not found ''' self._import_orgid(xml) self._import_parents_from_xml(xml) self._import_instances_from_xml(xml) self._import_common_name(xml) ...
python
def import_from_xml(self, xml): ''' Standard imports for all types of object These must fail gracefully, skip if not found ''' self._import_orgid(xml) self._import_parents_from_xml(xml) self._import_instances_from_xml(xml) self._import_common_name(xml) ...
[ "def", "import_from_xml", "(", "self", ",", "xml", ")", ":", "self", ".", "_import_orgid", "(", "xml", ")", "self", ".", "_import_parents_from_xml", "(", "xml", ")", "self", ".", "_import_instances_from_xml", "(", "xml", ")", "self", ".", "_import_common_name"...
Standard imports for all types of object These must fail gracefully, skip if not found
[ "Standard", "imports", "for", "all", "types", "of", "object", "These", "must", "fail", "gracefully", "skip", "if", "not", "found" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L551-L561
mfitzp/biocyc
biocyc/biocyc.py
BioCycEntityBase._set_var_from_xml_text
def _set_var_from_xml_text(self, xml, xmlpath, var): ''' Sets a object variable from the xml if it is there and passing it through a data conversion based on the variable datatype ''' xmle = xml.find(xmlpath) if xmle is not None: setattr(self, var, type_conver...
python
def _set_var_from_xml_text(self, xml, xmlpath, var): ''' Sets a object variable from the xml if it is there and passing it through a data conversion based on the variable datatype ''' xmle = xml.find(xmlpath) if xmle is not None: setattr(self, var, type_conver...
[ "def", "_set_var_from_xml_text", "(", "self", ",", "xml", ",", "xmlpath", ",", "var", ")", ":", "xmle", "=", "xml", ".", "find", "(", "xmlpath", ")", "if", "xmle", "is", "not", "None", ":", "setattr", "(", "self", ",", "var", ",", "type_converter", "...
Sets a object variable from the xml if it is there and passing it through a data conversion based on the variable datatype
[ "Sets", "a", "object", "variable", "from", "the", "xml", "if", "it", "is", "there", "and", "passing", "it", "through", "a", "data", "conversion", "based", "on", "the", "variable", "datatype" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L630-L637
mfitzp/biocyc
biocyc/biocyc.py
BioCycEntityBase._set_list_ids_from_xml_iter
def _set_list_ids_from_xml_iter(self, xml, xmlpath, var): ''' Set a list variable from the frameids of matching xml entities ''' es = xml.iterfind(xmlpath) if es is not None: l = [] for e in es: l.append( e.attrib['frameid'] ) ...
python
def _set_list_ids_from_xml_iter(self, xml, xmlpath, var): ''' Set a list variable from the frameids of matching xml entities ''' es = xml.iterfind(xmlpath) if es is not None: l = [] for e in es: l.append( e.attrib['frameid'] ) ...
[ "def", "_set_list_ids_from_xml_iter", "(", "self", ",", "xml", ",", "xmlpath", ",", "var", ")", ":", "es", "=", "xml", ".", "iterfind", "(", "xmlpath", ")", "if", "es", "is", "not", "None", ":", "l", "=", "[", "]", "for", "e", "in", "es", ":", "l...
Set a list variable from the frameids of matching xml entities
[ "Set", "a", "list", "variable", "from", "the", "frameids", "of", "matching", "xml", "entities" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L639-L649
mfitzp/biocyc
biocyc/biocyc.py
BioCycEntityBase._set_id_from_xml_frameid
def _set_id_from_xml_frameid(self, xml, xmlpath, var): ''' Set a single variable with the frameids of matching entity ''' e = xml.find(xmlpath) if e is not None: setattr(self, var, e.attrib['frameid'])
python
def _set_id_from_xml_frameid(self, xml, xmlpath, var): ''' Set a single variable with the frameids of matching entity ''' e = xml.find(xmlpath) if e is not None: setattr(self, var, e.attrib['frameid'])
[ "def", "_set_id_from_xml_frameid", "(", "self", ",", "xml", ",", "xmlpath", ",", "var", ")", ":", "e", "=", "xml", ".", "find", "(", "xmlpath", ")", "if", "e", "is", "not", "None", ":", "setattr", "(", "self", ",", "var", ",", "e", ".", "attrib", ...
Set a single variable with the frameids of matching entity
[ "Set", "a", "single", "variable", "with", "the", "frameids", "of", "matching", "entity" ]
train
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L651-L657
mitsei/dlkit
dlkit/json_/resource/objects.py
Resource.get_avatar_id
def get_avatar_id(self): """Gets the asset ``Id``. return: (osid.id.Id) - the asset ``Id`` raise: IllegalState - ``has_avatar()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource.get_ava...
python
def get_avatar_id(self): """Gets the asset ``Id``. return: (osid.id.Id) - the asset ``Id`` raise: IllegalState - ``has_avatar()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource.get_ava...
[ "def", "get_avatar_id", "(", "self", ")", ":", "# Implemented from template for osid.resource.Resource.get_avatar_id_template", "if", "not", "bool", "(", "self", ".", "_my_map", "[", "'avatarId'", "]", ")", ":", "raise", "errors", ".", "IllegalState", "(", "'this Reso...
Gets the asset ``Id``. return: (osid.id.Id) - the asset ``Id`` raise: IllegalState - ``has_avatar()`` is ``false`` *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "asset", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L87-L99
mitsei/dlkit
dlkit/json_/resource/objects.py
Resource.get_avatar
def get_avatar(self): """Gets the asset. return: (osid.repository.Asset) - the asset raise: IllegalState - ``has_avatar()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Imple...
python
def get_avatar(self): """Gets the asset. return: (osid.repository.Asset) - the asset raise: IllegalState - ``has_avatar()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Imple...
[ "def", "get_avatar", "(", "self", ")", ":", "# Implemented from template for osid.resource.Resource.get_avatar_template", "if", "not", "bool", "(", "self", ".", "_my_map", "[", "'avatarId'", "]", ")", ":", "raise", "errors", ".", "IllegalState", "(", "'this Resource h...
Gets the asset. return: (osid.repository.Asset) - the asset raise: IllegalState - ``has_avatar()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "asset", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L103-L121
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm._init_metadata
def _init_metadata(self, **kwargs): """Initialize form metadata""" osid_objects.OsidObjectForm._init_metadata(self, **kwargs) self._group_default = self._mdata['group']['default_boolean_values'][0] self._avatar_default = self._mdata['avatar']['default_id_values'][0]
python
def _init_metadata(self, **kwargs): """Initialize form metadata""" osid_objects.OsidObjectForm._init_metadata(self, **kwargs) self._group_default = self._mdata['group']['default_boolean_values'][0] self._avatar_default = self._mdata['avatar']['default_id_values'][0]
[ "def", "_init_metadata", "(", "self", ",", "*", "*", "kwargs", ")", ":", "osid_objects", ".", "OsidObjectForm", ".", "_init_metadata", "(", "self", ",", "*", "*", "kwargs", ")", "self", ".", "_group_default", "=", "self", ".", "_mdata", "[", "'group'", "...
Initialize form metadata
[ "Initialize", "form", "metadata" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L179-L183
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm._init_map
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['assignedBinIds'] = [str(kwargs['bin_id'])] self._my_map['group'] = self._group_default self._my_map['avatarId'] = self....
python
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['assignedBinIds'] = [str(kwargs['bin_id'])] self._my_map['group'] = self._group_default self._my_map['avatarId'] = self....
[ "def", "_init_map", "(", "self", ",", "record_types", "=", "None", ",", "*", "*", "kwargs", ")", ":", "osid_objects", ".", "OsidObjectForm", ".", "_init_map", "(", "self", ",", "record_types", "=", "record_types", ")", "self", ".", "_my_map", "[", "'assign...
Initialize form map
[ "Initialize", "form", "map" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L185-L190
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.get_group_metadata
def get_group_metadata(self): """Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada...
python
def get_group_metadata(self): """Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada...
[ "def", "get_group_metadata", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'group'", "]", ")", "metadata", ".", "update", "(", "{", "'existing_b...
Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "a", "group", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L192-L202
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.set_group
def set_group(self, group): """Sets the resource as a group. arg: group (boolean): ``true`` if this resource is a group, ``false`` otherwise raise: InvalidArgument - ``group`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: ma...
python
def set_group(self, group): """Sets the resource as a group. arg: group (boolean): ``true`` if this resource is a group, ``false`` otherwise raise: InvalidArgument - ``group`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: ma...
[ "def", "set_group", "(", "self", ",", "group", ")", ":", "# Implemented from template for osid.resource.ResourceForm.set_group_template", "if", "self", ".", "get_group_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess", "(", ...
Sets the resource as a group. arg: group (boolean): ``true`` if this resource is a group, ``false`` otherwise raise: InvalidArgument - ``group`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemen...
[ "Sets", "the", "resource", "as", "a", "group", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L207-L222
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.clear_group
def clear_group(self): """Clears the group designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceFo...
python
def clear_group(self): """Clears the group designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceFo...
[ "def", "clear_group", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.clear_group_template", "if", "(", "self", ".", "get_group_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_group_metadata", "(", ")", "....
Clears the group designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Clears", "the", "group", "designation", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L224-L236
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.get_avatar_metadata
def get_avatar_metadata(self): """Gets the metadata for an asset. return: (osid.Metadata) - metadata for the asset *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template meta...
python
def get_avatar_metadata(self): """Gets the metadata for an asset. return: (osid.Metadata) - metadata for the asset *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template meta...
[ "def", "get_avatar_metadata", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'avatar'", "]", ")", "metadata", ".", "update", "(", "{", "'existing...
Gets the metadata for an asset. return: (osid.Metadata) - metadata for the asset *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "an", "asset", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L240-L250
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.set_avatar
def set_avatar(self, asset_id): """Sets the avatar asset. arg: asset_id (osid.id.Id): an asset ``Id`` raise: InvalidArgument - ``asset_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* ...
python
def set_avatar(self, asset_id): """Sets the avatar asset. arg: asset_id (osid.id.Id): an asset ``Id`` raise: InvalidArgument - ``asset_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* ...
[ "def", "set_avatar", "(", "self", ",", "asset_id", ")", ":", "# Implemented from template for osid.resource.ResourceForm.set_avatar_template", "if", "self", ".", "get_avatar_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess", "...
Sets the avatar asset. arg: asset_id (osid.id.Id): an asset ``Id`` raise: InvalidArgument - ``asset_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Sets", "the", "avatar", "asset", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L255-L269
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.clear_avatar
def clear_avatar(self): """Clears the asset. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_av...
python
def clear_avatar(self): """Clears the asset. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_av...
[ "def", "clear_avatar", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.clear_avatar_template", "if", "(", "self", ".", "get_avatar_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_avatar_metadata", "(", ")", ...
Clears the asset. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Clears", "the", "asset", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L271-L283
mitsei/dlkit
dlkit/json_/resource/objects.py
BinNode.get_bin
def get_bin(self): """Gets the ``Bin`` at this node. return: (osid.resource.Bin) - the bin represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('RESOURCE', runtime=self._...
python
def get_bin(self): """Gets the ``Bin`` at this node. return: (osid.resource.Bin) - the bin represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('RESOURCE', runtime=self._...
[ "def", "get_bin", "(", "self", ")", ":", "if", "self", ".", "_lookup_session", "is", "None", ":", "mgr", "=", "get_provider_manager", "(", "'RESOURCE'", ",", "runtime", "=", "self", ".", "_runtime", ",", "proxy", "=", "self", ".", "_proxy", ")", "self", ...
Gets the ``Bin`` at this node. return: (osid.resource.Bin) - the bin represented by this node *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Bin", "at", "this", "node", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L607-L617
mitsei/dlkit
dlkit/json_/resource/objects.py
BinNode.get_parent_bin_nodes
def get_parent_bin_nodes(self): """Gets the parents of this bin. return: (osid.resource.BinNodeList) - the parents of the ``id`` *compliance: mandatory -- This method must be implemented.* """ parent_bin_nodes = [] for node in self._my_map['parentNodes']: pa...
python
def get_parent_bin_nodes(self): """Gets the parents of this bin. return: (osid.resource.BinNodeList) - the parents of the ``id`` *compliance: mandatory -- This method must be implemented.* """ parent_bin_nodes = [] for node in self._my_map['parentNodes']: pa...
[ "def", "get_parent_bin_nodes", "(", "self", ")", ":", "parent_bin_nodes", "=", "[", "]", "for", "node", "in", "self", ".", "_my_map", "[", "'parentNodes'", "]", ":", "parent_bin_nodes", ".", "append", "(", "BinNode", "(", "node", ".", "_my_map", ",", "runt...
Gets the parents of this bin. return: (osid.resource.BinNodeList) - the parents of the ``id`` *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "parents", "of", "this", "bin", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L621-L635
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_coordinate_type
def supports_coordinate_type(self, coordinate_type): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax i...
python
def supports_coordinate_type(self, coordinate_type): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax i...
[ "def", "supports_coordinate_type", "(", "self", ",", "coordinate_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``COORDINATE``'", "]", ":", "raise", "erro...
Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``COORDINATE`` raise: NullArgument - ``coordina...
[ "Tests", "if", "the", "given", "coordinate", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L304-L318
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_currency_type
def supports_currency_type(self, currency_type): """Tests if the given currency type is supported. arg: currency_type (osid.type.Type): a currency Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``...
python
def supports_currency_type(self, currency_type): """Tests if the given currency type is supported. arg: currency_type (osid.type.Type): a currency Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``...
[ "def", "supports_currency_type", "(", "self", ",", "currency_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``CURRENCY``'", "]", ":", "raise", "errors", ...
Tests if the given currency type is supported. arg: currency_type (osid.type.Type): a currency Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``CURRENCY`` raise: NullArgument - ``currency_type`` ...
[ "Tests", "if", "the", "given", "currency", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L442-L456
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_calendar_type
def supports_calendar_type(self, calendar_type): """Tests if the given calendar type is supported. arg: calendar_type (osid.type.Type): a calendar Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``...
python
def supports_calendar_type(self, calendar_type): """Tests if the given calendar type is supported. arg: calendar_type (osid.type.Type): a calendar Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``...
[ "def", "supports_calendar_type", "(", "self", ",", "calendar_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``DATETIME``'", ",", "'``DURATION``'", "]", ":...
Tests if the given calendar type is supported. arg: calendar_type (osid.type.Type): a calendar Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME`` or ``DURATION`` raise: N...
[ "Tests", "if", "the", "given", "calendar", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L578-L593
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_time_type
def supports_time_type(self, time_type): """Tests if the given time type is supported. arg: time_type (osid.type.Type): a time Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME, DURATION,`...
python
def supports_time_type(self, time_type): """Tests if the given time type is supported. arg: time_type (osid.type.Type): a time Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME, DURATION,`...
[ "def", "supports_time_type", "(", "self", ",", "time_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``DATETIME,'", ",", "'DURATION,``'", ",", "'``TIME``'"...
Tests if the given time type is supported. arg: time_type (osid.type.Type): a time Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``DATETIME, DURATION,`` or ``TIME`` raise: NullAr...
[ "Tests", "if", "the", "given", "time", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L613-L628
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_heading_type
def supports_heading_type(self, heading_type): """Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADI...
python
def supports_heading_type(self, heading_type): """Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADI...
[ "def", "supports_heading_type", "(", "self", ",", "heading_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``HEADING``'", "]", ":", "raise", "errors", "....
Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADING`` raise: NullArgument - ``heading_type`` is ``...
[ "Tests", "if", "the", "given", "heading", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1025-L1039
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_object_type
def supports_object_type(self, object_type): """Tests if the given object type is supported. arg: object_type (osid.type.Type): an object Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not an ``OBJECT``...
python
def supports_object_type(self, object_type): """Tests if the given object type is supported. arg: object_type (osid.type.Type): an object Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not an ``OBJECT``...
[ "def", "supports_object_type", "(", "self", ",", "object_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``OBJECT``'", "]", ":", "raise", "errors", ".", ...
Tests if the given object type is supported. arg: object_type (osid.type.Type): an object Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not an ``OBJECT`` raise: NullArgument - ``object_type`` is ``nul...
[ "Tests", "if", "the", "given", "object", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1299-L1313
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_spatial_unit_record_type
def supports_spatial_unit_record_type(self, spatial_unit_record_type): """Tests if the given spatial unit record type is supported. arg: spatial_unit_record_type (osid.type.Type): a spatial unit record Type return: (boolean) - ``true`` if the type is supported, ``false`` ...
python
def supports_spatial_unit_record_type(self, spatial_unit_record_type): """Tests if the given spatial unit record type is supported. arg: spatial_unit_record_type (osid.type.Type): a spatial unit record Type return: (boolean) - ``true`` if the type is supported, ``false`` ...
[ "def", "supports_spatial_unit_record_type", "(", "self", ",", "spatial_unit_record_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``SPATIALUNIT``'", "]", ":",...
Tests if the given spatial unit record type is supported. arg: spatial_unit_record_type (osid.type.Type): a spatial unit record Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not an ``SPATIALUNI...
[ "Tests", "if", "the", "given", "spatial", "unit", "record", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1387-L1402
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_string_match_type
def supports_string_match_type(self, string_match_type): """Tests if the given string match type is supported. arg: string_match_type (osid.type.Type): a string match type return: (boolean) - ``true`` if the given string match type Is supported, ``false`` otherwise ra...
python
def supports_string_match_type(self, string_match_type): """Tests if the given string match type is supported. arg: string_match_type (osid.type.Type): a string match type return: (boolean) - ``true`` if the given string match type Is supported, ``false`` otherwise ra...
[ "def", "supports_string_match_type", "(", "self", ",", "string_match_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``STRING``'", "]", ":", "raise", "erro...
Tests if the given string match type is supported. arg: string_match_type (osid.type.Type): a string match type return: (boolean) - ``true`` if the given string match type Is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``STRING`` raise: Null...
[ "Tests", "if", "the", "given", "string", "match", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1597-L1611
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_version_type
def supports_version_type(self, version_type): """Tests if the given version type is supported. arg: version_type (osid.type.Type): a version Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``VERSI...
python
def supports_version_type(self, version_type): """Tests if the given version type is supported. arg: version_type (osid.type.Type): a version Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``VERSI...
[ "def", "supports_version_type", "(", "self", ",", "version_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``VERSION``'", "]", ":", "raise", "errors", "....
Tests if the given version type is supported. arg: version_type (osid.type.Type): a version Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``VERSION`` raise: NullArgument - ``version_type`` is ``...
[ "Tests", "if", "the", "given", "version", "type", "is", "supported", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1858-L1872
morngrar/betterdialogs
betterdialogs/bettertext.py
BetterText.get
def get(self, index1, index2=None): """Return the text from INDEX1 to INDEX2 (not included).""" returnvar = self.tk.call(self._w, 'get', index1, index2) return returnvar.strip()
python
def get(self, index1, index2=None): """Return the text from INDEX1 to INDEX2 (not included).""" returnvar = self.tk.call(self._w, 'get', index1, index2) return returnvar.strip()
[ "def", "get", "(", "self", ",", "index1", ",", "index2", "=", "None", ")", ":", "returnvar", "=", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'get'", ",", "index1", ",", "index2", ")", "return", "returnvar", ".", "strip", "(", "...
Return the text from INDEX1 to INDEX2 (not included).
[ "Return", "the", "text", "from", "INDEX1", "to", "INDEX2", "(", "not", "included", ")", "." ]
train
https://github.com/morngrar/betterdialogs/blob/185570c8dd6ea3718fef5e09ac1647e716d8bff5/betterdialogs/bettertext.py#L9-L12
mitsei/dlkit
dlkit/primordium/locale/types/format.py
get_type_data
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'okapia.net', 'namespace': 'TextFormats', 'identifier': name, '...
python
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'okapia.net', 'namespace': 'TextFormats', 'identifier': name, '...
[ "def", "get_type_data", "(", "name", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "try", ":", "return", "{", "'authority'", ":", "'okapia.net'", ",", "'namespace'", ":", "'TextFormats'", ",", "'identifier'", ":", "name", ",", "'domain'", ":", "...
Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type
[ "Return", "dictionary", "representation", "of", "type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/primordium/locale/types/format.py#L32-L51
discontinue/django-secure-js-login
secure_js_login/decorators.py
log_view
def log_view(func): """ Helpful while debugging Selenium unittests. e.g.: server response an error in AJAX requests """ @functools.wraps(func) def view_logger(*args, **kwargs): log.debug("call view %r", func.__name__) try: response = func(*args, **kwargs) exc...
python
def log_view(func): """ Helpful while debugging Selenium unittests. e.g.: server response an error in AJAX requests """ @functools.wraps(func) def view_logger(*args, **kwargs): log.debug("call view %r", func.__name__) try: response = func(*args, **kwargs) exc...
[ "def", "log_view", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "view_logger", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "log", ".", "debug", "(", "\"call view %r\"", ",", "func", ".", "__name__", ")", ...
Helpful while debugging Selenium unittests. e.g.: server response an error in AJAX requests
[ "Helpful", "while", "debugging", "Selenium", "unittests", ".", "e", ".", "g", ".", ":", "server", "response", "an", "error", "in", "AJAX", "requests" ]
train
https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/decorators.py#L25-L44
mitsei/dlkit
dlkit/json_/list_utilities.py
move_id_ahead
def move_id_ahead(element_id, reference_id, idstr_list): """Moves element_id ahead of reference_id in the list""" if element_id == reference_id: return idstr_list idstr_list.remove(str(element_id)) reference_index = idstr_list.index(str(reference_id)) idstr_list.insert(reference_index, str(e...
python
def move_id_ahead(element_id, reference_id, idstr_list): """Moves element_id ahead of reference_id in the list""" if element_id == reference_id: return idstr_list idstr_list.remove(str(element_id)) reference_index = idstr_list.index(str(reference_id)) idstr_list.insert(reference_index, str(e...
[ "def", "move_id_ahead", "(", "element_id", ",", "reference_id", ",", "idstr_list", ")", ":", "if", "element_id", "==", "reference_id", ":", "return", "idstr_list", "idstr_list", ".", "remove", "(", "str", "(", "element_id", ")", ")", "reference_index", "=", "i...
Moves element_id ahead of reference_id in the list
[ "Moves", "element_id", "ahead", "of", "reference_id", "in", "the", "list" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/list_utilities.py#L6-L13
ayust/kitnirc
skeleton/main.py
initialize_logging
def initialize_logging(args): """Configure the root logger with some sensible defaults.""" log_handler = logging.StreamHandler() log_formatter = logging.Formatter( "%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s") log_handler.setFormatter(log_formatter) root_logger = logging....
python
def initialize_logging(args): """Configure the root logger with some sensible defaults.""" log_handler = logging.StreamHandler() log_formatter = logging.Formatter( "%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s") log_handler.setFormatter(log_formatter) root_logger = logging....
[ "def", "initialize_logging", "(", "args", ")", ":", "log_handler", "=", "logging", ".", "StreamHandler", "(", ")", "log_formatter", "=", "logging", ".", "Formatter", "(", "\"%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s\"", ")", "log_handler", ".", "setF...
Configure the root logger with some sensible defaults.
[ "Configure", "the", "root", "logger", "with", "some", "sensible", "defaults", "." ]
train
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/skeleton/main.py#L38-L47
ayust/kitnirc
skeleton/main.py
main
def main(): """Run the bot.""" args = parser.parse_args() initialize_logging(args) # Allow expansion of paths even if the shell doesn't do it config_path = os.path.abspath(os.path.expanduser(args.config)) client = kitnirc.client.Client() controller = kitnirc.modular.Controller(client, conf...
python
def main(): """Run the bot.""" args = parser.parse_args() initialize_logging(args) # Allow expansion of paths even if the shell doesn't do it config_path = os.path.abspath(os.path.expanduser(args.config)) client = kitnirc.client.Client() controller = kitnirc.modular.Controller(client, conf...
[ "def", "main", "(", ")", ":", "args", "=", "parser", ".", "parse_args", "(", ")", "initialize_logging", "(", "args", ")", "# Allow expansion of paths even if the shell doesn't do it", "config_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path",...
Run the bot.
[ "Run", "the", "bot", "." ]
train
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/skeleton/main.py#L50-L109
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntry.get_agent_id
def get_agent_id(self): """Gets the agent ``Id`` who created this entry. return: (osid.id.Id) - the agent ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource.get_avatar_id_template if not bool(sel...
python
def get_agent_id(self): """Gets the agent ``Id`` who created this entry. return: (osid.id.Id) - the agent ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource.get_avatar_id_template if not bool(sel...
[ "def", "get_agent_id", "(", "self", ")", ":", "# Implemented from template for osid.resource.Resource.get_avatar_id_template", "if", "not", "bool", "(", "self", ".", "_my_map", "[", "'agentId'", "]", ")", ":", "raise", "errors", ".", "IllegalState", "(", "'this LogEnt...
Gets the agent ``Id`` who created this entry. return: (osid.id.Id) - the agent ``Id`` *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "agent", "Id", "who", "created", "this", "entry", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L90-L101
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntry.get_agent
def get_agent(self): """Gets the ``Agent`` who created this entry. return: (osid.authentication.Agent) - the ``Agent`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os...
python
def get_agent(self): """Gets the ``Agent`` who created this entry. return: (osid.authentication.Agent) - the ``Agent`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os...
[ "def", "get_agent", "(", "self", ")", ":", "# Implemented from template for osid.resource.Resource.get_avatar_template", "if", "not", "bool", "(", "self", ".", "_my_map", "[", "'agentId'", "]", ")", ":", "raise", "errors", ".", "IllegalState", "(", "'this LogEntry has...
Gets the ``Agent`` who created this entry. return: (osid.authentication.Agent) - the ``Agent`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Agent", "who", "created", "this", "entry", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L105-L122
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.get_priority_metadata
def get_priority_metadata(self): """Gets the metadata for a priority type. return: (osid.Metadata) - metadata for the priority *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogEntryForm.get_priority_metadata ...
python
def get_priority_metadata(self): """Gets the metadata for a priority type. return: (osid.Metadata) - metadata for the priority *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogEntryForm.get_priority_metadata ...
[ "def", "get_priority_metadata", "(", "self", ")", ":", "# Implemented from template for osid.logging.LogEntryForm.get_priority_metadata", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'priority'", "]", ")", "metadata", ".", "update", "(", "{", "'existing_ty...
Gets the metadata for a priority type. return: (osid.Metadata) - metadata for the priority *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "a", "priority", "type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L200-L210
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.set_priority
def set_priority(self, priority): """Sets the priority. arg: priority (osid.type.Type): the new priority raise: InvalidArgument - ``priority`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``priority`` is ``null`` *complia...
python
def set_priority(self, priority): """Sets the priority. arg: priority (osid.type.Type): the new priority raise: InvalidArgument - ``priority`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``priority`` is ``null`` *complia...
[ "def", "set_priority", "(", "self", ",", "priority", ")", ":", "# Implemented from template for osid.logging.LogEntryForm.set_priority", "if", "self", ".", "get_priority_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess", "(", ...
Sets the priority. arg: priority (osid.type.Type): the new priority raise: InvalidArgument - ``priority`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``priority`` is ``null`` *compliance: mandatory -- This method must be impleme...
[ "Sets", "the", "priority", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L215-L230
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.clear_priority
def clear_priority(self): """Removes the priority. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogE...
python
def clear_priority(self): """Removes the priority. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogE...
[ "def", "clear_priority", "(", "self", ")", ":", "# Implemented from template for osid.logging.LogEntryForm.clear_priority_template", "if", "(", "self", ".", "get_priority_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_priority_metadata", "(", ...
Removes the priority. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Removes", "the", "priority", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L232-L244
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.get_timestamp_metadata
def get_timestamp_metadata(self): """Gets the metadata for a timestamp. return: (osid.Metadata) - metadata for the timestamp *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template ...
python
def get_timestamp_metadata(self): """Gets the metadata for a timestamp. return: (osid.Metadata) - metadata for the timestamp *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template ...
[ "def", "get_timestamp_metadata", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'timestamp'", "]", ")", "metadata", ".", "update", "(", "{", "'ex...
Gets the metadata for a timestamp. return: (osid.Metadata) - metadata for the timestamp *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "a", "timestamp", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L248-L258
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.set_timestamp
def set_timestamp(self, timestamp): """Sets the timestamp. arg: timestamp (osid.calendaring.DateTime): the new timestamp raise: InvalidArgument - ``timestamp`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``timestamp`` is ``null`...
python
def set_timestamp(self, timestamp): """Sets the timestamp. arg: timestamp (osid.calendaring.DateTime): the new timestamp raise: InvalidArgument - ``timestamp`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``timestamp`` is ``null`...
[ "def", "set_timestamp", "(", "self", ",", "timestamp", ")", ":", "# Implemented from template for osid.assessment.AssessmentOfferedForm.set_start_time_template", "if", "self", ".", "get_timestamp_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ...
Sets the timestamp. arg: timestamp (osid.calendaring.DateTime): the new timestamp raise: InvalidArgument - ``timestamp`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``timestamp`` is ``null`` *compliance: mandatory -- This method...
[ "Sets", "the", "timestamp", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L263-L280
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.get_agent_metadata
def get_agent_metadata(self): """Gets the metadata for the agent. return: (osid.Metadata) - metadata for the agent *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template meta...
python
def get_agent_metadata(self): """Gets the metadata for the agent. return: (osid.Metadata) - metadata for the agent *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template meta...
[ "def", "get_agent_metadata", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'agent'", "]", ")", "metadata", ".", "update", "(", "{", "'existing_i...
Gets the metadata for the agent. return: (osid.Metadata) - metadata for the agent *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "the", "agent", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L284-L294
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogEntryForm.set_agent
def set_agent(self, agent_id): """Sets the agent. arg: agent_id (osid.id.Id): the new agent raise: InvalidArgument - ``agent_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``agent_id`` is ``null`` *compliance: mandator...
python
def set_agent(self, agent_id): """Sets the agent. arg: agent_id (osid.id.Id): the new agent raise: InvalidArgument - ``agent_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``agent_id`` is ``null`` *compliance: mandator...
[ "def", "set_agent", "(", "self", ",", "agent_id", ")", ":", "# Implemented from template for osid.resource.ResourceForm.set_avatar_template", "if", "self", ".", "get_agent_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess", "("...
Sets the agent. arg: agent_id (osid.id.Id): the new agent raise: InvalidArgument - ``agent_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``agent_id`` is ``null`` *compliance: mandatory -- This method must be implemented.*
[ "Sets", "the", "agent", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L299-L314
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogNode.get_log
def get_log(self): """Gets the ``Log`` at this node. return: (osid.logging.Log) - the log represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('LOGGING', runtime=self._ru...
python
def get_log(self): """Gets the ``Log`` at this node. return: (osid.logging.Log) - the log represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('LOGGING', runtime=self._ru...
[ "def", "get_log", "(", "self", ")", ":", "if", "self", ".", "_lookup_session", "is", "None", ":", "mgr", "=", "get_provider_manager", "(", "'LOGGING'", ",", "runtime", "=", "self", ".", "_runtime", ",", "proxy", "=", "self", ".", "_proxy", ")", "self", ...
Gets the ``Log`` at this node. return: (osid.logging.Log) - the log represented by this node *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Log", "at", "this", "node", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L550-L560
mitsei/dlkit
dlkit/json_/logging_/objects.py
LogNode.get_parent_log_nodes
def get_parent_log_nodes(self): """Gets the parents of this log. return: (osid.logging.LogNodeList) - the parents of this log *compliance: mandatory -- This method must be implemented.* """ parent_log_nodes = [] for node in self._my_map['parentNodes']: paren...
python
def get_parent_log_nodes(self): """Gets the parents of this log. return: (osid.logging.LogNodeList) - the parents of this log *compliance: mandatory -- This method must be implemented.* """ parent_log_nodes = [] for node in self._my_map['parentNodes']: paren...
[ "def", "get_parent_log_nodes", "(", "self", ")", ":", "parent_log_nodes", "=", "[", "]", "for", "node", "in", "self", ".", "_my_map", "[", "'parentNodes'", "]", ":", "parent_log_nodes", ".", "append", "(", "LogNode", "(", "node", ".", "_my_map", ",", "runt...
Gets the parents of this log. return: (osid.logging.LogNodeList) - the parents of this log *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "parents", "of", "this", "log", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/objects.py#L564-L578
5monkeys/content-io
cio/utils/formatters.py
ContentFormatter._brace_key
def _brace_key(self, key): """ key: 'x' -> '{x}' """ if isinstance(key, six.integer_types): t = str key = t(key) else: t = type(key) return t(u'{') + key + t(u'}')
python
def _brace_key(self, key): """ key: 'x' -> '{x}' """ if isinstance(key, six.integer_types): t = str key = t(key) else: t = type(key) return t(u'{') + key + t(u'}')
[ "def", "_brace_key", "(", "self", ",", "key", ")", ":", "if", "isinstance", "(", "key", ",", "six", ".", "integer_types", ")", ":", "t", "=", "str", "key", "=", "t", "(", "key", ")", "else", ":", "t", "=", "type", "(", "key", ")", "return", "t"...
key: 'x' -> '{x}'
[ "key", ":", "x", "-", ">", "{", "x", "}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/formatters.py#L52-L61
5monkeys/content-io
cio/utils/formatters.py
ContentFormatter._inject_conversion
def _inject_conversion(self, value, conversion): """ value: '{x}', conversion: 's' -> '{x!s}' """ t = type(value) return value[:-1] + t(u'!') + conversion + t(u'}')
python
def _inject_conversion(self, value, conversion): """ value: '{x}', conversion: 's' -> '{x!s}' """ t = type(value) return value[:-1] + t(u'!') + conversion + t(u'}')
[ "def", "_inject_conversion", "(", "self", ",", "value", ",", "conversion", ")", ":", "t", "=", "type", "(", "value", ")", "return", "value", "[", ":", "-", "1", "]", "+", "t", "(", "u'!'", ")", "+", "conversion", "+", "t", "(", "u'}'", ")" ]
value: '{x}', conversion: 's' -> '{x!s}'
[ "value", ":", "{", "x", "}", "conversion", ":", "s", "-", ">", "{", "x!s", "}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/formatters.py#L63-L68
5monkeys/content-io
cio/utils/formatters.py
ContentFormatter._inject_format_spec
def _inject_format_spec(self, value, format_spec): """ value: '{x}', format_spec: 'f' -> '{x:f}' """ t = type(value) return value[:-1] + t(u':') + format_spec + t(u'}')
python
def _inject_format_spec(self, value, format_spec): """ value: '{x}', format_spec: 'f' -> '{x:f}' """ t = type(value) return value[:-1] + t(u':') + format_spec + t(u'}')
[ "def", "_inject_format_spec", "(", "self", ",", "value", ",", "format_spec", ")", ":", "t", "=", "type", "(", "value", ")", "return", "value", "[", ":", "-", "1", "]", "+", "t", "(", "u':'", ")", "+", "format_spec", "+", "t", "(", "u'}'", ")" ]
value: '{x}', format_spec: 'f' -> '{x:f}'
[ "value", ":", "{", "x", "}", "format_spec", ":", "f", "-", ">", "{", "x", ":", "f", "}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/formatters.py#L70-L75
5monkeys/content-io
cio/utils/formatters.py
ContentFormatter._escape
def _escape(self, bits): """ value: 'foobar {' -> 'foobar {{' value: 'x}' -> 'x}}' """ # for value, field_name, format_spec, conversion in bits: while True: try: value, field_name, format_spec, conversion = next(bits) if value: ...
python
def _escape(self, bits): """ value: 'foobar {' -> 'foobar {{' value: 'x}' -> 'x}}' """ # for value, field_name, format_spec, conversion in bits: while True: try: value, field_name, format_spec, conversion = next(bits) if value: ...
[ "def", "_escape", "(", "self", ",", "bits", ")", ":", "# for value, field_name, format_spec, conversion in bits:", "while", "True", ":", "try", ":", "value", ",", "field_name", ",", "format_spec", ",", "conversion", "=", "next", "(", "bits", ")", "if", "value", ...
value: 'foobar {' -> 'foobar {{' value: 'x}' -> 'x}}'
[ "value", ":", "foobar", "{", "-", ">", "foobar", "{{", "value", ":", "x", "}", "-", ">", "x", "}}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/formatters.py#L77-L92
avladev/pypro
examples/vagrant_todo/todo/todo.py
Index.GET
def GET(self): """ Show page """ todos = model.get_todos() form = self.form() return render.index(todos, form)
python
def GET(self): """ Show page """ todos = model.get_todos() form = self.form() return render.index(todos, form)
[ "def", "GET", "(", "self", ")", ":", "todos", "=", "model", ".", "get_todos", "(", ")", "form", "=", "self", ".", "form", "(", ")", "return", "render", ".", "index", "(", "todos", ",", "form", ")" ]
Show page
[ "Show", "page" ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/examples/vagrant_todo/todo/todo.py#L25-L29
avladev/pypro
examples/vagrant_todo/todo/todo.py
Index.POST
def POST(self): """ Add new entry """ form = self.form() if not form.validates(): todos = model.get_todos() return render.index(todos, form) model.new_todo(form.d.title) raise web.seeother('/')
python
def POST(self): """ Add new entry """ form = self.form() if not form.validates(): todos = model.get_todos() return render.index(todos, form) model.new_todo(form.d.title) raise web.seeother('/')
[ "def", "POST", "(", "self", ")", ":", "form", "=", "self", ".", "form", "(", ")", "if", "not", "form", ".", "validates", "(", ")", ":", "todos", "=", "model", ".", "get_todos", "(", ")", "return", "render", ".", "index", "(", "todos", ",", "form"...
Add new entry
[ "Add", "new", "entry" ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/examples/vagrant_todo/todo/todo.py#L31-L38
avladev/pypro
examples/vagrant_todo/todo/todo.py
Delete.POST
def POST(self, id): """ Delete based on ID """ id = int(id) model.del_todo(id) raise web.seeother('/')
python
def POST(self, id): """ Delete based on ID """ id = int(id) model.del_todo(id) raise web.seeother('/')
[ "def", "POST", "(", "self", ",", "id", ")", ":", "id", "=", "int", "(", "id", ")", "model", ".", "del_todo", "(", "id", ")", "raise", "web", ".", "seeother", "(", "'/'", ")" ]
Delete based on ID
[ "Delete", "based", "on", "ID" ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/examples/vagrant_todo/todo/todo.py#L43-L47
mitsei/dlkit
dlkit/authz_adapter/osid/sessions.py
OsidSession._can
def _can(self, func_name, qualifier_id=None): """Tests if the named function is authorized with agent and qualifier. Also, caches authz's in a dict. It is expected that this will not grow to big, as there are typically only a small number of qualifier + function combinations to store f...
python
def _can(self, func_name, qualifier_id=None): """Tests if the named function is authorized with agent and qualifier. Also, caches authz's in a dict. It is expected that this will not grow to big, as there are typically only a small number of qualifier + function combinations to store f...
[ "def", "_can", "(", "self", ",", "func_name", ",", "qualifier_id", "=", "None", ")", ":", "function_id", "=", "self", ".", "_get_function_id", "(", "func_name", ")", "if", "qualifier_id", "is", "None", ":", "qualifier_id", "=", "self", ".", "_qualifier_id", ...
Tests if the named function is authorized with agent and qualifier. Also, caches authz's in a dict. It is expected that this will not grow to big, as there are typically only a small number of qualifier + function combinations to store for the agent. However, if this becomes an issue, we can ...
[ "Tests", "if", "the", "named", "function", "is", "authorized", "with", "agent", "and", "qualifier", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/authz_adapter/osid/sessions.py#L52-L72
mitsei/dlkit
dlkit/authz_adapter/osid/sessions.py
OsidSession._can_for_object
def _can_for_object(self, func_name, object_id, method_name): """Checks if agent can perform function for object""" can_for_session = self._can(func_name) if (can_for_session or self._object_catalog_session is None or self._override_lookup_session is None): ...
python
def _can_for_object(self, func_name, object_id, method_name): """Checks if agent can perform function for object""" can_for_session = self._can(func_name) if (can_for_session or self._object_catalog_session is None or self._override_lookup_session is None): ...
[ "def", "_can_for_object", "(", "self", ",", "func_name", ",", "object_id", ",", "method_name", ")", ":", "can_for_session", "=", "self", ".", "_can", "(", "func_name", ")", "if", "(", "can_for_session", "or", "self", ".", "_object_catalog_session", "is", "None...
Checks if agent can perform function for object
[ "Checks", "if", "agent", "can", "perform", "function", "for", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/authz_adapter/osid/sessions.py#L74-L93
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageAltTextFormRecord.get_alt_texts_metadata
def get_alt_texts_metadata(self): """Gets the metadata for all alt_texts. return: (osid.Metadata) - metadata for the alt_texts *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._alt_texts_metadata) metadata.update({'existing_string_val...
python
def get_alt_texts_metadata(self): """Gets the metadata for all alt_texts. return: (osid.Metadata) - metadata for the alt_texts *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._alt_texts_metadata) metadata.update({'existing_string_val...
[ "def", "get_alt_texts_metadata", "(", "self", ")", ":", "metadata", "=", "dict", "(", "self", ".", "_alt_texts_metadata", ")", "metadata", ".", "update", "(", "{", "'existing_string_values'", ":", "[", "t", "[", "'text'", "]", "for", "t", "in", "self", "."...
Gets the metadata for all alt_texts. return: (osid.Metadata) - metadata for the alt_texts *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "all", "alt_texts", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L71-L80
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageAltTextFormRecord.add_alt_text
def add_alt_text(self, alt_text): """Adds an alt_text. arg: alt_text (displayText): the new alt_text raise: InvalidArgument - ``alt_text`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``alt_text`` is ``null`` *compliance:...
python
def add_alt_text(self, alt_text): """Adds an alt_text. arg: alt_text (displayText): the new alt_text raise: InvalidArgument - ``alt_text`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``alt_text`` is ``null`` *compliance:...
[ "def", "add_alt_text", "(", "self", ",", "alt_text", ")", ":", "if", "self", ".", "get_alt_texts_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "add_or_replace_value", "(", "'altTexts'", ",", "alt_text", ...
Adds an alt_text. arg: alt_text (displayText): the new alt_text raise: InvalidArgument - ``alt_text`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``alt_text`` is ``null`` *compliance: mandatory -- This method must be implemented...
[ "Adds", "an", "alt_text", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L85-L97
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageAltTextFormRecord.remove_alt_text_language
def remove_alt_text_language(self, language_type): """Removes the specified alt_text. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.get_al...
python
def remove_alt_text_language(self, language_type): """Removes the specified alt_text. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.get_al...
[ "def", "remove_alt_text_language", "(", "self", ",", "language_type", ")", ":", "if", "self", ".", "get_alt_texts_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "remove_field_by_language", "(", "'altTexts'", ...
Removes the specified alt_text. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Removes", "the", "specified", "alt_text", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L112-L123
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageMediaDescriptionFormRecord.get_media_descriptions_metadata
def get_media_descriptions_metadata(self): """Gets the metadata for all media descriptions. return: (osid.Metadata) - metadata for the media descriptions *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._media_descriptions_metadata) m...
python
def get_media_descriptions_metadata(self): """Gets the metadata for all media descriptions. return: (osid.Metadata) - metadata for the media descriptions *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._media_descriptions_metadata) m...
[ "def", "get_media_descriptions_metadata", "(", "self", ")", ":", "metadata", "=", "dict", "(", "self", ".", "_media_descriptions_metadata", ")", "metadata", ".", "update", "(", "{", "'existing_string_values'", ":", "[", "t", "[", "'text'", "]", "for", "t", "in...
Gets the metadata for all media descriptions. return: (osid.Metadata) - metadata for the media descriptions *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "all", "media", "descriptions", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L186-L195
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageMediaDescriptionFormRecord.add_media_description
def add_media_description(self, media_description): """Adds a media_description. arg: media_description (displayText): the new media_description raise: InvalidArgument - ``media_description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArg...
python
def add_media_description(self, media_description): """Adds a media_description. arg: media_description (displayText): the new media_description raise: InvalidArgument - ``media_description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArg...
[ "def", "add_media_description", "(", "self", ",", "media_description", ")", ":", "if", "self", ".", "get_media_descriptions_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "add_or_replace_value", "(", "'mediaD...
Adds a media_description. arg: media_description (displayText): the new media_description raise: InvalidArgument - ``media_description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``media_description`` is ``null`` *compliance: ...
[ "Adds", "a", "media_description", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L200-L212
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageMediaDescriptionFormRecord.remove_media_description_language
def remove_media_description_language(self, language_type): """Removes the specified media_description. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ ...
python
def remove_media_description_language(self, language_type): """Removes the specified media_description. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ ...
[ "def", "remove_media_description_language", "(", "self", ",", "language_type", ")", ":", "if", "self", ".", "get_media_descriptions_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "remove_field_by_language", "("...
Removes the specified media_description. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Removes", "the", "specified", "media_description", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L227-L238
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageVTTFormRecord.add_vtt_file
def add_vtt_file(self, vtt_file, language_type=None): """Adds a vtt file tagged as the given language. arg: vtt_file (displayText): the new vtt_file raise: InvalidArgument - ``vtt_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument...
python
def add_vtt_file(self, vtt_file, language_type=None): """Adds a vtt file tagged as the given language. arg: vtt_file (displayText): the new vtt_file raise: InvalidArgument - ``vtt_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument...
[ "def", "add_vtt_file", "(", "self", ",", "vtt_file", ",", "language_type", "=", "None", ")", ":", "if", "not", "isinstance", "(", "vtt_file", ",", "DataInputStream", ")", ":", "raise", "InvalidArgument", "(", "'vtt_file'", ")", "# for now, don't bother with genusT...
Adds a vtt file tagged as the given language. arg: vtt_file (displayText): the new vtt_file raise: InvalidArgument - ``vtt_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``media_description`` is ``null`` *compliance: mandato...
[ "Adds", "a", "vtt", "file", "tagged", "as", "the", "given", "language", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L322-L342
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
AssetContentMultiLanguageTranscriptFormRecord.add_transcript_file
def add_transcript_file(self, transcript_file, language_type=None): """Adds a transcript file tagged as the given language. arg: transcript_file (displayText): the new transcript_file raise: InvalidArgument - ``transcript_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`...
python
def add_transcript_file(self, transcript_file, language_type=None): """Adds a transcript file tagged as the given language. arg: transcript_file (displayText): the new transcript_file raise: InvalidArgument - ``transcript_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`...
[ "def", "add_transcript_file", "(", "self", ",", "transcript_file", ",", "language_type", "=", "None", ")", ":", "if", "not", "isinstance", "(", "transcript_file", ",", "DataInputStream", ")", ":", "raise", "InvalidArgument", "(", "'transcript_file'", ")", "# for n...
Adds a transcript file tagged as the given language. arg: transcript_file (displayText): the new transcript_file raise: InvalidArgument - ``transcript_file`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``media_description`` is ``null`` ...
[ "Adds", "a", "transcript", "file", "tagged", "as", "the", "given", "language", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L430-L450
mitsei/dlkit
dlkit/primordium/locale/types/unit_system.py
get_type_data
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'birdland.mit.edu', 'namespace': 'unit system', 'identifier': name, ...
python
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'birdland.mit.edu', 'namespace': 'unit system', 'identifier': name, ...
[ "def", "get_type_data", "(", "name", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "try", ":", "return", "{", "'authority'", ":", "'birdland.mit.edu'", ",", "'namespace'", ":", "'unit system'", ",", "'identifier'", ":", "name", ",", "'domain'", ":...
Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type
[ "Return", "dictionary", "representation", "of", "type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/primordium/locale/types/unit_system.py#L16-L35
mitsei/dlkit
dlkit/primordium/locale/types/string.py
get_type_data
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'okapia.net', 'namespace': 'string match types', 'identifier': name, ...
python
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'okapia.net', 'namespace': 'string match types', 'identifier': name, ...
[ "def", "get_type_data", "(", "name", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "try", ":", "return", "{", "'authority'", ":", "'okapia.net'", ",", "'namespace'", ":", "'string match types'", ",", "'identifier'", ":", "name", ",", "'domain'", "...
Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type
[ "Return", "dictionary", "representation", "of", "type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/primordium/locale/types/string.py#L25-L44
mitsei/dlkit
dlkit/json_/authentication/objects.py
AgentForm._init_map
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['assignedAgencyIds'] = [str(kwargs['agency_id'])]
python
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['assignedAgencyIds'] = [str(kwargs['agency_id'])]
[ "def", "_init_map", "(", "self", ",", "record_types", "=", "None", ",", "*", "*", "kwargs", ")", ":", "osid_objects", ".", "OsidObjectForm", ".", "_init_map", "(", "self", ",", "record_types", "=", "record_types", ")", "self", ".", "_my_map", "[", "'assign...
Initialize form map
[ "Initialize", "form", "map" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/objects.py#L117-L120
peopledoc/django-agnocomplete
agnocomplete/core.py
load_settings_sizes
def load_settings_sizes(): """ Load sizes from settings or fallback to the module constants """ page_size = AGNOCOMPLETE_DEFAULT_PAGESIZE settings_page_size = getattr( settings, 'AGNOCOMPLETE_DEFAULT_PAGESIZE', None) page_size = settings_page_size or page_size page_size_min = AGNOCO...
python
def load_settings_sizes(): """ Load sizes from settings or fallback to the module constants """ page_size = AGNOCOMPLETE_DEFAULT_PAGESIZE settings_page_size = getattr( settings, 'AGNOCOMPLETE_DEFAULT_PAGESIZE', None) page_size = settings_page_size or page_size page_size_min = AGNOCO...
[ "def", "load_settings_sizes", "(", ")", ":", "page_size", "=", "AGNOCOMPLETE_DEFAULT_PAGESIZE", "settings_page_size", "=", "getattr", "(", "settings", ",", "'AGNOCOMPLETE_DEFAULT_PAGESIZE'", ",", "None", ")", "page_size", "=", "settings_page_size", "or", "page_size", "p...
Load sizes from settings or fallback to the module constants
[ "Load", "sizes", "from", "settings", "or", "fallback", "to", "the", "module", "constants" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L81-L114
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteBase.is_valid_query
def is_valid_query(self, query): """ Return True if the search query is valid. e.g.: * not empty, * not too short, """ # No query, no item if not query: return False # Query is too short, no item if len(query) < self.get_query_...
python
def is_valid_query(self, query): """ Return True if the search query is valid. e.g.: * not empty, * not too short, """ # No query, no item if not query: return False # Query is too short, no item if len(query) < self.get_query_...
[ "def", "is_valid_query", "(", "self", ",", "query", ")", ":", "# No query, no item", "if", "not", "query", ":", "return", "False", "# Query is too short, no item", "if", "len", "(", "query", ")", "<", "self", ".", "get_query_size_min", "(", ")", ":", "return",...
Return True if the search query is valid. e.g.: * not empty, * not too short,
[ "Return", "True", "if", "the", "search", "query", "is", "valid", "." ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L226-L240
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteChoices.selected
def selected(self, ids): """ Return the selected options as a list of tuples """ result = copy(self.choices) result = filter(lambda x: x[0] in ids, result) # result = ((item, item) for item in result) return list(result)
python
def selected(self, ids): """ Return the selected options as a list of tuples """ result = copy(self.choices) result = filter(lambda x: x[0] in ids, result) # result = ((item, item) for item in result) return list(result)
[ "def", "selected", "(", "self", ",", "ids", ")", ":", "result", "=", "copy", "(", "self", ".", "choices", ")", "result", "=", "filter", "(", "lambda", "x", ":", "x", "[", "0", "]", "in", "ids", ",", "result", ")", "# result = ((item, item) for item in ...
Return the selected options as a list of tuples
[ "Return", "the", "selected", "options", "as", "a", "list", "of", "tuples" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L277-L284
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModelBase.get_model
def get_model(self): """ Return the class Model used by this Agnocomplete """ if hasattr(self, 'model') and self.model: return self.model # Give me a "none" queryset try: none = self.get_queryset().none() return none.model excep...
python
def get_model(self): """ Return the class Model used by this Agnocomplete """ if hasattr(self, 'model') and self.model: return self.model # Give me a "none" queryset try: none = self.get_queryset().none() return none.model excep...
[ "def", "get_model", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'model'", ")", "and", "self", ".", "model", ":", "return", "self", ".", "model", "# Give me a \"none\" queryset", "try", ":", "none", "=", "self", ".", "get_queryset", "(", ")...
Return the class Model used by this Agnocomplete
[ "Return", "the", "class", "Model", "used", "by", "this", "Agnocomplete" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L301-L314
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModelBase.get_field_name
def get_field_name(self): """ Return the model field name to be used as a value, or 'pk' if unset """ if hasattr(self, 'agnocomplete_field') and \ hasattr(self.agnocomplete_field, 'to_field_name'): return self.agnocomplete_field.to_field_name or 'pk' return...
python
def get_field_name(self): """ Return the model field name to be used as a value, or 'pk' if unset """ if hasattr(self, 'agnocomplete_field') and \ hasattr(self.agnocomplete_field, 'to_field_name'): return self.agnocomplete_field.to_field_name or 'pk' return...
[ "def", "get_field_name", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'agnocomplete_field'", ")", "and", "hasattr", "(", "self", ".", "agnocomplete_field", ",", "'to_field_name'", ")", ":", "return", "self", ".", "agnocomplete_field", ".", "to_fi...
Return the model field name to be used as a value, or 'pk' if unset
[ "Return", "the", "model", "field", "name", "to", "be", "used", "as", "a", "value", "or", "pk", "if", "unset" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L325-L332
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel._construct_qs_filter
def _construct_qs_filter(self, field_name): """ Using a field name optionnaly prefixed by `^`, `=`, `@`, return a case-insensitive filter condition name usable as a queryset `filter()` keyword argument. """ if field_name.startswith('^'): return "%s__istartswit...
python
def _construct_qs_filter(self, field_name): """ Using a field name optionnaly prefixed by `^`, `=`, `@`, return a case-insensitive filter condition name usable as a queryset `filter()` keyword argument. """ if field_name.startswith('^'): return "%s__istartswit...
[ "def", "_construct_qs_filter", "(", "self", ",", "field_name", ")", ":", "if", "field_name", ".", "startswith", "(", "'^'", ")", ":", "return", "\"%s__istartswith\"", "%", "field_name", "[", "1", ":", "]", "elif", "field_name", ".", "startswith", "(", "'='",...
Using a field name optionnaly prefixed by `^`, `=`, `@`, return a case-insensitive filter condition name usable as a queryset `filter()` keyword argument.
[ "Using", "a", "field", "name", "optionnaly", "prefixed", "by", "^", "=" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L355-L368
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel.get_queryset_filters
def get_queryset_filters(self, query): """ Return the filtered queryset """ conditions = Q() for field_name in self.fields: conditions |= Q(**{ self._construct_qs_filter(field_name): query }) return conditions
python
def get_queryset_filters(self, query): """ Return the filtered queryset """ conditions = Q() for field_name in self.fields: conditions |= Q(**{ self._construct_qs_filter(field_name): query }) return conditions
[ "def", "get_queryset_filters", "(", "self", ",", "query", ")", ":", "conditions", "=", "Q", "(", ")", "for", "field_name", "in", "self", ".", "fields", ":", "conditions", "|=", "Q", "(", "*", "*", "{", "self", ".", "_construct_qs_filter", "(", "field_nam...
Return the filtered queryset
[ "Return", "the", "filtered", "queryset" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L378-L387
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel.item
def item(self, current_item): """ Return the current item. @param current_item: Current item @type param: django.models @return: Value and label of the current item @rtype : dict """ return { 'value': text(getattr(current_item, self.get_fiel...
python
def item(self, current_item): """ Return the current item. @param current_item: Current item @type param: django.models @return: Value and label of the current item @rtype : dict """ return { 'value': text(getattr(current_item, self.get_fiel...
[ "def", "item", "(", "self", ",", "current_item", ")", ":", "return", "{", "'value'", ":", "text", "(", "getattr", "(", "current_item", ",", "self", ".", "get_field_name", "(", ")", ")", ")", ",", "'label'", ":", "self", ".", "label", "(", "current_item...
Return the current item. @param current_item: Current item @type param: django.models @return: Value and label of the current item @rtype : dict
[ "Return", "the", "current", "item", "." ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L416-L429
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel.build_filtered_queryset
def build_filtered_queryset(self, query, **kwargs): """ Build and return the fully-filtered queryset """ # Take the basic queryset qs = self.get_queryset() # filter it via the query conditions qs = qs.filter(self.get_queryset_filters(query)) return self.bu...
python
def build_filtered_queryset(self, query, **kwargs): """ Build and return the fully-filtered queryset """ # Take the basic queryset qs = self.get_queryset() # filter it via the query conditions qs = qs.filter(self.get_queryset_filters(query)) return self.bu...
[ "def", "build_filtered_queryset", "(", "self", ",", "query", ",", "*", "*", "kwargs", ")", ":", "# Take the basic queryset", "qs", "=", "self", ".", "get_queryset", "(", ")", "# filter it via the query conditions", "qs", "=", "qs", ".", "filter", "(", "self", ...
Build and return the fully-filtered queryset
[ "Build", "and", "return", "the", "fully", "-", "filtered", "queryset" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L458-L466
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel.items
def items(self, query=None, **kwargs): """ Return the items to be sent to the client """ # Cut this, we don't need no empty query if not query: self.__final_queryset = self.get_model().objects.none() return self.serialize(self.__final_queryset) # Q...
python
def items(self, query=None, **kwargs): """ Return the items to be sent to the client """ # Cut this, we don't need no empty query if not query: self.__final_queryset = self.get_model().objects.none() return self.serialize(self.__final_queryset) # Q...
[ "def", "items", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Cut this, we don't need no empty query", "if", "not", "query", ":", "self", ".", "__final_queryset", "=", "self", ".", "get_model", "(", ")", ".", "objects", ".",...
Return the items to be sent to the client
[ "Return", "the", "items", "to", "be", "sent", "to", "the", "client" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L468-L494
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteModel.selected
def selected(self, ids): """ Return the selected options as a list of tuples """ # Cleanup the ID list if self.get_field_name() == 'pk': ids = filter(lambda x: "{}".format(x).isdigit(), copy(ids)) else: ids = filter(lambda x: len("{}".format(x)) > ...
python
def selected(self, ids): """ Return the selected options as a list of tuples """ # Cleanup the ID list if self.get_field_name() == 'pk': ids = filter(lambda x: "{}".format(x).isdigit(), copy(ids)) else: ids = filter(lambda x: len("{}".format(x)) > ...
[ "def", "selected", "(", "self", ",", "ids", ")", ":", "# Cleanup the ID list", "if", "self", ".", "get_field_name", "(", ")", "==", "'pk'", ":", "ids", "=", "filter", "(", "lambda", "x", ":", "\"{}\"", ".", "format", "(", "x", ")", ".", "isdigit", "(...
Return the selected options as a list of tuples
[ "Return", "the", "selected", "options", "as", "a", "list", "of", "tuples" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L496-L515
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteUrlProxy.get_http_method_arg_name
def get_http_method_arg_name(self): """ Return the HTTP function to call and the params/data argument name """ if self.method == 'get': arg_name = 'params' else: arg_name = 'data' return getattr(requests, self.method), arg_name
python
def get_http_method_arg_name(self): """ Return the HTTP function to call and the params/data argument name """ if self.method == 'get': arg_name = 'params' else: arg_name = 'data' return getattr(requests, self.method), arg_name
[ "def", "get_http_method_arg_name", "(", "self", ")", ":", "if", "self", ".", "method", "==", "'get'", ":", "arg_name", "=", "'params'", "else", ":", "arg_name", "=", "'data'", "return", "getattr", "(", "requests", ",", "self", ".", "method", ")", ",", "a...
Return the HTTP function to call and the params/data argument name
[ "Return", "the", "HTTP", "function", "to", "call", "and", "the", "params", "/", "data", "argument", "name" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L544-L552
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteUrlProxy.http_call
def http_call(self, url=None, **kwargs): """ Call the target URL via HTTP and return the JSON result """ if not url: url = self.search_url http_func, arg_name = self.get_http_method_arg_name() # Build the argument dictionary to pass in the http function ...
python
def http_call(self, url=None, **kwargs): """ Call the target URL via HTTP and return the JSON result """ if not url: url = self.search_url http_func, arg_name = self.get_http_method_arg_name() # Build the argument dictionary to pass in the http function ...
[ "def", "http_call", "(", "self", ",", "url", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "url", ":", "url", "=", "self", ".", "search_url", "http_func", ",", "arg_name", "=", "self", ".", "get_http_method_arg_name", "(", ")", "# Build ...
Call the target URL via HTTP and return the JSON result
[ "Call", "the", "target", "URL", "via", "HTTP", "and", "return", "the", "JSON", "result" ]
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L554-L576
peopledoc/django-agnocomplete
agnocomplete/core.py
AgnocompleteUrlProxy.validate
def validate(self, value): """ From a value available on the remote server, the method returns the complete item matching the value. If case the value is not available on the server side or filtered through :meth:`item`, the class:`agnocomplete.exceptions.ItemNotFound` is...
python
def validate(self, value): """ From a value available on the remote server, the method returns the complete item matching the value. If case the value is not available on the server side or filtered through :meth:`item`, the class:`agnocomplete.exceptions.ItemNotFound` is...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "url", "=", "self", ".", "get_item_url", "(", "value", ")", "try", ":", "data", "=", "self", ".", "http_call", "(", "url", "=", "url", ")", "except", "requests", ".", "HTTPError", ":", "raise", ...
From a value available on the remote server, the method returns the complete item matching the value. If case the value is not available on the server side or filtered through :meth:`item`, the class:`agnocomplete.exceptions.ItemNotFound` is raised.
[ "From", "a", "value", "available", "on", "the", "remote", "server", "the", "method", "returns", "the", "complete", "item", "matching", "the", "value", ".", "If", "case", "the", "value", "is", "not", "available", "on", "the", "server", "side", "or", "filter...
train
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/core.py#L647-L669
jason-weirather/py-seq-tools
seqtools/simulation/emitter.py
TranscriptomeEmitter.emit
def emit(self): """Get a mapping from a transcript :return: One random Transcript sequence :rtype: sequence """ i = self.options.rand.get_weighted_random_index(self._weights) return self._transcriptome.transcripts[i]
python
def emit(self): """Get a mapping from a transcript :return: One random Transcript sequence :rtype: sequence """ i = self.options.rand.get_weighted_random_index(self._weights) return self._transcriptome.transcripts[i]
[ "def", "emit", "(", "self", ")", ":", "i", "=", "self", ".", "options", ".", "rand", ".", "get_weighted_random_index", "(", "self", ".", "_weights", ")", "return", "self", ".", "_transcriptome", ".", "transcripts", "[", "i", "]" ]
Get a mapping from a transcript :return: One random Transcript sequence :rtype: sequence
[ "Get", "a", "mapping", "from", "a", "transcript" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/simulation/emitter.py#L93-L100
jason-weirather/py-seq-tools
seqtools/simulation/emitter.py
TranscriptomeEmitter.set_weights_by_dict
def set_weights_by_dict(self,weights): """input: an array of weights <<txname1> <weight1>> <<txname2> <weight2>>... if this does not get set then even weighting will be used :param weights: [[tx1,wght1],[tx2,wght2],...[txN,wightN]] :type weights: list """ self._weights = [] txnames = [x....
python
def set_weights_by_dict(self,weights): """input: an array of weights <<txname1> <weight1>> <<txname2> <weight2>>... if this does not get set then even weighting will be used :param weights: [[tx1,wght1],[tx2,wght2],...[txN,wightN]] :type weights: list """ self._weights = [] txnames = [x....
[ "def", "set_weights_by_dict", "(", "self", ",", "weights", ")", ":", "self", ".", "_weights", "=", "[", "]", "txnames", "=", "[", "x", ".", "name", "for", "x", "in", "self", ".", "_transcriptome", ".", "transcripts", "]", "for", "txname", "in", "txname...
input: an array of weights <<txname1> <weight1>> <<txname2> <weight2>>... if this does not get set then even weighting will be used :param weights: [[tx1,wght1],[tx2,wght2],...[txN,wightN]] :type weights: list
[ "input", ":", "an", "array", "of", "weights", "<<txname1", ">", "<weight1", ">>", "<<txname2", ">", "<weight2", ">>", "...", "if", "this", "does", "not", "get", "set", "then", "even", "weighting", "will", "be", "used" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/simulation/emitter.py#L102-L116
jason-weirather/py-seq-tools
seqtools/simulation/emitter.py
ReadEmitter.emit
def emit(self,rlen=150): """Emit a read based on a source sequence""" source_tx = self._source.emit() source_read = self._cutter.cut(source_tx) if self._flip and self.options.rand.random() < 0.5: source_read = source_read.rc() srname = self.options.rand.uuid4() seqfull = FASTQ('@'+se...
python
def emit(self,rlen=150): """Emit a read based on a source sequence""" source_tx = self._source.emit() source_read = self._cutter.cut(source_tx) if self._flip and self.options.rand.random() < 0.5: source_read = source_read.rc() srname = self.options.rand.uuid4() seqfull = FASTQ('@'+se...
[ "def", "emit", "(", "self", ",", "rlen", "=", "150", ")", ":", "source_tx", "=", "self", ".", "_source", ".", "emit", "(", ")", "source_read", "=", "self", ".", "_cutter", ".", "cut", "(", "source_tx", ")", "if", "self", ".", "_flip", "and", "self"...
Emit a read based on a source sequence
[ "Emit", "a", "read", "based", "on", "a", "source", "sequence" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/simulation/emitter.py#L166-L190
marcocamma/datastorage
datastorage/datastorage.py
unwrapArray
def unwrapArray(a, recursive=True, readH5pyDataset=True): """ This function takes an object (like a dictionary) and recursively unwraps it solving issues like: * the fact that many objects are packaged as 0d array This funciton has also some specific hack for handling h5py limits: ...
python
def unwrapArray(a, recursive=True, readH5pyDataset=True): """ This function takes an object (like a dictionary) and recursively unwraps it solving issues like: * the fact that many objects are packaged as 0d array This funciton has also some specific hack for handling h5py limits: ...
[ "def", "unwrapArray", "(", "a", ",", "recursive", "=", "True", ",", "readH5pyDataset", "=", "True", ")", ":", "try", ":", "### take care of hdf5 groups ", "if", "isinstance", "(", "a", ",", "h5py", ".", "Group", ")", ":", "# take care of special flags first", ...
This function takes an object (like a dictionary) and recursively unwraps it solving issues like: * the fact that many objects are packaged as 0d array This funciton has also some specific hack for handling h5py limits: * handle the None python object * numpy unicode ...
[ "This", "function", "takes", "an", "object", "(", "like", "a", "dictionary", ")", "and", "recursively", "unwraps", "it", "solving", "issues", "like", ":", "*", "the", "fact", "that", "many", "objects", "are", "packaged", "as", "0d", "array", "This", "funci...
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L23-L78
marcocamma/datastorage
datastorage/datastorage.py
dictToH5Group
def dictToH5Group(d, group, link_copy=True): """ helper function that transform (recursive) a dictionary into an hdf group by creating subgroups link_copy = True, tries to save space in the hdf file by creating an internal link. the current implementation uses memory though ... ...
python
def dictToH5Group(d, group, link_copy=True): """ helper function that transform (recursive) a dictionary into an hdf group by creating subgroups link_copy = True, tries to save space in the hdf file by creating an internal link. the current implementation uses memory though ... ...
[ "def", "dictToH5Group", "(", "d", ",", "group", ",", "link_copy", "=", "True", ")", ":", "for", "key", "in", "d", ".", "keys", "(", ")", ":", "value", "=", "d", "[", "key", "]", "log", ".", "debug", "(", "\"saving\"", ",", "key", ",", "\"in\"", ...
helper function that transform (recursive) a dictionary into an hdf group by creating subgroups link_copy = True, tries to save space in the hdf file by creating an internal link. the current implementation uses memory though ...
[ "helper", "function", "that", "transform", "(", "recursive", ")", "a", "dictionary", "into", "an", "hdf", "group", "by", "creating", "subgroups", "link_copy", "=", "True", "tries", "to", "save", "space", "in", "the", "hdf", "file", "by", "creating", "an", ...
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L104-L144
marcocamma/datastorage
datastorage/datastorage.py
dictToH5
def dictToH5(h5, d, link_copy=False): """ Save a dictionary into an hdf5 file h5py is not capable of handling dictionaries natively""" global _array_cache _array_cache = dict() h5 = h5py.File(h5, mode="w") dictToH5Group(d, h5["/"], link_copy=link_copy) h5.close() _array_cache = dict(...
python
def dictToH5(h5, d, link_copy=False): """ Save a dictionary into an hdf5 file h5py is not capable of handling dictionaries natively""" global _array_cache _array_cache = dict() h5 = h5py.File(h5, mode="w") dictToH5Group(d, h5["/"], link_copy=link_copy) h5.close() _array_cache = dict(...
[ "def", "dictToH5", "(", "h5", ",", "d", ",", "link_copy", "=", "False", ")", ":", "global", "_array_cache", "_array_cache", "=", "dict", "(", ")", "h5", "=", "h5py", ".", "File", "(", "h5", ",", "mode", "=", "\"w\"", ")", "dictToH5Group", "(", "d", ...
Save a dictionary into an hdf5 file h5py is not capable of handling dictionaries natively
[ "Save", "a", "dictionary", "into", "an", "hdf5", "file", "h5py", "is", "not", "capable", "of", "handling", "dictionaries", "natively" ]
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L147-L155
marcocamma/datastorage
datastorage/datastorage.py
h5ToDict
def h5ToDict(h5, readH5pyDataset=True): """ Read a hdf5 file into a dictionary """ h = h5py.File(h5, "r") ret = unwrapArray(h, recursive=True, readH5pyDataset=readH5pyDataset) if readH5pyDataset: h.close() return ret
python
def h5ToDict(h5, readH5pyDataset=True): """ Read a hdf5 file into a dictionary """ h = h5py.File(h5, "r") ret = unwrapArray(h, recursive=True, readH5pyDataset=readH5pyDataset) if readH5pyDataset: h.close() return ret
[ "def", "h5ToDict", "(", "h5", ",", "readH5pyDataset", "=", "True", ")", ":", "h", "=", "h5py", ".", "File", "(", "h5", ",", "\"r\"", ")", "ret", "=", "unwrapArray", "(", "h", ",", "recursive", "=", "True", ",", "readH5pyDataset", "=", "readH5pyDataset"...
Read a hdf5 file into a dictionary
[ "Read", "a", "hdf5", "file", "into", "a", "dictionary" ]
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L158-L163
marcocamma/datastorage
datastorage/datastorage.py
_toDict
def _toDict(datastorage_obj,recursive=True): """ this is the recursive part of the toDict (otherwise it fails when converting to DataStorage """ if "items" not in dir(datastorage_obj): return datastorage_obj d = dict() for k, v in datastorage_obj.items(): try: d[k] = _toDict(v) ...
python
def _toDict(datastorage_obj,recursive=True): """ this is the recursive part of the toDict (otherwise it fails when converting to DataStorage """ if "items" not in dir(datastorage_obj): return datastorage_obj d = dict() for k, v in datastorage_obj.items(): try: d[k] = _toDict(v) ...
[ "def", "_toDict", "(", "datastorage_obj", ",", "recursive", "=", "True", ")", ":", "if", "\"items\"", "not", "in", "dir", "(", "datastorage_obj", ")", ":", "return", "datastorage_obj", "d", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "datastorage_...
this is the recursive part of the toDict (otherwise it fails when converting to DataStorage
[ "this", "is", "the", "recursive", "part", "of", "the", "toDict", "(", "otherwise", "it", "fails", "when", "converting", "to", "DataStorage" ]
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L183-L194
marcocamma/datastorage
datastorage/datastorage.py
toDict
def toDict(datastorage_obj, recursive=True): """ convert a DataStorage object to a dictionary (useful for saving); it should work for other objects too """ # if not a DataStorage, convert to it first if "items" not in dir(datastorage_obj): datastorage_obj = DataStorage(datastorage_obj) return _toDi...
python
def toDict(datastorage_obj, recursive=True): """ convert a DataStorage object to a dictionary (useful for saving); it should work for other objects too """ # if not a DataStorage, convert to it first if "items" not in dir(datastorage_obj): datastorage_obj = DataStorage(datastorage_obj) return _toDi...
[ "def", "toDict", "(", "datastorage_obj", ",", "recursive", "=", "True", ")", ":", "# if not a DataStorage, convert to it first", "if", "\"items\"", "not", "in", "dir", "(", "datastorage_obj", ")", ":", "datastorage_obj", "=", "DataStorage", "(", "datastorage_obj", "...
convert a DataStorage object to a dictionary (useful for saving); it should work for other objects too
[ "convert", "a", "DataStorage", "object", "to", "a", "dictionary", "(", "useful", "for", "saving", ")", ";", "it", "should", "work", "for", "other", "objects", "too" ]
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L197-L202
marcocamma/datastorage
datastorage/datastorage.py
save
def save(fname, d, link_copy=True,raiseError=False): """ link_copy is used by hdf5 saving only, it allows to creat link of identical arrays (saving space) """ # make sure the object is dict (recursively) this allows reading it # without the DataStorage module fname = pathlib.Path(fname) d = toDict(d...
python
def save(fname, d, link_copy=True,raiseError=False): """ link_copy is used by hdf5 saving only, it allows to creat link of identical arrays (saving space) """ # make sure the object is dict (recursively) this allows reading it # without the DataStorage module fname = pathlib.Path(fname) d = toDict(d...
[ "def", "save", "(", "fname", ",", "d", ",", "link_copy", "=", "True", ",", "raiseError", "=", "False", ")", ":", "# make sure the object is dict (recursively) this allows reading it", "# without the DataStorage module", "fname", "=", "pathlib", ".", "Path", "(", "fnam...
link_copy is used by hdf5 saving only, it allows to creat link of identical arrays (saving space)
[ "link_copy", "is", "used", "by", "hdf5", "saving", "only", "it", "allows", "to", "creat", "link", "of", "identical", "arrays", "(", "saving", "space", ")" ]
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L233-L254
marcocamma/datastorage
datastorage/datastorage.py
DataStorage.save
def save(self, fname=None, link_copy=False,raiseError=False): """ link_copy: only works in hfd5 format save space by creating link when identical arrays are found, it may slows down the saving (3 or 4 folds) but saves space when saving different dataset together (since it doe...
python
def save(self, fname=None, link_copy=False,raiseError=False): """ link_copy: only works in hfd5 format save space by creating link when identical arrays are found, it may slows down the saving (3 or 4 folds) but saves space when saving different dataset together (since it doe...
[ "def", "save", "(", "self", ",", "fname", "=", "None", ",", "link_copy", "=", "False", ",", "raiseError", "=", "False", ")", ":", "if", "fname", "is", "None", ":", "fname", "=", "self", ".", "filename", "assert", "fname", "is", "not", "None", "save",...
link_copy: only works in hfd5 format save space by creating link when identical arrays are found, it may slows down the saving (3 or 4 folds) but saves space when saving different dataset together (since it does not duplicate arrays)
[ "link_copy", ":", "only", "works", "in", "hfd5", "format", "save", "space", "by", "creating", "link", "when", "identical", "arrays", "are", "found", "it", "may", "slows", "down", "the", "saving", "(", "3", "or", "4", "folds", ")", "but", "saves", "space"...
train
https://github.com/marcocamma/datastorage/blob/d88cdc08414c1c99d34d62e65fcbf807c3088a37/datastorage/datastorage.py#L415-L425
mitsei/dlkit
dlkit/json_/assessment/queries.py
ItemQuery.match_learning_objective_id
def match_learning_objective_id(self, objective_id, match): """Sets the learning objective ``Id`` for this query. arg: objective_id (osid.id.Id): a learning objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for negative match raise: N...
python
def match_learning_objective_id(self, objective_id, match): """Sets the learning objective ``Id`` for this query. arg: objective_id (osid.id.Id): a learning objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for negative match raise: N...
[ "def", "match_learning_objective_id", "(", "self", ",", "objective_id", ",", "match", ")", ":", "self", ".", "_add_match", "(", "'learningObjectiveIds'", ",", "str", "(", "objective_id", ")", ",", "bool", "(", "match", ")", ")" ]
Sets the learning objective ``Id`` for this query. arg: objective_id (osid.id.Id): a learning objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for negative match raise: NullArgument - ``objective_id`` is ``null`` *compliance: mandato...
[ "Sets", "the", "learning", "objective", "Id", "for", "this", "query", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/queries.py#L117-L127
mitsei/dlkit
dlkit/json_/assessment/queries.py
AssessmentOfferedQuery.match_start_time
def match_start_time(self, start, end, match): """Matches assessments whose start time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a pos...
python
def match_start_time(self, start, end, match): """Matches assessments whose start time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a pos...
[ "def", "match_start_time", "(", "self", ",", "start", ",", "end", ",", "match", ")", ":", "self", ".", "_match_minimum_date_time", "(", "'startTime'", ",", "start", ",", "match", ")", "self", ".", "_match_maximum_date_time", "(", "'startTime'", ",", "end", "...
Matches assessments whose start time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a positive match, ``false`` for a negative matc...
[ "Matches", "assessments", "whose", "start", "time", "falls", "between", "the", "specified", "range", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/queries.py#L1148-L1160
mitsei/dlkit
dlkit/json_/assessment/queries.py
AssessmentOfferedQuery.match_deadline
def match_deadline(self, start, end, match): """Matches assessments whose end time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a positiv...
python
def match_deadline(self, start, end, match): """Matches assessments whose end time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a positiv...
[ "def", "match_deadline", "(", "self", ",", "start", ",", "end", ",", "match", ")", ":", "self", ".", "_match_minimum_date_time", "(", "'deadline'", ",", "start", ",", "match", ")", "self", ".", "_match_maximum_date_time", "(", "'deadline'", ",", "end", ",", ...
Matches assessments whose end time falls between the specified range inclusive. arg: start (osid.calendaring.DateTime): start of range arg: end (osid.calendaring.DateTime): end of range arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match ...
[ "Matches", "assessments", "whose", "end", "time", "falls", "between", "the", "specified", "range", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/queries.py#L1186-L1199
mitsei/dlkit
dlkit/json_/assessment/queries.py
AssessmentTakenQuery.match_taking_agent_id
def match_taking_agent_id(self, agent_id, match): """Sets the agent ``Id`` for this query. arg: agent_id (osid.id.Id): an agent ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``agent_id`` is ``null`...
python
def match_taking_agent_id(self, agent_id, match): """Sets the agent ``Id`` for this query. arg: agent_id (osid.id.Id): an agent ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``agent_id`` is ``null`...
[ "def", "match_taking_agent_id", "(", "self", ",", "agent_id", ",", "match", ")", ":", "self", ".", "_add_match", "(", "'takingAgentId'", ",", "str", "(", "agent_id", ")", ",", "bool", "(", "match", ")", ")" ]
Sets the agent ``Id`` for this query. arg: agent_id (osid.id.Id): an agent ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``agent_id`` is ``null`` *compliance: mandatory -- This method must be imple...
[ "Sets", "the", "agent", "Id", "for", "this", "query", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/queries.py#L1781-L1791
mitsei/dlkit
dlkit/json_/assessment/queries.py
BankQuery.match_ancestor_bank_id
def match_ancestor_bank_id(self, bank_id, match): """Sets the bank ``Id`` for to match banks in which the specified bank is an acestor. arg: bank_id (osid.id.Id): a bank ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match rais...
python
def match_ancestor_bank_id(self, bank_id, match): """Sets the bank ``Id`` for to match banks in which the specified bank is an acestor. arg: bank_id (osid.id.Id): a bank ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match rais...
[ "def", "match_ancestor_bank_id", "(", "self", ",", "bank_id", ",", "match", ")", ":", "# matches when the bank_id param is an ancestor of", "# any bank", "bank_descendants", "=", "self", ".", "_get_descendant_catalog_ids", "(", "bank_id", ")", "identifiers", "=", "[", "...
Sets the bank ``Id`` for to match banks in which the specified bank is an acestor. arg: bank_id (osid.id.Id): a bank ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``bank_id`` is ``null`` *complianc...
[ "Sets", "the", "bank", "Id", "for", "to", "match", "banks", "in", "which", "the", "specified", "bank", "is", "an", "acestor", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/queries.py#L2555-L2569
LFenske/python-scsi-pt
Cmd.py
Cmd.fill
def fill(cdb, defs, pparms): """ Take field values in parms and insert them into cdb based on the field definitions in defs. """ #print "defs =", defs parms = {n:v[2] for (n,v) in defs.items()} # Create parms for default field values. parms.update(pparms) # Inse...
python
def fill(cdb, defs, pparms): """ Take field values in parms and insert them into cdb based on the field definitions in defs. """ #print "defs =", defs parms = {n:v[2] for (n,v) in defs.items()} # Create parms for default field values. parms.update(pparms) # Inse...
[ "def", "fill", "(", "cdb", ",", "defs", ",", "pparms", ")", ":", "#print \"defs =\", defs", "parms", "=", "{", "n", ":", "v", "[", "2", "]", "for", "(", "n", ",", "v", ")", "in", "defs", ".", "items", "(", ")", "}", "# Create parms for default field ...
Take field values in parms and insert them into cdb based on the field definitions in defs.
[ "Take", "field", "values", "in", "parms", "and", "insert", "them", "into", "cdb", "based", "on", "the", "field", "definitions", "in", "defs", "." ]
train
https://github.com/LFenske/python-scsi-pt/blob/17c35598564e0402581b4766bc6d5a8576011cfd/Cmd.py#L208-L253
LFenske/python-scsi-pt
Cmd.py
Cmd.extract
def extract(data, defs, byteoffset=0): """ Extract fields from data into a structure based on field definitions in defs. byteoffset is added to each local byte offset to get the byte offset returned for each field. defs is a list of lists comprising start, width in bits, format,...
python
def extract(data, defs, byteoffset=0): """ Extract fields from data into a structure based on field definitions in defs. byteoffset is added to each local byte offset to get the byte offset returned for each field. defs is a list of lists comprising start, width in bits, format,...
[ "def", "extract", "(", "data", ",", "defs", ",", "byteoffset", "=", "0", ")", ":", "retval", "=", "ListDict", "(", ")", "for", "fielddef", "in", "defs", ":", "start", ",", "width", ",", "form", ",", "name", ",", "desc", "=", "fielddef", "if", "form...
Extract fields from data into a structure based on field definitions in defs. byteoffset is added to each local byte offset to get the byte offset returned for each field. defs is a list of lists comprising start, width in bits, format, nickname, description. field start is either a byt...
[ "Extract", "fields", "from", "data", "into", "a", "structure", "based", "on", "field", "definitions", "in", "defs", ".", "byteoffset", "is", "added", "to", "each", "local", "byte", "offset", "to", "get", "the", "byte", "offset", "returned", "for", "each", ...
train
https://github.com/LFenske/python-scsi-pt/blob/17c35598564e0402581b4766bc6d5a8576011cfd/Cmd.py#L266-L308
LFenske/python-scsi-pt
Cmd.py
Cmd.inq
def inq(pt, page=None, alloc=74): """ Create an Inquiry command, send it, and parse the results. Input: pt : ScsiPT object page : vital product page number or None alloc: size to allocate for result TODO: implement page """ cmd = Cmd("inq",...
python
def inq(pt, page=None, alloc=74): """ Create an Inquiry command, send it, and parse the results. Input: pt : ScsiPT object page : vital product page number or None alloc: size to allocate for result TODO: implement page """ cmd = Cmd("inq",...
[ "def", "inq", "(", "pt", ",", "page", "=", "None", ",", "alloc", "=", "74", ")", ":", "cmd", "=", "Cmd", "(", "\"inq\"", ",", "{", "\"evpd\"", ":", "0", ",", "\"alloc\"", ":", "alloc", "}", ")", "cdb", "=", "CDB", "(", "cmd", ".", "cdb", ")",...
Create an Inquiry command, send it, and parse the results. Input: pt : ScsiPT object page : vital product page number or None alloc: size to allocate for result TODO: implement page
[ "Create", "an", "Inquiry", "command", "send", "it", "and", "parse", "the", "results", ".", "Input", ":", "pt", ":", "ScsiPT", "object", "page", ":", "vital", "product", "page", "number", "or", "None", "alloc", ":", "size", "to", "allocate", "for", "resul...
train
https://github.com/LFenske/python-scsi-pt/blob/17c35598564e0402581b4766bc6d5a8576011cfd/Cmd.py#L370-L384