module filehelper.transfer_api
¶
Short summary¶
module pyquickhelper.filehelper.transfer_api
API to move files
Classes¶
class |
truncated documentation |
---|---|
Class used for unit test purposes, simple key, value storage. |
|
Defines an API to transfer files over a remote location. |
|
Keeps tracks of transferred files. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
|
Deserializes a mapping. |
Deserializes a mapping. |
|
|
Computes MD5 for a file. |
Computes MD5 for a file. |
|
|
Serializes a mapping. |
Serializes a mapping. |
|
Retrieves information from a json string. |
Methods¶
method |
truncated documentation |
---|---|
Information about a transferred file. |
|
usual |
|
Adds a piece. |
|
|
Produces a remote path. |
Produces a remote path. |
|
Retrieves data from path. |
|
Retrieves data from path. |
|
|
Returns the mapping. |
Returns the mapping. |
|
Serializes this class info JSON. |
|
It assumes a data holds in memory, tansfer data to path. |
|
It assumes a data holds in memory, tansfer data to path. |
|
|
Transfers the mapping. |
Transfers the mapping. |
Documentation¶
API to move files
- class pyquickhelper.filehelper.transfer_api.MockTransferAPI(fLOG=<function noLOG>)[source]¶
Bases:
TransferAPI
Class used for unit test purposes, simple key, value storage.
- Parameters
fLOG – logging function
- retrieve(path, exc=True)[source]¶
Retrieves data from path.
- Parameters
path – remove location
exc – keep exception
- Returns
data
- class pyquickhelper.filehelper.transfer_api.TransferAPI(fLOG=<function noLOG>)[source]¶
Bases:
object
Defines an API to transfer files over a remote location.
- Parameters
fLOG – logging function
- static bytes2mapping(byt)[source]¶
Deserializes a mapping.
- Parameters
byt – bytes
- Returns
dictionary { str,
TransferAPI_FileInfo
}
- static checksum_md5(data)[source]¶
Computes MD5 for a file.
- Parameters
data – some data
- Returns
string
- get_remote_path(data, name, piece=0)[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
- static mapping2bytes(mapping)[source]¶
Serializes a mapping.
- Parameters
mapping – dictionary { str,
TransferAPI_FileInfo
}- Returns
bytes
- retrieve(path, exc=True)[source]¶
Retrieves data from path.
- Parameters
path – remove location
exc – keep exception
- Returns
data
- retrieve_mapping(decrypt)[source]¶
Returns the mapping.
- Parameters
decrypt – decrypt function
- Returns
list of key,value pair
- transfer(path, data)[source]¶
It assumes a data holds in memory, tansfer data to path.
- Parameters
data – bytes
path – path to remove location
- Returns
boolean
- class pyquickhelper.filehelper.transfer_api.TransferAPI_FileInfo(name, pieces, last_update)[source]¶
Bases:
object
Keeps tracks of transferred files.
Information about a transferred file.
- Parameters
name – name of the file
pieces – list of pieces contributing to the file
last_update – last_update
- __init__(name, pieces, last_update)[source]¶
Information about a transferred file.
- Parameters
name – name of the file
pieces – list of pieces contributing to the file
last_update – last_update