Make a field AST for an edges field.

 field - The GraphQL::Field instance to make the fragment for.

 Returns a GraphQL::Language::Nodes::Field instance.
978484
def edges_field_ast(field)
      f_ast = field_ast(field)
      return nil if f_ast.nil?
      node_fields = [node_field_ast(field.type.unwrap.get_field('node'))]
      if f_ast.respond_to?(:merge) # GraphQL-Ruby 1.9+
        f_ast.merge(selections: f_ast.selections + node_fields)
      else
        f_ast.selections.concat(node_fields)
        f_ast
      end
    end
1289497
function getFieldDefinitionLegacy(
  schema: GraphQLSchema,
  parentType: GraphQLOutputType,
  fieldName: string,
  fieldAST: FieldNode,
): ?GraphQLField<mixed, mixed> {
  let schemaFieldDef = getFieldDefinitionStrict(
    schema,
    parentType,
    fieldName,
    fieldAST,
  );
  if (!schemaFieldDef) {
    const type = getRawType(parentType);
    schemaFieldDef = getFieldDefinitionLegacyImpl(
      schema,
      type,
      fieldName,
      fieldAST,
    );
  }
  return schemaFieldDef || null;
}
316787
async def field(self, elem=None, elem_type=None, params=None):
        
        elem_type = elem_type if elem_type else elem.__class__
        fvalue = None

        src = elem
        if issubclass(elem_type, x.UVarintType):
            fvalue = await self.uvarint(x.get_elem(src))

        elif issubclass(elem_type, x.IntType):
            fvalue = await self.uint(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.BlobType):
            fvalue = await self.blob(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.UnicodeType):
            fvalue = await self.unicode_type(x.get_elem(src))

        elif issubclass(elem_type, x.VariantType):
            fvalue = await self.variant(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.ContainerType):  # container ~ simple list
            fvalue = await self.container(container=x.get_elem(src), container_type=elem_type, params=params)

        elif issubclass(elem_type, x.TupleType):  # tuple ~ simple list
            fvalue = await self.tuple(elem=x.get_elem(src), elem_type=elem_type, params=params)

        elif issubclass(elem_type, x.MessageType):
            fvalue = await self.message(x.get_elem(src), msg_type=elem_type)

        else:
            raise TypeError

        return fvalue if self.writing else x.set_elem(elem, fvalue)
337181
def is_vertex_field_type(graphql_type):
    """"""
    # This will need to change if we ever support complex embedded types or edge field types.
    underlying_type = strip_non_null_from_type(graphql_type)
    return isinstance(underlying_type, (GraphQLInterfaceType, GraphQLObjectType, GraphQLUnionType))
1192322
def _find_conflict(
    context,  # type: ValidationContext
    cached_fields_and_fragment_names,  # type: Dict[SelectionSet, Tuple[Dict[str, List[Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]]], List[str]]]
    compared_fragments,  # type: PairSet
    parent_fields_are_mutually_exclusive,  # type: bool
    response_name,  # type: str
    field1,  # type: Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]
    field2,  # type: Tuple[Union[GraphQLInterfaceType, GraphQLObjectType, None], Field, GraphQLField]
):
    # type: (...) -> Optional[Tuple[Tuple[str, str], List[Node], List[Node]]]
    """"""
    parent_type1, ast1, def1 = field1
    parent_type2, ast2, def2 = field2

    # If it is known that two fields could not possibly apply at the same
    # time, due to the parent types, then it is safe to permit them to diverge
    # in aliased field or arguments used as they will not present any ambiguity
    # by differing.
    # It is known that two parent types could never overlap if they are
    # different Object types. Interface or Union types might overlap - if not
    # in the current state of the schema, then perhaps in some future version,
    # thus may not safely diverge.

    are_mutually_exclusive = parent_fields_are_mutually_exclusive or (
        parent_type1 != parent_type2
        and isinstance(parent_type1, GraphQLObjectType)
        and isinstance(parent_type2, GraphQLObjectType)
    )

    # The return type for each field.
    type1 = def1 and def1.type
    type2 = def2 and def2.type

    if not are_mutually_exclusive:
        # Two aliases must refer to the same field.
        name1 = ast1.name.value
        name2 = ast2.name.value

        if name1 != name2:
            return (
                (response_name, "{} and {} are different fields".format(name1, name2)),
                [ast1],
                [ast2],
            )

        # Two field calls must have the same arguments.
        if not _same_arguments(ast1.arguments, ast2.arguments):
            return ((response_name, "they have differing arguments"), [ast1], [ast2])

    if type1 and type2 and do_types_conflict(type1, type2):
        return (
            (
                response_name,
                "they return conflicting types {} and {}".format(type1, type2),
            ),
            [ast1],
            [ast2],
        )

    #  Collect and compare sub-fields. Use the same "visited fragment names" list
    # for both collections so fields in a fragment reference are never
    # compared to themselves.
    selection_set1 = ast1.selection_set
    selection_set2 = ast2.selection_set

    if selection_set1 and selection_set2:
        conflicts = _find_conflicts_between_sub_selection_sets(  # type: ignore
            context,
            cached_fields_and_fragment_names,
            compared_fragments,
            are_mutually_exclusive,
            get_named_type(type1),  # type: ignore
            selection_set1,
            get_named_type(type2),  # type: ignore
            selection_set2,
        )

        return _subfield_conflicts(conflicts, response_name, ast1, ast2)

    return None
132371
def field(*fields, export_only: false)
      @config.fields += fields.map(&:to_sym)
      @config.fields.uniq!

      if export_only
        @config.export_only_fields += fields.map(&:to_sym)
        @config.export_only_fields.uniq!
      end

      nil
    end
916271
def field_factory(base_class):
    
    from .fields import TranslationField

    class TranslationFieldField(TranslationField, base_class):
        pass

    TranslationFieldField.__name__ = "Translation%s" % base_class.__name__

    return TranslationFieldField
174321
def make_field_objects(field_data, names):
        # type: (List[Dict[Text, Text]], Names) -> List[Field]
        """"""
        field_objects = []
        field_names = []  # type: List[Text]
        for field in field_data:
            if hasattr(field, 'get') and callable(field.get):
                atype = cast(Text, field.get('type'))
                name = cast(Text, field.get('name'))

                # null values can have a default value of None
                has_default = False
                default = None
                if 'default' in field:
                    has_default = True
                    default = field.get('default')

                order = field.get('order')
                doc = field.get('doc')
                other_props = get_other_props(field, FIELD_RESERVED_PROPS)
                new_field = Field(atype, name, has_default, default, order, names, doc,
                                 other_props)
                # make sure field name has not been used yet
                if new_field.name in field_names:
                    fail_msg = 'Field name %s already in use.' % new_field.name
                    raise SchemaParseException(fail_msg)
                field_names.append(new_field.name)
            else:
                raise SchemaParseException('Not a valid field: %s' % field)
            field_objects.append(new_field)
        return field_objects
446177
def get_instance_field(self, field_name):
        
        if not self.has_field(field_name):
            raise AttributeError('"%s" is not a field for the model "%s"' %
                                 (field_name, self.__class__.__name__))

        field = getattr(self, field_name)

        return field
365425
public static Field makeAccessible(Field field) {
        if (field == null) {
            throw new IllegalArgumentException("Method argument field must not be null.");
        }
        if (isInaccessible(field) && !field.isAccessible()) {
            field.setAccessible(true);
        }

        return field;
    }
698909
def _draw_ascii_graph(self, field):
        ''''''
        row_strings = []
        for y in range(len(field[0])):
            row = ''
            for x in range(len(field)):
                row += field[x][y]
            row_strings.insert(0, row)
        graph_string = '\n'.join(row_strings)
        return graph_string
780034
public ASTField getField(Field field) {
        ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers());

        return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field));
    }
395941
def build_parameter(field: Field) -> Mapping[str, Any]:
    
    builder = Parameters()
    return builder.build(field)
645869
def iterfields(klass):
    
    is_field = lambda x: isinstance(x, TypedField)

    for name, field in inspect.getmembers(klass, predicate=is_field):
        yield name, field
1252000
def create_ogr_field_from_definition(field_definition):
    
    if isinstance(field_definition['type'], list):
        # Use the first element in the list of type
        field_type = field_definition['type'][0]
    else:
        field_type = field_definition['type']

    # Conversion to OGR field
    field_type = field_type_converter.get(field_type, ogr.OFTString)

    return ogr.FieldDefn(field_definition['field_name'], field_type)
1304891
def get_field_def(
    schema: GraphQLSchema, parent_type: GraphQLType, field_node: FieldNode
) -> Optional[GraphQLField]:
    
    name = field_node.name.value
    if name == "__schema" and schema.query_type is parent_type:
        return SchemaMetaFieldDef
    if name == "__type" and schema.query_type is parent_type:
        return TypeMetaFieldDef
    if name == "__typename" and is_composite_type(parent_type):
        return TypeNameMetaFieldDef
    if is_object_type(parent_type) or is_interface_type(parent_type):
        parent_type = cast(Union[GraphQLObjectType, GraphQLInterfaceType], parent_type)
        return parent_type.fields.get(name)
    return None
1005656
def relative_field(field, parent):
    
    if parent==".":
        return field

    field_path = split_field(field)
    parent_path = split_field(parent)
    common = 0
    for f, p in _builtin_zip(field_path, parent_path):
        if f != p:
            break
        common += 1

    if len(parent_path) == common:
        return join_field(field_path[common:])
    else:
        dots = "." * (len(parent_path) - common)
        return dots + "." + join_field(field_path[common:])