(self, obj, name=None, pack=struct.pack)
Save a "global".

        The name of this method is somewhat misleading: all types get
        dispatched here.
Save a "global".
Save a global .
def save_global(self, obj, name=None, pack=struct.pack):
        """
        Save a "global".

        The name of this method is somewhat misleading: all types get
        dispatched here.
        """
        if obj is type(None):  # noqa
            return self.save_reduce(type, (None,), obj=obj)
        elif obj is type(Ellipsis):
            return self.save_reduce(type, (Ellipsis,), obj=obj)
        elif obj is type(NotImplemented):
            return self.save_reduce(type, (NotImplemented,), obj=obj)
        elif obj in _BUILTIN_TYPE_NAMES:
            return self.save_reduce(_builtin_type, (_BUILTIN_TYPE_NAMES[obj],), obj=obj)
        elif name is not None:
            Pickler.save_global(self, obj, name=name)
        elif not _is_global(obj, name=name):
            self.save_dynamic_class(obj)
        else:
            Pickler.save_global(self, obj, name=name)
def save_global ( self , obj , name = None , pack = struct . pack ) : if obj is type ( None ) : # noqa return self . save_reduce ( type , ( None , ) , obj = obj ) elif obj is type ( Ellipsis ) : return self . save_reduce ( type , ( Ellipsis , ) , obj = obj ) elif obj is type ( NotImplemented ) : return self . save_reduce ( type , ( NotImplemented , ) , obj = obj ) elif obj in _BUILTIN_TYPE_NAMES : return self . save_reduce ( _builtin_type , ( _BUILTIN_TYPE_NAMES [ obj ] , ) , obj = obj ) elif name is not None : Pickler . save_global ( self , obj , name = name ) elif not _is_global ( obj , name = name ) : self . save_dynamic_class ( obj ) else : Pickler . save_global ( self , obj , name = name )