Returns the qtype information to attach to question element
331048
protected function define_question_plugin_structure() {

        // Define the virtual plugin element with the condition to fulfill.
        // Note: we use $this->pluginname so for extended plugins this will work
        // automatically: calculatedsimple and calculatedmulti.
        $plugin = $this->get_plugin_element(null, '../../qtype', $this->pluginname);

        // Create one standard named plugin element (the visible container).
        $pluginwrapper = new backup_nested_element($this->get_recommended_name());

        // Connect the visible container ASAP.
        $plugin->add_child($pluginwrapper);

        // This qtype uses standard question_answers, add them here
        // to the tree before any other information that will use them.
        $this->add_question_question_answers($pluginwrapper);

        // This qtype uses standard numerical units, add them here.
        $this->add_question_numerical_units($pluginwrapper);

        // This qtype uses standard numerical options, add them here.
        $this->add_question_numerical_options($pluginwrapper);

        // This qtype uses standard datasets, add them here.
        $this->add_question_datasets($pluginwrapper);

        // Now create the qtype own structures.
        $calculatedrecords = new backup_nested_element('calculated_records');
        $calculatedrecord = new backup_nested_element('calculated_record', array('id'), array(
            'answer', 'tolerance', 'tolerancetype', 'correctanswerlength',
            'correctanswerformat'));

        $calculatedoptions = new backup_nested_element('calculated_options');
        $calculatedoption = new backup_nested_element('calculated_option', array('id'), array(
            'synchronize', 'single', 'shuffleanswers', 'correctfeedback',
            'correctfeedbackformat', 'partiallycorrectfeedback', 'partiallycorrectfeedbackformat',
            'incorrectfeedback', 'incorrectfeedbackformat', 'answernumbering'));

        // Now the own qtype tree.
        $pluginwrapper->add_child($calculatedrecords);
        $calculatedrecords->add_child($calculatedrecord);

        $pluginwrapper->add_child($calculatedoptions);
        $calculatedoptions->add_child($calculatedoption);

        // Set source to populate the data.
        $calculatedrecord->set_source_table('question_calculated',
                array('question' => backup::VAR_PARENTID));
        $calculatedoption->set_source_table('question_calculated_options',
                array('question' => backup::VAR_PARENTID));

        // Don't need to annotate ids nor files.

        return $plugin;
    }
608328
def answers(self):
        
        from .question import Question
        from .answer import Answer

        if self.url is None or self.answer_num == 0:
            return
        for page_index in range(1, (self.answer_num - 1) // 20 + 2):
            html = self._session.get(
                self.url + 'answers?page=' + str(page_index)).text
            soup = BeautifulSoup(html)
            questions = soup.find_all('a', class_='question_link')
            upvotes = soup.find_all('a', class_='zm-item-vote-count')
            for q, upvote in zip(questions, upvotes):
                answer_url = Zhihu_URL + q['href']
                question_url = Zhihu_URL + re_a2q.match(q['href']).group(1)
                question_title = q.text
                upvote_num = upvote.text
                if upvote_num.isdigit():
                    upvote_num = int(upvote_num)
                else:
                    upvote_num = None
                question = Question(question_url, question_title,
                                    session=self._session)
                yield Answer(answer_url, question, self, upvote_num,
                             session=self._session)
877690
private void fillWizardPageWithSelectedTypes() {
		final StructuredSelection selection = getSelectedItems();
		if (selection == null) {
			return;
		}
		for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) {
			final Object obj = iter.next();
			if (obj instanceof TypeNameMatch) {
				accessedHistoryItem(obj);
				final TypeNameMatch type = (TypeNameMatch) obj;
				final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType());
				final String message;

				if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) {
					message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2,
							TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
				} else {
					message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3,
							TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
				}
				updateStatus(new StatusInfo(IStatus.INFO, message));
			}
		}
	}
231768
def get_type_description(self, _type, suffix='', *args, **kwargs):
        
        if not SchemaObjects.contains(_type):
            return _type
        schema = SchemaObjects.get(_type)
        if schema.all_of:
            models = ','.join(
                (self.get_type_description(_type, *args, **kwargs) for _type in schema.all_of)
            )
            result = '{}'.format(models.split(',')[0])
            for r in models.split(',')[1:]:
                result += ' extended {}'.format(r)
        elif schema.is_array:
            result = 'array of {}'.format(
                self.get_type_description(schema.item['type'], *args, **kwargs))
        else:
            result = ':ref:`{} <{}{}>`'.format(schema.name, schema.schema_id, suffix)
        return result
624842
private static void attachJSDocInfoToNominalTypeOrShape(
      ObjectType objType, JSDocInfo docInfo, @Nullable String qName) {

    if (objType.isConstructor() || objType.isInterface()) {
      if (!isReferenceNameOf(objType, qName)) {
        return;
      }

      objType.setJSDocInfo(docInfo);
      JSType.toMaybeFunctionType(objType).getInstanceType().setJSDocInfo(docInfo);
    } else if (objType.isEnumType()) {
      // Given: `/** @enum {number} */ MyEnum = { FOO: 0 };`
      // Then: typeOf(MyEnum).referenceName() == "enum{MyEnum}"
      // Then: typeOf(MyEnum.FOO).referenceName() == "MyEnum"
      ObjectType elementType = objType.toMaybeEnumType().getElementsType();
      if (!isReferenceNameOf(elementType, qName)) {
        return;
      }

      objType.setJSDocInfo(docInfo);
      elementType.setJSDocInfo(docInfo);
    } else if (!objType.isNativeObjectType() && objType.isFunctionType()) {
      // Anonymous function types identified by their parameter and return types. Remember there can
      // be many unique but equal instances.
      objType.setJSDocInfo(docInfo);
    }
  }
364681
def _get_question(self, qcount):
        """"""

        if self.updating and qcount > 1:
            raise dns.exception.FormError

        for i in xrange(0, qcount):
            (qname, used) = dns.name.from_wire(self.wire, self.current)
            if not self.message.origin is None:
                qname = qname.relativize(self.message.origin)
            self.current = self.current + used
            (rdtype, rdclass) = \
                     struct.unpack('!HH',
                                   self.wire[self.current:self.current + 4])
            self.current = self.current + 4
            self.message.find_rrset(self.message.question, qname,
                                    rdclass, rdtype, create=True,
                                    force_unique=True)
            if self.updating:
                self.zone_rdclass = rdclass
671383
function getJsxElementAttributesType(node) {
            var links = getNodeLinks(node);
            if (!links.resolvedJsxType) {
                if (isJsxIntrinsicIdentifier(node.tagName)) {
                    var symbol = getIntrinsicTagSymbol(node);
                    if (links.jsxFlags & 1 /* IntrinsicNamedElement */) {
                        return links.resolvedJsxType = getTypeOfSymbol(symbol);
                    }
                    else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {
                        return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type;
                    }
                    else {
                        return links.resolvedJsxType = unknownType;
                    }
                }
                else {
                    var elemClassType = getJsxGlobalElementClassType();
                    return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType);
                }
            }
            return links.resolvedJsxType;
        }
634322
def getCheckedDetails(self):
        
        attrs = {}
        layout = self.layout()
        for i in range(layout.count()):
            w = layout.itemAt(i).widget()
            attrs[w.stimType] = w.getChecked()
        return attrs
647365
public String getQuestion() {
    if (InputElement_Type.featOkTst && ((InputElement_Type)jcasType).casFeat_question == null)
      jcasType.jcas.throwFeatMissing("question", "edu.cmu.lti.oaqa.framework.types.InputElement");
    return jcasType.ll_cas.ll_getStringValue(addr, ((InputElement_Type)jcasType).casFeatCode_question);}
666738
def parse_qtype(self, param_type, param_value):
        ''''''
        if param_type == 'quniform':
            return self._parse_quniform(param_value)
        if param_type == 'qloguniform':
            param_value[:2] = np.log(param_value[:2])
            return list(np.exp(self._parse_quniform(param_value)))

        raise RuntimeError("Not supported type: %s" % param_type)
1157611
function(_element,_type,_handler,_capture){
        var _result = {};
        // check element
        _element = _e._$get(_element);
        if (!_element){
            return null;
        }
        _e._$id(_element);
        _result.element = _element;
        // check event handler
        if (!_u._$isFunction(_handler)){
            return null;
        }
        _result.handler = _handler;
        // check type
        var _type = _getTypeList(_type);
        if (!_type){
            return null;
        }
        // save info
        _result.type = _type;
        _result.capture = !!_capture;
        return _result;
    }
216129
def checktype(self, elt, ps):
        '''
        '''
        typeName = _find_type(elt)
        if typeName is None or typeName == "":
            return (None,None)

        # Parse the QNAME.
        prefix,typeName = SplitQName(typeName)
        uri = ps.GetElementNSdict(elt).get(prefix)
        if uri is None:
            raise EvaluateException('Malformed type attribute (bad NS)',
                    ps.Backtrace(elt))

        #typeName = list[1]
        parselist,errorlist = self.get_parse_and_errorlist()
        if not parselist or \
        (uri,typeName) in parselist or \
        (_is_xsd_or_soap_ns(uri) and (None,typeName) in parselist):
            return (uri,typeName)
        raise EvaluateException(
                'Type mismatch (%s namespace) (got %s wanted %s)' % \
                (uri, typeName, errorlist), ps.Backtrace(elt))
425027
function() {
    var c=[], ce=this.childElements, celts=this.ctlElements, eltType;
    if (ce && ce.length) {
      for (var i=0, sz=ce.length;sz>i;i++) {
        eltType=celts[ce[i].name].type;
        if (eltType==="component") {
          c.push(ce[i].controller);
        } else if (eltType==="template") {
          c.push(ce[i]);
        } else {
          log.error(this+" Invalid element type: "+eltType);
        }
      }
    }
    return c.length>0? c : null;
  }
897275
def get_type_data(self, name):
        """"""
        try:
            return {
                'authority': 'DLKIT',
                'namespace': 'relationship.Relationship',
                'identifier': name.lower(),
                'domain': 'Generic Types',
                'display_name': name.title() + ' Type',
                'display_label': name.title(),
                'description': ('The ' + name.title() + ' Type.')
            }
        except IndexError:
            raise NotFound('RelationshipType: ' + name.title())
50269
private List<Element> findQuestionAnswers(Element questionnaireResponse, String question) {
		 List<Element> retVal = new ArrayList<>();

		 List<Element> items = questionnaireResponse.getChildren(ITEM_ELEMENT);
		 for (Element next : items) {
		 	if (hasLinkId(next, question)) {
				List<Element> answers = extractAnswer(next);
				retVal.addAll(answers);
			}
			retVal.addAll(findQuestionAnswers(next, question));
		 }

		 return retVal;
    }
56424
private static function question_structure() {
        return new external_single_structure(
            array(
                'slot' => new external_value(PARAM_INT, 'slot number'),
                'type' => new external_value(PARAM_ALPHANUMEXT, 'question type, i.e: multichoice'),
                'page' => new external_value(PARAM_INT, 'page of the quiz this question appears on'),
                'html' => new external_value(PARAM_RAW, 'the question rendered'),
                'sequencecheck' => new external_value(PARAM_INT, 'the number of real steps in this attempt', VALUE_OPTIONAL),
                'lastactiontime' => new external_value(PARAM_INT, 'the timestamp of the most recent step in this question attempt',
                                                        VALUE_OPTIONAL),
                'hasautosavedstep' => new external_value(PARAM_BOOL, 'whether this question attempt has autosaved data',
                                                            VALUE_OPTIONAL),
                'flagged' => new external_value(PARAM_BOOL, 'whether the question is flagged or not'),
                'number' => new external_value(PARAM_INT, 'question ordering number in the quiz', VALUE_OPTIONAL),
                'state' => new external_value(PARAM_ALPHA, 'the state where the question is in.
                    It will not be returned if the user cannot see it due to the quiz display correctness settings.',
                    VALUE_OPTIONAL),
                'status' => new external_value(PARAM_RAW, 'current formatted state of the question', VALUE_OPTIONAL),
                'blockedbyprevious' => new external_value(PARAM_BOOL, 'whether the question is blocked by the previous question',
                    VALUE_OPTIONAL),
                'mark' => new external_value(PARAM_RAW, 'the mark awarded.
                    It will be returned only if the user is allowed to see it.', VALUE_OPTIONAL),
                'maxmark' => new external_value(PARAM_FLOAT, 'the maximum mark possible for this question attempt.
                    It will be returned only if the user is allowed to see it.', VALUE_OPTIONAL),
            ),
            'The question data. Some fields may not be returned depending on the quiz display settings.'
        );
    }
672883
private void qrBinary(int[] datastream, int version, int target_binlen, QrMode[] inputMode, int[] inputData, boolean gs1, int eciMode, int est_binlen) {

        // TODO: make encodeInfo a StringBuilder, make this method static?

        int position = 0;
        int short_data_block_length, i;
        int padbits;
        int current_binlen, current_bytes;
        int toggle;
        QrMode data_block;

        StringBuilder binary = new StringBuilder(est_binlen + 12);

        if (gs1) {
            binary.append("0101"); /* FNC1 */
        }

        if (eciMode != 3) {
            binary.append("0111"); /* ECI (Table 4) */
            if (eciMode <= 127) {
                binaryAppend(eciMode, 8, binary); /* 000000 to 000127 */
            } else if (eciMode <= 16383) {
                binaryAppend(0x8000 + eciMode, 16, binary); /* 000000 to 016383 */
            } else {
                binaryAppend(0xC00000 + eciMode, 24, binary); /* 000000 to 999999 */
            }
        }

        encodeInfo += "Encoding: ";

        do {
            data_block = inputMode[position];
            short_data_block_length = 0;
            do {
                short_data_block_length++;
            } while (((short_data_block_length + position) < inputMode.length)
                    && (inputMode[position + short_data_block_length] == data_block));

            switch (data_block) {

                case KANJI:
                    /* Kanji mode */
                    /* Mode indicator */
                    binary.append("1000");

                    /* Character count indicator */
                    binaryAppend(short_data_block_length, tribus(version, 8, 10, 12), binary);

                    encodeInfo += "KNJI ";

                    /* Character representation */
                    for (i = 0; i < short_data_block_length; i++) {
                        int jis = inputData[position + i];
                        if (jis >= 0x8140 && jis <= 0x9ffc) {
                            jis -= 0x8140;
                        } else if (jis >= 0xe040 && jis <= 0xebbf) {
                            jis -= 0xc140;
                        }
                        int prod = ((jis >> 8) * 0xc0) + (jis & 0xff);
                        binaryAppend(prod, 13, binary);
                        encodeInfo += Integer.toString(prod) + " ";
                    }

                    break;

                case BINARY:
                    /* Byte mode */
                    /* Mode indicator */
                    binary.append("0100");

                    /* Character count indicator */
                    binaryAppend(short_data_block_length, tribus(version, 8, 16, 16), binary);

                    encodeInfo += "BYTE ";

                    /* Character representation */
                    for (i = 0; i < short_data_block_length; i++) {
                        int b = inputData[position + i];
                        if (b == FNC1) {
                            b = 0x1d; /* FNC1 */
                        }
                        binaryAppend(b, 8, binary);
                        encodeInfo += Integer.toString(b) + " ";
                    }

                    break;

                case ALPHANUM:
                    /* Alphanumeric mode */
                    /* Mode indicator */
                    binary.append("0010");

                    /* If in GS1 mode, expand FNC1 -> '%' and expand '%' -> '%%' in a new array */
                    int percentCount = 0;
                    if (gs1) {
                        for (i = 0; i < short_data_block_length; i++) {
                            if (inputData[position + i] == '%') {
                                percentCount++;
                            }
                        }
                    }
                    int[] inputExpanded = new int[short_data_block_length + percentCount];
                    percentCount = 0;
                    for (i = 0; i < short_data_block_length; i++) {
                        int c = inputData[position + i];
                        if (c == FNC1) {
                            inputExpanded[i + percentCount] = '%'; /* FNC1 */
                        } else {
                            inputExpanded[i + percentCount] = c;
                            if (gs1 && c == '%') {
                                percentCount++;
                                inputExpanded[i + percentCount] = c;
                            }
                        }
                    }

                    /* Character count indicator */
                    binaryAppend(inputExpanded.length, tribus(version, 9, 11, 13), binary);

                    encodeInfo += "ALPH ";

                    /* Character representation */
                    for (i = 0; i + 1 < inputExpanded.length; i += 2) {
                        int first = positionOf((char) inputExpanded[i], RHODIUM);
                        int second = positionOf((char) inputExpanded[i + 1], RHODIUM);
                        int prod = (first * 45) + second;
                        int count = 2;
                        binaryAppend(prod, 1 + (5 * count), binary);
                        encodeInfo += Integer.toString(prod) + " ";
                    }
                    if (inputExpanded.length % 2 != 0) {
                        int first = positionOf((char) inputExpanded[inputExpanded.length - 1], RHODIUM);
                        int prod = first;
                        int count = 1;
                        binaryAppend(prod, 1 + (5 * count), binary);
                        encodeInfo += Integer.toString(prod) + " ";
                    }

                    break;

                case NUMERIC:
                    /* Numeric mode */
                    /* Mode indicator */
                    binary.append("0001");

                    /* Character count indicator */
                    binaryAppend(short_data_block_length, tribus(version, 10, 12, 14), binary);

                    encodeInfo += "NUMB ";

                    /* Character representation */
                    i = 0;
                    while (i < short_data_block_length) {

                        int first = Character.getNumericValue(inputData[position + i]);
                        int count = 1;
                        int prod = first;

                        if (i + 1 < short_data_block_length) {
                            int second = Character.getNumericValue(inputData[position + i + 1]);
                            count = 2;
                            prod = (prod * 10) + second;

                            if (i + 2 < short_data_block_length) {
                                int third = Character.getNumericValue(inputData[position + i + 2]);
                                count = 3;
                                prod = (prod * 10) + third;
                            }
                        }

                        binaryAppend(prod, 1 + (3 * count), binary);

                        encodeInfo += Integer.toString(prod) + " ";

                        i += count;
                    };

                    break;
            }

            position += short_data_block_length;

        } while (position < inputMode.length);

        encodeInfo += "\n";

        /* Terminator */
        binary.append("0000");

        current_binlen = binary.length();
        padbits = 8 - (current_binlen % 8);
        if (padbits == 8) {
            padbits = 0;
        }
        current_bytes = (current_binlen + padbits) / 8;

        /* Padding bits */
        for (i = 0; i < padbits; i++) {
            binary.append('0');
        }

        /* Put data into 8-bit codewords */
        for (i = 0; i < current_bytes; i++) {
            datastream[i] = 0x00;
            for (int p = 0; p < 8; p++) {
                if (binary.charAt((i * 8) + p) == '1') {
                    datastream[i] += (0x80 >> p);
                }
            }
        }

        /* Add pad codewords */
        toggle = 0;
        for (i = current_bytes; i < target_binlen; i++) {
            if (toggle == 0) {
                datastream[i] = 0xec;
                toggle = 1;
            } else {
                datastream[i] = 0x11;
                toggle = 0;
            }
        }

        encodeInfo += "Codewords: ";
        for (i = 0; i < target_binlen; i++) {
            encodeInfo += Integer.toString(datastream[i]) + " ";
        }
        encodeInfo += "\n";
    }