module filehelper.transfer_api

Inheritance diagram of pyquickhelper.filehelper.transfer_api

Short summary

module pyquickhelper.filehelper.transfer_api

API to move files

source on GitHub

Classes

class

truncated documentation

MockTransferAPI

class used for unit test purposes, simple key, value storage

TransferAPI

defines an API to transfer files over a remote location

TransferAPI_FileInfo

keeps tracks of transferred files

Static Methods

staticmethod

truncated documentation

bytes2mapping

deserializes a mapping

bytes2mapping

deserializes a mapping

checksum_md5

computes MD5 for a file

checksum_md5

computes MD5 for a file

mapping2bytes

serializes a mapping

mapping2bytes

serializes a mapping

read_json

retrieves information from a json string

Methods

method

truncated documentation

__init__

constructor

__init__

constructor

__init__

information about a transferred file

__str__

usual

add_piece

add a piece

get_remote_path

produces a remote path

get_remote_path

produces a remote path

retrieve

retrieve data from path

retrieve

retrieve data from path

retrieve_mapping

returns the mapping

retrieve_mapping

returns the mapping

to_json

serializes this class info JSON

transfer

we assume a data holds in memory, tansfer data to path

transfer

we assume a data holds in memory, tansfer data to path

transfer_mapping

transfer the mapping

transfer_mapping

transfer the mapping

Documentation

API to move files

source on GitHub

class pyquickhelper.filehelper.transfer_api.MockTransferAPI(fLOG=<function noLOG>)[source][source]

Bases: pyquickhelper.filehelper.transfer_api.TransferAPI

class used for unit test purposes, simple key, value storage

source on GitHub

constructor

Parameters

fLOG – logging function

source on GitHub

__init__(fLOG=<function noLOG>)[source][source]

constructor

Parameters

fLOG – logging function

source on GitHub

retrieve(path, exc=True)[source][source]

retrieve data from path

Parameters
  • path – remove location

  • exc – keep exception

Returns

data

source on GitHub

transfer(path, data)[source][source]

we assume a data holds in memory, tansfer data to path

Parameters
  • data – bytes

  • path – path to remove location

Returns

boolean

source on GitHub

class pyquickhelper.filehelper.transfer_api.TransferAPI(fLOG=<function noLOG>)[source][source]

Bases: object

defines an API to transfer files over a remote location

source on GitHub

constructor

Parameters

fLOG – logging function

source on GitHub

__init__(fLOG=<function noLOG>)[source][source]

constructor

Parameters

fLOG – logging function

source on GitHub

static bytes2mapping(byt)[source][source]

deserializes a mapping

Parameters

byt – bytes

Returns

dictionary { str, TransferAPI_FileInfo }

source on GitHub

static checksum_md5(data)[source][source]

computes MD5 for a file

Parameters

data – some data

Returns

string

source on GitHub

get_remote_path(data, name, piece=0)[source][source]

produces a remote path

Parameters
  • data – binary data to transfer (to be hashed)

  • name – local name

  • piece – pieces

Returns

remote path

hash of everything

source on GitHub

static mapping2bytes(mapping)[source][source]

serializes a mapping

Parameters

mapping – dictionary { str, TransferAPI_FileInfo }

Returns

bytes

source on GitHub

retrieve(path, exc=True)[source][source]

retrieve data from path

Parameters
  • path – remove location

  • exc – keep exception

Returns

data

source on GitHub

retrieve_mapping(decrypt)[source][source]

returns the mapping

Parameters

decrypt – decrypt function

Returns

list of key,value pair

source on GitHub

transfer(path, data)[source][source]

we assume a data holds in memory, tansfer data to path

Parameters
  • data – bytes

  • path – path to remove location

Returns

boolean

source on GitHub

transfer_mapping(mapping, encrypt, filename=None)[source][source]

transfer the mapping

Parameters
  • mapping – mapping

  • encrypt – encryption function

  • filename – local filename

Returns

boolean

source on GitHub

class pyquickhelper.filehelper.transfer_api.TransferAPI_FileInfo(name, pieces, last_update)[source][source]

Bases: object

keeps tracks of transferred files

source on GitHub

information about a transferred file

Parameters
  • name – name of the file

  • pieces – list of pieces contributing to the file

  • last_update – last_update

source on GitHub

__init__(name, pieces, last_update)[source][source]

information about a transferred file

Parameters
  • name – name of the file

  • pieces – list of pieces contributing to the file

  • last_update – last_update

source on GitHub

__str__()[source][source]

usual

source on GitHub

add_piece(piece)[source][source]

add a piece

Parameters

piece – add piece

source on GitHub

static read_json(s)[source][source]

retrieves information from a json string

source on GitHub

to_json()[source][source]

serializes this class info JSON

source on GitHub