MCPcopy Index your code
hub / github.com/RustPython/RustPython / create

Method create

Lib/multiprocessing/managers.py:376–410  ·  view source on GitHub ↗

Create a new shared object and return its id

(self, c, typeid, /, *args, **kwds)

Source from the content-addressed store, hash-verified

374 self.stop_event.set()
375
376 def create(self, c, typeid, /, *args, **kwds):
377 '''
378 Create a new shared object and return its id
379 '''
380 with self.mutex:
381 callable, exposed, method_to_typeid, proxytype = \
382 self.registry[typeid]
383
384 if callable is None:
385 if kwds or (len(args) != 1):
386 raise ValueError(
387 "Without callable, must have one non-keyword argument")
388 obj = args[0]
389 else:
390 obj = callable(*args, **kwds)
391
392 if exposed is None:
393 exposed = public_methods(obj)
394 if method_to_typeid is not None:
395 if not isinstance(method_to_typeid, dict):
396 raise TypeError(
397 "Method_to_typeid {0!r}: type {1!s}, not dict".format(
398 method_to_typeid, type(method_to_typeid)))
399 exposed = list(exposed) + list(method_to_typeid)
400
401 ident = '%x' % id(obj) # convert to string because xmlrpclib
402 # only has 32 bit signed integers
403 util.debug('%r callable returned object with id %r', typeid, ident)
404
405 self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid)
406 if ident not in self.id_to_refcount:
407 self.id_to_refcount[ident] = 0
408
409 self.incref(c, ident)
410 return ident, tuple(exposed)
411
412 def get_methods(self, c, token):
413 '''

Callers 2

serve_clientMethod · 0.95
createMethod · 0.45

Calls 10

increfMethod · 0.95
lenFunction · 0.85
callableFunction · 0.85
public_methodsFunction · 0.85
isinstanceFunction · 0.85
listClass · 0.85
idFunction · 0.85
setFunction · 0.85
formatMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected