Return the best GraphQL type representation for an OrientDB property descriptor.
195775
def _property_descriptor_to_graphql_type(property_obj):
    """"""
    property_type = property_obj.type_id
    scalar_types = {
        PROPERTY_TYPE_BOOLEAN_ID: GraphQLBoolean,
        PROPERTY_TYPE_DATE_ID: GraphQLDate,
        PROPERTY_TYPE_DATETIME_ID: GraphQLDateTime,
        PROPERTY_TYPE_DECIMAL_ID: GraphQLDecimal,
        PROPERTY_TYPE_DOUBLE_ID: GraphQLFloat,
        PROPERTY_TYPE_FLOAT_ID: GraphQLFloat,
        PROPERTY_TYPE_INTEGER_ID: GraphQLInt,
        PROPERTY_TYPE_STRING_ID: GraphQLString,
    }

    result = scalar_types.get(property_type, None)
    if result:
        return result

    mapping_types = {
        PROPERTY_TYPE_EMBEDDED_SET_ID: GraphQLList,
        PROPERTY_TYPE_EMBEDDED_LIST_ID: GraphQLList,
    }
    wrapping_type = mapping_types.get(property_type, None)
    if wrapping_type:
        linked_property_obj = property_obj.qualifier
        # There are properties that are embedded collections of non-primitive types,
        # for example, ProxyEventSet.scalar_parameters.
        # The GraphQL compiler does not currently support these.
        if linked_property_obj in scalar_types:
            return wrapping_type(scalar_types[linked_property_obj])

    # We weren't able to represent this property in GraphQL, so we'll hide it instead.
    return None
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
518448
def get_datatype(object_type, propid, vendor_id=0):
    """"""
    if _debug: get_datatype._debug("get_datatype %r %r vendor_id=%r", object_type, propid, vendor_id)

    # get the related class
    cls = get_object_class(object_type, vendor_id)
    if not cls:
        return None

    # get the property
    prop = cls._properties.get(propid)
    if not prop:
        return None

    # return the datatype
    return prop.datatype
1254651
public int getColumnType( int index ) throws OdaException
	{
		//return Types.JAVA_OBJECT;//Any OrientDB field may be NULL
		///*
		String fieldName = getColumnName(index);
		OType fieldType = rowDoc.fieldType(fieldName);
		if (fieldType!=null){
			return typesSqlTypes.get(fieldType);
		}else{
			return Types.VARCHAR;
			//throw new OdaException("Unknown OType of field "+fieldName+" with index "+index);
		}
		//*/
	}
902734
def _create_interface_specification(schema_graph, graphql_types, hidden_classes, cls_name):
    """"""
    def interface_spec():
        """Return a list of GraphQL interface types implemented by the type named 'cls_name'."""
        abstract_inheritance_set = (
            superclass_name
            for superclass_name in sorted(list(schema_graph.get_inheritance_set(cls_name)))
            if (superclass_name not in hidden_classes and
                schema_graph.get_element_by_class_name(superclass_name).abstract)
        )

        return [
            graphql_types[x]
            for x in abstract_inheritance_set
            if x not in hidden_classes
        ]

    return interface_spec
210843
def _get_type_list(self, props):
        """"""
        type_list = []
        for k, v in list(props.items()):
            t = self._get_property_type(v)
            if t is not None:
                type_list.append(t)
        return sorted(type_list)
492856
def __FieldDescriptorFromProperties(self, name, index, attrs):
        """"""
        field = descriptor.FieldDescriptor()
        field.name = self.__names.CleanName(name)
        field.number = index
        field.label = self.__ComputeLabel(attrs)
        new_type_name_hint = self.__names.ClassName(
            '%sValue' % self.__names.ClassName(name))
        type_info = self.__GetTypeInfo(attrs, new_type_name_hint)
        field.type_name = type_info.type_name
        field.variant = type_info.variant
        if 'default' in attrs:
            # TODO(craigcitro): Correctly handle non-primitive default values.
            default = attrs['default']
            if not (field.type_name == 'string' or
                    field.variant == messages.Variant.ENUM):
                default = str(json.loads(default))
            if field.variant == messages.Variant.ENUM:
                default = self.__names.NormalizeEnumName(default)
            field.default_value = default
        extended_field = extended_descriptor.ExtendedFieldDescriptor()
        extended_field.name = field.name
        extended_field.description = util.CleanDescription(
            attrs.get('description', 'A %s attribute.' % field.type_name))
        extended_field.field_descriptor = field
        return extended_field
28081
def is_possible_type(
        self, abstract_type: GraphQLAbstractType, possible_type: GraphQLObjectType
    ) -> bool:
        """"""
        possible_type_map = self._possible_type_map
        try:
            possible_type_names = possible_type_map[abstract_type.name]
        except KeyError:
            possible_types = self.get_possible_types(abstract_type)
            possible_type_names = {type_.name for type_ in possible_types}
            possible_type_map[abstract_type.name] = possible_type_names
        return possible_type.name in possible_type_names
549169
def get_node_type(dgtree):
    """"""
    if is_leaf(dgtree):
        return TreeNodeTypes.leaf_node

    root_label = dgtree.label()
    if root_label == '':
        assert dgtree == DGParentedTree('', []), \
            "The tree has no root label, but isn't empty: {}".format(dgtree)
        return TreeNodeTypes.empty_tree
    elif root_label in NUCLEARITY_LABELS:
        return TreeNodeTypes.nuclearity_node
    else:
        assert isinstance(dgtree, (RSTTree, DGParentedTree)), type(dgtree)
        return TreeNodeTypes.relation_node
843235
public GraphQLObjectType getObjectType(String typeName) {
        GraphQLType graphQLType = typeMap.get(typeName);
        if (graphQLType != null) {
            assertTrue(graphQLType instanceof GraphQLObjectType,
                    format("You have asked for named object type '%s' but its not an object type but rather a '%s'", typeName, graphQLType.getClass().getName()));
        }
        return (GraphQLObjectType) graphQLType;
    }
1226636
private static String getCollectionInnerType(Class<?> type) {
        CQL3Type.Native nativeType = MAP_JAVA_TYPE_TO_CQL_TYPE.get(type);
        return nativeType.name().toLowerCase();
    }
168925
def get_type(t):
    
    if isinstance(t, UserDefinedType):
        if isinstance(t.type, Contract):
            return 'address'
    return str(t)
247316
def graph_hash(obj):
    ''''''
    obj_type = type(obj)
    try:
        # this works for hashables
        return hash((obj_type, obj))
    except:
        # this works for object containers since graphdb
        # wants to identify different containers
        # instead of the sum of their current internals
        return hash((obj_type, id(obj)))
509427
def convert_type type
      return type if type.is_a? GraphQL::BaseType

      unless type.is_a? Symbol
        type = type.to_s.downcase.to_sym
      end

      {
        boolean: GraphQL::BOOLEAN_TYPE,
        date: GraphQL::Types::DATE,
        datetime: GraphQL::Types::ISO8601DateTime,
        decimal: GraphQL::Types::DECIMAL,
        float: GraphQL::FLOAT_TYPE,
        int: GraphQL::INT_TYPE,
        integer: GraphQL::INT_TYPE,
        json: GraphQL::Types::JSON,
        string: GraphQL::STRING_TYPE,
        text: GraphQL::STRING_TYPE,
      }[type]
    end
722919
def __schemas_descriptor(self):
    
    # Filter out any keys that aren't 'properties', 'type', or 'id'
    result = {}
    for schema_key, schema_value in self.__parser.schemas().iteritems():
      field_keys = schema_value.keys()
      key_result = {}

      # Some special processing for the properties value
      if 'properties' in field_keys:
        key_result['properties'] = schema_value['properties'].copy()
        # Add in enumDescriptions for any enum properties and strip out
        # the required tag for consistency with Java framework
        for prop_key, prop_value in schema_value['properties'].iteritems():
          if 'enum' in prop_value:
            num_enums = len(prop_value['enum'])
            key_result['properties'][prop_key]['enumDescriptions'] = (
                [''] * num_enums)
          elif 'default' in prop_value:
            # stringify default values
            if prop_value.get('type') == 'boolean':
              prop_value['default'] = 'true' if prop_value['default'] else 'false'
            else:
              prop_value['default'] = str(prop_value['default'])
          key_result['properties'][prop_key].pop('required', None)

      for key in ('type', 'id', 'description'):
        if key in field_keys:
          key_result[key] = schema_value[key]

      if key_result:
        result[schema_key] = key_result

    # Add 'type': 'object' to all object properties
    for schema_value in result.itervalues():
      for field_value in schema_value.itervalues():
        if isinstance(field_value, dict):
          if '$ref' in field_value:
            field_value['type'] = 'object'

    return result
1238386
function getType (obj, prop, self) {
  var val = obj[prop];
  var type = typeof val;

  if (null == val) {
    return 'null';
  }

  if (Buffer.isBuffer(val) || val instanceof mongodb.Binary) {
    return 'Binary';
  }

  if (Array.isArray(val)) {
    if (val.length > 0) {
      return getArrayType(val, self);
    }
    return [];
  }

  if (val instanceof mongodb.ObjectID) {
    return 'ObjectId';
  }

  if (val instanceof mongodb.Long) {
    return 'Long';
  }

  if (val instanceof mongodb.Double) {
    return 'Double';
  }

  if (val instanceof mongodb.Code) {
    return 'Code';
  }

  if (val instanceof mongodb.DBRef) {
    return 'DBRef';
  }

  if (val instanceof mongodb.Timestamp) {
    return 'Timestamp';
  }

  if (val instanceof mongodb.MinKey ||
      val instanceof mongodb.MaxKey) {
    return 'Mixed';
  }

  if (val instanceof mongodb.Symbol) {
    return 'Symbol';
  }

  if (val instanceof Date) {
    return 'Date';
  }

  if (val instanceof RegExp) {
    return 'RegExp';
  }

  val = val.valueOf();
  type = typeof val;

  if ('string' == type) {
    return 'String';
  }

  if ('number' == type) {
    return 'Number';
  }

  if ('boolean' == type) {
    return 'Boolean';
  }

  if ('object' != type) {
    throw new Error('dunno what to do with ' + val);
  }

  var ret = {};
  var keys = Object.keys(val);

  if (0 === keys.length) {
    return ret;
  }

  for (var i = 0; i < keys.length; ++i) {
    var key = keys[i];
    ret[key] = self.getType(val, key);
  }

  return ret;
}
810379
function processObjectType(object: GraphQLObjectType) {
  return reduce(object._typeConfig, (def, value, key) => {
    if (value !== undefined) {
      switch (key) {
        case 'interfaces':
          const interfaces = object.getInterfaces();
          if (interfaces.length) {
            def.interfaces = interfaces.map(({ name }) => name);
          }
          break;
        case 'fields':
          def.fields = reduce(object.getFields(), (fields, field, name) => {
            fields[name] = processField(field);
            return fields;
          }, Object.create(null));
          break;
        case 'isTypeOf':
          set(def, key, value, (typeof value === 'function'));
          break;
        case 'description':
          set(def, key, value, (value !== ''));
          break;
        case 'astNode':
          const directives = extractDirectives(get(object, [ 'astNode' ]));
          set(def, '@directives', directives, Boolean(directives));
          break;
        default:
          break;
      }
    }
    return def;
  }, {
    type: 'Object'
  });
}