_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q47300
Question.get_learning_objectives
train
def get_learning_objectives(self): """ This method also mirrors that in the Item.""" # This is pretty much identicial to the method in assessment.Item! mgr = self._get_provider_manager('LEARNING') lookup_session = mgr.get_objective_lookup_session(proxy=getattr(self, "_proxy", None)) ...
python
{ "resource": "" }
q47301
Item.get_learning_objectives
train
def get_learning_objectives(self): """Gets the any ``Objectives`` corresponding to this item. return: (osid.learning.ObjectiveList) - the learning objectives raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ ...
python
{ "resource": "" }
q47302
Item.get_question
train
def get_question(self): """Gets the question. return: (osid.assessment.Question) - the question raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ question_map = dict(self._my_map['question']) que...
python
{ "resource": "" }
q47303
Item.get_answers
train
def get_answers(self): """Gets the answers. return: (osid.assessment.AnswerList) - the answers raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.repository.Asset.get_...
python
{ "resource": "" }
q47304
ItemForm.get_learning_objectives_metadata
train
def get_learning_objectives_metadata(self): """Gets the metadata for learning objectives. return: (osid.Metadata) - metadata for the learning objectives *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.ActivityForm.ge...
python
{ "resource": "" }
q47305
ItemForm.set_learning_objectives
train
def set_learning_objectives(self, objective_ids): """Sets the learning objectives. arg: objective_ids (osid.id.Id[]): the learning objective ``Ids`` raise: InvalidArgument - ``objective_ids`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` ...
python
{ "resource": "" }
q47306
ItemForm.clear_learning_objectives
train
def clear_learning_objectives(self): """Clears the learning objectives. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.lea...
python
{ "resource": "" }
q47307
Assessment.get_level_id
train
def get_level_id(self): """Gets the ``Id`` of a ``Grade`` corresponding to the assessment difficulty. return: (osid.id.Id) - a grade ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource.get_avatar_id_templ...
python
{ "resource": "" }
q47308
Assessment.get_level
train
def get_level(self): """Gets the ``Grade`` corresponding to the assessment difficulty. return: (osid.grading.Grade) - the level raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from templa...
python
{ "resource": "" }
q47309
AssessmentForm.get_level_metadata
train
def get_level_metadata(self): """Gets the metadata for a grade level. return: (osid.Metadata) - metadata for the grade level *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template ...
python
{ "resource": "" }
q47310
AssessmentForm.set_level
train
def set_level(self, grade_id): """Sets the level of difficulty expressed as a ``Grade``. arg: grade_id (osid.id.Id): the grade level raise: InvalidArgument - ``grade_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``grade_id`` ...
python
{ "resource": "" }
q47311
AssessmentForm.get_rubric_metadata
train
def get_rubric_metadata(self): """Gets the metadata for a rubric assessment. return: (osid.Metadata) - metadata for the assesment *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_templa...
python
{ "resource": "" }
q47312
AssessmentForm.set_rubric
train
def set_rubric(self, assessment_id): """Sets the rubric expressed as another assessment. arg: assessment_id (osid.id.Id): the assessment ``Id`` raise: InvalidArgument - ``assessment_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument...
python
{ "resource": "" }
q47313
AssessmentForm.clear_rubric
train
def clear_rubric(self): """Clears the rubric. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_a...
python
{ "resource": "" }
q47314
AssessmentForm.set_children
train
def set_children(self, child_ids): """Set the children IDs""" if not self._supports_simple_sequencing(): raise errors.IllegalState() self._my_map['childIds'] = [str(i) for i in child_ids]
python
{ "resource": "" }
q47315
AssessmentOffered.are_items_sequential
train
def are_items_sequential(self): """Tests if the items or parts in this assessment are taken sequentially. return: (boolean) - ``true`` if the items are taken sequentially, ``false`` if the items can be skipped and revisited *compliance: mandatory -- This method m...
python
{ "resource": "" }
q47316
AssessmentOffered.are_items_shuffled
train
def are_items_shuffled(self): """Tests if the items or parts appear in a random order. return: (boolean) - ``true`` if the items appear in a random order, ``false`` otherwise *compliance: mandatory -- This method must be implemented.* """ if self._my_map['itemsS...
python
{ "resource": "" }
q47317
AssessmentOffered.get_start_time
train
def get_start_time(self): """Gets the start time for this assessment. return: (osid.calendaring.DateTime) - the designated start time raise: IllegalState - ``has_start_time()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented f...
python
{ "resource": "" }
q47318
AssessmentOffered.get_duration
train
def get_duration(self): """Gets the duration for this assessment. return: (osid.calendaring.Duration) - the duration raise: IllegalState - ``has_duration()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os...
python
{ "resource": "" }
q47319
AssessmentOffered.get_score_system_id
train
def get_score_system_id(self): """Gets the grade system ``Id`` for the score. return: (osid.id.Id) - the grade system ``Id`` raise: IllegalState - ``is_scored()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template f...
python
{ "resource": "" }
q47320
AssessmentOfferedForm.get_items_sequential_metadata
train
def get_items_sequential_metadata(self): """Gets the metadata for sequential operation. return: (osid.Metadata) - metadata for the sequential flag *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_grou...
python
{ "resource": "" }
q47321
AssessmentOfferedForm.set_items_sequential
train
def set_items_sequential(self, sequential): """Sets the items sequential flag. arg: sequential (boolean): ``true`` if the items are taken sequentially, ``false`` if the items can be skipped and revisited raise: InvalidArgument - ``sequential`` is invalid ...
python
{ "resource": "" }
q47322
AssessmentOfferedForm.clear_items_sequential
train
def clear_items_sequential(self): """Clears the items sequential flag. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.reso...
python
{ "resource": "" }
q47323
AssessmentOfferedForm.get_items_shuffled_metadata
train
def get_items_shuffled_metadata(self): """Gets the metadata for shuffling items. return: (osid.Metadata) - metadata for the shuffled flag *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadat...
python
{ "resource": "" }
q47324
AssessmentOfferedForm.set_items_shuffled
train
def set_items_shuffled(self, shuffle): """Sets the shuffle flag. The shuffle flag may be overidden by other assessment sequencing rules. arg: shuffle (boolean): ``true`` if the items are shuffled, ``false`` if the items appear in the designated order raise: ...
python
{ "resource": "" }
q47325
AssessmentOfferedForm.clear_items_shuffled
train
def clear_items_shuffled(self): """Clears the shuffle flag. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resour...
python
{ "resource": "" }
q47326
AssessmentOfferedForm.get_start_time_metadata
train
def get_start_time_metadata(self): """Gets the metadata for the assessment start time. return: (osid.Metadata) - metadata for the start time *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_meta...
python
{ "resource": "" }
q47327
AssessmentOfferedForm.set_start_time
train
def set_start_time(self, start): """Sets the assessment start time. arg: start (osid.calendaring.DateTime): assessment start time raise: InvalidArgument - ``start`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must...
python
{ "resource": "" }
q47328
AssessmentOfferedForm.clear_start_time
train
def clear_start_time(self): """Clears the start time. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.Assessment...
python
{ "resource": "" }
q47329
AssessmentOfferedForm.get_deadline_metadata
train
def get_deadline_metadata(self): """Gets the metadata for the assessment deadline. return: (osid.Metadata) - metadata for the end time *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_t...
python
{ "resource": "" }
q47330
AssessmentOfferedForm.set_deadline
train
def set_deadline(self, end): """Sets the assessment end time. arg: end (timestamp): assessment end time raise: InvalidArgument - ``end`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* "...
python
{ "resource": "" }
q47331
AssessmentOfferedForm.clear_deadline
train
def clear_deadline(self): """Clears the deadline. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.AssessmentOffe...
python
{ "resource": "" }
q47332
AssessmentOfferedForm.get_duration_metadata
train
def get_duration_metadata(self): """Gets the metadata for the assessment duration. return: (osid.Metadata) - metadata for the duration *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_t...
python
{ "resource": "" }
q47333
AssessmentOfferedForm.set_duration
train
def set_duration(self, duration): """Sets the assessment duration. arg: duration (osid.calendaring.Duration): assessment duration raise: InvalidArgument - ``duration`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory ...
python
{ "resource": "" }
q47334
AssessmentOfferedForm.clear_duration
train
def clear_duration(self): """Clears the duration. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.AssessmentOffe...
python
{ "resource": "" }
q47335
AssessmentOfferedForm.get_score_system_metadata
train
def get_score_system_metadata(self): """Gets the metadata for a score system. return: (osid.Metadata) - metadata for the grade system *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_te...
python
{ "resource": "" }
q47336
AssessmentOfferedForm.set_score_system
train
def set_score_system(self, grade_system_id): """Sets the scoring system. arg: grade_system_id (osid.id.Id): the grade system raise: InvalidArgument - ``grade_system_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method...
python
{ "resource": "" }
q47337
AssessmentOfferedForm.clear_score_system
train
def clear_score_system(self): """Clears the score system. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resource...
python
{ "resource": "" }
q47338
AssessmentOfferedForm.get_grade_system_metadata
train
def get_grade_system_metadata(self): """Gets the metadata for a grading system. return: (osid.Metadata) - metadata for the grade system *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_...
python
{ "resource": "" }
q47339
AssessmentOfferedForm.set_grade_system
train
def set_grade_system(self, grade_system_id): """Sets the grading system. arg: grade_system_id (osid.id.Id): the grade system raise: InvalidArgument - ``grade_system_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method...
python
{ "resource": "" }
q47340
AssessmentOfferedForm.clear_grade_system
train
def clear_grade_system(self): """Clears the grading system. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.Resour...
python
{ "resource": "" }
q47341
AssessmentTaken.get_assessment_offered_id
train
def get_assessment_offered_id(self): """Gets the ``Id`` of the ``AssessmentOffered``. return: (osid.id.Id) - the assessment offered ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id ...
python
{ "resource": "" }
q47342
AssessmentTaken.get_assessment_offered
train
def get_assessment_offered(self): """Gets the ``AssessmentOffered``. return: (osid.assessment.AssessmentOffered) - the assessment offered raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ ...
python
{ "resource": "" }
q47343
AssessmentTaken.get_taker_id
train
def get_taker_id(self): """Gets the ``Id`` of the resource who took or is taking this assessment. return: (osid.id.Id) - the resource ``Id`` *compliance: mandatory -- This method must be implemented.* """ if self._my_map['takerId']: return Id(self._my_map['takerId']...
python
{ "resource": "" }
q47344
AssessmentTaken.has_started
train
def has_started(self): """Tests if this assessment has begun. return: (boolean) - ``true`` if the assessment has begun, ``false`` otherwise *compliance: mandatory -- This method must be implemented.* """ assessment_offered = self.get_assessment_offered() ...
python
{ "resource": "" }
q47345
AssessmentTaken.get_actual_start_time
train
def get_actual_start_time(self): """Gets the time this assessment was started. return: (osid.calendaring.DateTime) - the start time raise: IllegalState - ``has_started()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ if not self.has_star...
python
{ "resource": "" }
q47346
AssessmentTaken.has_ended
train
def has_ended(self): """Tests if this assessment has ended. return: (boolean) - ``true`` if the assessment has ended, ``false`` otherwise *compliance: mandatory -- This method must be implemented.* """ assessment_offered = self.get_assessment_offered() n...
python
{ "resource": "" }
q47347
AssessmentTaken.get_completion_time
train
def get_completion_time(self): """Gets the time of this assessment was completed. return: (osid.calendaring.DateTime) - the end time raise: IllegalState - ``has_ended()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ if not self.has_ended...
python
{ "resource": "" }
q47348
AssessmentTaken.get_time_spent
train
def get_time_spent(self): """Gets the total time spent taking this assessment. return: (osid.calendaring.Duration) - the total time spent *compliance: mandatory -- This method must be implemented.* """ # Take another look at this. Not sure it's correct: if not self.has_...
python
{ "resource": "" }
q47349
AssessmentTaken.get_score_system_id
train
def get_score_system_id(self): """Gets a score system ``Id`` for the assessment. return: (osid.id.Id) - the grade system raise: IllegalState - ``is_score()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os...
python
{ "resource": "" }
q47350
AssessmentTaken.get_score_system
train
def get_score_system(self): """Gets a grade system for the score. return: (osid.grading.GradeSystem) - the grade system raise: IllegalState - ``is_scored()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemen...
python
{ "resource": "" }
q47351
AssessmentTaken.get_rubric_id
train
def get_rubric_id(self): """Gets the ``Id`` of the rubric. return: (osid.id.Id) - an assessment taken ``Id`` raise: IllegalState - ``has_rubric()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resourc...
python
{ "resource": "" }
q47352
AssessmentTaken._get_first_assessment_section
train
def _get_first_assessment_section(self): """Gets the first section for this Taken's Assessment.""" if ('sections' not in self._my_map or not self._my_map['sections']): # This is the first time for this Taken, so start assessment # SHOULD THIS USE self._update_available_sections??...
python
{ "resource": "" }
q47353
AssessmentTaken._get_next_assessment_section
train
def _get_next_assessment_section(self, assessment_section_id): """Gets the next section following section_id. Assumes that section list exists in taken and section_id is in section list. Assumes that Section parts only exist as children of Assessments """ if self._my_map['secti...
python
{ "resource": "" }
q47354
AssessmentTaken._get_previous_assessment_section
train
def _get_previous_assessment_section(self, assessment_section_id): """Gets the previous section before section_id. Assumes that section list exists in taken and section_id is in section list. Assumes that Section parts only exist as children of Assessments """ if self._my_map['...
python
{ "resource": "" }
q47355
AssessmentTaken._get_assessment_sections
train
def _get_assessment_sections(self): """Gets a SectionList of all Sections currently known to this AssessmentTaken""" section_list = [] for section_idstr in self._my_map['sections']: section_list.append(self._get_assessment_section(Id(section_idstr))) return AssessmentSectionL...
python
{ "resource": "" }
q47356
AssessmentTaken._save
train
def _save(self): """Saves the current state of this AssessmentTaken. Should be called every time the sections map changes. """ collection = JSONClientValidated('assessment', collection='AssessmentTaken', ...
python
{ "resource": "" }
q47357
AssessmentTakenForm.get_taker_metadata
train
def get_taker_metadata(self): """Gets the metadata for a resource to manually set which resource will be taking the assessment. return: (osid.Metadata) - metadata for the resource *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os...
python
{ "resource": "" }
q47358
AssessmentTakenForm.set_taker
train
def set_taker(self, resource_id): """Sets the resource who will be taking this assessment. arg: resource_id (osid.id.Id): the resource Id raise: InvalidArgument - ``resource_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- Th...
python
{ "resource": "" }
q47359
AssessmentTakenForm.clear_taker
train
def clear_taker(self): """Clears the resource. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_...
python
{ "resource": "" }
q47360
AssessmentSection.get_assessment_taken_id
train
def get_assessment_taken_id(self): """Gets the ``Id`` of the ``AssessmentTaken``. return: (osid.id.Id) - the assessment taken ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id i...
python
{ "resource": "" }
q47361
AssessmentSection.get_assessment_taken
train
def get_assessment_taken(self): """Gets the ``AssessmentTakeb``. return: (osid.assessment.AssessmentTaken) - the assessment taken raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from temp...
python
{ "resource": "" }
q47362
BankNode.get_bank
train
def get_bank(self): """Gets the ``Bank`` at this node. return: (osid.assessment.Bank) - the bank represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('ASS...
python
{ "resource": "" }
q47363
BankNode.get_parent_bank_nodes
train
def get_parent_bank_nodes(self): """Gets the parents of this bank. return: (osid.assessment.BankNodeList) - the parents of this node *compliance: mandatory -- This method must be implemented.* """ parent_bank_nodes = [] for node in self._my_map['parentNo...
python
{ "resource": "" }
q47364
errors
train
def errors(request, *args, **kwargs): """ A dummy view that will throw errors. It'll throw any HTTP error that is contained in the search query. """ search_term = request.GET.get('q', None) if '400' in search_term: return HttpResponseBadRequest(MESSAGE_400) elif '403' in search_term...
python
{ "resource": "" }
q47365
on_connect
train
def on_connect(client): """Default on-connect actions.""" client.nick(client.user.nick) client.userinfo(client.user.username, client.user.realname)
python
{ "resource": "" }
q47366
on_line
train
def on_line(client, line): """Default handling for incoming lines. This handler will automatically manage the following IRC messages: PING: Responds with a PONG. PRIVMSG: Dispatches the PRIVMSG event. NOTICE: Dispatches the NOTICE event. MOTDSTART: Initi...
python
{ "resource": "" }
q47367
_parse_msg
train
def _parse_msg(client, command, actor, args): """Parse a PRIVMSG or NOTICE and dispatch the corresponding event.""" recipient, _, message = args.partition(' :') chantypes = client.server.features.get("CHANTYPES", "#") if recipient[0] in chantypes: recipient = client.server.get_channel(recipient)...
python
{ "resource": "" }
q47368
_parse_join
train
def _parse_join(client, command, actor, args): """Parse a JOIN and update channel states, then dispatch events. Note that two events are dispatched here: - JOIN, because a user joined the channel - MEMBERS, because the channel's members changed """ actor = User(actor) channel = args...
python
{ "resource": "" }
q47369
_parse_part
train
def _parse_part(client, command, actor, args): """Parse a PART and update channel states, then dispatch events. Note that two events are dispatched here: - PART, because a user parted the channel - MEMBERS, because the channel's members changed """ actor = User(actor) channel, _, me...
python
{ "resource": "" }
q47370
_parse_quit
train
def _parse_quit(client, command, actor, args): """Parse a QUIT and update channel states, then dispatch events. Note that two events are dispatched here: - QUIT, because a user quit the server - MEMBERS, for each channel the user is no longer in """ actor = User(actor) _, _, message...
python
{ "resource": "" }
q47371
_parse_kick
train
def _parse_kick(client, command, actor, args): """Parse a KICK and update channel states, then dispatch events. Note that two events are dispatched here: - KICK, because a user was kicked from the channel - MEMBERS, because the channel's members changed """ actor = User(actor) args,...
python
{ "resource": "" }
q47372
_parse_topic
train
def _parse_topic(client, command, actor, args): """Parse a TOPIC and update channel state, then dispatch a TOPIC event.""" channel, _, topic = args.partition(" :") channel = client.server.get_channel(channel) channel.topic = topic or None if actor: actor = User(actor) client.dispatch_eve...
python
{ "resource": "" }
q47373
_parse_welcome
train
def _parse_welcome(client, command, actor, args): """Parse a WELCOME and update user state, then dispatch a WELCOME event.""" _, _, hostmask = args.rpartition(' ') client.user.update_from_hostmask(hostmask) client.dispatch_event("WELCOME", hostmask)
python
{ "resource": "" }
q47374
_parse_created
train
def _parse_created(client, command, actor, args): """Parse CREATED and update the Host object.""" m = re.search("This server was created (.+)$", args) if m: client.server.created = m.group(1)
python
{ "resource": "" }
q47375
_parse_myinfo
train
def _parse_myinfo(client, command, actor, args): """Parse MYINFO and update the Host object.""" _, server, version, usermodes, channelmodes = args.split(None, 5)[:5] s = client.server s.host = server s.version = version s.user_modes = set(usermodes) s.channel_modes = set(channelmodes)
python
{ "resource": "" }
q47376
_parse_featurelist
train
def _parse_featurelist(client, command, actor, args): """Parse FEATURELIST and update the Host object.""" # Strip off ":are supported by this server" args = args.rsplit(":", 1)[0] # Strip off the nick; we know it's addressed to us. _, _, args = args.partition(' ') items = args.split() for i...
python
{ "resource": "" }
q47377
_parse_namreply
train
def _parse_namreply(client, command, actor, args): """Parse NAMREPLY and update a Channel object.""" prefixes = client._get_prefixes() channelinfo, _, useritems = args.partition(' :') _, _, channel = channelinfo.rpartition(' ') # channeltype channelname c = client.server.get_channel(channel) ...
python
{ "resource": "" }
q47378
_parse_endofnames
train
def _parse_endofnames(client, command, actor, args): """Parse an ENDOFNAMES and dispatch a NAMES event for the channel.""" args = args.split(" :", 1)[0] # Strip off human-readable message _, _, channel = args.rpartition(' ') channel = client.server.get_channel(channel) or channel.lower() client.disp...
python
{ "resource": "" }
q47379
_parse_mode
train
def _parse_mode(client, command, actor, args): """Parse a mode changes, update states, and dispatch MODE events.""" chantypes = client.server.features.get("CHANTYPES", "#") channel, _, args = args.partition(" ") args = args.lstrip(":") if channel[0] not in chantypes: # Personal modes ...
python
{ "resource": "" }
q47380
_parse_whois
train
def _parse_whois(client, command, actor, args): """Parse the content responses from a WHOIS query. Individual response lines are parsed and used to fill in data in a buffer, the full contents of which are then sent as the argument to the WHOIS event dispatched when an ENDOFWHOIS line is received from t...
python
{ "resource": "" }
q47381
_parse_nick
train
def _parse_nick(client, command, actor, args): """Parse a NICK response, update state, and dispatch events. Note: this function dispatches both a NICK event and also one or more MEMBERS events for each channel the user that changed nick was in. """ old_nick, _, _ = actor.partition('!') new_nick...
python
{ "resource": "" }
q47382
_parse_invite
train
def _parse_invite(client, command, actor, args): """Parse an INVITE and dispatch an event.""" target, _, channel = args.rpartition(" ") client.dispatch_event("INVITE", actor, target, channel.lower())
python
{ "resource": "" }
q47383
_parse_nicknameinuse
train
def _parse_nicknameinuse(client, command, actor, args): """Parse a NICKNAMEINUSE message and dispatch an event. The parameter passed along with the event is the nickname which is already in use. """ nick, _, _ = args.rpartition(" ") client.dispatch_event("NICKNAMEINUSE", nick)
python
{ "resource": "" }
q47384
Client.add_handler
train
def add_handler(self, event, handler): """Adds a handler for a particular event. Handlers are appended to the list, so a handler added earlier will be called before a handler added later. If you wish to insert a handler at another position, you should modify the event_handlers p...
python
{ "resource": "" }
q47385
Client.dispatch_event
train
def dispatch_event(self, event, *args): """Dispatches an event. Returns a boolean indicating whether or not a handler suppressed further handling of the event (even the last). """ if event not in self.event_handlers: _log.error("Dispatch requested for unknown event '...
python
{ "resource": "" }
q47386
Client.connect
train
def connect(self, nick, username=None, realname=None, password=None, host=None, port=6667, ssl=None): """Connect to the server using the specified credentials. Note: if host is specified here, both the host and port arguments passed to Client.__init__ will be ignored. I...
python
{ "resource": "" }
q47387
Client.run
train
def run(self): """Process events such as incoming data. This method blocks indefinitely. It will only return after the connection to the server is closed. """ self._stop = False # Allow re-starting the event loop while not self._stop: try: sel...
python
{ "resource": "" }
q47388
Client.send
train
def send(self, *args): """Sends a single raw message to the IRC server. Arguments are automatically joined by spaces. No newlines are allowed. """ msg = " ".join(a.nick if isinstance(a, User) else str(a) for a in args) if "\n" in msg: raise ValueError("Cannot send() ...
python
{ "resource": "" }
q47389
Client.userinfo
train
def userinfo(self, username, realname=None): """Set the username and realname for this connection. Note: this should only be called once, on connect. (The default on-connect routine calls this automatically.) """ realname = realname or username _log.info("Requesting use...
python
{ "resource": "" }
q47390
Client.reply
train
def reply(self, incoming, user, message, prefix=None): """Replies to a user in a given channel or PM. If the specified incoming is a user, simply sends a PM to user. If the specified incoming is a channel, prefixes the message with the user's nick and sends it to the channel. T...
python
{ "resource": "" }
q47391
Client.join
train
def join(self, target, key=None): """Attempt to join a channel. The optional second argument is the channel key, if needed. """ chantypes = self.server.features.get("CHANTYPES", "#") if not target or target[0] not in chantypes: # Among other things, this prevents acc...
python
{ "resource": "" }
q47392
Client.part
train
def part(self, target, message=None): """Part a channel.""" if not self.server.in_channel(target): _log.warning("Ignoring request to part channel '%s' because we " "are not in that channel.", target) return return False self.send("PART...
python
{ "resource": "" }
q47393
Client.kick
train
def kick(self, channel, nick, message=None): """Attempt to kick a user from a channel. If a message is not provided, defaults to own nick. """ self.send("KICK", channel, nick, ":%s" % (message or self.user.nick))
python
{ "resource": "" }
q47394
Client.handle
train
def handle(self, event): """Decorator for adding a handler function for a particular event. Usage: my_client = Client() @my_client.handle("WELCOME") def welcome_handler(client, *params): # Do something with the event. pass ""...
python
{ "resource": "" }
q47395
Client._get_prefixes
train
def _get_prefixes(self): """Get the possible nick prefixes and associated modes for a client.""" prefixes = { "@": "o", "+": "v", } feature_prefixes = self.server.features.get('PREFIX') if feature_prefixes: modes = feature_prefixes[1:len(featur...
python
{ "resource": "" }
q47396
get_asset_content_mdata
train
def get_asset_content_mdata(): """Return default mdata map for AssetContent""" return { 'url': { 'element_label': { 'text': 'url', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTy...
python
{ "resource": "" }
q47397
get_composition_mdata
train
def get_composition_mdata(): """Return default mdata map for Composition""" return { 'children': { 'element_label': { 'text': 'children', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'f...
python
{ "resource": "" }
q47398
AssessmentPartSearchSession.get_assessment_parts_by_search
train
def get_assessment_parts_by_search(self, assessment_part_query, assessment_part_search): """Pass through to provider AssessmentPartSearchSession.get_assessment_parts_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template ...
python
{ "resource": "" }
q47399
SequenceRuleSearchSession.get_sequence_rules_by_search
train
def get_sequence_rules_by_search(self, sequence_rule_query, sequence_rule_search): """Pass through to provider SequenceRuleSearchSession.get_sequence_rules_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not ...
python
{ "resource": "" }