Return the root serializer (serializer for the primary resource).
516527
def root_serializer(self):
        """"""
        if not self.parent:
            # Don't cache, so that we'd recompute if parent is set.
            return None

        node = self
        seen = set()
        while True:
            seen.add(node)
            if getattr(node, 'parent', None):
                node = node.parent
                if node in seen:
                    return None
            else:
                return node
1225467
public static final CClassLoader getRootLoader() {
		if (CClassLoader.rootLoader == null) {
			CClassLoader.rootLoader = CClassLoader.createLoader(
					CClassLoader.class.getClassLoader(),
					CClassLoader.ROOT_LOADER);
		}
		return CClassLoader.rootLoader;
	}
1109717
public JsonSerializer<T> getSerializer() {
        if ( null == serializer ) {
            serializer = (JsonSerializer<T>) newSerializer();
        }
        return serializer;
    }
522462
public static Serializer getSerializer(Class<?> type) {
    Class<?> serializable = lookupSerializableType(type);
    Serializer serializer = serializers.get(serializable);
    if (serializer == null) {
      serializer = getInstance().createSerializer(serializable);
      serializers.put(serializable, serializer);
    }
    return serializer;
  }
617140
def get_root( self, **kwargs ):
        ''' 
        '''
        if self.parent == None:
            return self
        else:
            return self.parent.get_root( **kwargs )
862022
def find_root(self):
        """"""
        node = self
        while node.parent is not None:
            node = node.parent
        return node
639353
def root(self) -> "GameNode":
        """"""
        node = self

        while node.parent:
            node = node.parent

        return node
1235877
def start_serialization(self):
        
        if (self.root):
            self.xml = XmlPrinter(self.stream, self.options.get("encoding", settings.DEFAULT_CHARSET))
            self.xml.startDocument()
            self.xml.startElement("django-objects", {"version" : "1.0"})
820927
def get_serializer(name, **options):
    '''
'''
    if name in _serializers:
        serializer = _serializers[name]
        return serializer(**options)
    else:
        raise ValueError('Unknown serializer {0}.'.format(name))
938009
def parent(self):
        """"""
        drv = self._drv
        root = self._root
        parts = self._parts
        if len(parts) == 1 and (drv or root):
            return self
        return self._from_parsed_parts(drv, root, parts[:-1])
754637
protected final SerializerFactory findSerializerFactory()
    {
        SerializerFactory factory = _serializerFactory;

        if (factory == null) {
            factory = SerializerFactory.createDefault();
            _defaultSerializerFactory = factory;
            _serializerFactory = factory;
        }

        return factory;
    }
1117331
def _get_root(cls, order: Optional[str] = None) -> "Console":
        
        global _root_console
        if _root_console is None:
            _root_console = object.__new__(cls)
        self = _root_console  # type: Console
        if order is not None:
            self._order = order
        self.console_c = ffi.NULL
        self._init_setup_console_data(self._order)
        return self
437448
private ClassLoader getRootLoader() {
        ClassLoader ret = getClass().getClassLoader();
        while (ret != null && ret.getParent() != null) {
            ret = ret.getParent();
        }
        return ret;
    }
1023777
def root_representer(dumper: yaml.Dumper, data: YAMLRoot):
    
    rval = dict()
    for k, v in data.__dict__.items():
        if not k.startswith('_') and v is not None and (not isinstance(v, (dict, list)) or v):
            rval[k] = v
    return dumper.represent_data(rval)
795190
protected function _serializeRootAttributes()
	{
		$rootAttributes = $this->_getRootAttributes();
		$qualifyAttributes = function ($name) use ($rootAttributes) {
			return sprintf('%s="%s"', $name, $rootAttributes[$name]);
		};
		$qualifiedAttributes = array_map($qualifyAttributes, array_keys($rootAttributes));
		return implode(' ', $qualifiedAttributes);
	}
400698
def get_resource_type_from_included_serializer(self):
        
        field_name = self.field_name or self.parent.field_name
        parent = self.get_parent_serializer()

        if parent is not None:
            # accept both singular and plural versions of field_name
            field_names = [
                inflection.singularize(field_name),
                inflection.pluralize(field_name)
            ]
            includes = get_included_serializers(parent)
            for field in field_names:
                if field in includes.keys():
                    return get_resource_type_from_serializer(includes[field])

        return None
925676
def schema_root(self) -> "SchemaTreeNode":
        """"""
        sn = self
        while sn.parent:
            sn = sn.parent
        return sn