MCPcopy Index your code
hub / github.com/python/cpython / register

Method register

Lib/multiprocessing/managers.py:702–739  ·  view source on GitHub ↗

Register a typeid with the manager type

(cls, typeid, callable=None, proxytype=None, exposed=None,
                 method_to_typeid=None, create_method=True)

Source from the content-addressed store, hash-verified

700
701 @classmethod
702 def register(cls, typeid, callable=None, proxytype=None, exposed=None,
703 method_to_typeid=None, create_method=True):
704 '''
705 Register a typeid with the manager type
706 '''
707 if '_registry' not in cls.__dict__:
708 cls._registry = cls._registry.copy()
709
710 if proxytype is None:
711 proxytype = AutoProxy
712
713 exposed = exposed or getattr(proxytype, '_exposed_', None)
714
715 method_to_typeid = method_to_typeid or \
716 getattr(proxytype, '_method_to_typeid_', None)
717
718 if method_to_typeid:
719 for key, value in list(method_to_typeid.items()): # isinstance?
720 assert type(key) is str, '%r is not a string' % key
721 assert type(value) is str, '%r is not a string' % value
722
723 cls._registry[typeid] = (
724 callable, exposed, method_to_typeid, proxytype
725 )
726
727 if create_method:
728 def temp(self, /, *args, **kwds):
729 util.debug('requesting creation of a shared %r object', typeid)
730 token, exp = self._create(typeid, *args, **kwds)
731 proxy = proxytype(
732 token, self._serializer, manager=self,
733 authkey=self._authkey, exposed=exp
734 )
735 conn = self._Client(token.address, authkey=self._authkey)
736 dispatch(conn, None, 'decref', (token.id,))
737 return proxy
738 temp.__name__ = typeid
739 setattr(cls, typeid, temp)
740
741#
742# Subclass of set which get cleared after a fork

Callers 10

_launchMethod · 0.45
mainFunction · 0.45
waitFunction · 0.45
connection.pyFile · 0.45
rebuild_ctypeFunction · 0.45
managers.pyFile · 0.45
heap.pyFile · 0.45
get_loggerFunction · 0.45
util.pyFile · 0.45
__init__Method · 0.45

Calls 3

listClass · 0.85
copyMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected