module ipythonhelper.magic_class_compress

Inheritance diagram of pyquickhelper.ipythonhelper.magic_class_compress

Short summary

module pyquickhelper.ipythonhelper.magic_class_compress

Magic command to handle files

source on GitHub

Classes

class

truncated documentation

MagicCompress

Defines magic commands to compress files.

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

compress_parser

defines the way to parse the magic command %compress

Methods

method

truncated documentation

compress

Documentation

Magic command to handle files

source on GitHub

class pyquickhelper.ipythonhelper.magic_class_compress.MagicCompress(shell=None, **kwargs)[source][source]

Bases: pyquickhelper.ipythonhelper.magic_class.MagicClassWithHelpers

Defines magic commands to compress files.

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]
compress(line)[source][source]

%compress

It compresses a list of files, it returns the number of compressed files:

from pyquickhelper import zip_files, gzip_files, zip7_files
if format == "zip":
    zip_files(dest, files)
elif format == "gzip":
    gzip_files(dest, files)
elif format == "7z":
    zip7_files(dest, files)
else:
    raise ValueError("unexpected format: " + format)

source on GitHub

static compress_parser()[source][source]

defines the way to parse the magic command %compress

source on GitHub

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

register magics function, can be called from a notebook

Parameters

ip – from get_ipython()

source on GitHub