def _configure_buffer_sizes():
 global PIPE_BUF_BYTES
 global OS_PIPE_SZ
 PIPE_BUF_BYTES = 65536
 OS_PIPE_SZ = None
 if (not hasattr(fcntl, 'F_SETPIPE_SZ')):
  import platform
  if (platform.system() == 'Linux'):
   fcntl.F_SETPIPE_SZ = 1031
 try:
  with open('/proc/sys/fs/pipe-max-size', 'r') as f:
   OS_PIPE_SZ = min(int(f.read()), (1024 * 1024))
   PIPE_BUF_BYTES = max(OS_PIPE_SZ, PIPE_BUF_BYTES)
 except:
  pass

def _configure_buffer_sizes ( ) : global PIPE_BUF_BYTES global OS_PIPE_SZ PIPE_BUF_BYTES = 65536 OS_PIPE_SZ = None if ( not hasattr ( fcntl , 'F_SETPIPE_SZ' ) ) : import platform if ( platform . system ( ) == 'Linux' ) : fcntl . F_SETPIPE_SZ = 1031 try : with open ( '/proc/sys/fs/pipe-max-size' , 'r' ) as f : OS_PIPE_SZ = min ( int ( f . read ( ) ) , ( 1024 * 1024 ) ) PIPE_BUF_BYTES = max ( OS_PIPE_SZ , PIPE_BUF_BYTES ) except : pass
set up module globals controlling buffer sizes .