本文整理匯總了Python中multiprocessing.sharedctypes方法的典型用法代碼示例。如果您正苦於以下問題:Python multiprocessing.sharedctypes方法的具體用法?Python multiprocessing.sharedctypes怎麽用?Python multiprocessing.sharedctypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類multiprocessing
的用法示例。
在下文中一共展示了multiprocessing.sharedctypes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: import multiprocessing [as 別名]
# 或者: from multiprocessing import sharedctypes [as 別名]
def setUp(self):
if not HAS_SHAREDCTYPES:
self.skipTest("requires multiprocessing.sharedctypes")
示例2: test_import
# 需要導入模塊: import multiprocessing [as 別名]
# 或者: from multiprocessing import sharedctypes [as 別名]
def test_import(self):
modules = [
'multiprocessing', 'multiprocessing.connection',
'multiprocessing.heap', 'multiprocessing.managers',
'multiprocessing.pool', 'multiprocessing.process',
'multiprocessing.synchronize', 'multiprocessing.util'
]
if HAS_REDUCTION:
modules.append('multiprocessing.reduction')
if c_int is not None:
# This module requires _ctypes
modules.append('multiprocessing.sharedctypes')
for name in modules:
__import__(name)
mod = sys.modules[name]
for attr in getattr(mod, '__all__', ()):
self.assertTrue(
hasattr(mod, attr),
'%r does not have attribute %r' % (mod, attr)
)
#
# Quick test that logging works -- does not test logging output
#
示例3: __init__
# 需要導入模塊: import multiprocessing [as 別名]
# 或者: from multiprocessing import sharedctypes [as 別名]
def __init__(self, keys, probe_seqs_ind, probe_pos, probe_seqs, k,
probe_seqs_to_probe, native_dict):
"""Accepts arrays containing the information of a kmer_probe_map.
These arrays are allocated using multiprocessing.sharedctypes.RawArray
because the read/write synchronization (as offered by Array) is not
needed.
Args:
keys: Contains the k-mers (keys) from kmer_probe_map, as strings,
in sorted order. This is used for lookup. The same k-mer may
appear multiple times if there are multiple probes that contain
that k-mer (e.g., ['abc', 'def', 'def', 'ghi'] means that the
k-mer 'def' appears at positions in two probes.
probe_seqs_ind: For a k-mer keys[i], the value probe_seqs_ind[i]
gives an index in the array probe_seqs whose value contains the
sequence of a probe that contains the k-mer keys[i]. That is,
the sequence probe_seqs[probe_seqs_ind[i]] contains the k-mer
keys[i].
probe_pos: Contains the position of k-mers in probes. A k-mer
keys[i] appears at the position probe_pos[i] in the probe whose
sequence is given by probe_seqs[probe_seqs_ind[i]].
probe_seqs: The sequences of all the probes that appear in values
in the kmer_probe_map. Note that there may be many k-mers/keys
that map to the same probe; that probe's sequence appears just
once in the probe_seqs array. If we were to make a direct
mapping between indices in keys and indices in probe_seqs, we
would have to store the same probe sequence many times.
k: length of the k-mers (as an int) in keys
probe_seqs_to_probe: dict mapping probe sequences (as strings)
to the instances of probe.Probe from which these sequences
came
native_dict: kmer_probe_map as a native Python dict
"""
self.keys = keys
self.probe_seqs_ind = probe_seqs_ind
self.probe_pos = probe_pos
self.probe_seqs = probe_seqs
self.k = k
self.probe_seqs_to_probe = probe_seqs_to_probe
self.native_dict = native_dict
示例4: test_import
# 需要導入模塊: import multiprocessing [as 別名]
# 或者: from multiprocessing import sharedctypes [as 別名]
def test_import(self):
modules = self.get_module_names()
if sys.platform == 'win32':
modules.remove('multiprocessing.popen_fork')
modules.remove('multiprocessing.popen_forkserver')
modules.remove('multiprocessing.popen_spawn_posix')
else:
modules.remove('multiprocessing.popen_spawn_win32')
if not HAS_REDUCTION:
modules.remove('multiprocessing.popen_forkserver')
if c_int is None:
# This module requires _ctypes
modules.remove('multiprocessing.sharedctypes')
for name in modules:
__import__(name)
mod = sys.modules[name]
self.assertTrue(hasattr(mod, '__all__'), name)
for attr in mod.__all__:
self.assertTrue(
hasattr(mod, attr),
'%r does not have attribute %r' % (mod, attr)
)
#
# Quick test that logging works -- does not test logging output
#