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_/repository/sessions.py
CompositionRepositoryAssignmentSession.unassign_composition_from_repository
def unassign_composition_from_repository(self, composition_id, repository_id): """Removes ``Composition`` from a ``Repository``. arg: composition_id (osid.id.Id): the ``Id`` of the ``Composition`` arg: repository_id (osid.id.Id): the ``Id`` of the ``Reposit...
python
def unassign_composition_from_repository(self, composition_id, repository_id): """Removes ``Composition`` from a ``Repository``. arg: composition_id (osid.id.Id): the ``Id`` of the ``Composition`` arg: repository_id (osid.id.Id): the ``Id`` of the ``Reposit...
[ "def", "unassign_composition_from_repository", "(", "self", ",", "composition_id", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", ...
Removes ``Composition`` from a ``Repository``. arg: composition_id (osid.id.Id): the ``Id`` of the ``Composition`` arg: repository_id (osid.id.Id): the ``Id`` of the ``Repository`` raise: NotFound - ``composition_id`` or ``repository_id`` not ...
[ "Removes", "Composition", "from", "a", "Repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4536-L4558
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryLookupSession.get_repository
def get_repository(self, repository_id): """Gets the ``Repository`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Repository`` may have a different ``Id`` than requested, such as the case where a duplicat...
python
def get_repository(self, repository_id): """Gets the ``Repository`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Repository`` may have a different ``Id`` than requested, such as the case where a duplicat...
[ "def", "get_repository", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.get_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "get_cat...
Gets the ``Repository`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Repository`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``Repository`` and retain...
[ "Gets", "the", "Repository", "specified", "by", "its", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4651-L4685
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryLookupSession.get_repositories_by_ids
def get_repositories_by_ids(self, repository_ids): """Gets a ``RepositoryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the repositories specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if...
python
def get_repositories_by_ids(self, repository_ids): """Gets a ``RepositoryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the repositories specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if...
[ "def", "get_repositories_by_ids", "(", "self", ",", "repository_ids", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.get_bins_by_ids_template", "# NOTE: This implementation currently ignores plenary view", "# Also, this should be implemented to use get_Repositor...
Gets a ``RepositoryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the repositories specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inacce...
[ "Gets", "a", "RepositoryList", "corresponding", "to", "the", "given", "IdList", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4688-L4724
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryLookupSession.get_repositories_by_genus_type
def get_repositories_by_genus_type(self, repository_genus_type): """Gets a ``RepositoryList`` corresponding to the given repository genus ``Type`` which does not include repositories of types derived from the specified ``Type``. In plenary mode, the returned list contains all known repositories...
python
def get_repositories_by_genus_type(self, repository_genus_type): """Gets a ``RepositoryList`` corresponding to the given repository genus ``Type`` which does not include repositories of types derived from the specified ``Type``. In plenary mode, the returned list contains all known repositories...
[ "def", "get_repositories_by_genus_type", "(", "self", ",", "repository_genus_type", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.get_bins_by_genus_type_template", "# NOTE: This implementation currently ignores plenary view", "if", "self", ".", "_catalog_...
Gets a ``RepositoryList`` corresponding to the given repository genus ``Type`` which does not include repositories of types derived from the specified ``Type``. In plenary mode, the returned list contains all known repositories or an error results. Otherwise, the returned list may contain only ...
[ "Gets", "a", "RepositoryList", "corresponding", "to", "the", "given", "repository", "genus", "Type", "which", "does", "not", "include", "repositories", "of", "types", "derived", "from", "the", "specified", "Type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4727-L4755
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryQuerySession.get_repositories_by_query
def get_repositories_by_query(self, repository_query): """Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ...
python
def get_repositories_by_query(self, repository_query): """Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ...
[ "def", "get_repositories_by_query", "(", "self", ",", "repository_query", ")", ":", "# Implemented from template for", "# osid.resource.BinQuerySession.get_bins_by_query_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_cat...
Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ``RepositoryList`` raise: NullArgument - ``repository_qu...
[ "Gets", "a", "list", "of", "Repositories", "matching", "the", "given", "repository", "query", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4903-L4928
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryAdminSession.can_create_repository_with_record_types
def can_create_repository_with_record_types(self, repository_record_types): """Tests if this user can create a single ``Repository`` using the desired record types. While ``RepositoryManager.getRepositoryRecordTypes()`` can be used to examine which records are supported, this method tests ...
python
def can_create_repository_with_record_types(self, repository_record_types): """Tests if this user can create a single ``Repository`` using the desired record types. While ``RepositoryManager.getRepositoryRecordTypes()`` can be used to examine which records are supported, this method tests ...
[ "def", "can_create_repository_with_record_types", "(", "self", ",", "repository_record_types", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.can_create_bin_with_record_types", "# NOTE: It is expected that real authentication hints will be", "# handled in a servi...
Tests if this user can create a single ``Repository`` using the desired record types. While ``RepositoryManager.getRepositoryRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Repository``. Providi...
[ "Tests", "if", "this", "user", "can", "create", "a", "single", "Repository", "using", "the", "desired", "record", "types", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4994-L5018
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryAdminSession.update_repository
def update_repository(self, repository_form): """Updates an existing repository. arg: repository_form (osid.repository.RepositoryForm): the form containing the elements to be updated raise: IllegalState - ``repository_form`` already used in an update transact...
python
def update_repository(self, repository_form): """Updates an existing repository. arg: repository_form (osid.repository.RepositoryForm): the form containing the elements to be updated raise: IllegalState - ``repository_form`` already used in an update transact...
[ "def", "update_repository", "(", "self", ",", "repository_form", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.update_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ...
Updates an existing repository. arg: repository_form (osid.repository.RepositoryForm): the form containing the elements to be updated raise: IllegalState - ``repository_form`` already used in an update transaction raise: InvalidArgument - the form contains a...
[ "Updates", "an", "existing", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5161-L5200
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryAdminSession.alias_repository
def alias_repository(self, repository_id, alias_id): """Adds an ``Id`` to a ``Repository`` for the purpose of creating compatibility. The primary ``Id`` of the ``Repository`` is determined by the provider. The new ``Id`` is an alias to the primary ``Id``. If the alias is a pointer to an...
python
def alias_repository(self, repository_id, alias_id): """Adds an ``Id`` to a ``Repository`` for the purpose of creating compatibility. The primary ``Id`` of the ``Repository`` is determined by the provider. The new ``Id`` is an alias to the primary ``Id``. If the alias is a pointer to an...
[ "def", "alias_repository", "(", "self", ",", "repository_id", ",", "alias_id", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.alias_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_c...
Adds an ``Id`` to a ``Repository`` for the purpose of creating compatibility. The primary ``Id`` of the ``Repository`` is determined by the provider. The new ``Id`` is an alias to the primary ``Id``. If the alias is a pointer to another repository, it is reassigned to the given reposito...
[ "Adds", "an", "Id", "to", "a", "Repository", "for", "the", "purpose", "of", "creating", "compatibility", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5273-L5298
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_root_repositories
def get_root_repositories(self): """Gets the root repositories in the repository hierarchy. A node with no parents is an orphan. While all repository ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of ...
python
def get_root_repositories(self): """Gets the root repositories in the repository hierarchy. A node with no parents is an orphan. While all repository ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of ...
[ "def", "get_root_repositories", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_root_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "get_root_catalogs...
Gets the root repositories in the repository hierarchy. A node with no parents is an orphan. While all repository ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node. return: (osid.reposi...
[ "Gets", "the", "root", "repositories", "in", "the", "repository", "hierarchy", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5450-L5470
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.has_parent_repositories
def has_parent_repositories(self, repository_id): """Tests if the ``Repository`` has any parents. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the repository has parents, ``false`` otherwise raise: NotFound - ``repository_id`` ...
python
def has_parent_repositories(self, repository_id): """Tests if the ``Repository`` has any parents. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the repository has parents, ``false`` otherwise raise: NotFound - ``repository_id`` ...
[ "def", "has_parent_repositories", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.has_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session...
Tests if the ``Repository`` has any parents. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the repository has parents, ``false`` otherwise raise: NotFound - ``repository_id`` is not found raise: NullArgument - ``repository_id``...
[ "Tests", "if", "the", "Repository", "has", "any", "parents", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5475-L5492
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.is_parent_of_repository
def is_parent_of_repository(self, id_, repository_id): """Tests if an ``Id`` is a direct parent of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if this ``id`` is a parent of `...
python
def is_parent_of_repository(self, id_, repository_id): """Tests if an ``Id`` is a direct parent of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if this ``id`` is a parent of `...
[ "def", "is_parent_of_repository", "(", "self", ",", "id_", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_parent_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", ...
Tests if an ``Id`` is a direct parent of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if this ``id`` is a parent of ``repository_id,`` ``false`` otherwise raise: NotFound - ...
[ "Tests", "if", "an", "Id", "is", "a", "direct", "parent", "of", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5495-L5514
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_parent_repository_ids
def get_parent_repository_ids(self, repository_id): """Gets the parent ``Ids`` of the given repository. arg: repository_id (osid.id.Id): a repository ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the repository raise: NotFound - ``repository_id`` is not found raise...
python
def get_parent_repository_ids(self, repository_id): """Gets the parent ``Ids`` of the given repository. arg: repository_id (osid.id.Id): a repository ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the repository raise: NotFound - ``repository_id`` is not found raise...
[ "def", "get_parent_repository_ids", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_parent_bin_ids", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_se...
Gets the parent ``Ids`` of the given repository. arg: repository_id (osid.id.Id): a repository ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the repository raise: NotFound - ``repository_id`` is not found raise: NullArgument - ``repository_id`` is ``null`` raise: ...
[ "Gets", "the", "parent", "Ids", "of", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5517-L5533
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_parent_repositories
def get_parent_repositories(self, repository_id): """Gets the parents of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the parents of the repository raise: NotFound - ``repository_id`` not found ...
python
def get_parent_repositories(self, repository_id): """Gets the parents of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the parents of the repository raise: NotFound - ``repository_id`` not found ...
[ "def", "get_parent_repositories", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session...
Gets the parents of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the parents of the repository raise: NotFound - ``repository_id`` not found raise: NullArgument - ``repository_id`` is ``null`` ...
[ "Gets", "the", "parents", "of", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5536-L5556
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.is_ancestor_of_repository
def is_ancestor_of_repository(self, id_, repository_id): """Tests if an ``Id`` is an ancestor of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the Id of a repository return: (boolean) - ``true`` if this ``id`` is an ancestor of ``re...
python
def is_ancestor_of_repository(self, id_, repository_id): """Tests if an ``Id`` is an ancestor of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the Id of a repository return: (boolean) - ``true`` if this ``id`` is an ancestor of ``re...
[ "def", "is_ancestor_of_repository", "(", "self", ",", "id_", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_ancestor_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", "."...
Tests if an ``Id`` is an ancestor of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the Id of a repository return: (boolean) - ``true`` if this ``id`` is an ancestor of ``repository_id,`` ``false`` otherwise raise: NotFound - ``rep...
[ "Tests", "if", "an", "Id", "is", "an", "ancestor", "of", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5559-L5578
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.has_child_repositories
def has_child_repositories(self, repository_id): """Tests if a repository has any children. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the ``repository_id`` has children, ``false`` otherwise raise: NotFound - ``repository_id`...
python
def has_child_repositories(self, repository_id): """Tests if a repository has any children. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the ``repository_id`` has children, ``false`` otherwise raise: NotFound - ``repository_id`...
[ "def", "has_child_repositories", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.has_child_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session",...
Tests if a repository has any children. arg: repository_id (osid.id.Id): a repository ``Id`` return: (boolean) - ``true`` if the ``repository_id`` has children, ``false`` otherwise raise: NotFound - ``repository_id`` not found raise: NullArgument - ``repository_id``...
[ "Tests", "if", "a", "repository", "has", "any", "children", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5581-L5598
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.is_child_of_repository
def is_child_of_repository(self, id_, repository_id): """Tests if a node is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a child of ``repository_...
python
def is_child_of_repository(self, id_, repository_id): """Tests if a node is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a child of ``repository_...
[ "def", "is_child_of_repository", "(", "self", ",", "id_", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_child_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_...
Tests if a node is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a child of ``repository_id,`` ``false`` otherwise raise: NotFound - ``repositor...
[ "Tests", "if", "a", "node", "is", "a", "direct", "child", "of", "another", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5601-L5620
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_child_repository_ids
def get_child_repository_ids(self, repository_id): """Gets the ``Ids`` of the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the repository raise: NotFound - ``repository_id`` not found raise:...
python
def get_child_repository_ids(self, repository_id): """Gets the ``Ids`` of the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the repository raise: NotFound - ``repository_id`` not found raise:...
[ "def", "get_child_repository_ids", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_child_bin_ids", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_sess...
Gets the ``Ids`` of the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the repository raise: NotFound - ``repository_id`` not found raise: NullArgument - ``repository_id`` is ``null`` raise: ...
[ "Gets", "the", "Ids", "of", "the", "children", "of", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5623-L5639
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_child_repositories
def get_child_repositories(self, repository_id): """Gets the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the children of the repository raise: NotFound - ``repository_id`` not found...
python
def get_child_repositories(self, repository_id): """Gets the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the children of the repository raise: NotFound - ``repository_id`` not found...
[ "def", "get_child_repositories", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_child_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session",...
Gets the children of the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query return: (osid.repository.RepositoryList) - the children of the repository raise: NotFound - ``repository_id`` not found raise: NullArgument - ``repository_id`` is ``null`...
[ "Gets", "the", "children", "of", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5642-L5662
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.is_descendant_of_repository
def is_descendant_of_repository(self, id_, repository_id): """Tests if an ``Id`` is a descendant of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a descendant of ...
python
def is_descendant_of_repository(self, id_, repository_id): """Tests if an ``Id`` is a descendant of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a descendant of ...
[ "def", "is_descendant_of_repository", "(", "self", ",", "id_", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_descendant_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ...
Tests if an ``Id`` is a descendant of a repository. arg: id (osid.id.Id): an ``Id`` arg: repository_id (osid.id.Id): the ``Id`` of a repository return: (boolean) - ``true`` if the ``id`` is a descendant of the ``repository_id,`` ``false`` otherwise raise: NotFound...
[ "Tests", "if", "an", "Id", "is", "a", "descendant", "of", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5665-L5684
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_repository_node_ids
def get_repository_node_ids(self, repository_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ...
python
def get_repository_node_ids(self, repository_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ...
[ "def", "get_repository_node_ids", "(", "self", ",", "repository_id", ",", "ancestor_levels", ",", "descendant_levels", ",", "include_siblings", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_bin_node_ids", "if", "self", ".", "_catalog_sess...
Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. arg: descendant...
[ "Gets", "a", "portion", "of", "the", "hierarchy", "for", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5687-L5720
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchySession.get_repository_nodes
def get_repository_nodes(self, repository_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of anc...
python
def get_repository_nodes(self, repository_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of anc...
[ "def", "get_repository_nodes", "(", "self", ",", "repository_id", ",", "ancestor_levels", ",", "descendant_levels", ",", "include_siblings", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_bin_nodes", "return", "objects", ".", "RepositoryNo...
Gets a portion of the hierarchy for the given repository. arg: repository_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. arg: descendant...
[ "Gets", "a", "portion", "of", "the", "hierarchy", "for", "the", "given", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5723-L5751
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchyDesignSession.add_root_repository
def add_root_repository(self, repository_id): """Adds a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: AlreadyExists - ``repository_id`` is already in hierarchy raise: NotFound - ``repository_id`` not found raise: NullAr...
python
def add_root_repository(self, repository_id): """Adds a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: AlreadyExists - ``repository_id`` is already in hierarchy raise: NotFound - ``repository_id`` not found raise: NullAr...
[ "def", "add_root_repository", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.add_root_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog...
Adds a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: AlreadyExists - ``repository_id`` is already in hierarchy raise: NotFound - ``repository_id`` not found raise: NullArgument - ``repository_id`` is ``null`` raise: Op...
[ "Adds", "a", "root", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5836-L5853
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchyDesignSession.remove_root_repository
def remove_root_repository(self, repository_id): """Removes a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not a root raise: NullArgument - ``repository_id`` is ``null`` raise: OperationFailed - unable to ...
python
def remove_root_repository(self, repository_id): """Removes a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not a root raise: NullArgument - ``repository_id`` is ``null`` raise: OperationFailed - unable to ...
[ "def", "remove_root_repository", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_root_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_c...
Removes a root repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not a root raise: NullArgument - ``repository_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authoriz...
[ "Removes", "a", "root", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5856-L5871
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchyDesignSession.add_child_repository
def add_child_repository(self, repository_id, child_id): """Adds a child to a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``repository_id`` is already a parent of ...
python
def add_child_repository(self, repository_id, child_id): """Adds a child to a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``repository_id`` is already a parent of ...
[ "def", "add_child_repository", "(", "self", ",", "repository_id", ",", "child_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.add_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "se...
Adds a child to a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``repository_id`` is already a parent of ``child_id`` raise: NotFound - ``repository_id`` or `...
[ "Adds", "a", "child", "to", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5874-L5893
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchyDesignSession.remove_child_repository
def remove_child_repository(self, repository_id, child_id): """Removes a child from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``repository_id`` not a parent of ...
python
def remove_child_repository(self, repository_id, child_id): """Removes a child from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``repository_id`` not a parent of ...
[ "def", "remove_child_repository", "(", "self", ",", "repository_id", ",", "child_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return",...
Removes a child from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``repository_id`` not a parent of ``child_id`` raise: NullArgument - ``repository_id`` or ``ch...
[ "Removes", "a", "child", "from", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5896-L5914
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryHierarchyDesignSession.remove_child_repositories
def remove_child_repositories(self, repository_id): """Removes all children from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not in hierarchy raise: NullArgument - ``repository_id`` is ``null`` raise: Operat...
python
def remove_child_repositories(self, repository_id): """Removes all children from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not in hierarchy raise: NullArgument - ``repository_id`` is ``null`` raise: Operat...
[ "def", "remove_child_repositories", "(", "self", ",", "repository_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", ...
Removes all children from a repository. arg: repository_id (osid.id.Id): the ``Id`` of a repository raise: NotFound - ``repository_id`` not in hierarchy raise: NullArgument - ``repository_id`` is ``null`` raise: OperationFailed - unable to complete request raise: Permissi...
[ "Removes", "all", "children", "from", "a", "repository", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L5917-L5932
ayust/kitnirc
kitnirc/contrib/cron.py
CronModule.add_cron
def add_cron(self, client, event, seconds="*", minutes="*", hours="*"): """Add a cron entry. The arguments for this event are: 1. The name of the event to dispatch when the cron fires. 2. What seconds to trigger on, as a timespec (default "*") 3. What minutes to trig...
python
def add_cron(self, client, event, seconds="*", minutes="*", hours="*"): """Add a cron entry. The arguments for this event are: 1. The name of the event to dispatch when the cron fires. 2. What seconds to trigger on, as a timespec (default "*") 3. What minutes to trig...
[ "def", "add_cron", "(", "self", ",", "client", ",", "event", ",", "seconds", "=", "\"*\"", ",", "minutes", "=", "\"*\"", ",", "hours", "=", "\"*\"", ")", ":", "for", "cron", "in", "self", ".", "crons", ":", "if", "cron", ".", "event", "==", "event"...
Add a cron entry. The arguments for this event are: 1. The name of the event to dispatch when the cron fires. 2. What seconds to trigger on, as a timespec (default "*") 3. What minutes to trigger on, as a timespec (default "*") 4. What hours to trigger on, as a t...
[ "Add", "a", "cron", "entry", "." ]
train
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/contrib/cron.py#L160-L196
ayust/kitnirc
kitnirc/contrib/cron.py
CronModule.remove_cron
def remove_cron(self, client, event): """Remove a cron entry by event name.""" for index, cron in enumerate(self.crons): if cron.event == event: _log.info("De-registering cron '%s'.", event) # Yes, we're modifying the list we're iterating over, but ...
python
def remove_cron(self, client, event): """Remove a cron entry by event name.""" for index, cron in enumerate(self.crons): if cron.event == event: _log.info("De-registering cron '%s'.", event) # Yes, we're modifying the list we're iterating over, but ...
[ "def", "remove_cron", "(", "self", ",", "client", ",", "event", ")", ":", "for", "index", ",", "cron", "in", "enumerate", "(", "self", ".", "crons", ")", ":", "if", "cron", ".", "event", "==", "event", ":", "_log", ".", "info", "(", "\"De-registering...
Remove a cron entry by event name.
[ "Remove", "a", "cron", "entry", "by", "event", "name", "." ]
train
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/contrib/cron.py#L199-L208
avladev/pypro
pypro/core.py
exception_handler
def exception_handler(exctype, value, traceback): """ This exception handler catches KeyboardInterrupt to cancel the Runner and also stops the Runner in case of an error. """ if exctype == KeyboardInterrupt: pypro.console.out('') # Adds a new line after Ctrl+C character pypro.consol...
python
def exception_handler(exctype, value, traceback): """ This exception handler catches KeyboardInterrupt to cancel the Runner and also stops the Runner in case of an error. """ if exctype == KeyboardInterrupt: pypro.console.out('') # Adds a new line after Ctrl+C character pypro.consol...
[ "def", "exception_handler", "(", "exctype", ",", "value", ",", "traceback", ")", ":", "if", "exctype", "==", "KeyboardInterrupt", ":", "pypro", ".", "console", ".", "out", "(", "''", ")", "# Adds a new line after Ctrl+C character", "pypro", ".", "console", ".", ...
This exception handler catches KeyboardInterrupt to cancel the Runner and also stops the Runner in case of an error.
[ "This", "exception", "handler", "catches", "KeyboardInterrupt", "to", "cancel", "the", "Runner", "and", "also", "stops", "the", "Runner", "in", "case", "of", "an", "error", "." ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/pypro/core.py#L458-L470
avladev/pypro
pypro/core.py
Runner.run
def run(self): """ Starts recipes execution. """ self._prepare() for recipe in self._recipes: run_recipe = True # Ask user whether to run current recipe if -y argument is not specified if not self.arguments.yes: run_recipe = pypro.console.as...
python
def run(self): """ Starts recipes execution. """ self._prepare() for recipe in self._recipes: run_recipe = True # Ask user whether to run current recipe if -y argument is not specified if not self.arguments.yes: run_recipe = pypro.console.as...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_prepare", "(", ")", "for", "recipe", "in", "self", ".", "_recipes", ":", "run_recipe", "=", "True", "# Ask user whether to run current recipe if -y argument is not specified", "if", "not", "self", ".", "arguments...
Starts recipes execution.
[ "Starts", "recipes", "execution", "." ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/pypro/core.py#L147-L163
avladev/pypro
pypro/core.py
Recipe.name
def name(self): """ Returns the recipe name which is its class name without package. """ if not hasattr(self, '_name'): self._name = re.search('[a-z]+\.([a-z]+)\.([a-z]+)', str(self.__class__), re.IGNORECASE).group(2) return self._name
python
def name(self): """ Returns the recipe name which is its class name without package. """ if not hasattr(self, '_name'): self._name = re.search('[a-z]+\.([a-z]+)\.([a-z]+)', str(self.__class__), re.IGNORECASE).group(2) return self._name
[ "def", "name", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_name'", ")", ":", "self", ".", "_name", "=", "re", ".", "search", "(", "'[a-z]+\\.([a-z]+)\\.([a-z]+)'", ",", "str", "(", "self", ".", "__class__", ")", ",", "re", "."...
Returns the recipe name which is its class name without package.
[ "Returns", "the", "recipe", "name", "which", "is", "its", "class", "name", "without", "package", "." ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/pypro/core.py#L226-L231
avladev/pypro
pypro/core.py
Recipe.module
def module(self): """ Returns the module name of Recipe. This actually represents the file basename of a recipe. """ if not hasattr(self, '_module'): self._module = re.search('[a-z]+\.([a-z]+)\.([a-z]+)', str(self.__class__), re.IGNORECASE).group(1) return se...
python
def module(self): """ Returns the module name of Recipe. This actually represents the file basename of a recipe. """ if not hasattr(self, '_module'): self._module = re.search('[a-z]+\.([a-z]+)\.([a-z]+)', str(self.__class__), re.IGNORECASE).group(1) return se...
[ "def", "module", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_module'", ")", ":", "self", ".", "_module", "=", "re", ".", "search", "(", "'[a-z]+\\.([a-z]+)\\.([a-z]+)'", ",", "str", "(", "self", ".", "__class__", ")", ",", "re",...
Returns the module name of Recipe. This actually represents the file basename of a recipe.
[ "Returns", "the", "module", "name", "of", "Recipe", ".", "This", "actually", "represents", "the", "file", "basename", "of", "a", "recipe", "." ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/pypro/core.py#L234-L242
avladev/pypro
pypro/core.py
Recipe.settings
def settings(self): """ Loads the recipe settings file which is locate in: ./settings/{recipe_package}.ini """ settings_file = os.path.join(os.getcwd(), 'settings', self.module.lower() + '.ini') # Loads the settings file once. if (not hasattr(self, '_settings') o...
python
def settings(self): """ Loads the recipe settings file which is locate in: ./settings/{recipe_package}.ini """ settings_file = os.path.join(os.getcwd(), 'settings', self.module.lower() + '.ini') # Loads the settings file once. if (not hasattr(self, '_settings') o...
[ "def", "settings", "(", "self", ")", ":", "settings_file", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "'settings'", ",", "self", ".", "module", ".", "lower", "(", ")", "+", "'.ini'", ")", "# Loads the settings file on...
Loads the recipe settings file which is locate in: ./settings/{recipe_package}.ini
[ "Loads", "the", "recipe", "settings", "file", "which", "is", "locate", "in", ":", ".", "/", "settings", "/", "{", "recipe_package", "}", ".", "ini" ]
train
https://github.com/avladev/pypro/blob/7eb98c5ebd9830104689d105c36424b24c72b475/pypro/core.py#L245-L267
mulkieran/justbases
src/justbases/_rationals.py
Radices._reverse_rounding_method
def _reverse_rounding_method(method): """ Reverse meaning of ``method`` between positive and negative. """ if method is RoundingMethods.ROUND_UP: return RoundingMethods.ROUND_DOWN if method is RoundingMethods.ROUND_DOWN: return RoundingMethods.ROUND_UP ...
python
def _reverse_rounding_method(method): """ Reverse meaning of ``method`` between positive and negative. """ if method is RoundingMethods.ROUND_UP: return RoundingMethods.ROUND_DOWN if method is RoundingMethods.ROUND_DOWN: return RoundingMethods.ROUND_UP ...
[ "def", "_reverse_rounding_method", "(", "method", ")", ":", "if", "method", "is", "RoundingMethods", ".", "ROUND_UP", ":", "return", "RoundingMethods", ".", "ROUND_DOWN", "if", "method", "is", "RoundingMethods", ".", "ROUND_DOWN", ":", "return", "RoundingMethods", ...
Reverse meaning of ``method`` between positive and negative.
[ "Reverse", "meaning", "of", "method", "between", "positive", "and", "negative", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L44-L59
mulkieran/justbases
src/justbases/_rationals.py
Radices.from_rational
def from_rational( cls, value, to_base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Convert rational value to a base. :param Rational value: the value to convert :param int to_base: base of result, must be at least 2 :param pre...
python
def from_rational( cls, value, to_base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Convert rational value to a base. :param Rational value: the value to convert :param int to_base: base of result, must be at least 2 :param pre...
[ "def", "from_rational", "(", "cls", ",", "value", ",", "to_base", ",", "precision", "=", "None", ",", "method", "=", "RoundingMethods", ".", "ROUND_DOWN", ")", ":", "# pylint: disable=too-many-locals", "if", "to_base", "<", "2", ":", "raise", "BasesValueError", ...
Convert rational value to a base. :param Rational value: the value to convert :param int to_base: base of result, must be at least 2 :param precision: number of digits in total or None :type precision: int or NoneType :param method: rounding method :type method: element ...
[ "Convert", "rational", "value", "to", "a", "base", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L62-L132
mulkieran/justbases
src/justbases/_rationals.py
Rationals.round_to_int
def round_to_int(value, method): """ Round ``value`` to an int according to ``method``. :param Rational value: the value to round :param method: the rounding method (of RoundingMethods.METHODS()) :returns: rounded value and relation of rounded value to actual value. :rt...
python
def round_to_int(value, method): """ Round ``value`` to an int according to ``method``. :param Rational value: the value to round :param method: the rounding method (of RoundingMethods.METHODS()) :returns: rounded value and relation of rounded value to actual value. :rt...
[ "def", "round_to_int", "(", "value", ",", "method", ")", ":", "# pylint: disable=too-many-return-statements", "if", "value", ".", "denominator", "==", "1", ":", "return", "(", "value", ".", "numerator", ",", "0", ")", "int_value", "=", "int", "(", "value", "...
Round ``value`` to an int according to ``method``. :param Rational value: the value to round :param method: the rounding method (of RoundingMethods.METHODS()) :returns: rounded value and relation of rounded value to actual value. :rtype: (int * int) Complexity: O(1)
[ "Round", "value", "to", "an", "int", "according", "to", "method", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L142-L186
mulkieran/justbases
src/justbases/_rationals.py
Radix._validate
def _validate( # pylint: disable=too-many-arguments cls, sign, integer_part, non_repeating_part, repeating_part, base ): """ Check if radix is valid. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the part on the left...
python
def _validate( # pylint: disable=too-many-arguments cls, sign, integer_part, non_repeating_part, repeating_part, base ): """ Check if radix is valid. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the part on the left...
[ "def", "_validate", "(", "# pylint: disable=too-many-arguments", "cls", ",", "sign", ",", "integer_part", ",", "non_repeating_part", ",", "repeating_part", ",", "base", ")", ":", "if", "any", "(", "x", "<", "0", "or", "x", ">=", "base", "for", "x", "in", "...
Check if radix is valid. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the part on the left side of the radix :type integer_part: list of int :param non_repeating_part: non repeating part on left side :type non_repeating_part: list of int :param repeat...
[ "Check", "if", "radix", "is", "valid", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L208-L261
mulkieran/justbases
src/justbases/_rationals.py
Radix._repeat_length
def _repeat_length(cls, part): """ The length of the repeated portions of ``part``. :param part: a number :type part: list of int :returns: the first index at which part repeats :rtype: int If part does not repeat, result is the length of part. Complexi...
python
def _repeat_length(cls, part): """ The length of the repeated portions of ``part``. :param part: a number :type part: list of int :returns: the first index at which part repeats :rtype: int If part does not repeat, result is the length of part. Complexi...
[ "def", "_repeat_length", "(", "cls", ",", "part", ")", ":", "repeat_len", "=", "len", "(", "part", ")", "if", "repeat_len", "==", "0", ":", "return", "repeat_len", "first_digit", "=", "part", "[", "0", "]", "limit", "=", "repeat_len", "//", "2", "+", ...
The length of the repeated portions of ``part``. :param part: a number :type part: list of int :returns: the first index at which part repeats :rtype: int If part does not repeat, result is the length of part. Complexity: O(len(part)^2)
[ "The", "length", "of", "the", "repeated", "portions", "of", "part", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L264-L291
mulkieran/justbases
src/justbases/_rationals.py
Radix._canonicalize_fraction
def _canonicalize_fraction(cls, non_repeating, repeating): """ If the same fractional value can be represented by stripping repeating part from ``non_repeating``, do it. :param non_repeating: non repeating part of fraction :type non_repeating: list of int :param repeatin...
python
def _canonicalize_fraction(cls, non_repeating, repeating): """ If the same fractional value can be represented by stripping repeating part from ``non_repeating``, do it. :param non_repeating: non repeating part of fraction :type non_repeating: list of int :param repeatin...
[ "def", "_canonicalize_fraction", "(", "cls", ",", "non_repeating", ",", "repeating", ")", ":", "if", "repeating", "==", "[", "]", ":", "return", "(", "non_repeating", ",", "repeating", ")", "repeat_len", "=", "len", "(", "repeating", ")", "# strip all exact ma...
If the same fractional value can be represented by stripping repeating part from ``non_repeating``, do it. :param non_repeating: non repeating part of fraction :type non_repeating: list of int :param repeating: repeating part of fraction :type repeating: list of int :ret...
[ "If", "the", "same", "fractional", "value", "can", "be", "represented", "by", "stripping", "repeating", "part", "from", "non_repeating", "do", "it", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L294-L333
mulkieran/justbases
src/justbases/_rationals.py
Radix.getString
def getString(self, config, relation=0): """ Return a representation of a Radix according to config. :param DisplayConfig config: configuration :param int relation: the relation of this value to actual value """ return String(config, self.base).xform(self, relation)
python
def getString(self, config, relation=0): """ Return a representation of a Radix according to config. :param DisplayConfig config: configuration :param int relation: the relation of this value to actual value """ return String(config, self.base).xform(self, relation)
[ "def", "getString", "(", "self", ",", "config", ",", "relation", "=", "0", ")", ":", "return", "String", "(", "config", ",", "self", ".", "base", ")", ".", "xform", "(", "self", ",", "relation", ")" ]
Return a representation of a Radix according to config. :param DisplayConfig config: configuration :param int relation: the relation of this value to actual value
[ "Return", "a", "representation", "of", "a", "Radix", "according", "to", "config", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L406-L413
mulkieran/justbases
src/justbases/_rationals.py
Radix.as_rational
def as_rational(self): """ Return this value as a Rational. :returns: this radix as a rational :rtype: Rational """ (denominator, numerator) = \ NatDivision.undivision( self.integer_part, self.non_repeating_part, self....
python
def as_rational(self): """ Return this value as a Rational. :returns: this radix as a rational :rtype: Rational """ (denominator, numerator) = \ NatDivision.undivision( self.integer_part, self.non_repeating_part, self....
[ "def", "as_rational", "(", "self", ")", ":", "(", "denominator", ",", "numerator", ")", "=", "NatDivision", ".", "undivision", "(", "self", ".", "integer_part", ",", "self", ".", "non_repeating_part", ",", "self", ".", "repeating_part", ",", "self", ".", "...
Return this value as a Rational. :returns: this radix as a rational :rtype: Rational
[ "Return", "this", "value", "as", "a", "Rational", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L476-L494
mulkieran/justbases
src/justbases/_rationals.py
Radix.as_int
def as_int(self, method): """ This value as an int, rounded according to ``method``. :param method: rounding method :raises BasesValueError: on bad parameters :returns: corresponding int value :rtype: int """ (new_radix, relation) = self.rounded(0, metho...
python
def as_int(self, method): """ This value as an int, rounded according to ``method``. :param method: rounding method :raises BasesValueError: on bad parameters :returns: corresponding int value :rtype: int """ (new_radix, relation) = self.rounded(0, metho...
[ "def", "as_int", "(", "self", ",", "method", ")", ":", "(", "new_radix", ",", "relation", ")", "=", "self", ".", "rounded", "(", "0", ",", "method", ")", "value", "=", "Nats", ".", "convert_to_int", "(", "new_radix", ".", "integer_part", ",", "new_radi...
This value as an int, rounded according to ``method``. :param method: rounding method :raises BasesValueError: on bad parameters :returns: corresponding int value :rtype: int
[ "This", "value", "as", "an", "int", "rounded", "according", "to", "method", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L496-L508
mulkieran/justbases
src/justbases/_rationals.py
Radix.in_base
def in_base(self, base): """ Return value in ``base``. :returns: Radix in ``base`` :rtype: Radix :raises ConvertError: if ``base`` is less than 2 """ if base == self.base: return copy.deepcopy(self) (result, _) = Radices.from_rational(self.as_...
python
def in_base(self, base): """ Return value in ``base``. :returns: Radix in ``base`` :rtype: Radix :raises ConvertError: if ``base`` is less than 2 """ if base == self.base: return copy.deepcopy(self) (result, _) = Radices.from_rational(self.as_...
[ "def", "in_base", "(", "self", ",", "base", ")", ":", "if", "base", "==", "self", ".", "base", ":", "return", "copy", ".", "deepcopy", "(", "self", ")", "(", "result", ",", "_", ")", "=", "Radices", ".", "from_rational", "(", "self", ".", "as_ratio...
Return value in ``base``. :returns: Radix in ``base`` :rtype: Radix :raises ConvertError: if ``base`` is less than 2
[ "Return", "value", "in", "base", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L525-L536
mulkieran/justbases
src/justbases/_rationals.py
_Rounding._conditional_toward_zero
def _conditional_toward_zero(method, sign): """ Whether to round toward zero. :param method: rounding method :type method: element of RoundingMethods.METHODS() :param int sign: -1, 0, or 1 as appropriate Complexity: O(1) """ return method is RoundingMeth...
python
def _conditional_toward_zero(method, sign): """ Whether to round toward zero. :param method: rounding method :type method: element of RoundingMethods.METHODS() :param int sign: -1, 0, or 1 as appropriate Complexity: O(1) """ return method is RoundingMeth...
[ "def", "_conditional_toward_zero", "(", "method", ",", "sign", ")", ":", "return", "method", "is", "RoundingMethods", ".", "ROUND_HALF_ZERO", "or", "(", "method", "is", "RoundingMethods", ".", "ROUND_HALF_DOWN", "and", "sign", "==", "1", ")", "or", "(", "metho...
Whether to round toward zero. :param method: rounding method :type method: element of RoundingMethods.METHODS() :param int sign: -1, 0, or 1 as appropriate Complexity: O(1)
[ "Whether", "to", "round", "toward", "zero", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L547-L559
mulkieran/justbases
src/justbases/_rationals.py
_Rounding._increment
def _increment(sign, integer_part, non_repeating_part, base): """ Return an increment radix. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the integer part :type integer_part: list of int :param non_repeating_part: the fractional part :type non...
python
def _increment(sign, integer_part, non_repeating_part, base): """ Return an increment radix. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the integer part :type integer_part: list of int :param non_repeating_part: the fractional part :type non...
[ "def", "_increment", "(", "sign", ",", "integer_part", ",", "non_repeating_part", ",", "base", ")", ":", "(", "carry", ",", "non_repeating_part", ")", "=", "Nats", ".", "carry_in", "(", "non_repeating_part", ",", "1", ",", "base", ")", "(", "carry", ",", ...
Return an increment radix. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the integer part :type integer_part: list of int :param non_repeating_part: the fractional part :type non_repeating_part: list of int :param int base: the base :returns: ...
[ "Return", "an", "increment", "radix", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L562-L589
mulkieran/justbases
src/justbases/_rationals.py
_Rounding.roundFractional
def roundFractional(cls, value, precision, method): """ Round to precision as number of digits after radix. :param Radix value: value to round :param int precision: number of digits in total :param method: rounding method :raises BasesValueError: on bad parameters ...
python
def roundFractional(cls, value, precision, method): """ Round to precision as number of digits after radix. :param Radix value: value to round :param int precision: number of digits in total :param method: rounding method :raises BasesValueError: on bad parameters ...
[ "def", "roundFractional", "(", "cls", ",", "value", ",", "precision", ",", "method", ")", ":", "# pylint: disable=too-many-return-statements", "# pylint: disable=too-many-branches", "if", "precision", "<", "0", ":", "raise", "BasesValueError", "(", "precision", ",", "...
Round to precision as number of digits after radix. :param Radix value: value to round :param int precision: number of digits in total :param method: rounding method :raises BasesValueError: on bad parameters Precondition: Radix is valid and canonical Complexity: O(len...
[ "Round", "to", "precision", "as", "number", "of", "digits", "after", "radix", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L592-L684
mitsei/dlkit
dlkit/runtime/impls/osid/properties.py
PropertyList.get_next_property
def get_next_property(self): """Gets the next ``Property`` in this list. :return: the next ``Property`` in this list. The ``has_next()`` method should be used to test that a next ``Property`` is available before calling this method. :rtype: ``osid.Property`` :raise: ``IllegalState`` -- ...
python
def get_next_property(self): """Gets the next ``Property`` in this list. :return: the next ``Property`` in this list. The ``has_next()`` method should be used to test that a next ``Property`` is available before calling this method. :rtype: ``osid.Property`` :raise: ``IllegalState`` -- ...
[ "def", "get_next_property", "(", "self", ")", ":", "try", ":", "next_object", "=", "self", ".", "next", "(", ")", "except", "StopIteration", ":", "raise", "IllegalState", "(", "'no more elements available in this list'", ")", "except", "Exception", ":", "# Need to...
Gets the next ``Property`` in this list. :return: the next ``Property`` in this list. The ``has_next()`` method should be used to test that a next ``Property`` is available before calling this method. :rtype: ``osid.Property`` :raise: ``IllegalState`` -- no more elements available in this list ...
[ "Gets", "the", "next", "Property", "in", "this", "list", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/osid/properties.py#L97-L115
beathan/django-akamai
django_akamai/purge.py
load_edgegrid_client_settings
def load_edgegrid_client_settings(): '''Load Akamai EdgeGrid configuration returns a (hostname, EdgeGridAuth) tuple from the following locations: 1. Values specified directly in the Django settings:: AKAMAI_CCU_CLIENT_SECRET AKAMAI_CCU_HOST AKAMAI_CCU_ACCESS_TOKEN AKAMAI_CC...
python
def load_edgegrid_client_settings(): '''Load Akamai EdgeGrid configuration returns a (hostname, EdgeGridAuth) tuple from the following locations: 1. Values specified directly in the Django settings:: AKAMAI_CCU_CLIENT_SECRET AKAMAI_CCU_HOST AKAMAI_CCU_ACCESS_TOKEN AKAMAI_CC...
[ "def", "load_edgegrid_client_settings", "(", ")", ":", "if", "getattr", "(", "settings", ",", "'AKAMAI_CCU_CLIENT_SECRET'", ",", "None", ")", ":", "# If the settings module has the values directly and they are not empty", "# we'll use them without checking for an edgerc file:", "ho...
Load Akamai EdgeGrid configuration returns a (hostname, EdgeGridAuth) tuple from the following locations: 1. Values specified directly in the Django settings:: AKAMAI_CCU_CLIENT_SECRET AKAMAI_CCU_HOST AKAMAI_CCU_ACCESS_TOKEN AKAMAI_CCU_CLIENT_TOKEN 2. An edgerc file specifi...
[ "Load", "Akamai", "EdgeGrid", "configuration" ]
train
https://github.com/beathan/django-akamai/blob/00cab2dd5fab3745742721185e75a55a5c26fe7e/django_akamai/purge.py#L68-L106
beathan/django-akamai
django_akamai/purge.py
PurgeRequest.add
def add(self, urls): """ Add the provided urls to this purge request The urls argument can be a single string, a list of strings, a queryset or model instance. Models must implement `get_absolute_url()`. """ if isinstance(urls, (list, tuple)): self.urls.exte...
python
def add(self, urls): """ Add the provided urls to this purge request The urls argument can be a single string, a list of strings, a queryset or model instance. Models must implement `get_absolute_url()`. """ if isinstance(urls, (list, tuple)): self.urls.exte...
[ "def", "add", "(", "self", ",", "urls", ")", ":", "if", "isinstance", "(", "urls", ",", "(", "list", ",", "tuple", ")", ")", ":", "self", ".", "urls", ".", "extend", "(", "urls", ")", "elif", "isinstance", "(", "urls", ",", "basestring", ")", ":"...
Add the provided urls to this purge request The urls argument can be a single string, a list of strings, a queryset or model instance. Models must implement `get_absolute_url()`.
[ "Add", "the", "provided", "urls", "to", "this", "purge", "request" ]
train
https://github.com/beathan/django-akamai/blob/00cab2dd5fab3745742721185e75a55a5c26fe7e/django_akamai/purge.py#L149-L167
beathan/django-akamai
django_akamai/purge.py
PurgeRequest.purge
def purge(self): """Submit purge request(s) to the CCU API Since a purge call may require multiple API requests and may trigger rate-limiting this method uses a generator to provide the results of each request, allowing you to communicate request progress or implement a custom rate-limi...
python
def purge(self): """Submit purge request(s) to the CCU API Since a purge call may require multiple API requests and may trigger rate-limiting this method uses a generator to provide the results of each request, allowing you to communicate request progress or implement a custom rate-limi...
[ "def", "purge", "(", "self", ")", ":", "purge_url", "=", "urljoin", "(", "'https://%s'", "%", "self", ".", "host", ",", "'/ccu/v3/%s/url/%s'", "%", "(", "self", ".", "action", ",", "self", ".", "network", ")", ")", "while", "self", ".", "urls", ":", ...
Submit purge request(s) to the CCU API Since a purge call may require multiple API requests and may trigger rate-limiting this method uses a generator to provide the results of each request, allowing you to communicate request progress or implement a custom rate-limiting response:: ...
[ "Submit", "purge", "request", "(", "s", ")", "to", "the", "CCU", "API" ]
train
https://github.com/beathan/django-akamai/blob/00cab2dd5fab3745742721185e75a55a5c26fe7e/django_akamai/purge.py#L169-L221
beathan/django-akamai
django_akamai/purge.py
PurgeRequest.purge_all
def purge_all(self, rate_limit_delay=60): '''Purge all pending URLs, waiting for API rate-limits if necessary!''' for batch, response in self.purge(): if response.status_code == 507: details = response.json().get('detail', '<response did not contain "detail">') ...
python
def purge_all(self, rate_limit_delay=60): '''Purge all pending URLs, waiting for API rate-limits if necessary!''' for batch, response in self.purge(): if response.status_code == 507: details = response.json().get('detail', '<response did not contain "detail">') ...
[ "def", "purge_all", "(", "self", ",", "rate_limit_delay", "=", "60", ")", ":", "for", "batch", ",", "response", "in", "self", ".", "purge", "(", ")", ":", "if", "response", ".", "status_code", "==", "507", ":", "details", "=", "response", ".", "json", ...
Purge all pending URLs, waiting for API rate-limits if necessary!
[ "Purge", "all", "pending", "URLs", "waiting", "for", "API", "rate", "-", "limits", "if", "necessary!" ]
train
https://github.com/beathan/django-akamai/blob/00cab2dd5fab3745742721185e75a55a5c26fe7e/django_akamai/purge.py#L223-L231
mitsei/dlkit
dlkit/records/assessment/fbw/assessment_bank_records.py
AssessmentBankWithObjectiveBankFormRecord._init_metadata
def _init_metadata(self): """stub""" self._objective_bank_id_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'objective_bank_id'), 'element_label': 'Objective Bank Id...
python
def _init_metadata(self): """stub""" self._objective_bank_id_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'objective_bank_id'), 'element_label': 'Objective Bank Id...
[ "def", "_init_metadata", "(", "self", ")", ":", "self", ".", "_objective_bank_id_metadata", "=", "{", "'element_id'", ":", "Id", "(", "self", ".", "my_osid_object_form", ".", "_authority", ",", "self", ".", "my_osid_object_form", ".", "_namespace", ",", "'object...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/fbw/assessment_bank_records.py#L48-L63
mitsei/dlkit
dlkit/records/assessment/fbw/assessment_bank_records.py
AssessmentBankWithObjectiveBankFormRecord.clear_objective_bank_id
def clear_objective_bank_id(self): """stub""" if (self.get_objective_bank_id_metadata().is_read_only() or self.get_objective_bank_id_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['objectiveBankId'] = ''
python
def clear_objective_bank_id(self): """stub""" if (self.get_objective_bank_id_metadata().is_read_only() or self.get_objective_bank_id_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['objectiveBankId'] = ''
[ "def", "clear_objective_bank_id", "(", "self", ")", ":", "if", "(", "self", ".", "get_objective_bank_id_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_objective_bank_id_metadata", "(", ")", ".", "is_required", "(", ")", ")", ":", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/fbw/assessment_bank_records.py#L73-L78
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
MagicNumericResponseItemLookupSession.get_item
def get_item(self, item_id): """ see if this is a magic item id (i.e. questionId). If so, grab the item and set the params. If not, just pass through to the original Mongo ItemLookupSession :param item_id: :return: """ authority = item_id.authority mgr = s...
python
def get_item(self, item_id): """ see if this is a magic item id (i.e. questionId). If so, grab the item and set the params. If not, just pass through to the original Mongo ItemLookupSession :param item_id: :return: """ authority = item_id.authority mgr = s...
[ "def", "get_item", "(", "self", ",", "item_id", ")", ":", "authority", "=", "item_id", ".", "authority", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'ASSESSMENT'", ",", "local", "=", "True", ")", "if", "self", ".", "_proxy", "is", "not", "Non...
see if this is a magic item id (i.e. questionId). If so, grab the item and set the params. If not, just pass through to the original Mongo ItemLookupSession :param item_id: :return:
[ "see", "if", "this", "is", "a", "magic", "item", "id", "(", "i", ".", "e", ".", "questionId", ")", ".", "If", "so", "grab", "the", "item", "and", "set", "the", "params", ".", "If", "not", "just", "pass", "through", "to", "the", "original", "Mongo",...
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L60-L87
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
CalculationInteractionQuestionFormRecord._init_map
def _init_map(self): """stub""" super(CalculationInteractionQuestionFormRecord, self)._init_map() QuestionTextFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) self.my_osid_object_form._my_map['text']['text'] = '' self.my_osid_object_form._my_map['variabl...
python
def _init_map(self): """stub""" super(CalculationInteractionQuestionFormRecord, self)._init_map() QuestionTextFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) self.my_osid_object_form._my_map['text']['text'] = '' self.my_osid_object_form._my_map['variabl...
[ "def", "_init_map", "(", "self", ")", ":", "super", "(", "CalculationInteractionQuestionFormRecord", ",", "self", ")", ".", "_init_map", "(", ")", "QuestionTextFormRecord", ".", "_init_map", "(", "self", ")", "QuestionFilesFormRecord", ".", "_init_map", "(", "self...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L379-L388
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
CalculationInteractionQuestionFormRecord._init_metadata
def _init_metadata(self): """stub""" super(CalculationInteractionQuestionFormRecord, self)._init_metadata() QuestionTextFormRecord._init_metadata(self) QuestionFilesFormRecord._init_metadata(self) self._variables_metadata = { 'element_id': Id(self.my_osid_object_form....
python
def _init_metadata(self): """stub""" super(CalculationInteractionQuestionFormRecord, self)._init_metadata() QuestionTextFormRecord._init_metadata(self) QuestionFilesFormRecord._init_metadata(self) self._variables_metadata = { 'element_id': Id(self.my_osid_object_form....
[ "def", "_init_metadata", "(", "self", ")", ":", "super", "(", "CalculationInteractionQuestionFormRecord", ",", "self", ")", ".", "_init_metadata", "(", ")", "QuestionTextFormRecord", ".", "_init_metadata", "(", "self", ")", "QuestionFilesFormRecord", ".", "_init_metad...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L390-L429
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
CalculationInteractionFeedbackAndFilesAnswerFormRecord._init_map
def _init_map(self): """call these all manually because non-cooperative""" DecimalValuesFormRecord._init_map(self) IntegerValuesFormRecord._init_map(self) TextAnswerFormRecord._init_map(self) FilesAnswerFormRecord._init_map(self) FeedbackAnswerFormRecord._init_map(self) ...
python
def _init_map(self): """call these all manually because non-cooperative""" DecimalValuesFormRecord._init_map(self) IntegerValuesFormRecord._init_map(self) TextAnswerFormRecord._init_map(self) FilesAnswerFormRecord._init_map(self) FeedbackAnswerFormRecord._init_map(self) ...
[ "def", "_init_map", "(", "self", ")", ":", "DecimalValuesFormRecord", ".", "_init_map", "(", "self", ")", "IntegerValuesFormRecord", ".", "_init_map", "(", "self", ")", "TextAnswerFormRecord", ".", "_init_map", "(", "self", ")", "FilesAnswerFormRecord", ".", "_ini...
call these all manually because non-cooperative
[ "call", "these", "all", "manually", "because", "non", "-", "cooperative" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L560-L569
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
MultiLanguageCalculationInteractionQuestionFormRecord._init_map
def _init_map(self): """stub""" super(MultiLanguageCalculationInteractionQuestionFormRecord, self)._init_map() MultiLanguageQuestionFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) self.my_osid_object_form._my_map['variables'] = \ self._variables_met...
python
def _init_map(self): """stub""" super(MultiLanguageCalculationInteractionQuestionFormRecord, self)._init_map() MultiLanguageQuestionFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) self.my_osid_object_form._my_map['variables'] = \ self._variables_met...
[ "def", "_init_map", "(", "self", ")", ":", "super", "(", "MultiLanguageCalculationInteractionQuestionFormRecord", ",", "self", ")", ".", "_init_map", "(", ")", "MultiLanguageQuestionFormRecord", ".", "_init_map", "(", "self", ")", "QuestionFilesFormRecord", ".", "_ini...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L722-L730
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord._init_map
def _init_map(self): """call these all manually because non-cooperative""" DecimalValuesFormRecord._init_map(self) IntegerValuesFormRecord._init_map(self) TextAnswerFormRecord._init_map(self) super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_m...
python
def _init_map(self): """call these all manually because non-cooperative""" DecimalValuesFormRecord._init_map(self) IntegerValuesFormRecord._init_map(self) TextAnswerFormRecord._init_map(self) super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_m...
[ "def", "_init_map", "(", "self", ")", ":", "DecimalValuesFormRecord", ".", "_init_map", "(", "self", ")", "IntegerValuesFormRecord", ".", "_init_map", "(", "self", ")", "TextAnswerFormRecord", ".", "_init_map", "(", "self", ")", "super", "(", "MultiLanguageCalcula...
call these all manually because non-cooperative
[ "call", "these", "all", "manually", "because", "non", "-", "cooperative" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L896-L903
mitsei/dlkit
dlkit/records/assessment/qti/numeric_response_records.py
MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord._init_metadata
def _init_metadata(self): """stub""" DecimalValuesFormRecord._init_metadata(self) IntegerValuesFormRecord._init_metadata(self) TextAnswerFormRecord._init_metadata(self) super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_metadata() self....
python
def _init_metadata(self): """stub""" DecimalValuesFormRecord._init_metadata(self) IntegerValuesFormRecord._init_metadata(self) TextAnswerFormRecord._init_metadata(self) super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_metadata() self....
[ "def", "_init_metadata", "(", "self", ")", ":", "DecimalValuesFormRecord", ".", "_init_metadata", "(", "self", ")", "IntegerValuesFormRecord", ".", "_init_metadata", "(", "self", ")", "TextAnswerFormRecord", ".", "_init_metadata", "(", "self", ")", "super", "(", "...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/numeric_response_records.py#L905-L931
mitsei/dlkit
dlkit/authz_adapter/relationship/sessions.py
RelationshipLookupSession.get_relationships_for_source_on_date
def get_relationships_for_source_on_date(self, source_id, from_, to): """Pass through to provider RelationshipLookupSession.get_relationships_for_source_on_date""" # Implemented from azosid template for - # osid.relationship.RelationshipLookupSession.get_relationships_for_source_on_date_template...
python
def get_relationships_for_source_on_date(self, source_id, from_, to): """Pass through to provider RelationshipLookupSession.get_relationships_for_source_on_date""" # Implemented from azosid template for - # osid.relationship.RelationshipLookupSession.get_relationships_for_source_on_date_template...
[ "def", "get_relationships_for_source_on_date", "(", "self", ",", "source_id", ",", "from_", ",", "to", ")", ":", "# Implemented from azosid template for -", "# osid.relationship.RelationshipLookupSession.get_relationships_for_source_on_date_template", "if", "self", ".", "_can", "...
Pass through to provider RelationshipLookupSession.get_relationships_for_source_on_date
[ "Pass", "through", "to", "provider", "RelationshipLookupSession", ".", "get_relationships_for_source_on_date" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/authz_adapter/relationship/sessions.py#L200-L210
mitsei/dlkit
dlkit/authz_adapter/relationship/sessions.py
RelationshipSearchSession.get_relationships_by_search
def get_relationships_by_search(self, relationship_query, relationship_search): """Pass through to provider RelationshipSearchSession.get_relationships_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self...
python
def get_relationships_by_search(self, relationship_query, relationship_search): """Pass through to provider RelationshipSearchSession.get_relationships_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self...
[ "def", "get_relationships_by_search", "(", "self", ",", "relationship_query", ",", "relationship_search", ")", ":", "# Implemented from azosid template for -", "# osid.resource.ResourceSearchSession.get_resources_by_search_template", "if", "not", "self", ".", "_can", "(", "'searc...
Pass through to provider RelationshipSearchSession.get_relationships_by_search
[ "Pass", "through", "to", "provider", "RelationshipSearchSession", ".", "get_relationships_by_search" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/authz_adapter/relationship/sessions.py#L401-L407
mitsei/dlkit
dlkit/services/authentication.py
AuthenticationManager._set_agency_view
def _set_agency_view(self, session): """Sets the underlying agency view to match current view""" if self._agency_view == COMPARATIVE: try: session.use_comparative_agency_view() except AttributeError: pass else: try: ...
python
def _set_agency_view(self, session): """Sets the underlying agency view to match current view""" if self._agency_view == COMPARATIVE: try: session.use_comparative_agency_view() except AttributeError: pass else: try: ...
[ "def", "_set_agency_view", "(", "self", ",", "session", ")", ":", "if", "self", ".", "_agency_view", "==", "COMPARATIVE", ":", "try", ":", "session", ".", "use_comparative_agency_view", "(", ")", "except", "AttributeError", ":", "pass", "else", ":", "try", "...
Sets the underlying agency view to match current view
[ "Sets", "the", "underlying", "agency", "view", "to", "match", "current", "view" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authentication.py#L133-L144
theosysbio/means
src/means/io/serialise.py
to_file
def to_file(data, filename_or_file_object): """ Write ``data`` to a file specified by either filename of the file or an opened :class:`file` buffer. :param data: Object to write to file :param filename_or_file_object: filename/or opened file buffer to write to :type filename_or_file_object: basestr...
python
def to_file(data, filename_or_file_object): """ Write ``data`` to a file specified by either filename of the file or an opened :class:`file` buffer. :param data: Object to write to file :param filename_or_file_object: filename/or opened file buffer to write to :type filename_or_file_object: basestr...
[ "def", "to_file", "(", "data", ",", "filename_or_file_object", ")", ":", "if", "isinstance", "(", "filename_or_file_object", ",", "basestring", ")", ":", "file_", "=", "open", "(", "filename_or_file_object", ",", "'w'", ")", "we_opened", "=", "True", "else", "...
Write ``data`` to a file specified by either filename of the file or an opened :class:`file` buffer. :param data: Object to write to file :param filename_or_file_object: filename/or opened file buffer to write to :type filename_or_file_object: basestring|file
[ "Write", "data", "to", "a", "file", "specified", "by", "either", "filename", "of", "the", "file", "or", "an", "opened", ":", "class", ":", "file", "buffer", "." ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/io/serialise.py#L64-L83
theosysbio/means
src/means/io/serialise.py
from_file
def from_file(filename_or_file_object): """ Read data from the specified file. :param filename_or_file_object: filename of the file or an opened :class:`file` buffer to that file :type filename_or_file_object: basestring|file :return: """ if isinstance(filename_or_file_object, basestring): ...
python
def from_file(filename_or_file_object): """ Read data from the specified file. :param filename_or_file_object: filename of the file or an opened :class:`file` buffer to that file :type filename_or_file_object: basestring|file :return: """ if isinstance(filename_or_file_object, basestring): ...
[ "def", "from_file", "(", "filename_or_file_object", ")", ":", "if", "isinstance", "(", "filename_or_file_object", ",", "basestring", ")", ":", "file_", "=", "open", "(", "filename_or_file_object", ",", "'r'", ")", "we_opened", "=", "True", "else", ":", "we_opene...
Read data from the specified file. :param filename_or_file_object: filename of the file or an opened :class:`file` buffer to that file :type filename_or_file_object: basestring|file :return:
[ "Read", "data", "from", "the", "specified", "file", ".", ":", "param", "filename_or_file_object", ":", "filename", "of", "the", "file", "or", "an", "opened", ":", "class", ":", "file", "buffer", "to", "that", "file", ":", "type", "filename_or_file_object", "...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/io/serialise.py#L85-L105
theosysbio/means
src/means/io/serialise.py
SerialisableObject.from_file
def from_file(cls, filename_or_file_object): """ Create new instance of the object from the file. :param filename_or_file_object: the filename of the file to read from or already opened file buffer :type filename_or_file_object: basestring|file """ object_ = from_file(fil...
python
def from_file(cls, filename_or_file_object): """ Create new instance of the object from the file. :param filename_or_file_object: the filename of the file to read from or already opened file buffer :type filename_or_file_object: basestring|file """ object_ = from_file(fil...
[ "def", "from_file", "(", "cls", ",", "filename_or_file_object", ")", ":", "object_", "=", "from_file", "(", "filename_or_file_object", ")", "if", "not", "isinstance", "(", "object_", ",", "cls", ")", ":", "raise", "ValueError", "(", "'Expected to read {0!r} object...
Create new instance of the object from the file. :param filename_or_file_object: the filename of the file to read from or already opened file buffer :type filename_or_file_object: basestring|file
[ "Create", "new", "instance", "of", "the", "object", "from", "the", "file", ".", ":", "param", "filename_or_file_object", ":", "the", "filename", "of", "the", "file", "to", "read", "from", "or", "already", "opened", "file", "buffer", ":", "type", "filename_or...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/io/serialise.py#L26-L36
ascribe/pyspool
spool/spoolex.py
BlockchainSpider.history
def history(self, hash): """ Retrieve the ownership tree of all editions of a piece given the hash. Args: hash (str): Hash of the file to check. Can be created with the :class:`File` class Returns: dict: Ownsership tree of all editions of a piece...
python
def history(self, hash): """ Retrieve the ownership tree of all editions of a piece given the hash. Args: hash (str): Hash of the file to check. Can be created with the :class:`File` class Returns: dict: Ownsership tree of all editions of a piece...
[ "def", "history", "(", "self", ",", "hash", ")", ":", "txs", "=", "self", ".", "_t", ".", "get", "(", "hash", ",", "max_transactions", "=", "10000", ")", "[", "'transactions'", "]", "tree", "=", "defaultdict", "(", "list", ")", "number_editions", "=", ...
Retrieve the ownership tree of all editions of a piece given the hash. Args: hash (str): Hash of the file to check. Can be created with the :class:`File` class Returns: dict: Ownsership tree of all editions of a piece. .. note:: For now we only support ...
[ "Retrieve", "the", "ownership", "tree", "of", "all", "editions", "of", "a", "piece", "given", "the", "hash", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L70-L118
ascribe/pyspool
spool/spoolex.py
BlockchainSpider.chain
def chain(tree, edition_number): """ Args: tree (dict): Tree history of all editions of a piece. edition_number (int): The edition number to check for. In the case of a piece (master edition), an empty string (``''``) or zero (``0``) can be passed....
python
def chain(tree, edition_number): """ Args: tree (dict): Tree history of all editions of a piece. edition_number (int): The edition number to check for. In the case of a piece (master edition), an empty string (``''``) or zero (``0``) can be passed....
[ "def", "chain", "(", "tree", ",", "edition_number", ")", ":", "# return the chain for an edition_number sorted by the timestamp", "return", "sorted", "(", "tree", ".", "get", "(", "edition_number", ",", "[", "]", ")", ",", "key", "=", "lambda", "d", ":", "d", ...
Args: tree (dict): Tree history of all editions of a piece. edition_number (int): The edition number to check for. In the case of a piece (master edition), an empty string (``''``) or zero (``0``) can be passed. Returns: list: The chain of own...
[ "Args", ":", "tree", "(", "dict", ")", ":", "Tree", "history", "of", "all", "editions", "of", "a", "piece", ".", "edition_number", "(", "int", ")", ":", "The", "edition", "number", "to", "check", "for", ".", "In", "the", "case", "of", "a", "piece", ...
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L121-L135
ascribe/pyspool
spool/spoolex.py
BlockchainSpider.check_script
def check_script(vouts): """ Looks into the vouts list of a transaction and returns the ``op_return`` if one exists. Args; vouts (list): List of outputs of a transaction. Returns: str: String representation of the ``op_return``. Raises: ...
python
def check_script(vouts): """ Looks into the vouts list of a transaction and returns the ``op_return`` if one exists. Args; vouts (list): List of outputs of a transaction. Returns: str: String representation of the ``op_return``. Raises: ...
[ "def", "check_script", "(", "vouts", ")", ":", "for", "vout", "in", "[", "v", "for", "v", "in", "vouts", "[", ":", ":", "-", "1", "]", "if", "v", "[", "'hex'", "]", ".", "startswith", "(", "'6a'", ")", "]", ":", "verb", "=", "BlockchainSpider", ...
Looks into the vouts list of a transaction and returns the ``op_return`` if one exists. Args; vouts (list): List of outputs of a transaction. Returns: str: String representation of the ``op_return``. Raises: Exception: If no ``vout`` having a suppor...
[ "Looks", "into", "the", "vouts", "list", "of", "a", "transaction", "and", "returns", "the", "op_return", "if", "one", "exists", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L185-L206
ascribe/pyspool
spool/spoolex.py
BlockchainSpider._get_addresses
def _get_addresses(tx): """ Checks for the from, to, and piece address of a SPOOL transaction. Args: tx (dict): Transaction payload, as returned by :meth:`transactions.Transactions.get()`. .. note:: Formats as returned by JSON-RPC API ``decoderaw...
python
def _get_addresses(tx): """ Checks for the from, to, and piece address of a SPOOL transaction. Args: tx (dict): Transaction payload, as returned by :meth:`transactions.Transactions.get()`. .. note:: Formats as returned by JSON-RPC API ``decoderaw...
[ "def", "_get_addresses", "(", "tx", ")", ":", "from_address", "=", "set", "(", "[", "vin", "[", "'address'", "]", "for", "vin", "in", "tx", "[", "'vins'", "]", "]", ")", "if", "len", "(", "from_address", ")", "!=", "1", ":", "raise", "InvalidTransact...
Checks for the from, to, and piece address of a SPOOL transaction. Args: tx (dict): Transaction payload, as returned by :meth:`transactions.Transactions.get()`. .. note:: Formats as returned by JSON-RPC API ``decoderawtransaction`` have yet to be supported. ...
[ "Checks", "for", "the", "from", "to", "and", "piece", "address", "of", "a", "SPOOL", "transaction", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L209-L235
ascribe/pyspool
spool/spoolex.py
BlockchainSpider._get_time_utc
def _get_time_utc(time_utc_str): """ Convert a string representation of the time (as returned by blockr.io api) into unix timestamp. Args: time_utc_str (str): String representation of the time, with the format: `'%Y-%m-%dT%H:%M:%S %Z'`. Returns: ...
python
def _get_time_utc(time_utc_str): """ Convert a string representation of the time (as returned by blockr.io api) into unix timestamp. Args: time_utc_str (str): String representation of the time, with the format: `'%Y-%m-%dT%H:%M:%S %Z'`. Returns: ...
[ "def", "_get_time_utc", "(", "time_utc_str", ")", ":", "dt", "=", "datetime", ".", "strptime", "(", "time_utc_str", ",", "TIME_FORMAT", ")", "return", "int", "(", "calendar", ".", "timegm", "(", "dt", ".", "utctimetuple", "(", ")", ")", ")" ]
Convert a string representation of the time (as returned by blockr.io api) into unix timestamp. Args: time_utc_str (str): String representation of the time, with the format: `'%Y-%m-%dT%H:%M:%S %Z'`. Returns: int: Unix timestamp.
[ "Convert", "a", "string", "representation", "of", "the", "time", "(", "as", "returned", "by", "blockr", ".", "io", "api", ")", "into", "unix", "timestamp", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/spoolex.py#L238-L252
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
list_perceel_adapter
def list_perceel_adapter(obj, request): """ Adapter for rendering a list of :class: `crabpy.gateway.capakey.Perceel` to json. """ return { 'id': obj.id, 'sectie': obj.sectie, 'capakey': obj.capakey, 'percid': obj.percid }
python
def list_perceel_adapter(obj, request): """ Adapter for rendering a list of :class: `crabpy.gateway.capakey.Perceel` to json. """ return { 'id': obj.id, 'sectie': obj.sectie, 'capakey': obj.capakey, 'percid': obj.percid }
[ "def", "list_perceel_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'sectie'", ":", "obj", ".", "sectie", ",", "'capakey'", ":", "obj", ".", "capakey", ",", "'percid'", ":", "obj", ".", "percid", "...
Adapter for rendering a list of :class: `crabpy.gateway.capakey.Perceel` to json.
[ "Adapter", "for", "rendering", "a", "list", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "capakey", ".", "Perceel", "to", "json", "." ]
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L49-L59
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
item_gemeente_adapter
def item_gemeente_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Gemeente` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'centroid': obj.centroid, 'bounding_box': obj.bounding_box }
python
def item_gemeente_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Gemeente` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'centroid': obj.centroid, 'bounding_box': obj.bounding_box }
[ "def", "item_gemeente_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'naam'", ":", "obj", ".", "naam", ",", "'centroid'", ":", "obj", ".", "centroid", ",", "'bounding_box'", ":", "obj", ".", "boundin...
Adapter for rendering an object of :class: `crabpy.gateway.capakey.Gemeente` to json.
[ "Adapter", "for", "rendering", "an", "object", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "capakey", ".", "Gemeente", "to", "json", "." ]
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L67-L77
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
item_afdeling_adapter
def item_afdeling_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'gemeente': { 'id': obj.gemeente.id, 'naam': obj.gemeente.naam }, ...
python
def item_afdeling_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'gemeente': { 'id': obj.gemeente.id, 'naam': obj.gemeente.naam }, ...
[ "def", "item_afdeling_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'naam'", ":", "obj", ".", "naam", ",", "'gemeente'", ":", "{", "'id'", ":", "obj", ".", "gemeente", ".", "id", ",", "'naam'", ...
Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json.
[ "Adapter", "for", "rendering", "an", "object", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "capakey", ".", "Afdeling", "to", "json", "." ]
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L80-L94
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
item_sectie_adapter
def item_sectie_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Sectie` to json. """ return { 'id': obj.id, 'afdeling': { 'id': obj.afdeling.id, 'naam': obj.afdeling.naam, 'gemeente': { ...
python
def item_sectie_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Sectie` to json. """ return { 'id': obj.id, 'afdeling': { 'id': obj.afdeling.id, 'naam': obj.afdeling.naam, 'gemeente': { ...
[ "def", "item_sectie_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'afdeling'", ":", "{", "'id'", ":", "obj", ".", "afdeling", ".", "id", ",", "'naam'", ":", "obj", ".", "afdeling", ".", "naam", ...
Adapter for rendering an object of :class: `crabpy.gateway.capakey.Sectie` to json.
[ "Adapter", "for", "rendering", "an", "object", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "capakey", ".", "Sectie", "to", "json", "." ]
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L97-L114
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
item_perceel_adapter
def item_perceel_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Perceel` to json. """ return { 'id': obj.id, 'sectie': { 'id': obj.sectie.id, 'afdeling': { 'id': obj.sectie.afdeling.id, ...
python
def item_perceel_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Perceel` to json. """ return { 'id': obj.id, 'sectie': { 'id': obj.sectie.id, 'afdeling': { 'id': obj.sectie.afdeling.id, ...
[ "def", "item_perceel_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'sectie'", ":", "{", "'id'", ":", "obj", ".", "sectie", ".", "id", ",", "'afdeling'", ":", "{", "'id'", ":", "obj", ".", "secti...
Adapter for rendering an object of :class: `crabpy.gateway.capakey.Perceel` to json.
[ "Adapter", "for", "rendering", "an", "object", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "capakey", ".", "Perceel", "to", "json", "." ]
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L117-L139
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
in1d_events
def in1d_events(ar1, ar2): """ Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted and the c++ library. Is therefore much much faster. """ ar1 = np.ascontiguousarray(ar1) # change memory alignement for c++ library ar2 = np.ascontiguousarray(ar2) # change memory alignement for...
python
def in1d_events(ar1, ar2): """ Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted and the c++ library. Is therefore much much faster. """ ar1 = np.ascontiguousarray(ar1) # change memory alignement for c++ library ar2 = np.ascontiguousarray(ar2) # change memory alignement for...
[ "def", "in1d_events", "(", "ar1", ",", "ar2", ")", ":", "ar1", "=", "np", ".", "ascontiguousarray", "(", "ar1", ")", "# change memory alignement for c++ library", "ar2", "=", "np", ".", "ascontiguousarray", "(", "ar2", ")", "# change memory alignement for c++ librar...
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted and the c++ library. Is therefore much much faster.
[ "Does", "the", "same", "than", "np", ".", "in1d", "but", "uses", "the", "fact", "that", "ar1", "and", "ar2", "are", "sorted", "and", "the", "c", "++", "library", ".", "Is", "therefore", "much", "much", "faster", "." ]
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L12-L20
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
get_max_events_in_both_arrays
def get_max_events_in_both_arrays(events_one, events_two): """ Calculates the maximum count of events that exist in both arrays. """ events_one = np.ascontiguousarray(events_one) # change memory alignement for c++ library events_two = np.ascontiguousarray(events_two) # change memory alignement fo...
python
def get_max_events_in_both_arrays(events_one, events_two): """ Calculates the maximum count of events that exist in both arrays. """ events_one = np.ascontiguousarray(events_one) # change memory alignement for c++ library events_two = np.ascontiguousarray(events_two) # change memory alignement fo...
[ "def", "get_max_events_in_both_arrays", "(", "events_one", ",", "events_two", ")", ":", "events_one", "=", "np", ".", "ascontiguousarray", "(", "events_one", ")", "# change memory alignement for c++ library", "events_two", "=", "np", ".", "ascontiguousarray", "(", "even...
Calculates the maximum count of events that exist in both arrays.
[ "Calculates", "the", "maximum", "count", "of", "events", "that", "exist", "in", "both", "arrays", "." ]
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L23-L32
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
map_cluster
def map_cluster(events, cluster): """ Maps the cluster hits on events. Not existing hits in events have all values set to 0 """ cluster = np.ascontiguousarray(cluster) events = np.ascontiguousarray(events) mapped_cluster = np.zeros((events.shape[0], ), dtype=dtype_from_descr(data_struct.Cluster...
python
def map_cluster(events, cluster): """ Maps the cluster hits on events. Not existing hits in events have all values set to 0 """ cluster = np.ascontiguousarray(cluster) events = np.ascontiguousarray(events) mapped_cluster = np.zeros((events.shape[0], ), dtype=dtype_from_descr(data_struct.Cluster...
[ "def", "map_cluster", "(", "events", ",", "cluster", ")", ":", "cluster", "=", "np", ".", "ascontiguousarray", "(", "cluster", ")", "events", "=", "np", ".", "ascontiguousarray", "(", "events", ")", "mapped_cluster", "=", "np", ".", "zeros", "(", "(", "e...
Maps the cluster hits on events. Not existing hits in events have all values set to 0
[ "Maps", "the", "cluster", "hits", "on", "events", ".", "Not", "existing", "hits", "in", "events", "have", "all", "values", "set", "to", "0" ]
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L35-L45
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
get_events_in_both_arrays
def get_events_in_both_arrays(events_one, events_two): """ Calculates the events that exist in both arrays. """ events_one = np.ascontiguousarray(events_one) # change memory alignement for c++ library events_two = np.ascontiguousarray(events_two) # change memory alignement for c++ library eve...
python
def get_events_in_both_arrays(events_one, events_two): """ Calculates the events that exist in both arrays. """ events_one = np.ascontiguousarray(events_one) # change memory alignement for c++ library events_two = np.ascontiguousarray(events_two) # change memory alignement for c++ library eve...
[ "def", "get_events_in_both_arrays", "(", "events_one", ",", "events_two", ")", ":", "events_one", "=", "np", ".", "ascontiguousarray", "(", "events_one", ")", "# change memory alignement for c++ library", "events_two", "=", "np", ".", "ascontiguousarray", "(", "events_t...
Calculates the events that exist in both arrays.
[ "Calculates", "the", "events", "that", "exist", "in", "both", "arrays", "." ]
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L48-L57
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
hist_1d_index
def hist_1d_index(x, shape): """ Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like shape :...
python
def hist_1d_index(x, shape): """ Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like shape :...
[ "def", "hist_1d_index", "(", "x", ",", "shape", ")", ":", "if", "len", "(", "shape", ")", "!=", "1", ":", "raise", "InvalidInputError", "(", "'The shape has to describe a 1-d histogram'", ")", "# change memory alignment for c++ library", "x", "=", "np", ".", "asco...
Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like shape : tuple tuple with x dimensions: (...
[ "Fast", "1d", "histogram", "of", "1D", "indices", "with", "C", "++", "inner", "loop", "optimization", ".", "Is", "more", "than", "2", "orders", "faster", "than", "np", ".", "histogram", "()", ".", "The", "indices", "are", "given", "in", "coordinates", "a...
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L60-L83
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
hist_2d_index
def hist_2d_index(x, y, shape): """ Fast 2d histogram of 2D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram2d(). The indices are given in x, y coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like ...
python
def hist_2d_index(x, y, shape): """ Fast 2d histogram of 2D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram2d(). The indices are given in x, y coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like ...
[ "def", "hist_2d_index", "(", "x", ",", "y", ",", "shape", ")", ":", "if", "len", "(", "shape", ")", "!=", "2", ":", "raise", "InvalidInputError", "(", "'The shape has to describe a 2-d histogram'", ")", "# change memory alignment for c++ library", "x", "=", "np", ...
Fast 2d histogram of 2D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram2d(). The indices are given in x, y coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like y : array like shape : tuple ...
[ "Fast", "2d", "histogram", "of", "2D", "indices", "with", "C", "++", "inner", "loop", "optimization", ".", "Is", "more", "than", "2", "orders", "faster", "than", "np", ".", "histogram2d", "()", ".", "The", "indices", "are", "given", "in", "x", "y", "co...
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L86-L111
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
hist_3d_index
def hist_3d_index(x, y, z, shape): """ Fast 3d histogram of 3D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogramdd(). The indices are given in x, y, z coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array ...
python
def hist_3d_index(x, y, z, shape): """ Fast 3d histogram of 3D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogramdd(). The indices are given in x, y, z coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array ...
[ "def", "hist_3d_index", "(", "x", ",", "y", ",", "z", ",", "shape", ")", ":", "if", "len", "(", "shape", ")", "!=", "3", ":", "raise", "InvalidInputError", "(", "'The shape has to describe a 3-d histogram'", ")", "# change memory alignment for c++ library", "x", ...
Fast 3d histogram of 3D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogramdd(). The indices are given in x, y, z coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like y : array like z : array like ...
[ "Fast", "3d", "histogram", "of", "3D", "indices", "with", "C", "++", "inner", "loop", "optimization", ".", "Is", "more", "than", "2", "orders", "faster", "than", "np", ".", "histogramdd", "()", ".", "The", "indices", "are", "given", "in", "x", "y", "z"...
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L114-L140
SiLab-Bonn/pyBAR_fei4_interpreter
pybar_fei4_interpreter/analysis_utils.py
get_n_cluster_in_events
def get_n_cluster_in_events(event_numbers): '''Calculates the number of cluster in every given event. An external C++ library is used since there is no sufficient solution in python possible. Because of np.bincount # BUG #225 for values > int32 and the different handling under 32/64 bit operating systems. ...
python
def get_n_cluster_in_events(event_numbers): '''Calculates the number of cluster in every given event. An external C++ library is used since there is no sufficient solution in python possible. Because of np.bincount # BUG #225 for values > int32 and the different handling under 32/64 bit operating systems. ...
[ "def", "get_n_cluster_in_events", "(", "event_numbers", ")", ":", "logging", ".", "debug", "(", "\"Calculate the number of cluster in every given event\"", ")", "event_numbers", "=", "np", ".", "ascontiguousarray", "(", "event_numbers", ")", "# change memory alignement for c+...
Calculates the number of cluster in every given event. An external C++ library is used since there is no sufficient solution in python possible. Because of np.bincount # BUG #225 for values > int32 and the different handling under 32/64 bit operating systems. Parameters ---------- event_numbers : n...
[ "Calculates", "the", "number", "of", "cluster", "in", "every", "given", "event", ".", "An", "external", "C", "++", "library", "is", "used", "since", "there", "is", "no", "sufficient", "solution", "in", "python", "possible", ".", "Because", "of", "np", ".",...
train
https://github.com/SiLab-Bonn/pyBAR_fei4_interpreter/blob/0f8df18557598d6db0c64baa708e587c84bb787b/pybar_fei4_interpreter/analysis_utils.py#L143-L164
5monkeys/content-io
cio/utils/imports.py
import_class
def import_class(import_path, name=None): """ Imports and returns class for full class path string. Ex. 'foo.bar.Bogus' -> <class 'foo.bar.Bogus'> """ if not name: import_path, name = import_path.rsplit('.', 1) mod = import_module(import_path) try: return getattr(mod, name) ...
python
def import_class(import_path, name=None): """ Imports and returns class for full class path string. Ex. 'foo.bar.Bogus' -> <class 'foo.bar.Bogus'> """ if not name: import_path, name = import_path.rsplit('.', 1) mod = import_module(import_path) try: return getattr(mod, name) ...
[ "def", "import_class", "(", "import_path", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "import_path", ",", "name", "=", "import_path", ".", "rsplit", "(", "'.'", ",", "1", ")", "mod", "=", "import_module", "(", "import_path", ")", "tr...
Imports and returns class for full class path string. Ex. 'foo.bar.Bogus' -> <class 'foo.bar.Bogus'>
[ "Imports", "and", "returns", "class", "for", "full", "class", "path", "string", ".", "Ex", ".", "foo", ".", "bar", ".", "Bogus", "-", ">", "<class", "foo", ".", "bar", ".", "Bogus", ">" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/imports.py#L12-L23
theosysbio/means
src/means/util/sympyhelpers.py
substitute_all
def substitute_all(sp_object, pairs): """ Performs multiple substitutions in an expression :param expr: a sympy matrix or expression :param pairs: a list of pairs (a,b) where each a_i is to be substituted with b_i :return: the substituted expression """ if not isinstance(pairs, dict): ...
python
def substitute_all(sp_object, pairs): """ Performs multiple substitutions in an expression :param expr: a sympy matrix or expression :param pairs: a list of pairs (a,b) where each a_i is to be substituted with b_i :return: the substituted expression """ if not isinstance(pairs, dict): ...
[ "def", "substitute_all", "(", "sp_object", ",", "pairs", ")", ":", "if", "not", "isinstance", "(", "pairs", ",", "dict", ")", ":", "dict_pairs", "=", "dict", "(", "pairs", ")", "else", ":", "dict_pairs", "=", "pairs", "# we recurse if the object was a matrix s...
Performs multiple substitutions in an expression :param expr: a sympy matrix or expression :param pairs: a list of pairs (a,b) where each a_i is to be substituted with b_i :return: the substituted expression
[ "Performs", "multiple", "substitutions", "in", "an", "expression", ":", "param", "expr", ":", "a", "sympy", "matrix", "or", "expression", ":", "param", "pairs", ":", "a", "list", "of", "pairs", "(", "a", "b", ")", "where", "each", "a_i", "is", "to", "b...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L14-L39
theosysbio/means
src/means/util/sympyhelpers.py
quick_solve
def quick_solve(expr, var): r""" A function that tries to solve a very simple equation in the quickest way. For instance, an expression like :math: `2*a + 3*b + c == 0` needed to be solved for :math: `c` may be simply solved by stating :math: `c = -(2*a + 3*b)`. The function chec...
python
def quick_solve(expr, var): r""" A function that tries to solve a very simple equation in the quickest way. For instance, an expression like :math: `2*a + 3*b + c == 0` needed to be solved for :math: `c` may be simply solved by stating :math: `c = -(2*a + 3*b)`. The function chec...
[ "def", "quick_solve", "(", "expr", ",", "var", ")", ":", "res", "=", "-", "(", "expr", "-", "var", ")", "# This may not work every time,", "# so we fallback on the --slow-- `solve()` if we failed", "if", "var", "in", "res", ".", "args", ":", "return", "sympy", "...
r""" A function that tries to solve a very simple equation in the quickest way. For instance, an expression like :math: `2*a + 3*b + c == 0` needed to be solved for :math: `c` may be simply solved by stating :math: `c = -(2*a + 3*b)`. The function checks if the right hand side does not c...
[ "r", "A", "function", "that", "tries", "to", "solve", "a", "very", "simple", "equation", "in", "the", "quickest", "way", ".", "For", "instance", "an", "expression", "like", ":", "math", ":", "2", "*", "a", "+", "3", "*", "b", "+", "c", "==", "0", ...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L41-L61
theosysbio/means
src/means/util/sympyhelpers.py
to_sympy_matrix
def to_sympy_matrix(value): """ Converts value to a `sympy.Matrix` object, if possible. Leaves the value as `sympy.Matrix` if it already was :param value: value to convert :return: :rtype: `sympy.Matrix` """ if isinstance(value, sympy.Matrix): return value try: return...
python
def to_sympy_matrix(value): """ Converts value to a `sympy.Matrix` object, if possible. Leaves the value as `sympy.Matrix` if it already was :param value: value to convert :return: :rtype: `sympy.Matrix` """ if isinstance(value, sympy.Matrix): return value try: return...
[ "def", "to_sympy_matrix", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "sympy", ".", "Matrix", ")", ":", "return", "value", "try", ":", "return", "sympy", ".", "Matrix", "(", "value", ")", "except", "ValueError", "as", "original_exception...
Converts value to a `sympy.Matrix` object, if possible. Leaves the value as `sympy.Matrix` if it already was :param value: value to convert :return: :rtype: `sympy.Matrix`
[ "Converts", "value", "to", "a", "sympy", ".", "Matrix", "object", "if", "possible", ".", "Leaves", "the", "value", "as", "sympy", ".", "Matrix", "if", "it", "already", "was", ":", "param", "value", ":", "value", "to", "convert", ":", "return", ":", ":"...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L63-L87
theosysbio/means
src/means/util/sympyhelpers.py
to_sympy_column_matrix
def to_sympy_column_matrix(matrix): """ Converts a sympy matrix to a column matrix (i.e. transposes it if it was row matrix) Raises ValueError if matrix provided is not a vector :param matrix: a vector to be converted to column :return: """ matrix = to_sympy_matrix(matrix) if matrix.cols...
python
def to_sympy_column_matrix(matrix): """ Converts a sympy matrix to a column matrix (i.e. transposes it if it was row matrix) Raises ValueError if matrix provided is not a vector :param matrix: a vector to be converted to column :return: """ matrix = to_sympy_matrix(matrix) if matrix.cols...
[ "def", "to_sympy_column_matrix", "(", "matrix", ")", ":", "matrix", "=", "to_sympy_matrix", "(", "matrix", ")", "if", "matrix", ".", "cols", "==", "1", ":", "return", "matrix", "elif", "matrix", ".", "rows", "==", "1", ":", "return", "matrix", ".", "T", ...
Converts a sympy matrix to a column matrix (i.e. transposes it if it was row matrix) Raises ValueError if matrix provided is not a vector :param matrix: a vector to be converted to column :return:
[ "Converts", "a", "sympy", "matrix", "to", "a", "column", "matrix", "(", "i", ".", "e", ".", "transposes", "it", "if", "it", "was", "row", "matrix", ")", "Raises", "ValueError", "if", "matrix", "provided", "is", "not", "a", "vector", ":", "param", "matr...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L92-L105
theosysbio/means
src/means/util/sympyhelpers.py
sympy_expressions_equal
def sympy_expressions_equal(expr1, expr2): """ Compare two sympy expressions that are not necessarily expanded. :param expr1: a first expression :param expr2: a second expression :return: True if the expressions are similar, False otherwise """ # the simplified difference is equal to zero: s...
python
def sympy_expressions_equal(expr1, expr2): """ Compare two sympy expressions that are not necessarily expanded. :param expr1: a first expression :param expr2: a second expression :return: True if the expressions are similar, False otherwise """ # the simplified difference is equal to zero: s...
[ "def", "sympy_expressions_equal", "(", "expr1", ",", "expr2", ")", ":", "# the simplified difference is equal to zero: same expressions", "try", ":", "difference", "=", "sympy", ".", "simplify", "(", "sympy", ".", "expand", "(", "expr1", "-", "expr2", ")", ")", "e...
Compare two sympy expressions that are not necessarily expanded. :param expr1: a first expression :param expr2: a second expression :return: True if the expressions are similar, False otherwise
[ "Compare", "two", "sympy", "expressions", "that", "are", "not", "necessarily", "expanded", ".", ":", "param", "expr1", ":", "a", "first", "expression", ":", "param", "expr2", ":", "a", "second", "expression", ":", "return", ":", "True", "if", "the", "expre...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L115-L138
theosysbio/means
src/means/util/sympyhelpers.py
assert_sympy_expressions_equal
def assert_sympy_expressions_equal(expr1, expr2): """ Raises `AssertionError` if `expr1` is not equal to `expr2`. :param expr1: first expression :param expr2: second expression :return: None """ if not sympy_expressions_equal(expr1, expr2): raise AssertionError("{0!r} != {1!r}".form...
python
def assert_sympy_expressions_equal(expr1, expr2): """ Raises `AssertionError` if `expr1` is not equal to `expr2`. :param expr1: first expression :param expr2: second expression :return: None """ if not sympy_expressions_equal(expr1, expr2): raise AssertionError("{0!r} != {1!r}".form...
[ "def", "assert_sympy_expressions_equal", "(", "expr1", ",", "expr2", ")", ":", "if", "not", "sympy_expressions_equal", "(", "expr1", ",", "expr2", ")", ":", "raise", "AssertionError", "(", "\"{0!r} != {1!r}\"", ".", "format", "(", "expr1", ",", "expr2", ")", "...
Raises `AssertionError` if `expr1` is not equal to `expr2`. :param expr1: first expression :param expr2: second expression :return: None
[ "Raises", "AssertionError", "if", "expr1", "is", "not", "equal", "to", "expr2", "." ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L141-L150
theosysbio/means
src/means/util/sympyhelpers.py
_sympy_matrices_equal
def _sympy_matrices_equal(matrix_left, matrix_right): """ Compare two sympy matrices that are not necessarily expanded. Calls `deep_compare_expressions` for each element in the matrices. Private function. Use `sympy_expressions_equal`. The former should be able to compare everything. :param ma...
python
def _sympy_matrices_equal(matrix_left, matrix_right): """ Compare two sympy matrices that are not necessarily expanded. Calls `deep_compare_expressions` for each element in the matrices. Private function. Use `sympy_expressions_equal`. The former should be able to compare everything. :param ma...
[ "def", "_sympy_matrices_equal", "(", "matrix_left", ",", "matrix_right", ")", ":", "if", "matrix_left", ".", "cols", "!=", "matrix_right", ".", "cols", "or", "matrix_left", ".", "rows", "!=", "matrix_right", ".", "rows", ":", "return", "False", "for", "express...
Compare two sympy matrices that are not necessarily expanded. Calls `deep_compare_expressions` for each element in the matrices. Private function. Use `sympy_expressions_equal`. The former should be able to compare everything. :param matrix_left: :param matrix_right: :return:
[ "Compare", "two", "sympy", "matrices", "that", "are", "not", "necessarily", "expanded", ".", "Calls", "deep_compare_expressions", "for", "each", "element", "in", "the", "matrices", "." ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L152-L171
theosysbio/means
src/means/util/sympyhelpers.py
_eval_res_equal
def _eval_res_equal(expr1, expr2, atoms, vals,threshold=10e-10): """ Compare two expressions after evaluation of symbols by random expressions private function called by `sympy_empirical_equal` :param expr1: a first sympy expression :param expr2: a second sympy expression :param atoms: the co...
python
def _eval_res_equal(expr1, expr2, atoms, vals,threshold=10e-10): """ Compare two expressions after evaluation of symbols by random expressions private function called by `sympy_empirical_equal` :param expr1: a first sympy expression :param expr2: a second sympy expression :param atoms: the co...
[ "def", "_eval_res_equal", "(", "expr1", ",", "expr2", ",", "atoms", ",", "vals", ",", "threshold", "=", "10e-10", ")", ":", "substitution_pairs", "=", "zip", "(", "atoms", ",", "vals", ")", "eval_1", "=", "substitute_all", "(", "expr1", ",", "substitution_...
Compare two expressions after evaluation of symbols by random expressions private function called by `sympy_empirical_equal` :param expr1: a first sympy expression :param expr2: a second sympy expression :param atoms: the component symbols (they are assumed to be common) :param vals: the values to...
[ "Compare", "two", "expressions", "after", "evaluation", "of", "symbols", "by", "random", "expressions" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L175-L193
theosysbio/means
src/means/util/sympyhelpers.py
sympy_empirical_equal
def sympy_empirical_equal(expr1, expr2): """ Compare long , complex, expressions by replacing all symbols by a set of arbitrary expressions :param expr1: first expression :param expr2: second expression :return: True if expressions are empirically equal, false otherwise """ atoms_1 = expr...
python
def sympy_empirical_equal(expr1, expr2): """ Compare long , complex, expressions by replacing all symbols by a set of arbitrary expressions :param expr1: first expression :param expr2: second expression :return: True if expressions are empirically equal, false otherwise """ atoms_1 = expr...
[ "def", "sympy_empirical_equal", "(", "expr1", ",", "expr2", ")", ":", "atoms_1", "=", "expr1", ".", "atoms", "(", ")", "atoms_1", "=", "[", "a", "for", "a", "in", "atoms_1", "if", "isinstance", "(", "a", ",", "sympy", ".", "Symbol", ")", "]", "atoms_...
Compare long , complex, expressions by replacing all symbols by a set of arbitrary expressions :param expr1: first expression :param expr2: second expression :return: True if expressions are empirically equal, false otherwise
[ "Compare", "long", "complex", "expressions", "by", "replacing", "all", "symbols", "by", "a", "set", "of", "arbitrary", "expressions" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/util/sympyhelpers.py#L196-L226
5monkeys/content-io
cio/utils/uri.py
URI.is_absolute
def is_absolute(self): """ Validates that uri contains all parts except version """ return self.namespace and self.ext and self.scheme and self.path
python
def is_absolute(self): """ Validates that uri contains all parts except version """ return self.namespace and self.ext and self.scheme and self.path
[ "def", "is_absolute", "(", "self", ")", ":", "return", "self", ".", "namespace", "and", "self", ".", "ext", "and", "self", ".", "scheme", "and", "self", ".", "path" ]
Validates that uri contains all parts except version
[ "Validates", "that", "uri", "contains", "all", "parts", "except", "version" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/utils/uri.py#L67-L71
mulkieran/justbases
src/justbases/_division.py
NatDivision._round
def _round( cls, quotient, divisor, remainder, base, method=RoundingMethods.ROUND_DOWN ): """ Round the quotient. :param quotient: current quotient :type quotient: list of int :param int divisor: the divisor :param int remain...
python
def _round( cls, quotient, divisor, remainder, base, method=RoundingMethods.ROUND_DOWN ): """ Round the quotient. :param quotient: current quotient :type quotient: list of int :param int divisor: the divisor :param int remain...
[ "def", "_round", "(", "cls", ",", "quotient", ",", "divisor", ",", "remainder", ",", "base", ",", "method", "=", "RoundingMethods", ".", "ROUND_DOWN", ")", ":", "# pylint: disable=too-many-return-statements", "# pylint: disable=too-many-arguments", "if", "method", "no...
Round the quotient. :param quotient: current quotient :type quotient: list of int :param int divisor: the divisor :param int remainder: the remainder :param int base: the base :param method: the rounding method :raises BasesValueError: :returns: carry-ou...
[ "Round", "the", "quotient", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L39-L103
mulkieran/justbases
src/justbases/_division.py
NatDivision._divide
def _divide(divisor, remainder, quotient, remainders, base, precision=None): """ Given a divisor and dividend, continue until precision in is reached. :param int divisor: the divisor :param int remainder: the remainder :param int base: the base :param precision: maximum ...
python
def _divide(divisor, remainder, quotient, remainders, base, precision=None): """ Given a divisor and dividend, continue until precision in is reached. :param int divisor: the divisor :param int remainder: the remainder :param int base: the base :param precision: maximum ...
[ "def", "_divide", "(", "divisor", ",", "remainder", ",", "quotient", ",", "remainders", ",", "base", ",", "precision", "=", "None", ")", ":", "# pylint: disable=too-many-arguments", "indices", "=", "itertools", ".", "count", "(", ")", "if", "precision", "is", ...
Given a divisor and dividend, continue until precision in is reached. :param int divisor: the divisor :param int remainder: the remainder :param int base: the base :param precision: maximum number of fractional digits to compute :type precision: int or NoneType :returns...
[ "Given", "a", "divisor", "and", "dividend", "continue", "until", "precision", "in", "is", "reached", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L106-L137
mulkieran/justbases
src/justbases/_division.py
NatDivision._fractional_division
def _fractional_division( cls, divisor, remainder, base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Get the repeating and non-repeating part. :param int divisor: the divisor :param int remainder: the remainder :param in...
python
def _fractional_division( cls, divisor, remainder, base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Get the repeating and non-repeating part. :param int divisor: the divisor :param int remainder: the remainder :param in...
[ "def", "_fractional_division", "(", "cls", ",", "divisor", ",", "remainder", ",", "base", ",", "precision", "=", "None", ",", "method", "=", "RoundingMethods", ".", "ROUND_DOWN", ")", ":", "# pylint: disable=too-many-arguments", "quotient", "=", "[", "]", "remai...
Get the repeating and non-repeating part. :param int divisor: the divisor :param int remainder: the remainder :param int base: the base :param precision: maximum number of fractional digits :type precision: int or NoneType :param method: rounding method :type met...
[ "Get", "the", "repeating", "and", "non", "-", "repeating", "part", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L140-L189
mulkieran/justbases
src/justbases/_division.py
NatDivision._division
def _division(divisor, dividend, remainder, base): """ Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns...
python
def _division(divisor, dividend, remainder, base): """ Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns...
[ "def", "_division", "(", "divisor", ",", "dividend", ",", "remainder", ",", "base", ")", ":", "quotient", "=", "[", "]", "for", "value", "in", "dividend", ":", "remainder", "=", "remainder", "*", "base", "+", "value", "(", "quot", ",", "rem", ")", "=...
Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns: quotient and remainder :rtype: tuple of (list of int) * int ...
[ "Get", "the", "quotient", "and", "remainder" ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L192-L214
mulkieran/justbases
src/justbases/_division.py
NatDivision.division
def division( cls, divisor, dividend, base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Division of natural numbers. :param divisor: the divisor :type divisor: list of int :param dividend: the dividend :type di...
python
def division( cls, divisor, dividend, base, precision=None, method=RoundingMethods.ROUND_DOWN ): """ Division of natural numbers. :param divisor: the divisor :type divisor: list of int :param dividend: the dividend :type di...
[ "def", "division", "(", "cls", ",", "divisor", ",", "dividend", ",", "base", ",", "precision", "=", "None", ",", "method", "=", "RoundingMethods", ".", "ROUND_DOWN", ")", ":", "# pylint: disable=too-many-arguments", "if", "base", "<", "2", ":", "raise", "Bas...
Division of natural numbers. :param divisor: the divisor :type divisor: list of int :param dividend: the dividend :type dividend: list of int :param precision: maximum number of fractional digits :type precision: int or NoneType :param method: rounding method ...
[ "Division", "of", "natural", "numbers", "." ]
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L217-L294