_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q46900
staticdir
train
def staticdir(): """Return the location of the static data directory.""" root = os.path.abspath(os.path.dirname(__file__)) return os.path.join(root, "static")
python
{ "resource": "" }
q46901
resource
train
def resource(name): """ Return the full path of a named resource in the static directory. If multiple files with the same name exist, **name** should contain the first directory as well. .. code-block:: python resource("myfile") resource("test01/test.txt") resource("test02...
python
{ "resource": "" }
q46902
RDFLoader.load_file
train
def load_file(self, file_obj, verbose): """ The type of open file objects such as sys.stdout; alias of the built-in file. @TODO: when is this used? """ if verbose: printDebug("----------") if verbose: printDebug("Reading: <%s> ...'" % file_obj.name) if type(file...
python
{ "resource": "" }
q46903
StdlibEpollProactor.run
train
def run(self, timeout = 0): """ Run a proactor loop and return new socket events. Timeout is a timedelta object, 0 if active coros or None. epoll timeout param is a integer number of seconds. """ ptimeout = float( timeout.microseconds/1000000+timeout....
python
{ "resource": "" }
q46904
Resolver._check
train
def _check(self, terms): """Check terms do not contain unknown characters""" for t in terms: try: _ = urllib.parse.quote(six.text_type(t).encode('utf8')) except: self.logger.error('Unknown character in [{0}]!'.format(t)) self.logger...
python
{ "resource": "" }
q46905
Resolver.main
train
def main(self): """Search and sieve query names.""" # TODO: Break up, too complex primary_bool = True no_records = True nsearch = 1 search_terms = self.terms original_names = [] while True: if primary_bool: self.logger.info('Sea...
python
{ "resource": "" }
q46906
Resolver.write
train
def write(self): """Write csv file of resolved names and txt file of unresolved names. """ csv_file = os.path.join(self.outdir, 'search_results.csv') txt_file = os.path.join(self.outdir, 'unresolved.txt') headers = self.key_terms unresolved = [] with open(csv_file...
python
{ "resource": "" }
q46907
set_document_type
train
def set_document_type(loader_cls: Type, type_: Type) -> None: """Set the type corresponding to the whole document. Args: loader_cls: The loader class to set the document type for. type_: The type to loader should process the document into. """ loader_cls.document_type = type_ if no...
python
{ "resource": "" }
q46908
add_to_loader
train
def add_to_loader(loader_cls: Type, classes: List[Type]) -> None: """Registers one or more classes with a YAtiML loader. Once a class has been registered, it can be recognized and \ constructed when reading a YAML text. Args: loader_cls: The loader to register the classes with. classes...
python
{ "resource": "" }
q46909
Loader.get_single_node
train
def get_single_node(self) -> yaml.Node: """Hook used when loading a single document. This is the hook we use to hook yatiml into ruamel.yaml. It is \ called by the yaml libray when the user uses load() to load a \ YAML document. Returns: A processed node representin...
python
{ "resource": "" }
q46910
Loader.__type_to_tag
train
def __type_to_tag(self, type_: Type) -> str: """Convert a type to the corresponding YAML tag. Args: type_: The type to convert Returns: A string containing the YAML tag. """ if type_ in scalar_type_to_tag: return scalar_type_to_tag[type_] ...
python
{ "resource": "" }
q46911
Loader.__savorize
train
def __savorize(self, node: yaml.Node, expected_type: Type) -> yaml.Node: """Removes syntactic sugar from the node. This calls yatiml_savorize(), first on the class's base \ classes, then on the class itself. Args: node: The node to modify. expected_type: The typ...
python
{ "resource": "" }
q46912
Loader.__process_node
train
def __process_node(self, node: yaml.Node, expected_type: Type) -> yaml.Node: """Processes a node. This is the main function that implements yatiml's \ functionality. It figures out how to interpret this node \ (recognition), then applies syntactic sugar, and final...
python
{ "resource": "" }
q46913
CreateCallMixin.create
train
def create(self): """ Creates the object :return: the created object :rtype: object """ # In the header.location there is the newly created object so get the id out of the url created_id = self._post_request( data=self.element_to_string(self.encode()...
python
{ "resource": "" }
q46914
set_cell_value
train
def set_cell_value(cell, value): """ Convenience method for setting the value of an openpyxl cell This is necessary since the value property changed from internal_value to value between version 1.* and 2.*. """ if OPENPYXL_MAJOR_VERSION > 1: cell.value = value else: cell.int...
python
{ "resource": "" }
q46915
SampleResultSetsResource.get_change_type
train
def get_change_type(self, ref, a1, a2): """ Given ref, allele1, and allele2, returns the type of change. The only case of an amino acid insertion is when the ref is represented as a '.'. """ if ref == '.': return self.INSERTION elif a1 == '.' or a2 == ...
python
{ "resource": "" }
q46916
get_osid_form_mdata
train
def get_osid_form_mdata(): """Return default mdata map for OsidForm""" return { 'journal_comment': { 'element_label': { 'text': 'Journal Comment', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
{ "resource": "" }
q46917
get_osid_object_mdata
train
def get_osid_object_mdata(): """Return default mdata map for OsidObject""" return { 'display_name': { 'element_label': { 'text': 'Display Name', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
{ "resource": "" }
q46918
get_osid_temporal_mdata
train
def get_osid_temporal_mdata(): """Return default mdata map for OsidTemporal""" return { 'start_date': { 'element_label': { 'text': 'Start Date', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
{ "resource": "" }
q46919
get_osid_containable_mdata
train
def get_osid_containable_mdata(): """Return default mdata map for OsidContainable""" return { 'sequestered': { 'element_label': { 'text': 'sequestered', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
{ "resource": "" }
q46920
get_osid_sourceable_mdata
train
def get_osid_sourceable_mdata(): """Return default mdata map for OsidSourceable""" return { 'provider': { 'element_label': { 'text': 'provider', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
{ "resource": "" }
q46921
ResourceSearchResults.get_resources
train
def get_resources(self): """Gets the resource list resulting from a search. return: (osid.resource.ResourceList) - the resource list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: ...
python
{ "resource": "" }
q46922
BinSearchResults.get_bins
train
def get_bins(self): """Gets the bin list resulting from the search. return: (osid.resource.BinList) - the bin list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.I...
python
{ "resource": "" }
q46923
_backward_delete_char
train
def _backward_delete_char(text, pos): """Delete the character behind pos.""" if pos == 0: return text, pos return text[:pos - 1] + text[pos:], pos - 1
python
{ "resource": "" }
q46924
_backward_kill_word
train
def _backward_kill_word(text, pos): """" Kill the word behind pos. Word boundaries are the same as those used by _backward_word. """ text, new_pos = _backward_word(text, pos) return text[:new_pos] + text[pos:], new_pos
python
{ "resource": "" }
q46925
_delete_horizontal_space
train
def _delete_horizontal_space(text, pos): """Delete all spaces and tabs around pos.""" while pos > 0 and text[pos - 1].isspace(): pos -= 1 end_pos = pos while end_pos < len(text) and text[end_pos].isspace(): end_pos += 1 return text[:pos] + text[end_pos:], pos
python
{ "resource": "" }
q46926
_kill_word
train
def _kill_word(text, pos): """ Kill from pos to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by _forward_word. """ text, end_pos = _forward_word(text, pos) return text[:pos] + text[end_pos:], pos
python
{ "resource": "" }
q46927
_transpose_chars
train
def _transpose_chars(text, pos): """ Drag the character before pos forward over the character at pos, moving pos forward as well. If pos is at the end of text, then this transposes the two characters before pos. """ if len(text) < 2 or pos == 0: return text, pos if pos == len(text): ...
python
{ "resource": "" }
q46928
_transpose_words
train
def _transpose_words(text, pos): """ Drag the word before pos past the word after pos, moving pos over that word as well. If pos is at the end of text, this transposes the last two words in text. """ text, end2 = _forward_word(text, pos) text, start2 = _backward_word(text, end2) text, st...
python
{ "resource": "" }
q46929
_unix_word_rubout
train
def _unix_word_rubout(text, pos): """ Kill the word behind pos, using white space as a word boundary. """ words = text[:pos].rsplit(None, 1) if len(words) < 2: return text[pos:], 0 else: index = text.rfind(words[1], 0, pos) return text[:index] + text[pos:], index
python
{ "resource": "" }
q46930
edit
train
def edit(text, pos, key): """ Process a key input in the context of a line, and return the resulting text and cursor position. `text' and `key' must be of type str or unicode, and `pos' must be an int in the range [0, len(text)]. If `key' is in keys(), the corresponding command is executed on ...
python
{ "resource": "" }
q46931
login_honeypot
train
def login_honeypot(request): """ A login honypot. """ status_code = None if request.method == 'POST': form = HoneypotForm(request.POST) if form.is_valid(): username = form.cleaned_data["username"] password = form.cleaned_data["password"] # Don't s...
python
{ "resource": "" }
q46932
LogEntrySearchSession.get_log_entries_by_search
train
def get_log_entries_by_search(self, log_entry_query, log_entry_search): """Pass through to provider LogEntrySearchSession.get_log_entries_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search'...
python
{ "resource": "" }
q46933
RelationshipAdminSession.get_relationship_form_for_update
train
def get_relationship_form_for_update(self, relationship_id=None): """Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Rela...
python
{ "resource": "" }
q46934
FamilyLookupSession.get_family
train
def get_family(self, family_id=None): """Gets the ``Family`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Family`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` wa...
python
{ "resource": "" }
q46935
FamilyLookupSession.get_families_by_ids
train
def get_families_by_ids(self, family_ids=None): """Gets a ``FamilyList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the families specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` ...
python
{ "resource": "" }
q46936
FamilyLookupSession.get_families_by_genus_type
train
def get_families_by_genus_type(self, family_genus_type=None): """Gets a ``FamilyList`` corresponding to the given family genus ``Type`` which does not include families of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known families ...
python
{ "resource": "" }
q46937
a_temp_file
train
def a_temp_file(): """Yield the name of a temporary file and ensure it's removed after use""" filename = None try: tmpfile = tempfile.NamedTemporaryFile(delete=False) filename = tmpfile.name yield tmpfile finally: if filename and os.path.exists(filename): os.r...
python
{ "resource": "" }
q46938
until
train
def until(timeout=10, step=0.5, action=None, silent=False): """Yield until timeout""" yield started = time.time() while True: if action and not silent: log.info(action) if time.time() - started > timeout: if action and not silent: log.error("Time...
python
{ "resource": "" }
q46939
write_to
train
def write_to(output, txt): """Write some text to some output""" if (isinstance(txt, six.binary_type) or six.PY3 and isinstance(output, StringIO)) or isinstance(output, TextIOWrapper): output.write(txt) else: output.write(txt.encode("utf-8", "replace"))
python
{ "resource": "" }
q46940
AgnocompleteMixin.transmit_agnocomplete_context
train
def transmit_agnocomplete_context(self): """ Assign the user context to the agnocomplete class, if any. """ # Only if the field has this attribute set. if hasattr(self, AGNOCOMPLETE_USER_ATTRIBUTE): user = self.get_agnocomplete_context() if user: ...
python
{ "resource": "" }
q46941
AgnocompleteMixin.clean
train
def clean(self, *args, **kwargs): """ Potentially, these fields should validate against context-based queries. If a context variable has been transmitted to the field, it's being used to 'reset' the queryset and make sure the chosen item fits to the user context. ...
python
{ "resource": "" }
q46942
AgnocompleteContextQuerysetMixin.transmit_agnocomplete_context
train
def transmit_agnocomplete_context(self): """ We'll reset the current queryset only if the user is set. """ user = super(AgnocompleteContextQuerysetMixin, self) \ .transmit_agnocomplete_context() if user: self.queryset = self.agnocomplete.get_queryset() ...
python
{ "resource": "" }
q46943
AgnocompleteMultipleMixin.clear_list_value
train
def clear_list_value(self, value): """ Clean the argument value to eliminate None or Falsy values if needed. """ # Don't go any further: this value is empty. if not value: return self.empty_value # Clean empty items if wanted if self.clean_empty: ...
python
{ "resource": "" }
q46944
AgnocompleteModelMultipleField.create_item
train
def create_item(self, **kwargs): """ Return a model instance created from kwargs. """ item, created = self.queryset.model.objects.get_or_create(**kwargs) return item
python
{ "resource": "" }
q46945
AgnocompleteModelMultipleField.create_new_values
train
def create_new_values(self): """ Create values created by the user input. Return the model instances QS. """ model = self.queryset.model pks = [] extra_create_kwargs = self.extra_create_kwargs() for value in self._new_values: create_kwargs = {self.crea...
python
{ "resource": "" }
q46946
AgnocompleteModelMultipleField.clean
train
def clean(self, value): """ Clean the field values. """ if not self.create: # No new value can be created, use the regular clean field return super(AgnocompleteModelMultipleField, self).clean(value) # We have to do this here before the call to "super". ...
python
{ "resource": "" }
q46947
sort_ranges
train
def sort_ranges(inranges): """from an array of ranges, make a sorted array of ranges :param inranges: List of GenomicRange data :type inranges: GenomicRange[] :returns: a new sorted GenomicRange list :rtype: GenomicRange[] """ return sorted(inranges,key=lambda x: (x.chr,x.start,x.end,x.direction))
python
{ "resource": "" }
q46948
pad_ranges
train
def pad_ranges(inranges,padding,chr_ranges=None): """Add the specfied amount onto the edges the transcripts :param inranges: List of genomic ranges in Bed o GenomicRange format. :param padding: how much to add on :param chr_ranges: looks like the list of ranges within which to pad :type inranges: GenomicRang...
python
{ "resource": "" }
q46949
subtract_ranges
train
def subtract_ranges(r1s,r2s,already_sorted=False): """Subtract multiple ranges from a list of ranges :param r1s: range list 1 :param r2s: range list 2 :param already_sorted: default (False) :type r1s: GenomicRange[] :type r2s: GenomicRange[] :return: new range r1s minus r2s :rtype: GenomicRange[] ""...
python
{ "resource": "" }
q46950
intersect_range_array
train
def intersect_range_array(bed1,beds2,payload=None,is_sorted=False): """ Does not do a merge if the payload has been set :param bed1: :param bed2: :param payload: payload=1 return the payload of bed1 on each of the intersect set, payload=2 return the payload of bed2 on each of the union set, payload=3 return th...
python
{ "resource": "" }
q46951
string_to_genomic_range
train
def string_to_genomic_range(rstring): """ Convert a string to a genomic range :param rstring: string representing a genomic range chr1:801-900 :type rstring: :returns: object representing the string :rtype: GenomicRange """ m = re.match('([^:]+):(\d+)-(\d+)',rstring) if not m: sys.stderr.write("ER...
python
{ "resource": "" }
q46952
sort_genomic_ranges
train
def sort_genomic_ranges(rngs): """sort multiple ranges""" return sorted(rngs, key=lambda x: (x.chr, x.start, x.end))
python
{ "resource": "" }
q46953
BedArrayStream.read_entry
train
def read_entry(self): """get the next value from the array, and set internal iterator so next call will be next entry :return: The next GenomicRange entry :rtype: GenomicRange """ if len(self.bedarray) <= self.curr_ind: return None val = self.bedarray[self.curr_ind] self.curr_ind += 1 r...
python
{ "resource": "" }
q46954
BedStream.read_entry
train
def read_entry(self): """read the next bed entry from the stream""" line = self.fh.readline() if not line: return None m = re.match('([^\t]+)\t(\d+)\t(\d+)\t*(.*)',line.rstrip()) if not m: sys.stderr.write("ERROR: unknown line in bed format file\n"+line+"\n") sys.exit() g = GenomicRa...
python
{ "resource": "" }
q46955
ProxyCondition.set_http_request
train
def set_http_request(self, http_request): """Support the HTTPRequest ProxyConditionRecordType and checks for special effective agent ids""" self._http_request = http_request if 'HTTP_LTI_USER_ID' in http_request.META: try: authority = http_request.META['HTTP_LTI_TOOL_...
python
{ "resource": "" }
q46956
paint
train
def paint(str,color='r'): '''Utility func, for printing colorful logs in console... @args: -- str : String to be modified. color : color code to which the string will be formed. default is 'r'=RED @returns: -- str : final modified string with foreground color as per parameters. ''...
python
{ "resource": "" }
q46957
LoggingSession.log
train
def log(self, content, content_type): """Logs an item. This method is a shortcut to ``createLogEntry()``. arg: content (object): the entry to log arg: content_type (osid.type.Type): the type of this entry which must be one of the types returned by ...
python
{ "resource": "" }
q46958
LogEntryLookupSession.get_log_entry
train
def get_log_entry(self, log_entry_id): """Gets the ``LogEntry`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``LogEntry`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id...
python
{ "resource": "" }
q46959
LogEntryLookupSession.get_log_entries_by_ids
train
def get_log_entries_by_ids(self, log_entry_ids): """Gets a ``LogEntryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the entries specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`...
python
{ "resource": "" }
q46960
LogEntryLookupSession.get_log_entries_by_genus_type
train
def get_log_entries_by_genus_type(self, log_entry_genus_type): """Gets a ``LogEntryList`` corresponding to the given log entry genus ``Type`` which doe snot include entries of genus types derived form the specified ``Type``. In plenary mode, the returned list contains all known entries or an er...
python
{ "resource": "" }
q46961
LogEntryLookupSession.get_log_entries
train
def get_log_entries(self): """Gets all log entries. In plenary mode, the returned list contains all known entries or an error results. Otherwise, the returned list may contain only those entries that are accessible through this session. return: (osid.logging.LogEntryList) - a l...
python
{ "resource": "" }
q46962
LogEntryQuerySession.get_log_entries_by_query
train
def get_log_entries_by_query(self, log_entry_query): """Gets a list of log entries matching the given log entry query. arg: log_entry_query (osid.logging.LogEntryQuery): the log entry query return: (osid.logging.LogEntryList) - the returned ``LogEntryList`` ...
python
{ "resource": "" }
q46963
LogEntryAdminSession.can_create_log_entry_with_record_types
train
def can_create_log_entry_with_record_types(self, log_entry_record_types): """Tests if this user can create a single ``LogEntry`` using the desired record types. While ``LoggingManager.getLogEntryRecordTypes()`` can be used to examine which records are supported, this method tests which ...
python
{ "resource": "" }
q46964
LogEntryAdminSession.get_log_entry_form_for_create
train
def get_log_entry_form_for_create(self, log_entry_record_types): """Gets the log entry form for creating new log entries. A new form should be requested for each create transaction. arg: log_entry_record_types (osid.type.Type[]): array of log entry record types retur...
python
{ "resource": "" }
q46965
LogEntryAdminSession.create_log_entry
train
def create_log_entry(self, log_entry_form): """Creates a new ``LogEntry``. arg: log_entry_form (osid.logging.LogEntryForm): the form for this ``LogEntry`` return: (osid.logging.LogEntry) - the new ``LogEntry`` raise: IllegalState - ``log_entry_form`` already used in ...
python
{ "resource": "" }
q46966
LogEntryAdminSession.update_log_entry
train
def update_log_entry(self, log_entry_form): """Updates an existing log entry. arg: log_entry_form (osid.logging.LogEntryForm): the form containing the elements to be updated raise: IllegalState - ``log_entry_form`` already used in an update transaction ...
python
{ "resource": "" }
q46967
LogEntryAdminSession.delete_log_entry
train
def delete_log_entry(self, log_entry_id): """Deletes a ``LogEntry``. arg: log_entry_id (osid.id.Id): the ``Id`` of the ``log_entry_id`` to remove raise: NotFound - ``log_entry_id`` not found raise: NullArgument - ``log_entry_id`` is ``null`` raise: Operatio...
python
{ "resource": "" }
q46968
LogEntryAdminSession.alias_log_entry
train
def alias_log_entry(self, log_entry_id, alias_id): """Adds an ``Id`` to a ``LogEntry`` for the purpose of creating compatibility. The primary ``Id`` of the ``LogEntry`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to...
python
{ "resource": "" }
q46969
LogEntryLogSession.get_log_entry_ids_by_log
train
def get_log_entry_ids_by_log(self, log_id): """Gets the list of ``LogEntry`` ``Ids`` associated with a ``Log``. arg: log_id (osid.id.Id): ``Id`` of a ``Log`` return: (osid.id.IdList) - list of related logEntry ``Ids`` raise: NotFound - ``log_id`` is not found raise: NullAr...
python
{ "resource": "" }
q46970
LogEntryLogSession.get_log_entries_by_log
train
def get_log_entries_by_log(self, log_id): """Gets the list of log entries associated with a ``Log``. arg: log_id (osid.id.Id): ``Id`` of a ``Log`` return: (osid.logging.LogEntryList) - list of related logEntry raise: NotFound - ``log_id`` is not found raise: NullArgument - ...
python
{ "resource": "" }
q46971
LogEntryLogSession.get_log_entrie_by_log
train
def get_log_entrie_by_log(self, log_ids): """Gets the list of log entries corresponding to a list of ``Log``. arg: log_ids (osid.id.IdList): list of log ``Ids`` return: (osid.logging.LogEntryList) - list of log entries raise: NullArgument - ``log_ids`` is ``null`` raise: Op...
python
{ "resource": "" }
q46972
LogEntryLogSession.get_log_ids_by_log_entry
train
def get_log_ids_by_log_entry(self, log_entry_id): """Gets the list of ``Log`` ``Ids`` mapped to a ``LogEntry``. arg: log_entry_id (osid.id.Id): ``Id`` of a ``LogEntry`` return: (osid.id.IdList) - list of log ``Ids`` raise: NotFound - ``log_entry_id`` is not found raise: Nu...
python
{ "resource": "" }
q46973
LogEntryLogAssignmentSession.get_assignable_log_ids
train
def get_assignable_log_ids(self, log_id): """Gets a list of log including and under the given log node in which any log entry can be assigned. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` return: (osid.id.IdList) - list of assignable log ``Ids`` raise: NullArgument - ``log_id...
python
{ "resource": "" }
q46974
LogEntryLogAssignmentSession.assign_log_entry_to_log
train
def assign_log_entry_to_log(self, log_entry_id, log_id): """Adds an existing ``LogEntry`` to a ``Log``. arg: log_entry_id (osid.id.Id): the ``Id`` of the ``LogEntry`` arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` raise: AlreadyExists - ``log_entry_id`` is al...
python
{ "resource": "" }
q46975
LogEntryLogAssignmentSession.unassign_log_entry_from_log
train
def unassign_log_entry_from_log(self, log_entry_id, log_id): """Removes a ``LogEntry`` from a ``Log``. arg: log_entry_id (osid.id.Id): the ``Id`` of the ``LogEntry`` arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` raise: NotFound - ``log_entry_id`` or ``log_id...
python
{ "resource": "" }
q46976
LogEntryLogAssignmentSession.reassign_log_entry_to_log
train
def reassign_log_entry_to_log(self, log_entry_id, from_log_id, to_log_id): """Moves a ``LogEntry`` from one ``Log`` to another. Mappings to other ``Logs`` are unaffected. arg: log_entry_id (osid.id.Id): the ``Id`` of the ``LogEntry`` arg: from_log_id (osid.id.Id):...
python
{ "resource": "" }
q46977
LogAdminSession.can_create_log_with_record_types
train
def can_create_log_with_record_types(self, log_record_types): """Tests if this user can create a single ``Log`` using the desired record types. While ``LoggingManager.getLogRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required...
python
{ "resource": "" }
q46978
LogAdminSession.update_log
train
def update_log(self, log_form): """Updates an existing log. arg: log_form (osid.logging.LogForm): the form containing the elements to be updated raise: IllegalState - ``log_form`` already used in an update transaction raise: InvalidArgument - the for...
python
{ "resource": "" }
q46979
LogAdminSession.alias_log
train
def alias_log(self, log_id, alias_id): """Adds an ``Id`` to a ``Log`` for the purpose of creating compatibility. The primary ``Id`` of the ``Log`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another log, it is re...
python
{ "resource": "" }
q46980
LogHierarchySession.get_log_hierarchy_id
train
def get_log_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. return: (osid.id.Id) - the hierarchy ``Id`` associated with this session *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for ...
python
{ "resource": "" }
q46981
LogHierarchySession.get_root_logs
train
def get_root_logs(self): """Gets the root logs in the log hierarchy. A node with no parents is an orphan. While all log ``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": "" }
q46982
LogHierarchySession.has_parent_logs
train
def has_parent_logs(self, log_id): """Tests if the ``Log`` has any parents. arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if the log has parents, ``false`` otherwise raise: NotFound - ``log_id`` is not found raise: NullArgument -...
python
{ "resource": "" }
q46983
LogHierarchySession.is_parent_of_log
train
def is_parent_of_log(self, id_, log_id): """Tests if an ``Id`` is a direct parent of a log. arg: id (osid.id.Id): an ``Id`` arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if this ``id`` is a parent of ``log_id,`` ``false`` otherwise ...
python
{ "resource": "" }
q46984
LogHierarchySession.get_parent_log_ids
train
def get_parent_log_ids(self, log_id): """Gets the parent ``Ids`` of the given log. arg: log_id (osid.id.Id): the ``Id`` of a log return: (osid.id.IdList) - the parent ``Ids`` of the log raise: NotFound - ``log_id`` is not found raise: NullArgument - ``log_id`` is ``null`` ...
python
{ "resource": "" }
q46985
LogHierarchySession.get_parent_logs
train
def get_parent_logs(self, log_id): """Gets the parent logs of the given ``id``. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query return: (osid.logging.LogList) - the parent logs of the ``id`` raise: NotFound - a ``Log`` identified by ``Id is`` not found raise: N...
python
{ "resource": "" }
q46986
LogHierarchySession.is_ancestor_of_log
train
def is_ancestor_of_log(self, id_, log_id): """Tests if an ``Id`` is an ancestor of a log. arg: id (osid.id.Id): an ``Id`` arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if the ``id`` is an ancestor of the ``log_id,`` ``false`` otherwise...
python
{ "resource": "" }
q46987
LogHierarchySession.has_child_logs
train
def has_child_logs(self, log_id): """Tests if a log has any children. arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if the ``log_id`` has children, ``false`` otherwise raise: NotFound - ``log_id`` is not found raise: NullArgument...
python
{ "resource": "" }
q46988
LogHierarchySession.is_child_of_log
train
def is_child_of_log(self, id_, log_id): """Tests if an ``Id`` is a direct child of a log. arg: id (osid.id.Id): an ``Id`` arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if this ``id`` is a child of ``log_id,`` ``false`` otherwise ...
python
{ "resource": "" }
q46989
LogHierarchySession.get_child_log_ids
train
def get_child_log_ids(self, log_id): """Gets the child ``Ids`` of the given log. arg: log_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the depot raise: NotFound - ``log_id`` is not found raise: NullArgument - ``log_id`` is ``null`` ...
python
{ "resource": "" }
q46990
LogHierarchySession.get_child_logs
train
def get_child_logs(self, log_id): """Gets the child logs of the given ``id``. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query return: (osid.logging.LogList) - the child logs of the ``id`` raise: NotFound - a ``Log`` identified by ``Id is`` not found raise: Null...
python
{ "resource": "" }
q46991
LogHierarchySession.is_descendant_of_log
train
def is_descendant_of_log(self, id_, log_id): """Tests if an ``Id`` is a descendant of a log. arg: id (osid.id.Id): an ``Id`` arg: log_id (osid.id.Id): the ``Id`` of a log return: (boolean) - ``true`` if the ``id`` is a descendant of the ``log_id,`` ``false`` other...
python
{ "resource": "" }
q46992
LogHierarchySession.get_log_nodes
train
def get_log_nodes(self, log_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given log. arg: log_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A v...
python
{ "resource": "" }
q46993
LogHierarchyDesignSession.add_root_log
train
def add_root_log(self, log_id): """Adds a root log. arg: log_id (osid.id.Id): the ``Id`` of a log raise: AlreadyExists - ``log_id`` is already in hierarchy raise: NotFound - ``log_id`` is not found raise: NullArgument - ``log_id`` is ``null`` raise: OperationFaile...
python
{ "resource": "" }
q46994
LogHierarchyDesignSession.remove_root_log
train
def remove_root_log(self, log_id): """Removes a root log. arg: log_id (osid.id.Id): the ``Id`` of a log raise: NotFound - ``log_id`` is not a root raise: NullArgument - ``log_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDen...
python
{ "resource": "" }
q46995
LogHierarchyDesignSession.add_child_log
train
def add_child_log(self, log_id, child_id): """Adds a child to a log. arg: log_id (osid.id.Id): the ``Id`` of a log arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``log_id`` is already a parent of ``child_id`` raise: NotFoun...
python
{ "resource": "" }
q46996
LogHierarchyDesignSession.remove_child_log
train
def remove_child_log(self, log_id, child_id): """Removes a child from a log. arg: log_id (osid.id.Id): the ``Id`` of a log arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``log_id`` not a parent of ``child_id`` raise: NullArgument - ``log_id`` o...
python
{ "resource": "" }
q46997
LogHierarchyDesignSession.remove_child_logs
train
def remove_child_logs(self, log_id): """Removes all children from a log. arg: log_id (osid.id.Id): the ``Id`` of a log raise: NotFound - ``log_id`` not in hierarchy raise: NullArgument - ``log_id`` is ``null`` raise: OperationFailed - unable to complete request rai...
python
{ "resource": "" }
q46998
bar_chart
train
def bar_chart(data, bar_char='=', width=80): """Return an horizontal bar chart >>> print bar_chart({ ... 'one': '1', ... 'two': '2', ... 'three': '3', ... 'four': '4', ... 'five': '5', ... }) five ===== four ==== one = three === two == >>> print bar_chart({ ... '1/1': 1/1....
python
{ "resource": "" }
q46999
security
train
def security(name, *permissions): """ Decorator to add security definition. """ def inner(c): c.security = Security(name, *permissions) return c return inner
python
{ "resource": "" }