module ipythonhelper.magic_class_diff
¶
Short summary¶
module pyquickhelper.ipythonhelper.magic_class_diff
Magic command to handle files
Classes¶
class |
truncated documentation |
---|---|
Defines magic commands to visualize differences between files. |
Functions¶
function |
truncated documentation |
---|---|
Register magics function, can be called from a notebook. |
Properties¶
property |
truncated documentation |
---|---|
|
return the context or None |
|
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 |
---|---|
Defines the way to parse the magic command |
|
Defines the way to parse the magic command |
|
Defines the way to parse the magic command |
Methods¶
method |
truncated documentation |
---|---|
Defines |
|
Documentation¶
Magic command to handle files
- class pyquickhelper.ipythonhelper.magic_class_diff.MagicDiff(**kwargs: Any)[source]¶
Bases:
MagicClassWithHelpers
Defines magic commands to visualize differences between files.
Create a configurable given a config config.
Parameters¶
- configConfig
If this is empty, default values are used. If config is a
Config
instance, it will be used to configure the instance.- parentConfigurable instance, optional
The parent Configurable instance of this object.
Notes¶
Subclasses of Configurable must call the
__init__()
method ofConfigurable
before doing anything else and usingsuper()
: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.
- _all_trait_default_generators: Dict[str, Any] = {'config': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'parent': <bound method TraitType.default of <traitlets.traitlets.Instance object>>}[source]¶
- _descriptors = [<traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Instance object>][source]¶
- _instance_inits = [<bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>][source]¶
- _traits: Dict[str, Any] = {'config': <traitlets.traitlets.Instance object>, 'parent': <traitlets.traitlets.Instance object>}[source]¶
- codediff(line)[source]¶
%codediff
It displays differences between two strings assuming they contains multiple lines. The magic command is equivalent to:
from IPython.core.display import display_html from pyquickhelper.texthelper.edit_text_diff ( import edit_distance_text, diff2html) _, aligned, final = edit_distance_text( args.c1, args.c2, threshold=args.threshold, verbose=args.verbose) ht = diff2html(args.c1, args.c2, aligned, final) display_html(ht)
- strdiff(line)[source]¶
%strdiff
It displays differences between two strings assuming they contains multiple lines. The magic command is equivalent to:
from IPython.core.display import display_html from pyquickhelper.texthelper.text_diff import html_diffs html = html_diffs(<s1>, <s2>) display_html(html)
- textdiff(line)[source]¶
%textdiff
It displays differences between two text files, two strings, two urls, it is based on
create_visual_diff_through_html_files
. Check blog post Visualize differences between two files in a notebook to see an example. See also A magic command to visualize differences between two files in a notebook. The magic command is equivalent to:from IPython.core.display import display_html, display_javascript from pyquickhelper import docstring2html, create_visual_diff_through_html_files html, js = create_visual_diff_through_html_files(<f1>, <f2>, encoding=<encoding>, notebook=True, context_size=None if <context> in [None, ""] else int(<context>), inline_view=<inline>) display_html(html) display_javascript(js)