home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_652 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  6.3 KB  |  216 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __version__ = '0.70a1'
  5. __all__ = [
  6.     'Process',
  7.     'current_process',
  8.     'active_children',
  9.     'freeze_support',
  10.     'Manager',
  11.     'Pipe',
  12.     'cpu_count',
  13.     'log_to_stderr',
  14.     'get_logger',
  15.     'allow_connection_pickling',
  16.     'BufferTooShort',
  17.     'TimeoutError',
  18.     'Lock',
  19.     'RLock',
  20.     'Semaphore',
  21.     'BoundedSemaphore',
  22.     'Condition',
  23.     'Event',
  24.     'Queue',
  25.     'JoinableQueue',
  26.     'Pool',
  27.     'Value',
  28.     'Array',
  29.     'RawValue',
  30.     'RawArray',
  31.     'SUBDEBUG',
  32.     'SUBWARNING']
  33. __author__ = 'R. Oudkerk (r.m.oudkerk@gmail.com)'
  34. import os
  35. import sys
  36. from multiprocessing.process import Process, current_process, active_children
  37. from multiprocessing.util import SUBDEBUG, SUBWARNING
  38.  
  39. class ProcessError(Exception):
  40.     pass
  41.  
  42.  
  43. class BufferTooShort(ProcessError):
  44.     pass
  45.  
  46.  
  47. class TimeoutError(ProcessError):
  48.     pass
  49.  
  50.  
  51. class AuthenticationError(ProcessError):
  52.     pass
  53.  
  54. import _multiprocessing
  55.  
  56. def Manager():
  57.     SyncManager = SyncManager
  58.     import multiprocessing.managers
  59.     m = SyncManager()
  60.     m.start()
  61.     return m
  62.  
  63.  
  64. def Pipe(duplex = True):
  65.     Pipe = Pipe
  66.     import multiprocessing.connection
  67.     return Pipe(duplex)
  68.  
  69.  
  70. def cpu_count():
  71.     if sys.platform == 'win32':
  72.         
  73.         try:
  74.             num = int(os.environ['NUMBER_OF_PROCESSORS'])
  75.         except (ValueError, KeyError):
  76.             num = 0
  77.         except:
  78.             None<EXCEPTION MATCH>(ValueError, KeyError)
  79.         
  80.  
  81.     None<EXCEPTION MATCH>(ValueError, KeyError)
  82.     if 'bsd' in sys.platform or sys.platform == 'darwin':
  83.         
  84.         try:
  85.             num = int(os.popen('sysctl -n hw.ncpu').read())
  86.         except ValueError:
  87.             num = 0
  88.         except:
  89.             None<EXCEPTION MATCH>ValueError
  90.         
  91.  
  92.     None<EXCEPTION MATCH>ValueError
  93.     
  94.     try:
  95.         num = os.sysconf('SC_NPROCESSORS_ONLN')
  96.     except (ValueError, OSError, AttributeError):
  97.         num = 0
  98.  
  99.     if num >= 1:
  100.         return num
  101.     raise NotImplementedError('cannot determine number of cpus')
  102.  
  103.  
  104. def freeze_support():
  105.     if sys.platform == 'win32' and getattr(sys, 'frozen', False):
  106.         freeze_support = freeze_support
  107.         import multiprocessing.forking
  108.         freeze_support()
  109.     
  110.  
  111.  
  112. def get_logger():
  113.     get_logger = get_logger
  114.     import multiprocessing.util
  115.     return get_logger()
  116.  
  117.  
  118. def log_to_stderr(level = None):
  119.     log_to_stderr = log_to_stderr
  120.     import multiprocessing.util
  121.     return log_to_stderr(level)
  122.  
  123.  
  124. def allow_connection_pickling():
  125.     reduction = reduction
  126.     import multiprocessing
  127.  
  128.  
  129. def Lock():
  130.     Lock = Lock
  131.     import multiprocessing.synchronize
  132.     return Lock()
  133.  
  134.  
  135. def RLock():
  136.     RLock = RLock
  137.     import multiprocessing.synchronize
  138.     return RLock()
  139.  
  140.  
  141. def Condition(lock = None):
  142.     Condition = Condition
  143.     import multiprocessing.synchronize
  144.     return Condition(lock)
  145.  
  146.  
  147. def Semaphore(value = 1):
  148.     Semaphore = Semaphore
  149.     import multiprocessing.synchronize
  150.     return Semaphore(value)
  151.  
  152.  
  153. def BoundedSemaphore(value = 1):
  154.     BoundedSemaphore = BoundedSemaphore
  155.     import multiprocessing.synchronize
  156.     return BoundedSemaphore(value)
  157.  
  158.  
  159. def Event():
  160.     Event = Event
  161.     import multiprocessing.synchronize
  162.     return Event()
  163.  
  164.  
  165. def Queue(maxsize = 0):
  166.     Queue = Queue
  167.     import multiprocessing.queues
  168.     return Queue(maxsize)
  169.  
  170.  
  171. def JoinableQueue(maxsize = 0):
  172.     JoinableQueue = JoinableQueue
  173.     import multiprocessing.queues
  174.     return JoinableQueue(maxsize)
  175.  
  176.  
  177. def Pool(processes = None, initializer = None, initargs = ()):
  178.     Pool = Pool
  179.     import multiprocessing.pool
  180.     return Pool(processes, initializer, initargs)
  181.  
  182.  
  183. def RawValue(typecode_or_type, *args):
  184.     RawValue = RawValue
  185.     import multiprocessing.sharedctypes
  186.     return RawValue(typecode_or_type, *args)
  187.  
  188.  
  189. def RawArray(typecode_or_type, size_or_initializer):
  190.     RawArray = RawArray
  191.     import multiprocessing.sharedctypes
  192.     return RawArray(typecode_or_type, size_or_initializer)
  193.  
  194.  
  195. def Value(typecode_or_type, *args, **kwds):
  196.     Value = Value
  197.     import multiprocessing.sharedctypes
  198.     return Value(typecode_or_type, *args, **kwds)
  199.  
  200.  
  201. def Array(typecode_or_type, size_or_initializer, **kwds):
  202.     Array = Array
  203.     import multiprocessing.sharedctypes
  204.     return Array(typecode_or_type, size_or_initializer, **kwds)
  205.  
  206. if sys.platform == 'win32':
  207.     
  208.     def set_executable(executable):
  209.         set_executable = set_executable
  210.         import multiprocessing.forking
  211.         set_executable(executable)
  212.  
  213.     __all__ += [
  214.         'set_executable']
  215.  
  216.