id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
170,910
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `string_span_tokenize` function. Write a Python function `def string_span_tokenize(s, sep)` to solve the following problem: r""" Return the offsets of the tokens in *s*, ...
r""" Return the offsets of the tokens in *s*, as a sequence of ``(start, end)`` tuples, by splitting the string at each occurrence of *sep*. >>> from nltk.tokenize.util import string_span_tokenize >>> s = '''Good muffins cost $3.88\nin New York. Please buy me ... two of them.\n\nThanks.''' >>> list(string_span_tokenize...
170,911
from re import finditer from xml.sax.saxutils import escape, unescape def finditer(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... def finditer(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... The provided code snippet include...
r""" Return the offsets of the tokens in *s*, as a sequence of ``(start, end)`` tuples, by splitting the string at each successive match of *regexp*. >>> from nltk.tokenize.util import regexp_span_tokenize >>> s = '''Good muffins cost $3.88\nin New York. Please buy me ... two of them.\n\nThanks.''' >>> list(regexp_span...
170,912
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `spans_to_relative` function. Write a Python function `def spans_to_relative(spans)` to solve the following problem: r""" Return a sequence of relative spans, given a seq...
r""" Return a sequence of relative spans, given a sequence of spans. >>> from nltk.tokenize import WhitespaceTokenizer >>> from nltk.tokenize.util import spans_to_relative >>> s = '''Good muffins cost $3.88\nin New York. Please buy me ... two of them.\n\nThanks.''' >>> list(spans_to_relative(WhitespaceTokenizer().span_...
170,913
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `is_cjk` function. Write a Python function `def is_cjk(character)` to solve the following problem: Python port of Moses' code to check for CJK character. >>> CJKChars().r...
Python port of Moses' code to check for CJK character. >>> CJKChars().ranges [(4352, 4607), (11904, 42191), (43072, 43135), (44032, 55215), (63744, 64255), (65072, 65103), (65381, 65500), (131072, 196607)] >>> is_cjk(u'\u33fe') True >>> is_cjk(u'\uFE5F') False :param character: The character that needs to be checked. :...
170,914
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `xml_escape` function. Write a Python function `def xml_escape(text)` to solve the following problem: This function transforms the input text into an "escaped" version su...
This function transforms the input text into an "escaped" version suitable for well-formed XML formatting. Note that the default xml.sax.saxutils.escape() function don't escape some characters that Moses does so we have to manually add them to the entities dictionary. >>> input_str = ''')| & < > ' " ] [''' >>> expected...
170,915
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `xml_unescape` function. Write a Python function `def xml_unescape(text)` to solve the following problem: This function transforms the "escaped" version suitable for well...
This function transforms the "escaped" version suitable for well-formed XML formatting into humanly-readable string. Note that the default xml.sax.saxutils.unescape() function don't unescape some characters that Moses does so we have to manually add them to the entities dictionary. >>> from xml.sax.saxutils import unes...
170,916
from re import finditer from xml.sax.saxutils import escape, unescape The provided code snippet includes necessary dependencies for implementing the `align_tokens` function. Write a Python function `def align_tokens(tokens, sentence)` to solve the following problem: This module attempt to find the offsets of the token...
This module attempt to find the offsets of the tokens in *s*, as a sequence of ``(start, end)`` tuples, given the tokens and also the source string. >>> from nltk.tokenize import TreebankWordTokenizer >>> from nltk.tokenize.util import align_tokens >>> s = str("The plane, bound for St Petersburg, crashed in Egypt's " ....
170,917
from nltk.tokenize.api import StringTokenizer, TokenizerI from nltk.tokenize.util import regexp_span_tokenize, string_span_tokenize class LineTokenizer(TokenizerI): r"""Tokenize a string into its lines, optionally discarding blank lines. This is similar to ``s.split('\n')``. >>> from nltk.tokenize impor...
null
170,918
import math import re import string from collections import defaultdict from typing import Any, Dict, Iterator, List, Match, Optional, Tuple, Union from nltk.probability import FreqDist from nltk.tokenize.api import TokenizerI The provided code snippet includes necessary dependencies for implementing the `_pair_iter` ...
Yields pairs of tokens from the given iterator such that each input token will appear as the first element in a yielded tuple. The last pair will have None as its second element.
170,919
import math import re import string from collections import defaultdict from typing import Any, Dict, Iterator, List, Match, Optional, Tuple, Union from nltk.probability import FreqDist from nltk.tokenize.api import TokenizerI DEBUG_DECISION_FMT = """Text: {text!r} (at offset {period_index}) Sentence break? {break_deci...
null
170,920
import math import re import string from collections import defaultdict from typing import Any, Dict, Iterator, List, Match, Optional, Tuple, Union from nltk.probability import FreqDist from nltk.tokenize.api import TokenizerI class PunktTrainer(PunktBaseClass): """Learns parameters used in Punkt sentence boundary ...
Builds a punkt model and applies it to the same text
170,921
import math import re try: import numpy except ImportError: pass from nltk.tokenize.api import TokenizerI The provided code snippet includes necessary dependencies for implementing the `smooth` function. Write a Python function `def smooth(x, window_len=11, window="flat")` to solve the following problem: smoot...
smooth the data using a window with requested size. This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the beginning and end part of the output signa...
170,922
import math import re from nltk.tokenize.api import TokenizerI class TextTilingTokenizer(TokenizerI): """Tokenize a document into topical sections using the TextTiling algorithm. This algorithm detects subtopic shifts based on the analysis of lexical co-occurrence patterns. The process starts by tokeniz...
null
170,923
import re from nltk.tokenize.api import TokenizerI from nltk.tokenize.util import regexp_span_tokenize class RegexpTokenizer(TokenizerI): r""" A tokenizer that splits a string using a regular expression, which matches either the tokens or the separators between tokens. >>> tokenizer = RegexpTokenize...
Return a tokenized copy of *text*. See :class:`.RegexpTokenizer` for descriptions of the arguments.
170,924
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk class E...
Extract the contents of the zip file ``filename`` into the directory ``root``.
170,925
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk def md5...
Create a new data.xml index file, by combining the xml description files for various packages and collections. ``root`` should be the path to a directory containing the package xml and zip files; and the collection xml files. The ``root`` directory is expected to have the following subdirectories:: root/ packages/ .......
170,926
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk The pr...
Helper for ``build_index()``: Perform some checks to make sure that the given package is consistent.
170,927
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk The pr...
Helper for ``build_index()``: Calculate the subversion revision number for a given file (by using ``subprocess`` to run ``svn``).
170,928
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk class D...
null
170,929
import functools import itertools import os import shutil import subprocess import sys import textwrap import threading import time import warnings import zipfile from hashlib import md5 from xml.etree import ElementTree from urllib.error import HTTPError, URLError from urllib.request import urlopen import nltk class D...
null
170,930
import logging import numpy as np from matplotlib import _api, artist as martist import matplotlib.transforms as mtransforms import matplotlib._layoutgrid as mlayoutgrid def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)): """ Make the layoutgrid tree. (Sub)Figures get a layoutgrid so we can have figu...
Do the constrained_layout. Called at draw time in ``figure.constrained_layout()`` Parameters ---------- fig : Figure ``Figure`` instance to do the layout in. renderer : Renderer Renderer to use. h_pad, w_pad : float Padding around the axes elements in figure-normalized units. hspace, wspace : float Fraction of the figu...
170,931
from matplotlib._tight_layout import * from matplotlib import _api def get_renderer(fig): canvas = fig.canvas if canvas and hasattr(canvas, "get_renderer"): return canvas.get_renderer() else: from . import backend_bases return backend_bases._get_renderer(fig)
null
170,932
import functools from numbers import Integral import numpy as np from numpy import ma import matplotlib as mpl from matplotlib import _api, _docstring from matplotlib.backend_bases import MouseButton from matplotlib.text import Text import matplotlib.path as mpath import matplotlib.ticker as ticker import matplotlib.cm...
null
170,933
import functools from numbers import Integral import numpy as np from numpy import ma import matplotlib as mpl from matplotlib import _api, _docstring from matplotlib.backend_bases import MouseButton from matplotlib.text import Text import matplotlib.path as mpath import matplotlib.ticker as ticker import matplotlib.cm...
Return whether first and last object in a sequence are the same. These are presumably coordinates on a polygonal curve, in which case this function tests if that curve is closed.
170,934
import functools from numbers import Integral import numpy as np from numpy import ma import matplotlib as mpl from matplotlib import _api, _docstring from matplotlib.backend_bases import MouseButton from matplotlib.text import Text import matplotlib.path as mpath import matplotlib.ticker as ticker import matplotlib.cm...
Parameters ---------- xys : (N, 2) array-like Coordinates of vertices. p : (float, float) Coordinates of point. Returns ------- d2min : float Minimum square distance of *p* to *xys*. proj : (float, float) Projection of *p* onto *xys*. imin : (int, int) Consecutive indices of vertices of segment in *xys* where *proj* is...
170,935
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
Decorator for the get_offset method of OffsetBox and subclasses, that allows supporting both the new signature (self, bbox, renderer) and the old signature (self, width, height, xdescent, ydescent, renderer).
170,936
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
null
170,937
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
null
170,938
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
r""" Pack boxes specified by their *widths*. For simplicity of the description, the terminology used here assumes a horizontal layout, but the function works equally for a vertical layout. There are three packing *mode*\s: - 'fixed': The elements are packed tight to the left with a spacing of *sep* in between. If *tota...
170,939
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
Align boxes each specified by their ``(y0, y1)`` spans. For simplicity of the description, the terminology used here assumes a horizontal layout (i.e., vertical alignment), but the function works equally for a vertical layout. Parameters ---------- yspans List of (y0, y1) spans of boxes to be aligned. height : float or...
170,940
import functools import numpy as np import matplotlib as mpl from matplotlib import _api, _docstring import matplotlib.artist as martist import matplotlib.path as mpath import matplotlib.text as mtext import matplotlib.transforms as mtransforms from matplotlib.font_manager import FontProperties from matplotlib.image im...
Return the (x, y) position of the *bbox* anchored at the *parentbbox* with the *loc* code with the *borderpad*.
170,941
import math import types import numpy as np import matplotlib as mpl from matplotlib import _api, cbook from matplotlib.axes import Axes import matplotlib.axis as maxis import matplotlib.markers as mmarkers import matplotlib.patches as mpatches from matplotlib.path import Path import matplotlib.ticker as mticker import...
Determine if a wedge (in degrees) spans the full circle. The condition is derived from :class:`~matplotlib.patches.Wedge`.
170,942
import math import types import numpy as np import matplotlib as mpl from matplotlib import _api, cbook from matplotlib.axes import Axes import matplotlib.axis as maxis import matplotlib.markers as mmarkers import matplotlib.patches as mpatches from matplotlib.path import Path import matplotlib.ticker as mticker import...
Determine if a wedge (in radians) spans the full circle. The condition is derived from :class:`~matplotlib.patches.Wedge`.
170,943
from collections import namedtuple import logging import re from ._mathtext_data import uni2type1 _log = logging.getLogger(__name__) def _to_int(x): # Some AFM files have floats where we are expecting ints -- there is # probably a better way to handle this (support floats, round rather than # truncate). Bu...
Read the font metrics header (up to the char metrics) and returns a dictionary mapping *key* to *val*. *val* will be converted to the appropriate python type as necessary; e.g.: * 'False'->False * '0'->0 * '-168 -218 1000 898'-> [-168, -218, 1000, 898] Dictionary keys are StartFontMetrics, FontName, FullName, FamilyNam...
170,944
from collections import namedtuple import logging import re from ._mathtext_data import uni2type1 def _to_int(x): # Some AFM files have floats where we are expecting ints -- there is # probably a better way to handle this (support floats, round rather than # truncate). But I don't know what the best approa...
Parse the given filehandle for character metrics information and return the information as dicts. It is assumed that the file cursor is on the line behind 'StartCharMetrics'. Returns ------- ascii_d : dict A mapping "ASCII num of the character" to `.CharMetrics`. name_d : dict A mapping "character name" to `.CharMetric...
170,945
from collections import namedtuple import logging import re from ._mathtext_data import uni2type1 def _parse_kern_pairs(fh): """ Return a kern pairs dictionary; keys are (*char1*, *char2*) tuples and values are the kern pair value. For example, a kern pairs line like ``KPX A y -50`` will be represe...
Parse the optional fields for kern pair data and composites. Returns ------- kern_data : dict A dict containing kerning information. May be empty. See `._parse_kern_pairs`. composites : dict A dict containing composite information. May be empty. See `._parse_composites`.
170,946
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path The provided code snippet includes necessar...
Generate a ``__str__`` method for a `.Transform` subclass. After :: class T: __str__ = _make_str_method("attr", key="other") ``str(T(...))`` will be .. code-block:: text {type(T).__name__}( {self.attr}, key={self.other})
170,947
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path class Affine2DBase(AffineBase): """ ...
Create a new "blended" transform using *x_transform* to transform the *x*-axis and *y_transform* to transform the *y*-axis. A faster version of the blended transform is returned for the case where both child transforms are affine.
170,948
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path class Affine2D(Affine2DBase): """ A ...
Create a new composite transform that is the result of applying transform a then transform b. Shortcut versions of the blended transform are provided for the case where both child transforms are affine, or one or the other is the identity transform. Composite transforms may also be created using the '+' operator, e.g.:...
170,949
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path The provided code snippet includes necessar...
Modify the endpoints of a range as needed to avoid singularities. Parameters ---------- vmin, vmax : float The initial endpoints. expander : float, default: 0.001 Fractional amount by which *vmin* and *vmax* are expanded if the original interval is too small, based on *tiny*. tiny : float, default: 1e-15 Threshold for ...
170,950
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path The provided code snippet includes necessar...
Check, inclusively, whether an interval includes a given value. Parameters ---------- interval : (float, float) The endpoints of the interval. val : float Value to check is within interval. Returns ------- bool Whether *val* is within the *interval*.
170,951
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path The provided code snippet includes necessar...
Check, inclusively, whether an interval includes a given value, with the interval expanded by a small tolerance to admit floating point errors. Parameters ---------- interval : (float, float) The endpoints of the interval. val : float Value to check is within interval. rtol : float, default: 1e-10 Relative tolerance sl...
170,952
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path The provided code snippet includes necessar...
Check, excluding endpoints, whether an interval includes a given value. Parameters ---------- interval : (float, float) The endpoints of the interval. val : float Value to check is within interval. Returns ------- bool Whether *val* is within the *interval*.
170,953
import copy import functools import textwrap import weakref import math import numpy as np from numpy.linalg import inv from matplotlib import _api from matplotlib._path import ( affine_transform, count_bboxes_overlapping_bbox, update_path_extents) from .path import Path class Affine2D(Affine2DBase): """ A ...
Return a new transform with an added offset. Parameters ---------- trans : `Transform` subclass Any transform, to which offset will be applied. fig : `~matplotlib.figure.Figure`, default: None Current figure. It can be None if *units* are 'dots'. x, y : float, default: 0.0 The offset to apply. units : {'inches', 'point...
170,954
import copy from numbers import Integral, Number, Real import logging import numpy as np import matplotlib as mpl from . import _api, cbook, colors as mcolors, _docstring from .artist import Artist, allow_rasterization from .cbook import ( _to_unmasked_float_array, ls_mapper, ls_mapper_r, STEP_LOOKUP_MAP) from .mar...
Convert linestyle to dash pattern.
170,955
import copy from numbers import Integral, Number, Real import logging import numpy as np import matplotlib as mpl from . import _api, cbook, colors as mcolors, _docstring from .artist import Artist, allow_rasterization from .cbook import ( _to_unmasked_float_array, ls_mapper, ls_mapper_r, STEP_LOOKUP_MAP) from .mar...
null
170,956
import copy from numbers import Integral, Number, Real import logging import numpy as np import matplotlib as mpl from . import _api, cbook, colors as mcolors, _docstring from .artist import Artist, allow_rasterization from .cbook import ( _to_unmasked_float_array, ls_mapper, ls_mapper_r, STEP_LOOKUP_MAP) from .mar...
Return the indices of the segments in the polyline with coordinates (*cx*, *cy*) that are within a distance *radius* of the point (*x*, *y*).
170,957
import copy from numbers import Integral, Number, Real import logging import numpy as np import matplotlib as mpl from . import _api, cbook, colors as mcolors, _docstring from .artist import Artist, allow_rasterization from .cbook import ( _to_unmasked_float_array, ls_mapper, ls_mapper_r, STEP_LOOKUP_MAP) from .mar...
Helper function that sorts out how to deal the input `markevery` and returns the points where markers should be drawn. Takes in the `markevery` value and the line path and returns the sub-sampled path.
170,958
import numpy as np from matplotlib import _api from matplotlib.path import Path def _validate_hatch_pattern(hatch): valid_hatch_patterns = set(r'-+|/\xXoO.*') if hatch is not None: invalids = set(hatch).difference(valid_hatch_patterns) if invalids: valid = ''.join(sorted(valid_hatch...
null
170,959
import numpy as np from matplotlib import _api from matplotlib.path import Path _hatch_types = [ HorizontalHatch, VerticalHatch, NorthEastHatch, SouthEastHatch, SmallCircles, LargeCircles, SmallFilledCircles, Stars ] class Path: """ A series of possibly disconnected, possibl...
Given a hatch specifier, *hatchpattern*, generates Path to render the hatch in a unit square. *density* is the number of lines per unit square.
170,960
import binascii import functools import logging import re import string import struct import numpy as np from matplotlib.cbook import _format_approx from . import _api class _NameToken(_Token): kind = 'name' def is_slash_name(self): return self.raw.startswith('/') def value(self): return sel...
A generator that produces _Token instances from Type-1 font code. The consumer of the generator may send an integer to the tokenizer to indicate that the next token should be _BinaryToken of the given length. Parameters ---------- data : bytes The data of the font to tokenize. skip_ws : bool If true, the generator will...
170,961
import binascii import functools import logging import re import string import struct import numpy as np from matplotlib.cbook import _format_approx from . import _api class _BalancedExpression(_Token): pass The provided code snippet includes necessary dependencies for implementing the `_expression` function. Writ...
Consume some number of tokens and return a balanced PostScript expression. Parameters ---------- initial : _Token The token that triggered parsing a balanced expression. tokens : iterator of _Token Following tokens. data : bytes Underlying data that the token positions point to. Returns ------- _BalancedExpression
170,962
The provided code snippet includes necessary dependencies for implementing the `blocking_input_loop` function. Write a Python function `def blocking_input_loop(figure, event_names, timeout, handler)` to solve the following problem: Run *figure*'s event loop while listening to interactive events. The events listed in ...
Run *figure*'s event loop while listening to interactive events. The events listed in *event_names* are passed to *handler*. This function is used to implement `.Figure.waitforbuttonpress`, `.Figure.ginput`, and `.Axes.clabel`. Parameters ---------- figure : `~matplotlib.figure.Figure` event_names : list of str The nam...
170,963
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D def adjust_bbox(fig, bbox_inches, fixed_dpi=None): """ Temporarily adjust the figure so that only the specified area (bbox_inches) is saved. It modifies fig.bbox, fig.bbox_inches, fig.transFigure._boxout, and fig.patch. While the fig...
A function that needs to be called when figure dpi changes during the drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with the new dpi.
170,964
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
Import and return ``pyplot``, correctly setting the backend if one is already forced.
170,965
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
Register a backend for saving to a given file format. Parameters ---------- format : str File extension backend : module string or canvas class Backend for handling file output description : str, default: "" Description of the file type.
170,966
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
Return the registered default canvas for given file format. Handles deferred import of required backend.
170,967
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
null
170,968
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
null
170,969
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
null
170,970
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
Return whether we are in a terminal IPython, but non interactive. When in _terminal_ IPython, ip.parent will have and `interact` attribute, if this attribute is False we do not setup eventloop integration as the user will _not_ interact with IPython. In all other case (ZMQKernel, or is interactive), we do.
170,971
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
Implement the default Matplotlib key bindings for the canvas and toolbar described at :ref:`key-event-handling`. Parameters ---------- event : `KeyEvent` A key press/release event. canvas : `FigureCanvasBase`, default: ``event.canvas`` The backend-specific canvas instance. This parameter is kept for back-compatibility,...
170,972
from collections import namedtuple from contextlib import ExitStack, contextmanager, nullcontext from enum import Enum, IntEnum import functools import importlib import inspect import io import itertools import logging import os import sys import time from weakref import WeakKeyDictionary import numpy as np import matp...
The default Matplotlib button actions for extra mouse buttons. Parameters are as for `key_press_handler`, except that *event* is a `MouseEvent`.
170,973
from collections import namedtuple import contextlib from functools import lru_cache, wraps import inspect from inspect import Signature, Parameter import logging from numbers import Number import re import warnings import numpy as np import matplotlib as mpl from . import _api, cbook from .colors import BoundaryNorm f...
null
170,974
from collections import namedtuple import contextlib from functools import lru_cache, wraps import inspect from inspect import Signature, Parameter import logging from numbers import Number import re import warnings import numpy as np import matplotlib as mpl from . import _api, cbook from .colors import BoundaryNorm f...
Decorator for Artist.draw method. Needed on the outermost artist, i.e. Figure, to finish up if the render is still in rasterized mode.
170,975
from collections import namedtuple import contextlib from functools import lru_cache, wraps import inspect from inspect import Signature, Parameter import logging from numbers import Number import re import warnings import numpy as np import matplotlib as mpl from . import _api, cbook from .colors import BoundaryNorm f...
null
170,976
from collections import namedtuple import contextlib from functools import lru_cache, wraps import inspect from inspect import Signature, Parameter import logging from numbers import Number import re import warnings import numpy as np import matplotlib as mpl from . import _api, cbook from .colors import BoundaryNorm f...
Return the value of an `.Artist`'s *property*, or print all of them. Parameters ---------- obj : `.Artist` The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`. property : str or None, default: None If *property* is 'somename', this function returns ``obj.get_somename()``. If it's None (or unset), it *...
170,977
from collections import namedtuple import contextlib from functools import lru_cache, wraps import inspect from inspect import Signature, Parameter import logging from numbers import Number import re import warnings import numpy as np import matplotlib as mpl from . import _api, cbook from .colors import BoundaryNorm f...
r""" Inspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and return information about its settable properties and their current values. Parameters ---------- artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s Returns ------- str The settable properties of *artist*, as plain text if :r...
170,978
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Reset the Matplotlib date epoch so it can be set again. Only for use in tests and examples.
170,979
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Set the epoch (origin for dates) for datetime calculations. The default epoch is :rc:`dates.epoch` (by default 1970-01-01T00:00). If microsecond accuracy is desired, the date being plotted needs to be within approximately 70 years of the epoch. Matplotlib internally represents dates as days since the epoch, so floating...
170,980
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Convert Gregorian float of the date, preserving hours, minutes, seconds and microseconds. Return value is a `.datetime`. The input date *x* is a float in ordinal days at UTC, and the output will be the specified `.datetime` object corresponding to that time in timezone *tz*, or if *tz* is ``None``, in the timezone spec...
170,981
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Convert a date string to a datenum using `dateutil.parser.parse`. Parameters ---------- d : str or sequence of str The dates to convert. default : datetime.datetime, optional The default date to use when fields are missing in *d*.
170,982
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Convert a Julian date (or sequence) to a Matplotlib date (or sequence). Parameters ---------- j : float or sequence of floats Julian dates (days relative to 4713 BC Jan 1, 12:00:00 Julian calendar or 4714 BC Nov 24, 12:00:00, proleptic Gregorian calendar). Returns ------- float or sequence of floats Matplotlib dates (d...
170,983
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Convert a Matplotlib date (or sequence) to a Julian date (or sequence). Parameters ---------- n : float or sequence of floats Matplotlib dates (days relative to `.get_epoch`). Returns ------- float or sequence of floats Julian dates (days relative to 4713 BC Jan 1, 12:00:00).
170,984
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Convert number of days to a `~datetime.timedelta` object. If *x* is a sequence, a sequence of `~datetime.timedelta` objects will be returned. Parameters ---------- x : float, sequence of floats Number of days. The fraction part represents hours, minutes, seconds. Returns ------- `datetime.timedelta` or list[`datetime.t...
170,985
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Return a sequence of equally spaced Matplotlib dates. The dates start at *dstart* and reach up to, but not including *dend*. They are spaced by *delta*. Parameters ---------- dstart, dend : `~datetime.datetime` The date limits. delta : `datetime.timedelta` Spacing of the dates. Returns ------- `numpy.array` A list floa...
170,986
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
null
170,987
import datetime import functools import logging import math import re from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY) from dateutil.relativedelta import relativedelta import dateutil.parser...
Create a date locator with *numticks* (approx) and a date formatter for *span* in days. Return value is (locator, formatter).
170,988
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,989
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,990
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,991
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
Confirm s is string 'figure' or convert s to float or raise.
170,992
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
Return a validator that converts inputs to *cls* or raises (and possibly allows ``None`` as well).
170,993
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,994
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
Confirm that this is a Postscript or PDF font type that we know how to convert to.
170,995
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,996
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,997
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
Return a valid color arg.
170,998
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
170,999
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,000
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,001
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,002
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,003
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,004
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,005
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,006
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,007
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,008
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null
171,009
import ast from functools import lru_cache, reduce from numbers import Number import operator import os import re import numpy as np from matplotlib import _api, cbook from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig...
null