createFilled=false always creates an empty linguistic details object, otherwise generate it or use the cache
511122
function createQueryLinguisticDetails(compositionAlternatives, compositionStartOffset, compositionLength, queryTextPrefix, queryTextSuffix) {
                        var linguisticDetails = null;

                        // The linguistic alternatives we receive are only for the composition string being composed. We need to provide the linguistic alternatives
                        // in the form of the full query text with alternatives embedded.
                        var fullCompositionAlternatives = [];
                        for (var i = 0; i < compositionAlternatives.length; i++) {
                            fullCompositionAlternatives[i] = queryTextPrefix + compositionAlternatives[i] + queryTextSuffix;
                        }

                        if (_WinRT.Windows.ApplicationModel.Search.SearchQueryLinguisticDetails) {
                            try {
                                linguisticDetails = new _WinRT.Windows.ApplicationModel.Search.SearchQueryLinguisticDetails(fullCompositionAlternatives, compositionStartOffset, compositionLength);
                            } catch (e) {
                                // WP10 currently exposes SQLD API but throws on instantiation.
                            }
                        }

                        if (!linguisticDetails) {
                            // If we're in web compartment, create a script version of the WinRT SearchQueryLinguisticDetails object
                            linguisticDetails = {
                                queryTextAlternatives: fullCompositionAlternatives,
                                queryTextCompositionStart: compositionStartOffset,
                                queryTextCompositionLength: compositionLength
                            };
                        }
                        return linguisticDetails;
                    }
746435
def fill_translation_cache(instance):
    

    if hasattr(instance, '_translation_cache'):
        # do not refill the cache
        return
    instance._translation_cache = {}

    # unsafed instances cannot have translations
    if not instance.pk:
        return

    for language_code in get_language_code_list():
        # see if translation for language_code was in the query
        field_alias = get_translated_field_alias('code', language_code)
        if getattr(instance, field_alias, None) is not None:
            field_names = [f.attname for f in instance._meta.translation_model._meta.fields]

            # if so, create a translation object and put it in the cache
            field_data = {}
            for fname in field_names:
                field_data[fname] = getattr(instance,
                                            get_translated_field_alias(fname, language_code))

            translation = instance._meta.translation_model(**field_data)
            instance._translation_cache[language_code] = translation

    # In some situations an (existing in the DB) object is loaded
    # without using the normal QuerySet.  In such case fallback to
    # loading the translations using a separate query.

    # Unfortunately, this is indistinguishable from the situation when
    # an object does not have any translations.  Oh well, we'll have
    # to live with this for the time being.
    if len(instance._translation_cache.keys()) == 0:
        for translation in instance.translations.all():
            instance._translation_cache[translation.language_code] = translation
606495
private function _fill()
    {

        if (empty($this->db)) return false;

        $sql = (string)"SHOW VARIABLES";
        $res = $this->db->query((string)$sql);

        if (!$res) return false;

        $data = $this->db->fetch_assoc_list($res);
        if (!empty($data)) {
            foreach ($data as $variable) {
                $this->$variable[(string)'Variable_name'] = (string)$variable['Value'];
            }
            $this->db->free($res);
        }

        // clear all the unecessary variables and the endles recursion of the db
        unset($this->db, $data, $variable);

        return true;
    }
55864
def create(contents, params = {:language => "Plain Text", :private => false})
      params = params.merge({:contents => contents}.merge(@base_params))
      self.class.post("/paste", :body => params).parsed_response
    end
812527
def _write(self, _new=False):
        
        pipeline = self.db.pipeline()
        self._create_membership(pipeline)
        self._update_indices(pipeline)
        h = {}
        # attributes
        for k, v in self.attributes.iteritems():
            if isinstance(v, DateTimeField):
                if v.auto_now:
                    setattr(self, k, datetime.now())
                if v.auto_now_add and _new:
                    setattr(self, k, datetime.now())
            elif isinstance(v, DateField):
                if v.auto_now:
                    setattr(self, k, date.today())
                if v.auto_now_add and _new:
                    setattr(self, k, date.today())
            for_storage = getattr(self, k)
            if for_storage is not None:
                h[k] = v.typecast_for_storage(for_storage)
        # indices
        for index in self.indices:
            if index not in self.lists and index not in self.attributes:
                v = getattr(self, index)
                if callable(v):
                    v = v()
                if v:
                    try:
                        h[index] = unicode(v)
                    except UnicodeError:
                        h[index] = unicode(v.decode('utf-8'))
        pipeline.delete(self.key())
        if h:
            pipeline.hmset(self.key(), h)

        # lists
        for k, v in self.lists.iteritems():
            l = List(self.key()[k], pipeline=pipeline)
            l.clear()
            values = getattr(self, k)
            if values:
                if v._redisco_model:
                    l.extend([item.id for item in values])
                else:
                    l.extend(values)
        pipeline.execute()
625192
def init_cache():
    '''
    
    '''
    cache_obj = json.loads("{}")
    try:
        with open(CACHE_NAME, 'r') as cache_file:
            try:
                cache_obj = json.load(cache_file)
            except ValueError:
                print("The cache file seems to be empty, starting with flushed cache")
    except IOError:
        print("The cache file seems to be empty, starting with flushed cache")

    print("Loaded JSON cache")

    return cache_obj
440602
def _ctx_get_or_create(self, key, creation_function, context, **kw):
        """"""

        if not self.template.cache_enabled:
            return creation_function()

        return self.impl.get_or_create(
            key,
            creation_function,
            **self._get_cache_kw(kw, context))
1208671
function checkFillingChar( element ) {
		var fillingChar = getFillingChar( element );
		if ( fillingChar ) {
			// Use this flag to avoid removing the filling char right after
			// creating it.
			if ( fillingChar.getCustomData( 'ready' ) )
				removeFillingChar( element );
			else
				fillingChar.setCustomData( 'ready', 1 );
		}
	}
91997
def fill(self, data, dialect):
        

        csvfile = cStringIO.StringIO()
        csvwriter = csv.writer(csvfile, dialect=dialect)

        for i, line in enumerate(data):
            csvwriter.writerow(list(encode_gen(line)))
            if i >= self.preview_lines:
                break

        preview = csvfile.getvalue()
        csvfile.close()
        preview = preview.decode("utf-8").replace("\r\n", "\n")
        self.SetValue(preview)
978642
protected function fillEncodingsOnce()
    {
        if ($this->filled) {
            return;
        }

        foreach ($this->loadEncodings() as $encoding) {
            $encoding = strtoupper($encoding);
            $this->encodings[] = $encoding;
            $this->encodingLookup[$encoding] = true;
        }

        $this->filled = true;
    }
962799
def new(self, filename, encoding, text, default_content=False,
            empty=False):
        
        finfo = self.create_new_editor(filename, encoding, text,
                                       set_current=False, new=True)
        finfo.editor.set_cursor_position('eof')
        if not empty:
            finfo.editor.insert_text(os.linesep)
        if default_content:
            finfo.default = True
            finfo.editor.document().setModified(False)
        return finfo
347177
def __set_cache(self, tokens):
        

        if DefaultCompleter._DefaultCompleter__tokens.get(self.__language):
            return

        DefaultCompleter._DefaultCompleter__tokens[self.__language] = tokens
384435
def p_save_data(p):
    
    if p[2].type_ != TYPE.string:
        api.errmsg.syntax_error_expected_string(p.lineno(1), p[2].type_)

    if len(p) != 4:
        entry = SYMBOL_TABLE.access_id(p[4], p.lineno(4))
        if entry is None:
            p[0] = None
            return

        entry.accessed = True
        access = entry
        start = make_unary(p.lineno(4), 'ADDRESS', access, type_=TYPE.uinteger)

        if entry.class_ == CLASS.array:
            length = make_number(entry.memsize, lineno=p.lineno(4))
        else:
            length = make_number(entry.type_.size, lineno=p.lineno(4))
    else:
        access = SYMBOL_TABLE.access_id('.ZXBASIC_USER_DATA', p.lineno(3))
        start = make_unary(p.lineno(3), 'ADDRESS', access, type_=TYPE.uinteger)

        access = SYMBOL_TABLE.access_id('.ZXBASIC_USER_DATA_LEN', p.lineno(3))
        length = make_unary(p.lineno(3), 'ADDRESS', access, type_=TYPE.uinteger)

    p[0] = make_sentence(p[1], p[2], start, length)
1202354
def cmd_create(args):
    
    if args.type == SQLITE:
        if args.output is not None and path.exists(args.output):
            remove(args.output)
        storage = SqliteStorage(db=args.output, settings=args.settings)
    else:
        storage = JsonStorage(settings=args.settings)
    markov = MarkovText.from_storage(storage)
    read(args.input, markov, args.progress)
    save(markov, args.output, args)
580735
def create(spellchecker_cache_path):
    """"""
    user_dictionary = os.path.join(os.getcwd(), "DICTIONARY")
    user_words = read_dictionary_file(user_dictionary)

    valid_words = Dictionary(valid_words_set(user_dictionary, user_words),
                             "valid_words",
                             [user_dictionary],
                             spellchecker_cache_path)

    return (user_words, valid_words)
197033
function createDiv( editor ) {
			// new adding containers OR detected pre-existed containers.
			var containers = [];
			// node markers store.
			var database = {};
			// All block level elements which contained by the ranges.
			var containedBlocks = [],
				block;

			// Get all ranges from the selection.
			var selection = editor.getSelection(),
				ranges = selection.getRanges();
			var bookmarks = selection.createBookmarks();
			var i, iterator;

			// Calcualte a default block tag if we need to create blocks.
			var blockTag = editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p';

			// collect all included elements from dom-iterator
			for ( i = 0; i < ranges.length; i++ ) {
				iterator = ranges[ i ].createIterator();
				while ( ( block = iterator.getNextParagraph() ) ) {
					// include contents of blockLimit elements.
					if ( block.getName() in divLimitDefinition && !block.isReadOnly() ) {
						var j,
							childNodes = block.getChildren();
						for ( j = 0; j < childNodes.count(); j++ )
							addSafely( containedBlocks, childNodes.getItem( j ), database );
					} else {
						while ( !dtd[ block.getName() ] && !block.equals( ranges[ i ].root ) )
							block = block.getParent();
						addSafely( containedBlocks, block, database );
					}
				}
			}

			CKEDITOR.dom.element.clearAllMarkers( database );

			var blockGroups = groupByDivLimit( containedBlocks );
			var ancestor, blockEl, divElement;

			for ( i = 0; i < blockGroups.length; i++ ) {
				var currentNode = blockGroups[ i ][ 0 ];

				// Calculate the common parent node of all contained elements.
				ancestor = currentNode.getParent();
				for ( j = 1; j < blockGroups[ i ].length; j++ )
					ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] );

				divElement = new CKEDITOR.dom.element( 'div', editor.document );

				// Normalize the blocks in each group to a common parent.
				for ( j = 0; j < blockGroups[ i ].length; j++ ) {
					currentNode = blockGroups[ i ][ j ];

					while ( !currentNode.getParent().equals( ancestor ) )
						currentNode = currentNode.getParent();

					// This could introduce some duplicated elements in array.
					blockGroups[ i ][ j ] = currentNode;
				}

				// Wrapped blocks counting
				var fixedBlock = null;
				for ( j = 0; j < blockGroups[ i ].length; j++ ) {
					currentNode = blockGroups[ i ][ j ];

					// Avoid DUP elements introduced by grouping.
					if ( !( currentNode.getCustomData && currentNode.getCustomData( 'block_processed' ) ) ) {
						currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true );

						// Establish new container, wrapping all elements in this group.
						if ( !j )
							divElement.insertBefore( currentNode );

						divElement.append( currentNode );
					}
				}

				CKEDITOR.dom.element.clearAllMarkers( database );
				containers.push( divElement );
			}

			selection.selectBookmarks( bookmarks );
			return containers;
		}
555345
function createCompleted( ) {
    if( !isset( $this->completed['value']['year'] )  &&
        !isset( $this->completed['value']['month'] ) &&
        !isset( $this->completed['value']['day'] )   &&
        !isset( $this->completed['value']['hour'] )  &&
        !isset( $this->completed['value']['min'] )   &&
        !isset( $this->completed['value']['sec'] ))
      return;
    $formatted  = $this->_format_date_time( $this->completed['value'], 7 );
    $attributes = $this->_createParams( $this->completed['params'] );
    return $this->_createElement( 'COMPLETED', $attributes, $formatted );
  }