File size: 6,566 Bytes
4c85bea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
import abc
from collections.abc import Callable, Collection, Iterable, Sequence, Generator
import contextlib
from pathlib import Path
from matplotlib.artist import Artist
from matplotlib.backend_bases import TimerBase
from matplotlib.figure import Figure

from typing import Any

subprocess_creation_flags: int

def adjusted_figsize(w: float, h: float, dpi: float, n: int) -> tuple[float, float]: ...

class MovieWriterRegistry:
    def __init__(self) -> None: ...
    def register(
        self, name: str
    ) -> Callable[[type[AbstractMovieWriter]], type[AbstractMovieWriter]]: ...
    def is_available(self, name: str) -> bool: ...
    def __iter__(self) -> Generator[str, None, None]: ...
    def list(self) -> list[str]: ...
    def __getitem__(self, name: str) -> type[AbstractMovieWriter]: ...

writers: MovieWriterRegistry

class AbstractMovieWriter(abc.ABC, metaclass=abc.ABCMeta):
    fps: int
    metadata: dict[str, str]
    codec: str
    bitrate: int
    def __init__(
        self,
        fps: int = ...,
        metadata: dict[str, str] | None = ...,
        codec: str | None = ...,
        bitrate: int | None = ...,
    ) -> None: ...
    outfile: str | Path
    fig: Figure
    dpi: float

    @abc.abstractmethod
    def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
    @property
    def frame_size(self) -> tuple[int, int]: ...
    @abc.abstractmethod
    def grab_frame(self, **savefig_kwargs) -> None: ...
    @abc.abstractmethod
    def finish(self) -> None: ...
    @contextlib.contextmanager
    def saving(
        self, fig: Figure, outfile: str | Path, dpi: float | None, *args, **kwargs
    ) -> Generator[AbstractMovieWriter, None, None]: ...

class MovieWriter(AbstractMovieWriter):
    supported_formats: list[str]
    frame_format: str
    extra_args: list[str] | None
    def __init__(
        self,
        fps: int = ...,
        codec: str | None = ...,
        bitrate: int | None = ...,
        extra_args: list[str] | None = ...,
        metadata: dict[str, str] | None = ...,
    ) -> None: ...
    def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
    def grab_frame(self, **savefig_kwargs) -> None: ...
    def finish(self) -> None: ...
    @classmethod
    def bin_path(cls) -> str: ...
    @classmethod
    def isAvailable(cls) -> bool: ...

class FileMovieWriter(MovieWriter):
    fig: Figure
    outfile: str | Path
    dpi: float
    temp_prefix: str
    fname_format_str: str
    def setup(
        self,
        fig: Figure,
        outfile: str | Path,
        dpi: float | None = ...,
        frame_prefix: str | Path | None = ...,
    ) -> None: ...
    def __del__(self) -> None: ...
    @property
    def frame_format(self) -> str: ...
    @frame_format.setter
    def frame_format(self, frame_format: str) -> None: ...

class PillowWriter(AbstractMovieWriter):
    @classmethod
    def isAvailable(cls) -> bool: ...
    def setup(
        self, fig: Figure, outfile: str | Path, dpi: float | None = ...
    ) -> None: ...
    def grab_frame(self, **savefig_kwargs) -> None: ...
    def finish(self) -> None: ...

class FFMpegBase:
    codec: str
    @property
    def output_args(self) -> list[str]: ...

class FFMpegWriter(FFMpegBase, MovieWriter): ...

class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
    supported_formats: list[str]

class ImageMagickBase:
    @classmethod
    def bin_path(cls) -> str: ...
    @classmethod
    def isAvailable(cls) -> bool: ...

class ImageMagickWriter(ImageMagickBase, MovieWriter):
    input_names: str

class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
    supported_formats: list[str]
    @property
    def input_names(self) -> str: ...

class HTMLWriter(FileMovieWriter):
    supported_formats: list[str]
    @classmethod
    def isAvailable(cls) -> bool: ...
    embed_frames: bool
    default_mode: str
    def __init__(
        self,
        fps: int = ...,
        codec: str | None = ...,
        bitrate: int | None = ...,
        extra_args: list[str] | None = ...,
        metadata: dict[str, str] | None = ...,
        embed_frames: bool = ...,
        default_mode: str = ...,
        embed_limit: float | None = ...,
    ) -> None: ...
    def setup(
        self,
        fig: Figure,
        outfile: str | Path,
        dpi: float | None = ...,
        frame_dir: str | Path | None = ...,
    ) -> None: ...
    def grab_frame(self, **savefig_kwargs): ...
    def finish(self) -> None: ...

class Animation:
    frame_seq: Iterable[Artist]
    event_source: Any
    def __init__(
        self, fig: Figure, event_source: Any | None = ..., blit: bool = ...
    ) -> None: ...
    def __del__(self) -> None: ...
    def save(
        self,
        filename: str | Path,
        writer: AbstractMovieWriter | str | None = ...,
        fps: int | None = ...,
        dpi: float | None = ...,
        codec: str | None = ...,
        bitrate: int | None = ...,
        extra_args: list[str] | None = ...,
        metadata: dict[str, str] | None = ...,
        extra_anim: list[Animation] | None = ...,
        savefig_kwargs: dict[str, Any] | None = ...,
        *,
        progress_callback: Callable[[int, int], Any] | None = ...
    ) -> None: ...
    def new_frame_seq(self) -> Iterable[Artist]: ...
    def new_saved_frame_seq(self) -> Iterable[Artist]: ...
    def to_html5_video(self, embed_limit: float | None = ...) -> str: ...
    def to_jshtml(
        self,
        fps: int | None = ...,
        embed_frames: bool = ...,
        default_mode: str | None = ...,
    ) -> str: ...
    def _repr_html_(self) -> str: ...
    def pause(self) -> None: ...
    def resume(self) -> None: ...

class TimedAnimation(Animation):
    def __init__(
        self,
        fig: Figure,
        interval: int = ...,
        repeat_delay: int = ...,
        repeat: bool = ...,
        event_source: TimerBase | None = ...,
        *args,
        **kwargs
    ) -> None: ...

class ArtistAnimation(TimedAnimation):
    def __init__(self, fig: Figure, artists: Sequence[Collection[Artist]], *args, **kwargs) -> None: ...

class FuncAnimation(TimedAnimation):
    def __init__(
        self,
        fig: Figure,
        func: Callable[..., Iterable[Artist]],
        frames: Iterable | int | Callable[[], Generator] | None = ...,
        init_func: Callable[[], Iterable[Artist]] | None = ...,
        fargs: tuple[Any, ...] | None = ...,
        save_count: int | None = ...,
        *,
        cache_frame_data: bool = ...,
        **kwargs
    ) -> None: ...