_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q49400 | Extensible._init_records | train | def _init_records(self, record_types):
"""Initalize all records for this form."""
for record_type in record_types:
# This conditional was inserted on 7/11/14. It may prove problematic:
if str(record_type) not in self._my_map['recordTypeIds']:
record_initialized = ... | python | {
"resource": ""
} |
q49401 | Extensible._delete | train | def _delete(self):
"""Override this method in inheriting objects to perform special clearing operations."""
try:
for record in self._records:
try:
self._records[record]._delete()
except AttributeError:
pass
excep... | python | {
"resource": ""
} |
q49402 | Extensible.get_record_types | train | def get_record_types(self):
"""Gets the record types available in this object.
A record ``Type`` explicitly indicates the specification of an
interface to the record. A record may or may not inherit other
record interfaces through interface inheritance in which case
support of a... | python | {
"resource": ""
} |
q49403 | Temporal.is_effective | train | def is_effective(self):
"""Tests if the current date is within the start end end dates inclusive.
return: (boolean) - ``true`` if this is effective, ``false``
otherwise
*compliance: mandatory -- This method must be implemented.*
"""
now = DateTime.utcnow()
... | python | {
"resource": ""
} |
q49404 | Temporal.get_start_date | train | def get_start_date(self):
"""Gets the start date.
return: (osid.calendaring.DateTime) - the start date
*compliance: mandatory -- This method must be implemented.*
"""
sdate = self._my_map['startDate']
return DateTime(
sdate.year,
sdate.month,
... | python | {
"resource": ""
} |
q49405 | Sourceable.get_provider | train | def get_provider(self):
"""Gets the ``Resource`` representing the provider.
return: (osid.resource.Resource) - the provider
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
"""
if 'providerId' not in self._... | python | {
"resource": ""
} |
q49406 | Transcript.rc | train | def rc(self):
"""Flip the direction"""
ntx = self.copy()
newstrand = '+'
if ntx.strand == '+': newstrand = '-'
ntx._options = ntx._options._replace(direction=newstrand)
return ntx | python | {
"resource": ""
} |
q49407 | Transcript.slice_sequence | train | def slice_sequence(self,start,end,directionless=False):
"""Slice the mapping by the position in the sequence
First coordinate is 0-indexed start
Second coordinate is 1-indexed finish
"""
if end > self.length: end = self.length
if start < 0: start = 0
if not directionless and s... | python | {
"resource": ""
} |
q49408 | Transcript.range | train | def range(self):
"""Get the range from the leftmost exon to the rightmost
:return: total range
:rtype: GenomicRange
"""
return GenomicRange(self._rngs[0].chr,self._rngs[0].start,self._rngs[-1].end) | python | {
"resource": ""
} |
q49409 | Transcript.junctions | train | def junctions(self):
"""Can be inferred from the exons, this is not implemented yet"""
if len(self.exons) < 2: return []
junctions = []
for i in range(1,len(self.exons)):
junctions.append(Junction(self.exons[i-1],self.exons[i]))
return junctions | python | {
"resource": ""
} |
q49410 | Transcript.set_gene_name | train | def set_gene_name(self,name):
"""assign a gene name
:param name: name
:type name: string
"""
self._options = self._options._replace(gene_name = name) | python | {
"resource": ""
} |
q49411 | Transcript.set_transcript_name | train | def set_transcript_name(self,name):
"""assign a transcript name
:param name: name
:type name: string
"""
self._options = self._options._replace(name = name) | python | {
"resource": ""
} |
q49412 | Transcript.exon_overlap | train | def exon_overlap(self,tx,multi_minover=10,multi_endfrac=0,multi_midfrac=0.8,single_minover=50,single_frac=0.5,multi_consec=True):
"""Get a report on how mucht the exons overlap
:param tx:
:param multi_minover: multi-exons need to overlap by at lest this much to be considered overlapped (default 10)
:pa... | python | {
"resource": ""
} |
q49413 | ExonOverlap.consecutive_exon_count | train | def consecutive_exon_count(self1):
"""Best number of consecutive exons that overlap
:return: matched consecutive exon count
:rtype: int
"""
best = 1
consec = 1
for i in range(0,len(self1.dif1)):
if self1.dif1[i] == 1 and self1.dif2[i] == 1:
consec += 1
... | python | {
"resource": ""
} |
q49414 | ExonOverlap.is_full_overlap | train | def is_full_overlap(self1):
"""true if they are a full overlap
:return: is full overlap
:rtype: bool
"""
if len(self1.overs) == 0: return False
if len(self1.dif1) > 0:
if max(self1.dif1) != 1 or max(self1.dif2) != 1: return False
if self1.start1 and self1.end1 and self... | python | {
"resource": ""
} |
q49415 | ExonOverlap.analyze_overs | train | def analyze_overs(self1):
"""A helper function that prepares overlap and consecutive matches data"""
#check for full overlap first
self1.dif1 = [self1.overs[i][0]-self1.overs[i-1][0] for i in range(1,len(self1.overs))]
self1.dif2 = [self1.overs[i][1]-self1.overs[i-1][1] for i in range(1,len(self... | python | {
"resource": ""
} |
q49416 | JunctionOverlap.analyze_overs | train | def analyze_overs(self):
"""A helper function to prepare values describing overlaps"""
#check for full overlap first
self.dif1 = [self.overs[i][0]-self.overs[i-1][0] for i in range(1,len(self.overs))]
self.dif2 = [self.overs[i][1]-self.overs[i-1][1] for i in range(1,len(self.overs))]
#see ... | python | {
"resource": ""
} |
q49417 | Junction.get_string | train | def get_string(self):
"""A string representation of the junction
:return: string represnetation
:rtype: string
"""
return self.left.chr+':'+str(self.left.end)+'-'+self.right.chr+':'+str(self.right.start) | python | {
"resource": ""
} |
q49418 | Junction.get_range_string | train | def get_range_string(self):
"""Another string representation of the junction. these may be redundant."""
return self.left.chr+":"+str(self.left.end)+'/'+self.right.chr+":"+str(self.right.start) | python | {
"resource": ""
} |
q49419 | Junction.equals | train | def equals(self,junc):
"""test equality with another junction"""
if self.left.equals(junc.left): return False
if self.right.equals(junc.right): return False
return True | python | {
"resource": ""
} |
q49420 | Junction.overlaps | train | def overlaps(self,junc,tolerance=0):
"""see if junction overlaps with tolerance"""
if not self.left.overlaps(junc.left,padding=tolerance): return False
if not self.right.overlaps(junc.right,padding=tolerance): return False
return True | python | {
"resource": ""
} |
q49421 | Junction.cmp | train | def cmp(self,junc,tolerance=0):
""" output comparison and allow for tolerance if desired
* -1 if junc comes before self
* 1 if junc comes after self
* 0 if overlaps
* 2 if else
:param junc:
:param tolerance: optional search space (default=0, no tolerance)
:type junc: Junction
:type... | python | {
"resource": ""
} |
q49422 | FASTAData.get_sequence | train | def get_sequence(self,chr=None,start=None,end=None,dir=None,rng=None):
"""get a sequence
:param chr:
:param start:
:param end:
:param dir: charcter +/-
:parma rng:
:type chr: string
:type start: int
:type end: int
:type dir: char
:type rng: GenomicRange
:return: sequence... | python | {
"resource": ""
} |
q49423 | OsidProfile._get_override_lookup_session | train | def _get_override_lookup_session(self):
"""Gets the AuthorizationLookupSession for the override typed Vault
Assumes only one
"""
from ..utilities import OVERRIDE_VAULT_TYPE
try:
override_vaults = self._get_vault_lookup_session().get_vaults_by_genus_type(OVERRIDE_VAU... | python | {
"resource": ""
} |
q49424 | BAMFileGeneric._fetch_headers | train | def _fetch_headers(self):
"""Needs ._fh handle to stream to be set by child"""
self._header_text, self._n_ref = self._read_top_header()
self._ref_lengths, self._ref_names = self._read_reference_information()
self._header = SAMHeader(self._header_text) | python | {
"resource": ""
} |
q49425 | BAMFileGeneric._get_block | train | def _get_block(self):
"""Just read a single block from your current location in _fh"""
b = self._fh.read(4) # get block size bytes
#print self._fh.tell()
if not b: raise StopIteration
block_size = struct.unpack('<i',b)[0]
return self._fh.read(block_size) | python | {
"resource": ""
} |
q49426 | BAMFileGeneric._read_reference_information | train | def _read_reference_information(self):
"""Reads the reference names and lengths"""
ref_lengths = {}
ref_names = []
for n in range(self._n_ref):
l_name = struct.unpack('<i',self._fh.read(4))[0]
name = self._fh.read(l_name).rstrip('\0')
l_ref = struct.unpack('<i',self._fh.read(4))[0]
... | python | {
"resource": ""
} |
q49427 | BAMFileGeneric._read_top_header | train | def _read_top_header(self):
"""Read the header text and number of reference seqs"""
magic = self._fh.read(4)
l_text = struct.unpack('<i',self._fh.read(4))[0]
header_text = self._fh.read(l_text).rstrip('\0')
n_ref = struct.unpack('<i',self._fh.read(4))[0]
return header_text, n_ref | python | {
"resource": ""
} |
q49428 | BAMFile.fetch_starting_at_coord | train | def fetch_starting_at_coord(self,coord):
#b2 = BAMFile(self.path,blockStart=coord[0],innerStart=coord[1],index_obj=self.index,reference=self._reference)
"""starting at a certain coordinate was supposed to make output
.. warning:: creates a new instance of a BAMFile object when maybe the one we had would ha... | python | {
"resource": ""
} |
q49429 | AgentSearchResults.get_agents | train | def get_agents(self):
"""Gets the agent list resulting from the search.
return: (osid.authentication.AgentList) - the agent list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | {
"resource": ""
} |
q49430 | SolverBase.simulate | train | def simulate(self, timepoints):
"""
Simulate initialised solver for the specified timepoints
:param timepoints: timepoints that will be returned from simulation
:return: a list of trajectories for each of the equations in the problem.
"""
solver = self._solver
la... | python | {
"resource": ""
} |
q49431 | SolverBase._results_to_trajectories | train | def _results_to_trajectories(self, simulated_timepoints, simulated_values):
"""
Convert the resulting results into a list of trajectories
:param simulated_timepoints: timepoints output from a solver
:param simulated_values: values returned by the solver
:return:
"""
... | python | {
"resource": ""
} |
q49432 | LoggingManager.use_comparative_log_view | train | def use_comparative_log_view(self):
"""Pass through to provider LogEntryLogSession.use_comparative_log_view"""
self._log_view = COMPARATIVE
# self._get_provider_session('log_entry_log_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | {
"resource": ""
} |
q49433 | LoggingManager.use_plenary_log_view | train | def use_plenary_log_view(self):
"""Pass through to provider LogEntryLogSession.use_plenary_log_view"""
self._log_view = PLENARY
# self._get_provider_session('log_entry_log_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | {
"resource": ""
} |
q49434 | LoggingManager.get_logs_by_provider | train | def get_logs_by_provider(self, *args, **kwargs):
"""Pass through to provider LogLookupSession.get_logs_by_provider"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_by_provider
catalogs = self._get_provider_session('log_lookup_session').get_logs_by_pr... | python | {
"resource": ""
} |
q49435 | LoggingManager.get_logs | train | def get_logs(self):
"""Pass through to provider LogLookupSession.get_logs"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('log_lookup_session').get_logs()
cat_list = []
for cat in catalo... | python | {
"resource": ""
} |
q49436 | LoggingManager.get_log_form | train | def get_log_form(self, *args, **kwargs):
"""Pass through to provider LogAdminSession.get_log_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if isin... | python | {
"resource": ""
} |
q49437 | Log.use_comparative_log_entry_view | train | def use_comparative_log_entry_view(self):
"""Pass through to provider LogEntryLookupSession.use_comparative_log_entry_view"""
self._object_views['log_entry'] = COMPARATIVE
# self._get_provider_session('log_entry_lookup_session') # To make sure the session is tracked
for session in self._... | python | {
"resource": ""
} |
q49438 | Log.use_plenary_log_entry_view | train | def use_plenary_log_entry_view(self):
"""Pass through to provider LogEntryLookupSession.use_plenary_log_entry_view"""
self._object_views['log_entry'] = PLENARY
# self._get_provider_session('log_entry_lookup_session') # To make sure the session is tracked
for session in self._get_provider... | python | {
"resource": ""
} |
q49439 | Log.use_federated_log_view | train | def use_federated_log_view(self):
"""Pass through to provider LogEntryLookupSession.use_federated_log_view"""
self._log_view = FEDERATED
# self._get_provider_session('log_entry_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | {
"resource": ""
} |
q49440 | Log.use_isolated_log_view | train | def use_isolated_log_view(self):
"""Pass through to provider LogEntryLookupSession.use_isolated_log_view"""
self._log_view = ISOLATED
# self._get_provider_session('log_entry_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
t... | python | {
"resource": ""
} |
q49441 | Log.get_log_entry_form | train | def get_log_entry_form(self, *args, **kwargs):
"""Pass through to provider LogEntryAdminSession.get_log_entry_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 tel... | python | {
"resource": ""
} |
q49442 | Log.save_log_entry | train | def save_log_entry(self, log_entry_form, *args, **kwargs):
"""Pass through to provider LogEntryAdminSession.update_log_entry"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if log_entry_form.is_for_update():
return self.update... | python | {
"resource": ""
} |
q49443 | LogList.get_next_logs | train | def get_next_logs(self, n):
"""gets next n objects from list"""
# Implemented from kitosid template for -
# osid.resource.ResourceList.get_next_resources
if n > self.available():
# !!! This is not quite as specified (see method docs) !!!
raise IllegalState('not en... | python | {
"resource": ""
} |
q49444 | MALAffinity.comparison | train | def comparison(self, username):
"""
Get a comparison of scores between the "base user" and ``username``.
A Key-Value returned will consist of the following:
.. code-block:: none
{
ANIME_ID: [BASE_USER_SCORE, OTHER_USER_SCORE],
...
... | python | {
"resource": ""
} |
q49445 | MALAffinity.calculate_affinity | train | def calculate_affinity(self, username):
"""
Get the affinity between the "base user" and ``username``.
.. note:: The data returned will be a namedtuple, with the affinity
and shared rated anime. This can easily be separated
as follows (using the user ``Luna``... | python | {
"resource": ""
} |
q49446 | to_bool | train | def to_bool(value):
# type: (Any) -> bool
"""
Convert a value into a bool but handle "truthy" strings eg, yes, true, ok, y
"""
if isinstance(value, _compat.string_types):
return value.upper() in ('Y', 'YES', 'T', 'TRUE', '1', 'OK')
return bool(value) | python | {
"resource": ""
} |
q49447 | dict_filter_update | train | def dict_filter_update(base, updates):
# type: (dict, dict) -> None
"""
Update dict with None values filtered out.
"""
base.update((k, v) for k, v in updates.items() if v is not None) | python | {
"resource": ""
} |
q49448 | dict_filter | train | def dict_filter(*args, **kwargs):
"""
Merge all values into a single dict with all None values removed.
"""
result = {}
for arg in itertools.chain(args, (kwargs,)):
dict_filter_update(result, arg)
return result | python | {
"resource": ""
} |
q49449 | sort_by_priority | train | def sort_by_priority(iterable, reverse=False, default_priority=10):
"""
Return a list or objects sorted by a priority value.
"""
return sorted(iterable, reverse=reverse, key=lambda o: getattr(o, 'priority', default_priority)) | python | {
"resource": ""
} |
q49450 | handle_services | train | def handle_services(changeset):
"""Populate the change set with addCharm and deploy changes."""
charms = {}
for service_name, service in sorted(changeset.bundle['services'].items()):
# Add the addCharm record if one hasn't been added yet.
if service['charm'] not in charms:
record... | python | {
"resource": ""
} |
q49451 | handle_machines | train | def handle_machines(changeset):
"""Populate the change set with addMachines changes."""
machines = sorted(changeset.bundle.get('machines', {}).items())
for machine_name, machine in machines:
if machine is None:
# We allow the machine value to be unset in the YAML.
machine = {... | python | {
"resource": ""
} |
q49452 | handle_relations | train | def handle_relations(changeset):
"""Populate the change set with addRelation changes."""
for relation in changeset.bundle.get('relations', []):
relations = [models.Relation(*i.split(':')) if ':' in i
else models.Relation(i, '') for i in relation]
changeset.send({
... | python | {
"resource": ""
} |
q49453 | handle_units | train | def handle_units(changeset):
"""Populate the change set with addUnit changes."""
units, records = {}, {}
for service_name, service in sorted(changeset.bundle['services'].items()):
for i in range(service.get('num_units', 0)):
record_id = 'addUnit-{}'.format(changeset.next_action())
... | python | {
"resource": ""
} |
q49454 | _handle_units_placement | train | def _handle_units_placement(changeset, units, records):
"""Ensure that requires and placement directives are taken into account."""
for service_name, service in sorted(changeset.bundle['services'].items()):
num_units = service.get('num_units')
if num_units is None:
# This is a subord... | python | {
"resource": ""
} |
q49455 | _next_unit_in_service | train | def _next_unit_in_service(service, placed_in_services):
"""Return the unit number where to place a unit placed on a service.
Receive the service name and a dict mapping service names to the current
number of placed units in that service.
"""
current = placed_in_services.get(service)
number = 0 ... | python | {
"resource": ""
} |
q49456 | parse | train | def parse(bundle, handler=handle_services):
"""Return a generator yielding changes required to deploy the given bundle.
The bundle argument is a YAML decoded Python dict.
"""
changeset = ChangeSet(bundle)
while True:
handler = handler(changeset)
for change in changeset.recv():
... | python | {
"resource": ""
} |
q49457 | Server.get_or_create | train | def get_or_create(self, db_name):
"""
Creates the database named `db_name` if it doesn't already exist and
return it
"""
if not db_name in self:
res = self.resource.put(db_name)
if not res[0] == 201:
raise RuntimeError(
... | python | {
"resource": ""
} |
q49458 | Server.replicate | train | def replicate(self, doc_id, source, target, continuous=False):
"""
Starts a replication from the `source` database to the `target`
database by writing a document with the id `doc_id` to the "_relicator"
database
"""
if doc_id in self["_replicator"]:
return
... | python | {
"resource": ""
} |
q49459 | Server.create_user | train | def create_user(self, username, password):
"""
Creates a user in the CouchDB instance with the username `username` and
password `password`
"""
user_id = "org.couchdb.user:" + username
res = self["_users"].resource.put(
user_id, body=json.dumps({
... | python | {
"resource": ""
} |
q49460 | Server.log_in | train | def log_in(self, username, password):
"""
Logs in to the CouchDB instance with the credentials `username` and
`password`
"""
self.resource.credentials = (username, password)
return self.resource.get_json("_session")[2] | python | {
"resource": ""
} |
q49461 | Server.get_user_info | train | def get_user_info(self):
"""
Returns the document representing the currently logged in user on the
server
"""
try:
user_id = "org.couchdb.user:"+self.resource.credentials[0]
except TypeError:
raise RuntimeError(
"Please log in befor... | python | {
"resource": ""
} |
q49462 | Server.push_design_documents | train | def push_design_documents(self, design_path):
"""
Push the design documents stored in `design_path` to the server
"""
for db_name in os.listdir(design_path):
if db_name.startswith("__") or db_name.startswith("."):
continue
db_path = os.path.join(de... | python | {
"resource": ""
} |
q49463 | Server._folder_to_dict | train | def _folder_to_dict(self, path):
"""
Recursively reads the files from the directory given by `path` and
writes their contents to a nested dictionary, which is then returned.
"""
res = {}
for key in os.listdir(path):
if key.startswith('.'):
cont... | python | {
"resource": ""
} |
q49464 | OpenERP.init_app | train | def init_app(self, app):
"""This callback can be used to initialize an application for use with
the OpenERP server.
"""
app.config.setdefault('OPENERP_SERVER', 'http://localhost:8069')
app.config.setdefault('OPENERP_DATABASE', 'openerp')
app.config.setdefault('OPENERP_DEF... | python | {
"resource": ""
} |
q49465 | RepositoryManager.get_asset_temporal_session | train | def get_asset_temporal_session(self):
"""Gets the session for retrieving temporal coverage of an asset.
return: (osid.repository.AssetTemporalSession) - an
AssetTemporalSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_asset_te... | python | {
"resource": ""
} |
q49466 | RepositoryManager.get_asset_temporal_session_for_repository | train | def get_asset_temporal_session_for_repository(self, repository_id=None):
"""Gets the session for retrieving temporal coverage of an asset
for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
return: (osid.repository.AssetTemporalSession) - an
... | python | {
"resource": ""
} |
q49467 | RepositoryManager.get_asset_temporal_assignment_session | train | def get_asset_temporal_assignment_session(self):
"""Gets the session for assigning temporal coverage to an asset.
return: (osid.repository.AssetTemporalAssignmentSession) - an
AssetTemporalAssignmentSession
raise: OperationFailed - unable to complete request
raise: Uni... | python | {
"resource": ""
} |
q49468 | RepositoryManager.get_repository_search_session | train | def get_repository_search_session(self):
"""Gets the repository search session.
return: (osid.repository.RepositorySearchSession) - a
RepositorySearchSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_repository_search() is fals... | python | {
"resource": ""
} |
q49469 | RepositoryProxyManager.get_asset_smart_repository_session | train | def get_asset_smart_repository_session(self, repository_id, proxy):
"""Gets an asset smart repository session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetSmartRepositorySes... | python | {
"resource": ""
} |
q49470 | RepositoryProxyManager.get_asset_temporal_assignment_session_for_repository | train | def get_asset_temporal_assignment_session_for_repository(self, repository_id, proxy):
"""Gets the session for assigning temporal coverage of an asset for
the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
... | python | {
"resource": ""
} |
q49471 | RepositoryProxyManager.get_asset_spatial_session | train | def get_asset_spatial_session(self, proxy):
"""Gets the session for retrieving spatial coverage of an asset.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetSpatialSession) - an
AssetSpatialSession
raise: OperationFailed - unable to complete requ... | python | {
"resource": ""
} |
q49472 | RepositoryProxyManager.get_asset_spatial_session_for_repository | train | def get_asset_spatial_session_for_repository(self, repository_id, proxy):
"""Gets the session for retrieving spatial coverage of an asset for
the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osi... | python | {
"resource": ""
} |
q49473 | RepositoryProxyManager.get_asset_spatial_assignment_session | train | def get_asset_spatial_assignment_session(self, proxy):
"""Gets the session for assigning spatial coverage to an asset.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetSpatialAssignmentSession) - an
AssetSpatialAssignmentSession
raise: OperationFa... | python | {
"resource": ""
} |
q49474 | RepositoryProxyManager.get_asset_spatial_assignment_session_for_repository | train | def get_asset_spatial_assignment_session_for_repository(self, repository_id, proxy):
"""Gets the session for assigning spatial coverage of an asset for
the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
re... | python | {
"resource": ""
} |
q49475 | RepositoryProxyManager.get_composition_smart_repository_session | train | def get_composition_smart_repository_session(self, repository_id, proxy):
"""Gets a composition smart repository session for the given
repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.Comp... | python | {
"resource": ""
} |
q49476 | RepositoryProxyManager.get_repository_notification_session | train | def get_repository_notification_session(self, repository_receiver, proxy):
"""Gets the notification session for subscribing to changes to a
repository.
arg: repository_receiver
(osid.repository.RepositoryReceiver): the notification
callback
arg pro... | python | {
"resource": ""
} |
q49477 | RepositoryManager.get_asset_content_lookup_session_for_repository | train | def get_asset_content_lookup_session_for_repository(self, repository_id=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service for
the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetLookupSess... | python | {
"resource": ""
} |
q49478 | RepositoryProxyManager.get_asset_content_lookup_session | train | def get_asset_content_lookup_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service.
return: (osid.repository.AssetLookupSession) - the new
``AssetLookupSession``
raise: OperationFailed - unable to complete request
raise:... | python | {
"resource": ""
} |
q49479 | RepositoryProxyManager.get_asset_query_session | train | def get_asset_query_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: NullArgument - ``proxy`` is ``null... | python | {
"resource": ""
} |
q49480 | TPMCalculator.calculate | train | def calculate(self):
"""do the TPM calculation"""
self._calculated = True
for name in self.transcripts:
self.transcripts[name]['RPK'] = (float(self.transcripts[name]['count'])/float(self.transcripts[name]['length']))/float(1000)
tot = 0.0
for name in self.transcripts:
tot... | python | {
"resource": ""
} |
q49481 | ObjectiveSearchResults.get_objectives | train | def get_objectives(self):
"""Gets the objective list resulting from the search.
return: (osid.learning.ObjectiveList) - the objective list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | {
"resource": ""
} |
q49482 | ActivitySearchResults.get_activities | train | def get_activities(self):
"""Gets the activity list resulting from the search.
return: (osid.learning.ActivityList) - the activity list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | {
"resource": ""
} |
q49483 | ProficiencySearchResults.get_proficiencies | train | def get_proficiencies(self):
"""Gets the proficiency list resulting from a search.
return: (osid.learning.ProficiencyList) - the proficiency list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrie... | python | {
"resource": ""
} |
q49484 | ObjectiveBankSearchResults.get_objective_banks | train | def get_objective_banks(self):
"""Gets the objective bank list resulting from the search.
return: (osid.learning.ObjectiveBankList) - the objective bank
list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
... | python | {
"resource": ""
} |
q49485 | ResourceManager.initialize | train | def initialize(self, runtime):
"""OSID Manager initialize"""
from .primitives import Id
if self._runtime is not None:
raise IllegalState('Manager has already been initialized')
self._runtime = runtime
config = runtime.get_configuration()
parameter_id = Id('par... | python | {
"resource": ""
} |
q49486 | ResourceManager.use_comparative_bin_view | train | def use_comparative_bin_view(self):
"""Pass through to provider ResourceBinSession.use_comparative_bin_view"""
self._bin_view = COMPARATIVE
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | {
"resource": ""
} |
q49487 | ResourceManager.use_plenary_bin_view | train | def use_plenary_bin_view(self):
"""Pass through to provider ResourceBinSession.use_plenary_bin_view"""
self._bin_view = PLENARY
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | {
"resource": ""
} |
q49488 | ResourceManager.get_bins_by_resource | train | def get_bins_by_resource(self, *args, **kwargs):
"""Pass through to provider ResourceBinSession.get_bins_by_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('resource_bin_session').get_bins... | python | {
"resource": ""
} |
q49489 | ResourceManager.get_bin | train | def get_bin(self, *args, **kwargs):
"""Pass through to provider BinLookupSession.get_bin"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bin
return Bin(
self._provider_manager,
self._get_provider_session('bin_lookup_session').get_... | python | {
"resource": ""
} |
q49490 | ResourceManager.get_bins | train | def get_bins(self):
"""Pass through to provider BinLookupSession.get_bins"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('bin_lookup_session').get_bins()
cat_list = []
for cat in catalo... | python | {
"resource": ""
} |
q49491 | ResourceManager.get_bin_form | train | def get_bin_form(self, *args, **kwargs):
"""Pass through to provider BinAdminSession.get_bin_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if isin... | python | {
"resource": ""
} |
q49492 | ResourceManager.save_bin | train | def save_bin(self, bin_form, *args, **kwargs):
"""Pass through to provider BinAdminSession.update_bin"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if bin_form.is_for_update():
return self.update_bin(bin_form, *args, **kwargs)
... | python | {
"resource": ""
} |
q49493 | Bin.use_comparative_resource_view | train | def use_comparative_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_comparative_resource_view"""
self._object_views['resource'] = COMPARATIVE
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_... | python | {
"resource": ""
} |
q49494 | Bin.use_plenary_resource_view | train | def use_plenary_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_plenary_resource_view"""
self._object_views['resource'] = PLENARY
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_ses... | python | {
"resource": ""
} |
q49495 | Bin.use_federated_bin_view | train | def use_federated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_federated_bin_view"""
self._bin_view = FEDERATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | {
"resource": ""
} |
q49496 | Bin.use_isolated_bin_view | train | def use_isolated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_isolated_bin_view"""
self._bin_view = ISOLATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
tr... | python | {
"resource": ""
} |
q49497 | Bin.get_resource_form | train | def get_resource_form(self, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.get_resource_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": ""
} |
q49498 | Bin.save_resource | train | def save_resource(self, resource_form, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.update_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if resource_form.is_for_update():
return self.update_res... | python | {
"resource": ""
} |
q49499 | Bin.use_comparative_agent_view | train | def use_comparative_agent_view(self):
"""Pass through to provider ResourceAgentSession.use_comparative_agent_view"""
self._object_views['agent'] = COMPARATIVE
# self._get_provider_session('resource_agent_session') # To make sure the session is tracked
for session in self._get_provider_se... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.