# ppft module documentation

## auto module

ppft auto: an auto-discovery service

class Discover(base, isclient=False)

  Bases: `object`

  Auto-discovery service class

  broadcast()

    Sends a broadcast

  listen()

    Listens for broadcasts from other clients/servers

  run(interface_addr, broadcast_addr)

    Starts auto-discovery

## common module

ppft common: a set of common utilities

b_(string)

file

  alias of `IOBase`

get_class_hierarchy(clazz)

is_not_imported(arg, modules)

long

  alias of `int`

class portnumber(min=0, max=65536)

  Bases: `object`

  port selector

  Usage:

        >>> pick = portnumber(min=1024,max=65535)
        >>> print( pick() )

  select a port number from a given range.

  The first call will return a random number from the available range, and each subsequent call will return the next number in the range.

  Inputs:

    min – minimum port number [default = 0] max – maximum port number [default = 65536]

  __call__()

    Call self as a function.

randomport(min=1024, max=65536)

  select a random port number

  Inputs:

    min – minimum port number [default = 1024] max – maximum port number [default = 65536]

start_thread(name, target, args=(), kwargs={}, daemon=True)

  Starts a thread

str_(byte)

## server module

(Remote) ppft servers can be created with `ppserver` (or with `python -m ppft.server`), and then jobs can be distributed to remote workers. See `--help` for more details on how to configure a server.

## transport module

ppft transport: parallel python transport

class CPipeTransport(r, w)

  Bases: `PipeTransport`, `CTransport`

class CSocketTransport(socket1, socket_timeout)

  Bases: `SocketTransport`, `CTransport`

class CTransport

  Bases: `Transport`

  Cached transport

  creceive(preprocess=None)
  csend(msg)
  hash(msg)
  rcache = {}

class PipeTransport(r, w)

  Bases: `Transport`

  close()
  receive(preprocess=None)
  send(msg)

class SocketTransport(socket1, socket_timeout)

  Bases: `Transport`

  _connect(host, port)
  close()
  receive(preprocess=None)
  send(data)

class Transport

  Bases: `object`

  _connect(host, port)
  authenticate(secret)
  close()
  receive(preprocess=None)
  send(msg)

md5_new(string=b'', *, usedforsecurity=True)

  Returns a md5 hash object; optionally initialized with a string

sha_new(string=b'', *, usedforsecurity=True)

  Returns a sha1 hash object; optionally initialized with a string

## worker module

ppft worker: a worker to communicate with ppserver

class _WorkerProcess

  Bases: `object`

  run()

ioStringIO

  alias of `StringIO`

preprocess(msg)