本文整理汇总了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
#