Creates a GraphQLDocument object from compiled code and the globals.  This
        is used by the loaders and schema to create a document object.
10956
def from_code(
        cls,
        schema,  # type: GraphQLSchema
        code,  # type: Union[str, Any]
        uptodate=None,  # type: Optional[bool]
        extra_namespace=None,  # type: Optional[Dict[str, Any]]
    ):
        # type: (...) -> GraphQLCompiledDocument
        
        if isinstance(code, string_types):
            filename = "<document>"
            code = compile(code, filename, "exec")
        namespace = {"__file__": code.co_filename}
        exec(code, namespace)
        if extra_namespace:
            namespace.update(extra_namespace)
        rv = cls._from_namespace(schema, namespace)
        # rv._uptodate = uptodate
        return rv
421921
public function fromGoogle(GoogleDocument $obj_source, array $arr_expressions = null)
    {
        $obj_schema = new Schema();
        $obj_doc = new Document($obj_schema);
        $obj_doc->setId($obj_source->getId());
        foreach($obj_source->getFieldList() as $obj_field) {
            /** @var Field $obj_field */
            $str_field_name = $obj_field->getName();
            $obj_value = $obj_field->getValue();
            if(ContentType::GEO === $obj_value->getType()) {
                $obj_schema->addGeopoint($str_field_name);
                $obj_geo = $obj_value->getGeo();
                $obj_doc->{$str_field_name} = [$obj_geo->getLat(), $obj_geo->getLng()];
            } else {
                if(isset(self::$arr_types_rev[$obj_value->getType()])) {
                    $obj_schema->addField($str_field_name, self::$arr_types_rev[$obj_value->getType()]);
                    $obj_doc->{$str_field_name} = $obj_value->getStringValue();
                } else {
                    throw new \InvalidArgumentException('Unknown type mapping from Google Document');
                }
            }
        }
        if(null !== $arr_expressions) {
            $this->mapExpressions($arr_expressions, $obj_doc);
        }
        return $obj_doc;
    }
5571
def codegen(lang,             # type: str
            i,                # type: List[Dict[Text, Any]]
            schema_metadata,  # type: Dict[Text, Any]
            loader            # type: Loader
           ):  # type: (...) -> None
    """"""

    j = schema.extend_and_specialize(i, loader)

    gen = None  # type: Optional[CodeGenBase]
    if lang == "python":
        gen = PythonCodeGen(sys.stdout)
    elif lang == "java":
        gen = JavaCodeGen(schema_metadata.get("$base", schema_metadata.get("id")))
    else:
        raise Exception("Unsupported code generation language '%s'" % lang)
    assert gen is not None

    gen.prologue()

    document_roots = []

    for rec in j:
        if rec["type"] in ("enum", "record"):
            gen.type_loader(rec)
            gen.add_vocab(shortname(rec["name"]), rec["name"])

    for rec in j:
        if rec["type"] == "enum":
            for symbol in rec["symbols"]:
                gen.add_vocab(shortname(symbol), symbol)

        if rec["type"] == "record":
            if rec.get("documentRoot"):
                document_roots.append(rec["name"])

            field_names = []
            for field in rec.get("fields", []):
                field_names.append(shortname(field["name"]))

            idfield = ""
            for field in rec.get("fields", []):
                if field.get("jsonldPredicate") == "@id":
                    idfield = field.get("name")

            gen.begin_class(rec["name"], aslist(rec.get("extends", [])), rec.get("doc", ""),
                            rec.get("abstract", False), field_names, idfield)
            gen.add_vocab(shortname(rec["name"]), rec["name"])

            for field in rec.get("fields", []):
                if field.get("jsonldPredicate") == "@id":
                    fieldpred = field["name"]
                    optional = bool("https://w3id.org/cwl/salad#null" in field["type"])
                    uri_loader = gen.uri_loader(gen.type_loader(field["type"]), True, False, None)
                    gen.declare_id_field(fieldpred, uri_loader, field.get("doc"), optional)
                    break

            for field in rec.get("fields", []):
                optional = bool("https://w3id.org/cwl/salad#null" in field["type"])
                type_loader = gen.type_loader(field["type"])
                jld = field.get("jsonldPredicate")
                fieldpred = field["name"]
                if isinstance(jld, MutableMapping):
                    ref_scope = jld.get("refScope")

                    if jld.get("typeDSL"):
                        type_loader = gen.typedsl_loader(type_loader, ref_scope)
                    elif jld.get("_type") == "@id":
                        type_loader = gen.uri_loader(type_loader, jld.get("identity", False),
                                                     False, ref_scope)
                    elif jld.get("_type") == "@vocab":
                        type_loader = gen.uri_loader(type_loader, False, True, ref_scope)

                    map_subject = jld.get("mapSubject")
                    if map_subject:
                        type_loader = gen.idmap_loader(
                            field["name"], type_loader, map_subject, jld.get("mapPredicate"))

                    if "_id" in jld and jld["_id"][0] != "@":
                        fieldpred = jld["_id"]

                if jld == "@id":
                    continue

                gen.declare_field(fieldpred, type_loader, field.get("doc"), optional)

            gen.end_class(rec["name"], field_names)

    root_type = list(document_roots)
    root_type.append({
        "type": "array",
        "items": document_roots
    })

    gen.epilogue(gen.type_loader(root_type))
1344000
function createDocument(args) {
  const { browser } = args;

  const features = {
    FetchExternalResources:   [],
    ProcessExternalResources: [],
    MutationEvents:           '2.0'
  };

  const window  = new Window({
    parsingMode:  'html',
    contentType:  'text/html',
    url:          args.url,
    referrer:     args.referrer
  });

  const { document } = window;
  const documentImpl = idlUtils.implForWrapper(document)

  if (args.browser.hasFeature('scripts', true)) {
    features.FetchExternalResources.push('script');
    features.ProcessExternalResources.push('script');
    window._runScripts = 'dangerously';
  }
  if (args.browser.hasFeature('css', false)) {
    features.FetchExternalResources.push('css');
    features.FetchExternalResources.push('link');
  }
  if (args.browser.hasFeature('img', false))
    features.FetchExternalResources.push('img');
  if (args.browser.hasFeature('iframe', true))
    features.FetchExternalResources.push('iframe');


  browserFeatures.applyDocumentFeatures(documentImpl, features);
  setupWindow(window, args);

  // Give event handler chance to register listeners.
  args.browser.emit('loading', document);
  return document;
}
578723
function generateSVGObject(parent, type) {
  let namespace = parent.namespaceURI;
  let node = namespace ? document.createElementNS(namespace, type)
    : document.createElement(type);
  parent.appendChild(node);
  return node;
}
7433
@NotNull
    public static DocumentBuilder createDocumentBuilder() {
        try {
            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            return factory.newDocumentBuilder();
        } catch (final ParserConfigurationException ex) {
            throw new RuntimeException("Couldn't create document builder", ex);
        }
    }
343352
def write(G):
    
    
    # Document root
    grxml = Document()
    if (type(G) == graph):
        grxmlr = grxml.createElement('graph')
    elif (type(G) == digraph ):
        grxmlr = grxml.createElement('digraph')
    elif (type(G) == hypergraph ):
        return write_hypergraph(G)
    else:
        raise InvalidGraphType
    grxml.appendChild(grxmlr)

    # Each node...
    for each_node in G.nodes():
        node = grxml.createElement('node')
        node.setAttribute('id', str(each_node))
        grxmlr.appendChild(node)
        for each_attr in G.node_attributes(each_node):
            attr = grxml.createElement('attribute')
            attr.setAttribute('attr', each_attr[0])
            attr.setAttribute('value', each_attr[1])
            node.appendChild(attr)

    # Each edge...
    for edge_from, edge_to in G.edges():
        edge = grxml.createElement('edge')
        edge.setAttribute('from', str(edge_from))
        edge.setAttribute('to', str(edge_to))
        edge.setAttribute('wt', str(G.edge_weight((edge_from, edge_to))))
        edge.setAttribute('label', str(G.edge_label((edge_from, edge_to))))
        grxmlr.appendChild(edge)
        for attr_name, attr_value in G.edge_attributes((edge_from, edge_to)):
            attr = grxml.createElement('attribute')
            attr.setAttribute('attr', attr_name)
            attr.setAttribute('value', attr_value)
            edge.appendChild(attr)

    return grxml.toprettyxml()
826103
final Document createDocument(List<String> row, DocumentFactory documentFactory) {
    String id = StringUtils.EMPTY;
    String content = StringUtils.EMPTY;
    Language language = documentFactory.getDefaultLanguage();
    Map<AttributeType, Object> attributeMap = new HashMap<>();

    String idField = Config.get(configProperty, "idField").asString("ID").toUpperCase();
    String contentField = Config.get(configProperty, "contentField").asString("CONTENT").toUpperCase();
    String languageField = Config.get(configProperty, "languageField").asString("LANGUAGE").toUpperCase();
    Index<String> fields = getFieldNames();

    for (int i = 0; i < row.size() && i < fieldNames.size(); i++) {
      String field = row.get(i);
      String fieldName = fields.get(i);
      if (idField.equalsIgnoreCase(fieldName)) {
        id = field;
      } else if (contentField.equalsIgnoreCase(fieldName)) {
        content = field;
      } else if (languageField.equalsIgnoreCase(fieldName)) {
        language = Language.fromString(field);
      } else {
        AttributeType attributeType = AttributeType.create(fieldName);
        attributeMap.put(attributeType, attributeType.getValueType().decode(field));
      }
    }
    return documentFactory.create(id, content, language, attributeMap);
  }
298719
function createSQLiteRecordStream(dbPaths, importPlace) {
  const sqliteStream = combinedStream.create();
  const sqliteStatement = importPlace ?
    SQLiteStream.findGeoJSONByPlacetypeAndWOFId(getPlacetypes(), importPlace) :
    SQLiteStream.findGeoJSONByPlacetype(getPlacetypes());

  dbPaths.forEach((dbPath) => {
    sqliteStream.append( (next) => {
      logger.info( `Loading ${path.basename(dbPath)} database from ${path.dirname(dbPath)}` );
      next(new SQLiteStream(dbPath, sqliteStatement));
    });
  });

  return sqliteStream;
}
312413
function initDocument (docName) {
  return db.getDocument(dbName, docName)
    .then(response => response.data._rev) // document already exists
    .catch(response => {
      if (response.status === 404) {
        // create new document
        return db.createDocument(dbName, {foo: 'bar'}, docName)
          .then(response => response.data.rev)
      } else {
        // real error
        return Promise.reject(response)
      }
    })
}
301836
function serializeDocument (node, context, eventTarget) {
  return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
}
1056544
def create(cls, schema, name):
        
        fn = cls.tags.get(name, XBuiltin)
        return fn(schema, name)
653669
def graphql_impl(
    schema,
    source,
    root_value,
    context_value,
    variable_values,
    operation_name,
    field_resolver,
    type_resolver,
    middleware,
    execution_context_class,
) -> AwaitableOrValue[ExecutionResult]:
    """"""
    # Validate Schema
    schema_validation_errors = validate_schema(schema)
    if schema_validation_errors:
        return ExecutionResult(data=None, errors=schema_validation_errors)

    # Parse
    try:
        document = parse(source)
    except GraphQLError as error:
        return ExecutionResult(data=None, errors=[error])
    except Exception as error:
        error = GraphQLError(str(error), original_error=error)
        return ExecutionResult(data=None, errors=[error])

    # Validate
    from .validation import validate

    validation_errors = validate(schema, document)
    if validation_errors:
        return ExecutionResult(data=None, errors=validation_errors)

    # Execute
    return execute(
        schema,
        document,
        root_value,
        context_value,
        variable_values,
        operation_name,
        field_resolver,
        type_resolver,
        middleware,
        execution_context_class,
    )
772591
private void createSchemaOnDb() {
        StringBuilder sql = new StringBuilder();
        sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name));
        if (this.sqlgGraph.getSqlDialect().needsSemicolon()) {
            sql.append(";");
        }
        if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
        }
        Connection conn = this.sqlgGraph.tx().getConnection();
        try (Statement stmt = conn.createStatement()) {
            stmt.execute(sql.toString());
        } catch (SQLException e) {
            logger.error("schema creation failed " + this.sqlgGraph.toString(), e);
            throw new RuntimeException(e);
        }
    }
1174136
def create_document(doc) #:nodoc:
      http_response = call_server(:method => :post, :uri => "document/#{@database}", \
          :content_type => 'application/json', :data => doc.to_json)
      resp = process_response(http_response) do
        raise DataError, 'validation problem' if http_response.body =~ /OValidationException/
      end

      resp = ::JSON.parse(http_response.body) # workaround: https://groups.google.com/forum/?fromgroups=#!topic/orient-database/UJGAXYpHDmo
      resp.extend Orientdb4r::DocumentMetadata
      resp
    end
416540
def document_from_string(self, schema, request_string):
        # type: (GraphQLSchema, str) -> GraphQLDocument
        """"""
        key = self.get_key_for_schema_and_document_string(schema, request_string)
        if key not in self.cache_map:
            # We return from the fallback
            self.cache_map[key] = self.fallback_backend.document_from_string(
                schema, request_string
            )
            # We ensure the main backend response is in the queue
            self.get_worker().queue(self.queue_backend, key, schema, request_string)

        return self.cache_map[key]
1091198
public static DocumentBuilder createDocumentBuilder()
	{
		try
		{
			DocumentBuilderFactory factory = DOCUMENT_BUILDER_FACTORY.get();

			if (factory == null)
			{
				factory = createDocumentBuilderFactory();

				DOCUMENT_BUILDER_FACTORY = new SoftReference<>(factory);
			}

			return factory.newDocumentBuilder();
		}
		catch (ParserConfigurationException e)
		{
			throw new RuntimeException("Error creating DocumentBuilder: " + e.getMessage(), e);
		}
	}