_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q49300 | RepositoryHierarchySession.get_parent_repository_ids | train | 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 | {
"resource": ""
} |
q49301 | RepositoryHierarchySession.get_parent_repositories | train | 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 | {
"resource": ""
} |
q49302 | RepositoryHierarchySession.is_ancestor_of_repository | train | 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 | {
"resource": ""
} |
q49303 | RepositoryHierarchySession.has_child_repositories | train | 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 | {
"resource": ""
} |
q49304 | RepositoryHierarchySession.get_child_repository_ids | train | 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 | {
"resource": ""
} |
q49305 | RepositoryHierarchySession.get_child_repositories | train | 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 | {
"resource": ""
} |
q49306 | RepositoryHierarchySession.is_descendant_of_repository | train | 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 | {
"resource": ""
} |
q49307 | RepositoryHierarchyDesignSession.add_root_repository | train | 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 | {
"resource": ""
} |
q49308 | RepositoryHierarchyDesignSession.remove_root_repository | train | 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 | {
"resource": ""
} |
q49309 | RepositoryHierarchyDesignSession.add_child_repository | train | 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 | {
"resource": ""
} |
q49310 | RepositoryHierarchyDesignSession.remove_child_repository | train | 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 | {
"resource": ""
} |
q49311 | RepositoryHierarchyDesignSession.remove_child_repositories | train | 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 | {
"resource": ""
} |
q49312 | CronModule.add_cron | train | 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 | {
"resource": ""
} |
q49313 | CronModule.remove_cron | train | 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 | {
"resource": ""
} |
q49314 | exception_handler | train | 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 | {
"resource": ""
} |
q49315 | Runner.run | train | 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 | {
"resource": ""
} |
q49316 | Recipe.name | train | 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 | {
"resource": ""
} |
q49317 | Recipe.module | train | 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 | {
"resource": ""
} |
q49318 | Radices._reverse_rounding_method | train | 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 | {
"resource": ""
} |
q49319 | Radices.from_rational | train | 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 | {
"resource": ""
} |
q49320 | Rationals.round_to_int | train | 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 | {
"resource": ""
} |
q49321 | Radix._validate | train | 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 | {
"resource": ""
} |
q49322 | Radix._repeat_length | train | 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 | {
"resource": ""
} |
q49323 | Radix._canonicalize_fraction | train | 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 | {
"resource": ""
} |
q49324 | Radix.getString | train | 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 | {
"resource": ""
} |
q49325 | Radix.as_rational | train | 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 | {
"resource": ""
} |
q49326 | Radix.as_int | train | 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 | {
"resource": ""
} |
q49327 | Radix.in_base | train | 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 | {
"resource": ""
} |
q49328 | _Rounding._conditional_toward_zero | train | 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 | {
"resource": ""
} |
q49329 | _Rounding._increment | train | 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 | {
"resource": ""
} |
q49330 | _Rounding.roundFractional | train | 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 | {
"resource": ""
} |
q49331 | PropertyList.get_next_property | train | 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 | {
"resource": ""
} |
q49332 | load_edgegrid_client_settings | train | 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 | {
"resource": ""
} |
q49333 | PurgeRequest.add | train | 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 | {
"resource": ""
} |
q49334 | PurgeRequest.purge_all | train | 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 | {
"resource": ""
} |
q49335 | RelationshipLookupSession.get_relationships_for_source_on_date | train | 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 | {
"resource": ""
} |
q49336 | RelationshipSearchSession.get_relationships_by_search | train | 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 | {
"resource": ""
} |
q49337 | AuthenticationManager._set_agency_view | train | 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 | {
"resource": ""
} |
q49338 | BlockchainSpider.history | train | 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 | {
"resource": ""
} |
q49339 | BlockchainSpider.check_script | train | 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 | {
"resource": ""
} |
q49340 | BlockchainSpider._get_addresses | train | 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 | {
"resource": ""
} |
q49341 | in1d_events | train | 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 | {
"resource": ""
} |
q49342 | get_max_events_in_both_arrays | train | 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 | {
"resource": ""
} |
q49343 | map_cluster | train | 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 | {
"resource": ""
} |
q49344 | get_events_in_both_arrays | train | 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 | {
"resource": ""
} |
q49345 | assert_sympy_expressions_equal | train | 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 | {
"resource": ""
} |
q49346 | _sympy_matrices_equal | train | 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 | {
"resource": ""
} |
q49347 | _eval_res_equal | train | 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 | {
"resource": ""
} |
q49348 | sympy_empirical_equal | train | 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 | {
"resource": ""
} |
q49349 | URI.is_absolute | train | 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 | {
"resource": ""
} |
q49350 | NatDivision._round | train | 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 | {
"resource": ""
} |
q49351 | NatDivision._divide | train | 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 | {
"resource": ""
} |
q49352 | NatDivision._fractional_division | train | 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 | {
"resource": ""
} |
q49353 | NatDivision._division | train | 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 | {
"resource": ""
} |
q49354 | NatDivision.division | train | 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 | {
"resource": ""
} |
q49355 | NatDivision.undivision | train | def undivision(
cls,
integer_part,
non_repeating_part,
repeating_part,
base
):
"""
Find divisor and dividend that yield component parts.
:param integer_part: the integer part
:type integer_part: list of int
:param non_repeating_part: the no... | python | {
"resource": ""
} |
q49356 | CatalogingManager.get_catalog_lookup_session | train | def get_catalog_lookup_session(self):
"""Gets the catalog lookup session.
return: (osid.cataloging.CatalogLookupSession) - a
``CatalogLookupSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_catalog_lookup()`` is
... | python | {
"resource": ""
} |
q49357 | CatalogingManager.get_catalog_query_session | train | def get_catalog_query_session(self):
"""Gets the catalog query session.
return: (osid.cataloging.CatalogQuerySession) - a
``CatalogQuerySession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_catalog_query()`` is
... | python | {
"resource": ""
} |
q49358 | CatalogingProxyManager.get_catalog_admin_session | train | def get_catalog_admin_session(self, proxy):
"""Gets the catalog administrative session for creating, updating and deleting catalogs.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.cataloging.CatalogAdminSession) - a
``CatalogAdminSession``
raise: NullArgument -... | python | {
"resource": ""
} |
q49359 | CatalogingProxyManager.get_catalog_hierarchy_session | train | def get_catalog_hierarchy_session(self, proxy):
"""Gets the catalog hierarchy traversal session.
arg: proxy (osid.proxy.Proxy): proxy
return: (osid.cataloging.CatalogHierarchySession) - a
``CatalogHierarchySession``
raise: NullArgument - ``proxy`` is null
rai... | python | {
"resource": ""
} |
q49360 | CatalogingProxyManager.get_catalog_hierarchy_design_session | train | def get_catalog_hierarchy_design_session(self, proxy):
"""Gets the catalog hierarchy design session.
arg: proxy (osid.proxy.Proxy): proxy
return: (osid.cataloging.CatalogHierarchyDesignSession) - a
``CatalogHierarchyDesignSession``
raise: NullArgument - ``proxy`` is ... | python | {
"resource": ""
} |
q49361 | CommandsModule.regenerate_prefixes | train | def regenerate_prefixes(self, *args):
"""Regenerate the cache of command prefixes based on nick etc."""
nick = self.controller.client.user.nick
self.prefixes = set([
nick + ": ",
nick + ", ",
nick + " - ",
])
# Include lower-case versions as we... | python | {
"resource": ""
} |
q49362 | CommandsModule.check_for_interest | train | def check_for_interest(self, client, recipient, message):
"""Determine whether this line is addressing us."""
for prefix in self.prefixes:
if message.startswith(prefix):
return True, message[len(prefix):]
# Don't require a prefix if addressed in PM.
# This co... | python | {
"resource": ""
} |
q49363 | CommandsModule.parse_command | train | def parse_command(self, string):
"""Parse out any possible valid command from an input string."""
possible_command, _, rest = string.partition(" ")
# Commands are case-insensitive, stored as lowercase
possible_command = possible_command.lower()
if possible_command not in self.com... | python | {
"resource": ""
} |
q49364 | waveform_image | train | def waveform_image(mediafile, xy_size, outdir=None, center_color=None, outer_color=None, bg_color=None):
""" Create waveform image from audio data.
Return path to created image file.
"""
try:
import waveform
except ImportError, exc:
raise ImportError("%s [get it at https://github... | python | {
"resource": ""
} |
q49365 | waveform_stack | train | def waveform_stack(mediafiles, xy_size, output=None, label_style=None,
center_color=None, outer_color=None, bg_color=None):
""" Create a stack of waveform images from audio data.
Return path to created image file.
"""
img_files = []
output = output or os.path.abspath(os.path.dirname(os.... | python | {
"resource": ""
} |
q49366 | OsidQuery._get_string_match_value | train | def _get_string_match_value(self, string, string_match_type):
"""Gets the match value"""
if string_match_type == Type(**get_type_data('EXACT')):
return string
elif string_match_type == Type(**get_type_data('IGNORECASE')):
return re.compile('^' + string, re.I)
elif... | python | {
"resource": ""
} |
q49367 | OsidQuery._match_display_text | train | def _match_display_text(self, element_key, string, string_match_type, match):
"""Matches a display text value"""
if string is None or string_match_type is None:
raise NullArgument()
match_value = self._get_string_match_value(string, string_match_type)
self._add_match(element_... | python | {
"resource": ""
} |
q49368 | _filter_settings | train | def _filter_settings(settings, prefix):
"""
Filter all settings to only return settings that start with a certain
prefix.
:param dict settings: A settings dictionary.
:param str prefix: A prefix.
"""
ret = {}
for skey in settings.keys():
if skey.startswith(prefix):
k... | python | {
"resource": ""
} |
q49369 | get_capakey | train | def get_capakey(registry):
"""
Get the Capakey Gateway
:rtype: :class:`crabpy.gateway.capakey.CapakeyRestGateway`
"""
# argument might be a config or a request
regis = getattr(registry, 'registry', None)
if regis is None:
regis = registry
return regis.queryUtility(ICapakey) | python | {
"resource": ""
} |
q49370 | get_crab | train | def get_crab(registry):
"""
Get the Crab Gateway
:rtype: :class:`crabpy.gateway.crab.CrabGateway`
# argument might be a config or a request
"""
# argument might be a config or a request
regis = getattr(registry, 'registry', None)
if regis is None:
regis = registry
return re... | python | {
"resource": ""
} |
q49371 | add_route | train | def add_route(config, name, pattern, *args, **kwargs):
"""
Adds a pyramid route to the config. All args and kwargs will be
passed on to config.add_route.
This exists so the default behaviour of including crabpy will still be to
cache all crabpy routes.
"""
config.add_route(name, pattern, *a... | python | {
"resource": ""
} |
q49372 | includeme | train | def includeme(config):
"""
Include `crabpy_pyramid` in this `Pyramid` application.
:param pyramid.config.Configurator config: A Pyramid configurator.
"""
settings = _parse_settings(config.registry.settings)
base_settings = _get_proxy_settings(settings)
# http caching tween
if not sett... | python | {
"resource": ""
} |
q49373 | AssessmentPartSearchResults.get_assessment_parts | train | def get_assessment_parts(self):
"""Gets the ``AssessmentPartList`` resulting from a search.
return: (osid.assessment.authoring.AssessmentPartList) - the
assessment part list
raise: IllegalState - list has already been retrieved
*compliance: mandatory -- This method must... | python | {
"resource": ""
} |
q49374 | SequenceRuleSearchResults.get_sequence_rules | train | def get_sequence_rules(self):
"""Gets the ``SequenceRuleList`` resulting from a search.
return: (osid.assessment.authoring.SequenceRuleList) - the
sequence rule list
raise: IllegalState - list has already been retrieved
*compliance: mandatory -- This method must be impl... | python | {
"resource": ""
} |
q49375 | InferenceResultsCollection.plot_distance_landscape_projection | train | def plot_distance_landscape_projection(self, x_axis, y_axis, ax=None, *args, **kwargs):
"""
Plots the distance landscape jointly-generated from all the results
:param x_axis: symbol to plot on x axis
:param y_axis: symbol to plot on y axis
:param ax: axis object to plot onto
... | python | {
"resource": ""
} |
q49376 | InferenceResult.distance_landscape_as_3d_data | train | def distance_landscape_as_3d_data(self, x_axis, y_axis):
"""
Returns the distance landscape as three-dimensional data for the specified projection.
:param x_axis: variable to be plotted on the x axis of projection
:param y_axis: variable to be plotted on the y axis of projection
... | python | {
"resource": ""
} |
q49377 | InferenceResult.plot_trajectory_projection | train | def plot_trajectory_projection(self, x_axis, y_axis,
legend=False, ax=None,
start_and_end_locations_only=False,
start_marker='bo',
end_marker='rx',
... | python | {
"resource": ""
} |
q49378 | get_short_reads | train | def get_short_reads(vals):
(args,txome,seed,chunk) = vals
#fast forward some ammount
"""Emit the short reads first"""
txe = TranscriptomeEmitter(txome,TranscriptomeEmitter.Options(seed=seed))
if args.weights:
weights = {}
if args.weights[-3:]=='.gz': inf = gzip.open(args.weights)
else: ... | python | {
"resource": ""
} |
q49379 | Builder.make_image | train | def make_image(self, conf, images, chain=None, parent_chain=None, made=None, ignore_deps=False, ignore_parent=False, pushing=False):
"""Make us an image"""
made = {} if made is None else made
chain = [] if chain is None else chain
parent_chain = [] if parent_chain is None else parent_cha... | python | {
"resource": ""
} |
q49380 | Builder.build_image | train | def build_image(self, conf, pushing=False):
"""Build this image"""
with conf.make_context() as context:
try:
stream = BuildProgressStream(conf.harpoon.silent_build)
with self.remove_replaced_images(conf) as info:
cached = NormalBuilder().bu... | python | {
"resource": ""
} |
q49381 | Builder.layered | train | def layered(self, images, only_pushable=False):
"""Yield layers of images"""
if only_pushable:
operate_on = dict((image, instance) for image, instance in images.items() if instance.image_index)
else:
operate_on = images
layers = Layers(operate_on, all_images=imag... | python | {
"resource": ""
} |
q49382 | QTIItemRecord._is_match | train | def _is_match(self, response, answer):
"""For MC, can call through to MultiChoice Item Record?"""
# TODO: this varies depending on question type
if self._only_generic_right_feedback():
return str(answer.genus_type) == str(RIGHT_ANSWER_GENUS)
elif self._is_multiple_choice():
... | python | {
"resource": ""
} |
q49383 | AuthorizationSearchResults.get_authorizations | train | def get_authorizations(self):
"""Gets the authorization list resulting from the search.
return: (osid.authorization.AuthorizationList) - the
authorization list
raise: IllegalState - list has already been retrieved
*compliance: mandatory -- This method must be implemente... | python | {
"resource": ""
} |
q49384 | VaultSearchResults.get_vaults | train | def get_vaults(self):
"""Gets the vault list resulting from the search.
return: (osid.authorization.VaultList) - the vault list
raise: IllegalState - list has already been retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | {
"resource": ""
} |
q49385 | Objective.get_knowledge_category | train | def get_knowledge_category(self):
"""Gets the grade associated with the knowledge dimension.
return: (osid.grading.Grade) - the grade
raise: IllegalState - has_knowledge_category() is false
raise: OperationFailed - unable to complete request
compliance: mandatory - This method... | python | {
"resource": ""
} |
q49386 | Objective.get_cognitive_process | train | def get_cognitive_process(self):
"""Gets the grade associated with the cognitive process.
return: (osid.grading.Grade) - the grade
raise: IllegalState - has_cognitive_process() is false
raise: OperationFailed - unable to complete request
compliance: mandatory - This method mus... | python | {
"resource": ""
} |
q49387 | ObjectiveList.get_next_objective | train | def get_next_objective(self):
"""Gets the next Objective in this list.
return: (osid.learning.Objective) - the next Objective in this
list. The has_next() method should be used to test that
a next Objective is available before calling this
method.
... | python | {
"resource": ""
} |
q49388 | Activity.get_asset_ids | train | def get_asset_ids(self):
"""Gets the Ids of any assets associated with this activity.
return: (osid.id.IdList) - list of asset Ids
raise: IllegalState - is_asset_based_activity() is false
compliance: mandatory - This method must be implemented.
"""
if not self.is_asset... | python | {
"resource": ""
} |
q49389 | Activity.get_assessment_ids | train | def get_assessment_ids(self):
"""Gets the Ids of any assessments associated with this activity.
return: (osid.id.IdList) - list of assessment Ids
raise: IllegalState - is_assessment_based_activity() is false
compliance: mandatory - This method must be implemented.
"""
... | python | {
"resource": ""
} |
q49390 | ActivityList.get_next_activity | train | def get_next_activity(self):
"""Gets the next Activity in this list.
return: (osid.learning.Activity) - the next Activity in this
list. The has_next() method should be used to test that
a next Activity is available before calling this method.
raise: IllegalState... | python | {
"resource": ""
} |
q49391 | ObjectiveBankList.get_next_objective_bank | train | def get_next_objective_bank(self):
"""Gets the next ObjectiveBank in this list.
return: (osid.learning.ObjectiveBank) - the next ObjectiveBank
in this list. The has_next() method should be used to
test that a next ObjectiveBank is available before
calling... | python | {
"resource": ""
} |
q49392 | get_report | train | def get_report(self):
""" describe the graph
:returns: report
:rtype: string
"""
ostr = ''
ostr += "Nodes: "+str(len(self.__nodes.keys()))+"\n"
ostr += "Edges: "+str(len(self.__edges.keys()))+"\n"
return ostr | python | {
"resource": ""
} |
q49393 | get_node_edges | train | def get_node_edges(self,node,type="both"):
""" given a node return the edges attached, by default get both incoming and outgoing
:param node:
:param type:
:type node: Node
:type type: string - default 'both'
:returns: edge list
:rtype: Edge[] edge list
"""
if type == "both":
r... | python | {
"resource": ""
} |
q49394 | get_children | train | def get_children(self,node):
""" Find all the children of a node. must be a undirectional graph with no cycles
:param node:
:type node: Node
:returns: list of nodes
:rtype: Node[]
"""
if self.find_cycle() or self.__directionless:
sys.stderr.write("ERROR: do cannot find a branch when ... | python | {
"resource": ""
} |
q49395 | get_roots | train | def get_roots(self):
"""get the roots of a graph. must be a directed graph
:returns: root list of nodes
:rtype: Node[]
"""
if self.__directionless:
sys.stderr.write("ERROR: can't get roots of an undirected graph\n")
sys.exit()
outputids = self.__nodes.keys()
#print outputids
... | python | {
"resource": ""
} |
q49396 | root_and_children_to_graph | train | def root_and_children_to_graph(self,root):
"""Take a root node and its children and make them into graphs"""
g = Graph()
g.add_node(root)
edges = []
edges += self.get_node_edges(root,"outgoing")
for c in self.get_children(root):
g.add_node(c)
edges += self.get_node_ed... | python | {
"resource": ""
} |
q49397 | Model.validate | train | def validate(self):
"""
Validates whether the particular model is created properly
"""
if self.stoichiometry_matrix.cols != self.propensities.rows:
raise ValueError('There must be a column in stoichiometry matrix '
'for each row in propensities ma... | python | {
"resource": ""
} |
q49398 | Identifiable.get_id | train | def get_id(self):
"""Gets the Id associated with this instance of this OSID object.
Persisting any reference to this object is done by persisting
the Id returned from this method. The Id returned may be
different than the Id used to query this object. In this case,
the new Id sh... | python | {
"resource": ""
} |
q49399 | Extensible._get_record | train | def _get_record(self, record_type):
"""Get the record string type value given the record_type."""
if not self.has_record_type(record_type):
raise errors.Unsupported()
if str(record_type) not in self._records:
raise errors.Unimplemented()
return self._records[str(r... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.