module ipythonhelper.magic_class_crypt

Inheritance diagram of pyquickhelper.ipythonhelper.magic_class_crypt

Short summary

module pyquickhelper.ipythonhelper.magic_class_crypt

Magic command to handle files

source on GitHub

Classes

class

truncated documentation

MagicCrypt

Defines magic commands to encrypt and decrypt file.

Functions

function

truncated documentation

register_file_magics

register magics function, can be called from a notebook

Properties

property

truncated documentation

Context

return the context or None

cross_validation_lock

A contextmanager for running a block with our cross validation lock set to True. At the end of the block, …

Static Methods

staticmethod

truncated documentation

decrypt_file_parser

defines the way to parse the magic command %decrypt_file

encrypt_file_parser

defines the way to parse the magic command %encrypt_file

endecrypt_file_parser

defines the way to parse the magic command %encrypt_file and %decrypt_file

Methods

method

truncated documentation

decrypt_file

encrypt_file

Documentation

Magic command to handle files

source on GitHub

class pyquickhelper.ipythonhelper.magic_class_crypt.MagicCrypt(shell=None, **kwargs)[source][source]

Bases: pyquickhelper.ipythonhelper.magic_class.MagicClassWithHelpers

Defines magic commands to encrypt and decrypt file.

source on GitHub

Create a configurable given a config config.

Parameters
  • config (Config) – If this is empty, default values are used. If config is a Config instance, it will be used to configure the instance.

  • parent (Configurable instance, optional) – The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():

class MyConfigurable(Configurable):
    def __init__(self, config=None):
        super(MyConfigurable, self).__init__(config=config)
        # Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

_trait_default_generators = {}[source]
decrypt_file(line)[source][source]

%decrypt_file

The magic command is equivalent to:

from pyquickhelper.filehelper import decrypt_stream

password = "password"
source = "file source"
dest = "file destination"

if isinstance(password, str):
    password = bytes(password, encoding="ascii")

decrypt_stream(key=password, filename=source, out_filename=dest,
               chunksize=os.stat(source).st_size * 2 + 1)

source on GitHub

static decrypt_file_parser()[source][source]

defines the way to parse the magic command %decrypt_file

source on GitHub

encrypt_file(line)[source][source]

%encrypt_file

The magic command is equivalent to:

from pyquickhelper.filehelper import encrypt_stream

password = "password"
source = "file source"
dest = "file destination"

if isinstance(password, str):
    password = bytes(password, encoding="ascii")

encrypt_stream(key=password, filename=source, out_filename=dest,
               chunksize=os.stat(source).st_size * 2 + 1)

source on GitHub

static encrypt_file_parser()[source][source]

defines the way to parse the magic command %encrypt_file

source on GitHub

static endecrypt_file_parser(encrypt)[source][source]

defines the way to parse the magic command %encrypt_file and %decrypt_file

Parameters

encrypt – True to encrypt or False to decrypt

Returns

parser

source on GitHub

pyquickhelper.ipythonhelper.magic_class_crypt.register_file_magics(ip=None)[source][source]

register magics function, can be called from a notebook

Parameters

ip – from get_ipython()

source on GitHub