Python multiprocessing.sharedctypes() Examples

The following are 13 code examples of multiprocessing.sharedctypes(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module multiprocessing , or try the search function .
Example #1
Source File: _test_multiprocessing.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #2
Source File: _test_multiprocessing.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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
# 
Example #3
Source File: _test_multiprocessing.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #4
Source File: _test_multiprocessing.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #5
Source File: _test_multiprocessing.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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
# 
Example #6
Source File: test_multiprocessing.py    From ironpython2 with Apache License 2.0 4 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #7
Source File: test_multiprocessing.py    From ironpython2 with Apache License 2.0 4 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #8
Source File: test_multiprocessing.py    From ironpython2 with Apache License 2.0 4 votes vote down vote up
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
# 
Example #9
Source File: probe.py    From catch with MIT License 4 votes vote down vote up
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 
Example #10
Source File: _test_multiprocessing.py    From Fluid-Designer with GNU General Public License v3.0 4 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #11
Source File: _test_multiprocessing.py    From Fluid-Designer with GNU General Public License v3.0 4 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes") 
Example #12
Source File: _test_multiprocessing.py    From Fluid-Designer with GNU General Public License v3.0 4 votes vote down vote up
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
# 
Example #13
Source File: _test_multiprocessing.py    From ironpython3 with Apache License 2.0 4 votes vote down vote up
def setUp(self):
        if not HAS_SHAREDCTYPES:
            self.skipTest("requires multiprocessing.sharedctypes")