_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q48300
ResourceBinAssignmentSession.get_assignable_bin_ids
train
def get_assignable_bin_ids(self, bin_id): """Gets a list of bins including and under the given bin node in which any resource can be assigned. arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` return: (osid.id.IdList) - list of assignable bin ``Ids`` raise: NullArgument - ``bin_id...
python
{ "resource": "" }
q48301
ResourceBinAssignmentSession.assign_resource_to_bin
train
def assign_resource_to_bin(self, resource_id, bin_id): """Adds an existing ``Resource`` to a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: AlreadyExists - ``resource_id`` is already assigned to ...
python
{ "resource": "" }
q48302
ResourceBinAssignmentSession.unassign_resource_from_bin
train
def unassign_resource_from_bin(self, resource_id, bin_id): """Removes a ``Resource`` from a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: NotFound - ``resource_id`` or ``bin_id`` not found or ...
python
{ "resource": "" }
q48303
ResourceAgentSession.get_resource_by_agent
train
def get_resource_by_agent(self, agent_id): """Gets the ``Resource`` associated with the given agent. arg: agent_id (osid.id.Id): ``Id`` of the ``Agent`` return: (osid.resource.Resource) - associated resource raise: NotFound - ``agent_id`` is not found raise: NullArgument - ...
python
{ "resource": "" }
q48304
ResourceAgentSession.get_agent_ids_by_resource
train
def get_agent_ids_by_resource(self, resource_id): """Gets the list of ``Agent`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of agent ``Ids`` raise: NotFound - ``resource_id`` is not found raise: ...
python
{ "resource": "" }
q48305
ResourceAgentSession.get_agents_by_resource
train
def get_agents_by_resource(self, resource_id): """Gets the list of ``Agents`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.authentication.AgentList) - list of agents raise: NotFound - ``resource_id`` is not found raise: Nul...
python
{ "resource": "" }
q48306
ResourceAgentAssignmentSession.assign_agent_to_resource
train
def assign_agent_to_resource(self, agent_id, resource_id): """Adds an existing ``Agent`` to a ``Resource``. arg: agent_id (osid.id.Id): the ``Id`` of the ``Agent`` arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` raise: AlreadyExists - ``agent_id`` is already assigne...
python
{ "resource": "" }
q48307
ResourceAgentAssignmentSession.unassign_agent_from_resource
train
def unassign_agent_from_resource(self, agent_id, resource_id): """Removes an ``Agent`` from a ``Resource``. arg: agent_id (osid.id.Id): the ``Id`` of the ``Agent`` arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` raise: NotFound - ``agent_id`` or ``resource_id`` not ...
python
{ "resource": "" }
q48308
BinQuerySession.get_bins_by_query
train
def get_bins_by_query(self, bin_query): """Gets a list of ``Bins`` matching the given bin query. arg: bin_query (osid.resource.BinQuery): the bin query return: (osid.resource.BinList) - the returned ``BinList`` raise: NullArgument - ``bin_query`` is ``null`` raise: Operatio...
python
{ "resource": "" }
q48309
BinAdminSession.can_create_bin_with_record_types
train
def can_create_bin_with_record_types(self, bin_record_types): """Tests if this user can create a single ``Bin`` using the desired record types. While ``ResourceManager.getBinRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are require...
python
{ "resource": "" }
q48310
BinAdminSession.update_bin
train
def update_bin(self, bin_form): """Updates an existing bin. arg: bin_form (osid.resource.BinForm): the form containing the elements to be updated raise: IllegalState - ``bin_form`` already used in an update transaction raise: InvalidArgument - the fo...
python
{ "resource": "" }
q48311
BinAdminSession.alias_bin
train
def alias_bin(self, bin_id, alias_id): """Adds an ``Id`` to a ``Bin`` for the purpose of creating compatibility. The primary ``Id`` of the ``Bin`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another bin, it is re...
python
{ "resource": "" }
q48312
BinHierarchySession.get_root_bins
train
def get_root_bins(self): """Gets the root bins in the bin hierarchy. A node with no parents is an orphan. While all bin ``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...
python
{ "resource": "" }
q48313
BinHierarchySession.has_parent_bins
train
def has_parent_bins(self, bin_id): """Tests if the ``Bin`` has any parents. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the bin has parents, ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: NullArgument -...
python
{ "resource": "" }
q48314
BinHierarchySession.is_parent_of_bin
train
def is_parent_of_bin(self, id_, bin_id): """Tests if an ``Id`` is a direct parent of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if this ``id`` is a parent of ``bin_id,`` ``false`` otherwise ...
python
{ "resource": "" }
q48315
BinHierarchySession.get_parent_bin_ids
train
def get_parent_bin_ids(self, bin_id): """Gets the parent ``Ids`` of the given bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (osid.id.IdList) - the parent ``Ids`` of the bin raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` ...
python
{ "resource": "" }
q48316
BinHierarchySession.get_parent_bins
train
def get_parent_bins(self, bin_id): """Gets the parents of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.resource.BinList) - the parents of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise:...
python
{ "resource": "" }
q48317
BinHierarchySession.is_ancestor_of_bin
train
def is_ancestor_of_bin(self, id_, bin_id): """Tests if an ``Id`` is an ancestor of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if this ``id`` is an ancestor of ``bin_id,`` ``false`` otherwise ...
python
{ "resource": "" }
q48318
BinHierarchySession.has_child_bins
train
def has_child_bins(self, bin_id): """Tests if a bin has any children. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``bin_id`` has children, ``false`` otherwise raise: NotFound - ``bin_id`` not found raise: NullArgument - ...
python
{ "resource": "" }
q48319
BinHierarchySession.is_child_of_bin
train
def is_child_of_bin(self, id_, bin_id): """Tests if a bin is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``id`` is a child of ``bin_id,`` ``false`` otherwise r...
python
{ "resource": "" }
q48320
BinHierarchySession.get_child_bin_ids
train
def get_child_bin_ids(self, bin_id): """Gets the child ``Ids`` of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` rais...
python
{ "resource": "" }
q48321
BinHierarchySession.get_child_bins
train
def get_child_bins(self, bin_id): """Gets the children of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.resource.BinList) - the children of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise...
python
{ "resource": "" }
q48322
BinHierarchySession.is_descendant_of_bin
train
def is_descendant_of_bin(self, id_, bin_id): """Tests if an ``Id`` is a descendant of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``id`` is a descendant of the ``bin_id,`` ``false`` other...
python
{ "resource": "" }
q48323
BinHierarchySession.get_bin_nodes
train
def get_bin_nodes(self, bin_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A v...
python
{ "resource": "" }
q48324
BinHierarchyDesignSession.add_root_bin
train
def add_root_bin(self, bin_id): """Adds a root bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: AlreadyExists - ``bin_id`` is already in hierarchy raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed -...
python
{ "resource": "" }
q48325
BinHierarchyDesignSession.remove_root_bin
train
def remove_root_bin(self, bin_id): """Removes a root bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: NotFound - ``bin_id`` not a root raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied...
python
{ "resource": "" }
q48326
BinHierarchyDesignSession.add_child_bin
train
def add_child_bin(self, bin_id, child_id): """Adds a child to a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``bin_id`` is already a parent of ``child_id`` raise: NotFoun...
python
{ "resource": "" }
q48327
BinHierarchyDesignSession.remove_child_bin
train
def remove_child_bin(self, bin_id, child_id): """Removes a child from a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``bin_id`` not a parent of ``child_id`` raise: NullArgument - ``bin_id`` o...
python
{ "resource": "" }
q48328
BinHierarchyDesignSession.remove_child_bins
train
def remove_child_bins(self, bin_id): """Removes all children from a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: NotFound - ``bin_id`` not in hierarchy raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request rai...
python
{ "resource": "" }
q48329
CasparCG.connect
train
def connect(self): """Create connection to CasparCG Server""" try: self.connection = telnetlib.Telnet(self.host, self.port, timeout=self.timeout) except Exception: log_traceback() return False return True
python
{ "resource": "" }
q48330
CasparCG.query
train
def query(self, query, **kwargs): """Send AMCP command""" if not self.connection: if not self.connect(): return CasparResponse(500, "Unable to connect CasparCG server") query = query.strip() if kwargs.get("verbose", True): if not query.startswith(...
python
{ "resource": "" }
q48331
average
train
def average(arr): """average of the values, must have more than 0 entries. :param arr: list of numbers :type arr: number[] a number array :return: average :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take average\n") sys.exit() if len(arr) == 1: return a...
python
{ "resource": "" }
q48332
median
train
def median(arr): """median of the values, must have more than 0 entries. :param arr: list of numbers :type arr: number[] a number array :return: median :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take average\n") sys.exit() if len(arr) == 1: return arr[0...
python
{ "resource": "" }
q48333
variance
train
def variance(arr): """variance of the values, must have 2 or more entries. :param arr: list of numbers :type arr: number[] a number array :return: variance :rtype: float """ avg = average(arr) return sum([(float(x)-avg)**2 for x in arr])/float(len(arr)-1)
python
{ "resource": "" }
q48334
N50
train
def N50(arr): """N50 often used in assessing denovo assembly. :param arr: list of numbers :type arr: number[] a number array :return: N50 :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take N50\n") sys.exit() tot = sum(arr) half = float(tot)/float(2) cu...
python
{ "resource": "" }
q48335
is_uuid4
train
def is_uuid4(instr): """A validator to confirm a string is indeed a UUID4 :param instr: input string that may be uuid4 :type instr: String :return: true if it is in UUID4 format :rtype: bool """ v = instr.strip().replace('-','').lower() if len(v) != 32: return False if not re.match('^[0-9a-f]+$',v): ...
python
{ "resource": "" }
q48336
LearningManager.use_comparative_objective_bank_view
train
def use_comparative_objective_bank_view(self): """Pass through to provider ObjectiveObjectiveBankSession.use_comparative_objective_bank_view""" self._objective_bank_view = COMPARATIVE # self._get_provider_session('objective_objective_bank_session') # To make sure the session is tracked f...
python
{ "resource": "" }
q48337
LearningManager.use_plenary_objective_bank_view
train
def use_plenary_objective_bank_view(self): """Pass through to provider ObjectiveObjectiveBankSession.use_plenary_objective_bank_view""" self._objective_bank_view = PLENARY # self._get_provider_session('objective_objective_bank_session') # To make sure the session is tracked for session i...
python
{ "resource": "" }
q48338
LearningManager.get_objective_banks_by_activity
train
def get_objective_banks_by_activity(self, *args, **kwargs): """Pass through to provider ActivityObjectiveBankSession.get_objective_banks_by_activity""" # Implemented from kitosid template for - # osid.resource.ResourceBinSession.get_bins_by_resource catalogs = self._get_provider_session(...
python
{ "resource": "" }
q48339
LearningManager.get_objective_banks
train
def get_objective_banks(self): """Pass through to provider ObjectiveBankLookupSession.get_objective_banks""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('objective_bank_lookup_session').get_objective_b...
python
{ "resource": "" }
q48340
LearningManager.create_objective_bank
train
def create_objective_bank(self, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.create_objective_bank""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.create_bin return ObjectiveBank( self._provider_manager, self...
python
{ "resource": "" }
q48341
LearningManager.get_objective_bank_form
train
def get_objective_bank_form(self, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.get_objective_bank_form_for_update""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.get_bin_form_for_update_template # This method might be a bit sketchy....
python
{ "resource": "" }
q48342
LearningManager.save_objective_bank
train
def save_objective_bank(self, objective_bank_form, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.update_objective_bank""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if objective_bank_form.is_for_update(): ret...
python
{ "resource": "" }
q48343
ObjectiveBank.use_comparative_objective_view
train
def use_comparative_objective_view(self): """Pass through to provider ObjectiveLookupSession.use_comparative_objective_view""" self._object_views['objective'] = COMPARATIVE # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self....
python
{ "resource": "" }
q48344
ObjectiveBank.use_plenary_objective_view
train
def use_plenary_objective_view(self): """Pass through to provider ObjectiveLookupSession.use_plenary_objective_view""" self._object_views['objective'] = PLENARY # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_provide...
python
{ "resource": "" }
q48345
ObjectiveBank.use_federated_objective_bank_view
train
def use_federated_objective_bank_view(self): """Pass through to provider ObjectiveLookupSession.use_federated_objective_bank_view""" self._objective_bank_view = FEDERATED # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._g...
python
{ "resource": "" }
q48346
ObjectiveBank.use_isolated_objective_bank_view
train
def use_isolated_objective_bank_view(self): """Pass through to provider ObjectiveLookupSession.use_isolated_objective_bank_view""" self._objective_bank_view = ISOLATED # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_...
python
{ "resource": "" }
q48347
ObjectiveBank.get_objective_form
train
def get_objective_form(self, *args, **kwargs): """Pass through to provider ObjectiveAdminSession.get_objective_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will te...
python
{ "resource": "" }
q48348
ObjectiveBank.save_objective
train
def save_objective(self, objective_form, *args, **kwargs): """Pass through to provider ObjectiveAdminSession.update_objective""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if objective_form.is_for_update(): return self.updat...
python
{ "resource": "" }
q48349
ObjectiveBank.use_comparative_activity_view
train
def use_comparative_activity_view(self): """Pass through to provider ActivityLookupSession.use_comparative_activity_view""" self._object_views['activity'] = COMPARATIVE # self._get_provider_session('activity_lookup_session') # To make sure the session is tracked for session in self._get_...
python
{ "resource": "" }
q48350
ObjectiveBank.use_plenary_activity_view
train
def use_plenary_activity_view(self): """Pass through to provider ActivityLookupSession.use_plenary_activity_view""" self._object_views['activity'] = PLENARY # self._get_provider_session('activity_lookup_session') # To make sure the session is tracked for session in self._get_provider_ses...
python
{ "resource": "" }
q48351
ObjectiveBank.get_activity_form
train
def get_activity_form(self, *args, **kwargs): """Pass through to provider ActivityAdminSession.get_activity_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will tell....
python
{ "resource": "" }
q48352
ObjectiveBank.save_activity
train
def save_activity(self, activity_form, *args, **kwargs): """Pass through to provider ActivityAdminSession.update_activity""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if activity_form.is_for_update(): return self.update_act...
python
{ "resource": "" }
q48353
ObjectiveBank.use_comparative_proficiency_view
train
def use_comparative_proficiency_view(self): """Pass through to provider ProficiencyLookupSession.use_comparative_proficiency_view""" self._object_views['proficiency'] = COMPARATIVE # self._get_provider_session('proficiency_lookup_session') # To make sure the session is tracked for sessio...
python
{ "resource": "" }
q48354
ObjectiveBank.use_plenary_proficiency_view
train
def use_plenary_proficiency_view(self): """Pass through to provider ProficiencyLookupSession.use_plenary_proficiency_view""" self._object_views['proficiency'] = PLENARY # self._get_provider_session('proficiency_lookup_session') # To make sure the session is tracked for session in self._g...
python
{ "resource": "" }
q48355
ObjectiveBank.get_proficiency_form
train
def get_proficiency_form(self, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time w...
python
{ "resource": "" }
q48356
ObjectiveBank.save_proficiency
train
def save_proficiency(self, proficiency_form, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.update_proficiency""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if proficiency_form.is_for_update(): return ...
python
{ "resource": "" }
q48357
AssetSearchResults.get_assets
train
def get_assets(self): """Gets the asset list resulting from a search. return: (osid.repository.AssetList) - the asset list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: ...
python
{ "resource": "" }
q48358
CompositionSearchResults.get_compositions
train
def get_compositions(self): """Gets the composition list resulting from a search. return: (osid.repository.CompositionList) - the composition list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ ...
python
{ "resource": "" }
q48359
RepositorySearchResults.get_repositories
train
def get_repositories(self): """Gets the repository list resulting from the search. return: (osid.repository.RepositoryList) - the repository list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ i...
python
{ "resource": "" }
q48360
OsidSession.is_authenticated
train
def is_authenticated(self): """Tests if an agent is authenticated to this session. return: (boolean) - true if valid authentication credentials exist, false otherwise compliance: mandatory - This method must be implemented. """ if self._proxy is None: ...
python
{ "resource": "" }
q48361
AssetLookupSession.can_lookup_assets
train
def can_lookup_assets(self): """Tests if this user can perform ``Asset`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a h...
python
{ "resource": "" }
q48362
AssetAdminSession.can_create_assets
train
def can_create_assets(self): """Tests if this user can create ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an appl...
python
{ "resource": "" }
q48363
AssetAdminSession.can_update_assets
train
def can_update_assets(self): """Tests if this user can update ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an appl...
python
{ "resource": "" }
q48364
AssetAdminSession.get_asset_form_for_update
train
def get_asset_form_for_update(self, asset_id=None): """Gets the asset form for updating an existing asset. A new asset form should be requested for each update transaction. :param asset_id: the ``Id`` of the ``Asset`` :type asset_id: ``osid.id.Id`` :return: the asset fo...
python
{ "resource": "" }
q48365
AssetAdminSession.can_delete_assets
train
def can_delete_assets(self): """Tests if this user can delete ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an appl...
python
{ "resource": "" }
q48366
AssetAdminSession.can_create_asset_content
train
def can_create_asset_content(self, asset_id=None): """Tests if this user can create content for ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Asset`` will result in a ``PermissionDenied``. This is int...
python
{ "resource": "" }
q48367
AssetAdminSession.can_create_asset_content_with_record_types
train
def can_create_asset_content_with_record_types(self, asset_id=None, asset_content_record_types=None): """Tests if this user can create an ``AssetContent`` using the desired record types. While ``RepositoryManager.getAssetContentRecordTypes()`` can be used to test which records are supported, th...
python
{ "resource": "" }
q48368
AssetAdminSession.can_update_asset_contents
train
def can_update_asset_contents(self, asset_id=None): """Tests if this user can update ``AssetContent``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``AssetContent`` will result in a ``PermissionDenied``. This is ...
python
{ "resource": "" }
q48369
AssetAdminSession.get_asset_content_form_for_update
train
def get_asset_content_form_for_update(self, asset_content_id=None): """Gets the asset form for updating content for an existing asset. A new asset content form should be requested for each update transaction. :param asset_content_id: the ``Id`` of the ``AssetContent`` :type ass...
python
{ "resource": "" }
q48370
AssetAdminSession.can_delete_asset_contents
train
def can_delete_asset_contents(self, asset_id=None): """Tests if this user can delete ``AssetsContent`` from ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``AssetContent`` will result in a ``PermissionDe...
python
{ "resource": "" }
q48371
RepositoryLookupSession.can_lookup_repositories
train
def can_lookup_repositories(self): """Tests if this user can perform ``Repository`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended ...
python
{ "resource": "" }
q48372
RepositoryAdminSession.can_create_repositories
train
def can_create_repositories(self): """Tests if this user can create ``Repositories``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a ``Repository`` will result in a ``PermissionDenied``. This is intended as a...
python
{ "resource": "" }
q48373
RepositoryAdminSession.create_repository
train
def create_repository(self, repository_form=None): """Creates a new ``Repository``. :param repository_form: the form for this ``Repository`` :type repository_form: ``osid.repository.RepositoryForm`` :return: the new ``Repository`` :rtype: ``osid.repository.Repository`` :...
python
{ "resource": "" }
q48374
RepositoryAdminSession.can_update_repositories
train
def can_update_repositories(self): """Tests if this user can update ``Repositories``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a ``Repository`` will result in a ``PermissionDenied``. This is intended as a...
python
{ "resource": "" }
q48375
RepositoryAdminSession.can_delete_repositories
train
def can_delete_repositories(self): """Tests if this user can delete ``Repositories``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a ``Repository`` will result in a ``PermissionDenied``. This is intended as a...
python
{ "resource": "" }
q48376
MaybeDefected.raise_if
train
def raise_if(self, exception, message, *args, **kwargs): """ If current exception has smaller priority than minimum, subclass of this class only warns user, otherwise normal exception will be raised. """ if issubclass(exception, self.minimum_defect): raise exception(*...
python
{ "resource": "" }
q48377
signal
train
def signal(e): """ Some docstrings. """ callback = find_handler(e) if callback is None: if _activate_debugger: print 'Handler for error {0} not found'.format(type(e)) traceback.print_stack() set_trace() raise e else: return callback(e)
python
{ "resource": "" }
q48378
WrongAnswerItemRecord.get_wrong_answer_ids
train
def get_wrong_answer_ids(self): """provide this method to return only wrong answer ids""" id_list = [] for answer in self.get_wrong_answers(): id_list.append(answer.get_id()) return IdList(id_list)
python
{ "resource": "" }
q48379
Collector.find_harpoon_options
train
def find_harpoon_options(self, configuration, args_dict): """Return us all the harpoon options""" d = lambda r: {} if r in (None, "", NotSpecified) else r return MergedOptions.using( dict(d(configuration.get('harpoon')).items()) , dict(d(args_dict.get("harpoon")).items(...
python
{ "resource": "" }
q48380
Collector.setup_addon_register
train
def setup_addon_register(self, harpoon): """Setup our addon register""" # Create the addon getter and register the crosshairs namespace self.addon_getter = AddonGetter() self.addon_getter.add_namespace("harpoon.crosshairs", Result.FieldSpec(), Addon.FieldSpec()) # Initiate the a...
python
{ "resource": "" }
q48381
Collector.extra_prepare_after_activation
train
def extra_prepare_after_activation(self, configuration, args_dict): """ Called after the configuration.converters are activated Here we create our ``task_maker`` helper that we pass into ``post_register`` for our ``option_merge_addon_hook`` functions. We also create a ``task_fi...
python
{ "resource": "" }
q48382
Collector.add_configuration
train
def add_configuration(self, configuration, collect_another_source, done, result, src): """ Used to add a file to the configuration, result here is the yaml.load of the src. If the configuration we're reading in has ``harpoon.extra_files`` then this is treated as a list of string...
python
{ "resource": "" }
q48383
Collector.make_image_converters
train
def make_image_converters(self, image, configuration, harpoon_spec): """Make converters for this image and add them to the configuration""" def convert_image(path, val): log.info("Converting %s", path) everything = path.configuration.root().wrapped() meta = Meta(every...
python
{ "resource": "" }
q48384
AssetLookupSession.get_assets_by_parent_genus_type
train
def get_assets_by_parent_genus_type(self, asset_genus_type=None): """Gets an ``AssetList`` corresponding to the given asset genus ``Type`` and include any additional assets with genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known assets...
python
{ "resource": "" }
q48385
AssetLookupSession.get_assets_by_record_type
train
def get_assets_by_record_type(self, asset_record_type=None): """Gets an ``AssetList`` containing the given asset record ``Type``. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessi...
python
{ "resource": "" }
q48386
AssetLookupSession.get_assets_by_provider
train
def get_assets_by_provider(self, resource_id=None): """Gets an ``AssetList`` from the given provider. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session. ...
python
{ "resource": "" }
q48387
AssetContentLookupSession.get_asset_contents_by_parent_genus_type
train
def get_asset_contents_by_parent_genus_type(self, asset_content_genus_type): """Gets an ``AssetContentList`` corresponding to the given asset content genus ``Type`` and include any additional asset contents with genus types derived from the specified ``Type``. In plenary mode, the returned list contain...
python
{ "resource": "" }
q48388
AssetContentLookupSession.get_asset_contents_by_record_type
train
def get_asset_contents_by_record_type(self, asset_content_record_type): """Gets an ``AssetContentList`` containing the given asset record ``Type``. In plenary mode, the returned list contains all known asset contents or an error results. Otherwise, the returned list may contain only tho...
python
{ "resource": "" }
q48389
AssetContentLookupSession.get_asset_contents_by_genus_type_for_asset
train
def get_asset_contents_by_genus_type_for_asset(self, asset_content_genus_type, asset_id): """Gets an ``AssetContentList`` from the given GenusType and Asset Id. In plenary mode, the returned list contains all known asset contents or an error results. Otherwise, the returned list may contain onl...
python
{ "resource": "" }
q48390
AssetQuerySession.get_asset_contents_by_query
train
def get_asset_contents_by_query(self, asset_content_query=None): """Gets a list of ``AssetContents`` matching the given asset content query. arg: asset_content_query (osid.repository.AssetContentQuery): the asset content query return: (osid.repository.AssetContentList) - the ...
python
{ "resource": "" }
q48391
docker_context
train
def docker_context(): """Make a docker context""" try: client = docker.from_env( version = "auto" , timeout = int(os.environ.get("DOCKER_CLIENT_TIMEOUT", 180)) , assert_hostname = False ) info = client.info() log.info("Connected to docke...
python
{ "resource": "" }
q48392
HierarchyProxyManager.get_hierarchy_traversal_session
train
def get_hierarchy_traversal_session(self, proxy): """Gets the ``OsidSession`` associated with the hierarchy traversal service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.hierarchy.HierarchyTraversalSession) - a ``HierarchyTraversalSession`` raise: NullArgum...
python
{ "resource": "" }
q48393
HierarchyProxyManager.get_hierarchy_traversal_session_for_hierarchy
train
def get_hierarchy_traversal_session_for_hierarchy(self, hierarchy_id, proxy): """Gets the ``OsidSession`` associated with the hierarchy traversal service for the given hierarchy. arg: hierarchy_id (osid.id.Id): the ``Id`` of the hierarchy arg: proxy (osid.proxy.Proxy): a proxy ret...
python
{ "resource": "" }
q48394
HierarchyProxyManager.get_hierarchy_design_session
train
def get_hierarchy_design_session(self, proxy): """Gets the ``OsidSession`` associated with the hierarchy design service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.hierarchy.HierarchyDesignSession) - a ``HierarchyDesignSession`` raise: NullArgument - ``prox...
python
{ "resource": "" }
q48395
HierarchyProxyManager.get_hierarchy_design_session_for_hierarchy
train
def get_hierarchy_design_session_for_hierarchy(self, hierarchy_id, proxy): """Gets the ``OsidSession`` associated with the topology design service using for the given hierarchy. arg: hierarchy_id (osid.id.Id): the ``Id`` of the hierarchy arg: proxy (osid.proxy.Proxy): a proxy retu...
python
{ "resource": "" }
q48396
HierarchyProxyManager.get_hierarchy_lookup_session
train
def get_hierarchy_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the hierarchy lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.hierarchy.HierarchyLookupSession) - a ``HierarchyLookupSession`` raise: NullArgument - ``prox...
python
{ "resource": "" }
q48397
HierarchyProxyManager.get_hierarchy_admin_session
train
def get_hierarchy_admin_session(self, proxy): """Gets the hierarchy administrative session. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.hierarchy.HierarchyAdminSession) - a ``HierarchyAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: ...
python
{ "resource": "" }
q48398
ast_to_headings
train
def ast_to_headings(node): """ Walks AST and returns a list of headings """ Heading = namedtuple('Heading', ['level', 'title']) level = None walker = node.walker() headings = [] event = walker.nxt() while event is not None: entering = event['entering'] node = event...
python
{ "resource": "" }
q48399
Dictator.copy
train
def copy(self): """Convert ``Dictator`` to standard ``dict`` object >>> dc = Dictator() >>> dc['l0'] = [1, 2] >>> dc['1'] = 'abc' >>> d = dc.copy() >>> type(d) dict >>> d {'l0': ['1', '2'], '1': 'abc'} >>> dc.clear() :return: Pyth...
python
{ "resource": "" }