repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
pytorch-lightning
src/lightning/fabric/strategies/single_xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
89
3,250
pytorch-lightning
src/lightning/fabric/strategies/model_parallel.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
615
26,902
pytorch-lightning
src/lightning/fabric/strategies/fsdp.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
965
44,724
pytorch-lightning
src/lightning/fabric/strategies/ddp.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
274
11,611
pytorch-lightning
src/lightning/fabric/strategies/launchers/launcher.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
37
1,421
pytorch-lightning
src/lightning/fabric/strategies/launchers/xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
129
5,002
pytorch-lightning
src/lightning/fabric/strategies/launchers/multiprocessing.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
262
11,178
pytorch-lightning
src/lightning/fabric/strategies/launchers/subprocess_script.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
235
10,055
pytorch-lightning
src/lightning/fabric/_graveyard/tpu.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
122
4,355
pytorch-lightning
src/lightning/fabric/accelerators/cpu.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
102
3,005
pytorch-lightning
src/lightning/fabric/accelerators/xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
180
6,467
pytorch-lightning
src/lightning/fabric/accelerators/registry.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
130
4,486
pytorch-lightning
src/lightning/fabric/accelerators/accelerator.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
68
2,046
pytorch-lightning
src/lightning/fabric/accelerators/mps.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
98
3,063
pytorch-lightning
src/lightning/fabric/accelerators/cuda.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
187
7,256
pytorch-lightning
src/lightning/fabric/utilities/types.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
91
2,620
pytorch-lightning
src/lightning/fabric/utilities/device_parser.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
222
7,859
pytorch-lightning
src/lightning/fabric/utilities/logger.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
184
6,194
pytorch-lightning
src/lightning/fabric/utilities/consolidate_checkpoint.py
.py
import logging import sys from argparse import ArgumentParser, Namespace from pathlib import Path import torch from lightning.fabric.utilities.cloud_io import _checkpoint_join, _resolve_path, get_filesystem from lightning.fabric.utilities.load import _METADATA_FILENAME, _load_distributed_checkpoint _log = logging.ge...
84
3,421
pytorch-lightning
src/lightning/fabric/utilities/device_dtype_mixin.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
126
4,668
pytorch-lightning
src/lightning/fabric/utilities/seed.py
.py
import logging import os import random from random import getstate as python_get_rng_state from random import setstate as python_set_rng_state from typing import Any, Optional import torch from lightning.fabric.utilities.imports import _NUMPY_AVAILABLE from lightning.fabric.utilities.rank_zero import _get_rank, rank_...
163
6,773
pytorch-lightning
src/lightning/fabric/utilities/distributed.py
.py
import atexit import contextlib import logging import os import signal import time from collections.abc import Iterable, Iterator, Sized from contextlib import nullcontext from datetime import timedelta from pathlib import Path from typing import TYPE_CHECKING, Any, Optional, Union import torch import torch.nn.functio...
436
17,531
pytorch-lightning
src/lightning/fabric/utilities/warnings.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
60
2,270
pytorch-lightning
src/lightning/fabric/utilities/load.py
.py
# Copyright 2023 MathInf GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this files from this repository except in compliance # with the License reproduced below (also at # http://www.apache.org/licenses/LICENSE-2.0). # # Unless required by applicable law or agreed to in writi...
269
9,767
pytorch-lightning
src/lightning/fabric/utilities/__init__.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
44
1,549
pytorch-lightning
src/lightning/fabric/utilities/apply_func.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
137
4,775
pytorch-lightning
src/lightning/fabric/utilities/spike.py
.py
import json import os import warnings from typing import TYPE_CHECKING, Any, Literal, Optional, Union import torch from lightning.fabric.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_1_0_0 from lightning.fabric.utilities.types import _PATH if TYPE_CHECKING: from lightning.fabric.fabric import Fabric cla...
177
7,579
pytorch-lightning
src/lightning/fabric/utilities/registry.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
58
2,148
pytorch-lightning
src/lightning/fabric/utilities/data.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
511
23,278
pytorch-lightning
src/lightning/fabric/utilities/imports.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
37
1,504
pytorch-lightning
src/lightning/fabric/utilities/init.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
116
4,589
pytorch-lightning
src/lightning/fabric/utilities/throughput.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
720
29,525
pytorch-lightning
src/lightning/fabric/utilities/rank_zero.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
58
1,976
pytorch-lightning
src/lightning/fabric/utilities/cloud_io.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
288
11,366
pytorch-lightning
src/lightning/fabric/utilities/optimizer.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
42
1,789
pytorch-lightning
src/lightning/fabric/utilities/testing/__init__.py
.py
from lightning.fabric.utilities.testing._runif import _runif_reasons __all__ = ["_runif_reasons"]
4
99
pytorch-lightning
src/lightning/fabric/utilities/testing/_runif.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
128
4,890
pytorch-lightning
src/lightning/fabric/plugins/__init__.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
43
1,836
pytorch-lightning
src/lightning/fabric/plugins/environments/lightning.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
125
4,131
pytorch-lightning
src/lightning/fabric/plugins/environments/torchelastic.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
94
3,361
pytorch-lightning
src/lightning/fabric/plugins/environments/slurm.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
233
8,949
pytorch-lightning
src/lightning/fabric/plugins/environments/xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
136
4,004
pytorch-lightning
src/lightning/fabric/plugins/environments/kubeflow.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
79
2,362
pytorch-lightning
src/lightning/fabric/plugins/environments/cluster_environment.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
72
2,415
pytorch-lightning
src/lightning/fabric/plugins/environments/mpi.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
132
4,369
pytorch-lightning
src/lightning/fabric/plugins/environments/lsf.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
201
7,729
pytorch-lightning
src/lightning/fabric/plugins/collectives/collective.py
.py
from abc import ABC, abstractmethod from typing import Any, Optional from torch import Tensor from typing_extensions import Self from lightning.fabric.utilities.types import CollectibleGroup class Collective(ABC): """Interface for collective operations. Supports communications between multiple processes an...
120
3,532
pytorch-lightning
src/lightning/fabric/plugins/collectives/__init__.py
.py
from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.plugins.collectives.single_device import SingleDeviceCollective from lightning.fabric.plugins.collectives.torch_collective import TorchCollective __all__ = [ "Collective", "TorchCollective", "SingleDeviceCollective...
10
325
pytorch-lightning
src/lightning/fabric/plugins/collectives/single_device.py
.py
from typing import Any from torch import Tensor from typing_extensions import override from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.utilities.types import CollectibleGroup class SingleDeviceCollective(Collective): """Support for collective operations on a single d...
108
2,615
pytorch-lightning
src/lightning/fabric/plugins/collectives/torch_collective.py
.py
import datetime import os from typing import Any, Optional, Union import torch import torch.distributed as dist from torch import Tensor from typing_extensions import Self, override from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.utilities.types import CollectibleGroup, Re...
220
8,770
pytorch-lightning
src/lightning/fabric/plugins/precision/bitsandbytes.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
449
21,464
pytorch-lightning
src/lightning/fabric/plugins/precision/deepspeed.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
101
3,587
pytorch-lightning
src/lightning/fabric/plugins/precision/utils.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
66
2,553
pytorch-lightning
src/lightning/fabric/plugins/precision/half.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
64
2,353
pytorch-lightning
src/lightning/fabric/plugins/precision/__init__.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
35
1,459
pytorch-lightning
src/lightning/fabric/plugins/precision/xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
74
2,502
pytorch-lightning
src/lightning/fabric/plugins/precision/double.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
55
1,963
pytorch-lightning
src/lightning/fabric/plugins/precision/precision.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
163
5,592
pytorch-lightning
src/lightning/fabric/plugins/precision/amp.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
124
4,919
pytorch-lightning
src/lightning/fabric/plugins/precision/transformer_engine.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
183
8,308
pytorch-lightning
src/lightning/fabric/plugins/precision/fsdp.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
169
6,846
pytorch-lightning
src/lightning/fabric/plugins/io/torch_io.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
105
4,214
pytorch-lightning
src/lightning/fabric/plugins/io/xla.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
75
3,004
pytorch-lightning
src/lightning/fabric/plugins/io/checkpoint_io.py
.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
80
3,207
tqdm
tqdm/_monitor.py
.py
import atexit from threading import Event, Thread, current_thread from time import time from warnings import warn __all__ = ["TMonitor", "TqdmSynchronisationWarning"] class TqdmSynchronisationWarning(RuntimeWarning): """ tqdm multi-thread/-process errors which may cause incorrect nesting but otherwise no...
105
4,013
tqdm
tqdm/gui.py
.py
""" Matplotlib GUI progress bar decorator for iterators. Usage: >>> from tqdm.gui import trange, tqdm >>> for i in trange(10): ... ... """ # future division is important to divide integers and get as # a result precise floating numbers (instead of truncated int) import re from warnings import warn # to inherit fr...
180
5,481
tqdm
tqdm/_utils.py
.py
from warnings import warn from .std import TqdmDeprecationWarning from .utils import ( # noqa: F401, pylint: disable=unused-import CUR_OS, IS_NIX, IS_WIN, RE_ANSI, Comparable, FormatReplace, SimpleTextIOWrapper, _environ_cols_wrapper, _is_ascii, _is_utf, _screen_shape_linux, _screen_shape_tput, _screen_sh...
12
559
tqdm
tqdm/_tqdm_gui.py
.py
from warnings import warn from .gui import * # NOQA from .gui import __all__ # NOQA from .std import TqdmDeprecationWarning warn("This function will be removed in tqdm==5.0.0\n" "Please use `tqdm.gui.*` instead of `tqdm._tqdm_gui.*`", TqdmDeprecationWarning, stacklevel=2)
10
287
tqdm
tqdm/asyncio.py
.py
""" Asynchronous progress bar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm.asyncio import trange, tqdm >>> async for i in trange(10): ... ... """ import asyncio from sys import version_info from .std import tqdm as std_tqdm __author__ = {"github.com/": [...
104
3,196
tqdm
tqdm/utils.py
.py
""" General helpers required for `tqdm.std`. """ import os import re import sys from functools import partial, partialmethod, wraps from inspect import signature # TODO consider using wcswidth third-party package for 0-width characters from unicodedata import east_asian_width from warnings import warn from weakref impo...
329
9,746
tqdm
tqdm/autonotebook.py
.py
""" Automatically choose between `tqdm.notebook` and `tqdm.std`. Usage: >>> from tqdm.autonotebook import trange, tqdm >>> for i in trange(10): ... ... """ import os import sys from warnings import warn try: if 'ipykernel.zmqshell' in sys.modules: if any(i == 'QT_API' or i.startswith('SPYDER') for i i...
39
1,440
tqdm
tqdm/_tqdm_pandas.py
.py
import sys __author__ = "github.com/casperdcl" __all__ = ['tqdm_pandas'] def tqdm_pandas(tclass, **tqdm_kwargs): """ Registers the given `tqdm` instance with `pandas.core.groupby.DataFrameGroupBy.progress_apply`. """ from tqdm import TqdmDeprecationWarning if isinstance(tclass, type) or (get...
25
888
tqdm
tqdm/rich.py
.py
""" `rich.progress` decorator for iterators. Usage: >>> from tqdm.rich import trange, tqdm >>> for i in trange(10): ... ... """ from warnings import warn from rich.progress import ( BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize) from .std import TqdmExperimentalW...
155
5,255
tqdm
tqdm/__init__.py
.py
from ._monitor import TMonitor, TqdmSynchronisationWarning from ._tqdm_pandas import tqdm_pandas from .cli import main # TODO: remove in v5.0.0 from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0 from .gui import trange as tgrange # TODO: remove in v5.0.0 from .std import ( TqdmDeprecationWarning, TqdmExp...
39
1,572
tqdm
tqdm/version.py
.py
"""`tqdm` version detector. Precedence: installed dist, git, 'UNKNOWN'.""" from importlib.metadata import PackageNotFoundError, version try: __version__ = version('tqdm') except PackageNotFoundError: __version__ = "UNKNOWN"
8
233
tqdm
tqdm/_tqdm.py
.py
from warnings import warn from .std import * # NOQA from .std import __all__ # NOQA from .std import TqdmDeprecationWarning warn("This function will be removed in tqdm==5.0.0\n" "Please use `tqdm.std.*` instead of `tqdm._tqdm.*`", TqdmDeprecationWarning, stacklevel=2)
10
283
tqdm
tqdm/_main.py
.py
from warnings import warn from .cli import * # NOQA from .cli import __all__ # NOQA from .std import TqdmDeprecationWarning warn("This function will be removed in tqdm==5.0.0\n" "Please use `tqdm.cli.*` instead of `tqdm._main.*`", TqdmDeprecationWarning, stacklevel=2)
10
283
tqdm
tqdm/dask.py
.py
from functools import partial from dask.callbacks import Callback from .auto import tqdm as tqdm_auto __author__ = {"github.com/": ["casperdcl"]} __all__ = ['TqdmCallback'] class TqdmCallback(Callback): """Dask callback for task progress.""" def __init__(self, start=None, pretask=None, tqdm_class=tqdm_auto...
45
1,319
tqdm
tqdm/notebook.py
.py
""" IPython/Jupyter Notebook progress bar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm.notebook import trange, tqdm >>> for i in trange(10): ... ... """ # import compatibility functions and utilities import re import sys from html import escape from weakre...
318
10,888
tqdm
tqdm/keras.py
.py
from copy import copy from functools import partial from .auto import tqdm as tqdm_auto try: import keras except (ImportError, AttributeError) as e: try: from tensorflow import keras except ImportError: raise e __author__ = {"github.com/": ["casperdcl"]} __all__ = ['TqdmCallback'] class ...
124
4,396
tqdm
tqdm/std.py
.py
""" Customisable progress bar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm import trange, tqdm >>> for i in trange(10): ... ... """ import sys from collections import OrderedDict, defaultdict from contextlib import contextmanager from datetime import datet...
1,534
58,074
tqdm
tqdm/tk.py
.py
""" Tkinter GUI progress bar decorator for iterators. Usage: >>> from tqdm.tk import trange, tqdm >>> for i in trange(10): ... ... """ import re import sys import tkinter import tkinter.ttk as ttk from warnings import warn from .std import TqdmExperimentalWarning, TqdmWarning from .std import tqdm as std_tqdm __...
197
6,702
tqdm
tqdm/cli.py
.py
""" Module version for monitoring CLI pipes (`... | python -m tqdm | ...`). """ import logging import re import sys from ast import literal_eval from textwrap import indent from .std import TqdmKeyError, TqdmTypeError, tqdm from .version import __version__ __all__ = ["main"] log = logging.getLogger(__name__) def ca...
325
11,011
tqdm
tqdm/auto.py
.py
""" Enables multiple commonly used features. Method resolution order: - `tqdm.autonotebook` without import warnings - `tqdm.asyncio` - `tqdm.std` base class Usage: >>> from tqdm.auto import trange, tqdm >>> for i in trange(10): ... ... """ import warnings from .std import TqdmExperimentalWarning with warnings....
41
871
tqdm
tqdm/_tqdm_notebook.py
.py
from warnings import warn from .notebook import * # NOQA from .notebook import __all__ # NOQA from .std import TqdmDeprecationWarning warn("This function will be removed in tqdm==5.0.0\n" "Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`", TqdmDeprecationWarning, stacklevel=2)
10
307
tqdm
tqdm/contrib/itertools.py
.py
""" Thin wrappers around `itertools`. """ import itertools import math from ..auto import tqdm as tqdm_auto __author__ = {"github.com/": ["casperdcl"]} __all__ = [ 'chain', 'product', 'permutations', 'combinations', 'combinations_with_replacement', 'batched'] def chain(*iterables, total=None, tqdm_class=tqdm_au...
93
2,949
tqdm
tqdm/contrib/logging.py
.py
""" Helper functionality for interoperability with stdlib `logging`. """ import logging import sys from contextlib import contextmanager try: from typing import Iterator, List, Optional, Type # noqa: F401, pylint: disable=unused-import except ImportError: pass from ..std import tqdm as std_tqdm class _Tqdm...
129
3,902
tqdm
tqdm/contrib/slack.py
.py
""" Sends updates to a Slack app. Usage: >>> from tqdm.contrib.slack import tqdm, trange >>> for i in trange(10, token='{token}', channel='{channel}'): ... ... ![screenshot](https://tqdm.github.io/img/screenshot-slack.png) """ import logging try: from slack_sdk import WebClient except ImportError: raise ...
120
4,049
tqdm
tqdm/contrib/__init__.py
.py
""" Thin wrappers around common functions. Subpackages contain potentially unstable extensions. """ from warnings import warn from ..auto import tqdm as tqdm_auto from ..std import TqdmDeprecationWarning, tqdm from ..utils import ObjectWrapper __author__ = {"github.com/": ["casperdcl"]} __all__ = ['tenumerate', 'tzi...
92
2,479
tqdm
tqdm/contrib/bells.py
.py
""" Even more features than `tqdm.auto` (all the bells & whistles): - `tqdm.auto` - `tqdm.tqdm.pandas` - `tqdm.contrib.slack` + uses `${TQDM_SLACK_TOKEN}` and `${TQDM_SLACK_CHANNEL}` - `tqdm.contrib.telegram` + uses `${TQDM_TELEGRAM_TOKEN}` and `${TQDM_TELEGRAM_CHAT_ID}` - `tqdm.contrib.discord` + uses `${...
29
921
tqdm
tqdm/contrib/concurrent.py
.py
""" Thin wrappers around `concurrent.futures`. """ import sys from contextlib import contextmanager from operator import length_hint from ..auto import tqdm as tqdm_auto from ..std import TqdmWarning __author__ = {"github.com/": ["casperdcl"]} __all__ = ['thread_map', 'process_map', 'interpreter_map'] class _Interp...
260
9,849
tqdm
tqdm/contrib/telegram.py
.py
""" Sends updates to a Telegram bot. Usage: >>> from tqdm.contrib.telegram import tqdm, trange >>> for i in trange(10, token='{token}', chat_id='{chat_id}'): ... ... ![screenshot](https://tqdm.github.io/img/screenshot-telegram.gif) """ from warnings import warn from requests import Session from ..auto import tq...
153
5,081
tqdm
tqdm/contrib/utils_worker.py
.py
""" IO/concurrency helpers for `tqdm.contrib`. """ from collections import deque from concurrent.futures import ThreadPoolExecutor from ..auto import tqdm as tqdm_auto __author__ = {"github.com/": ["casperdcl"]} __all__ = ['MonoWorker'] class MonoWorker: """ Supports one running task and one waiting task. ...
39
1,199
tqdm
tqdm/contrib/discord.py
.py
""" Sends updates to a Discord bot. Usage: >>> from tqdm.contrib.discord import tqdm, trange >>> for i in trange(10, token='{token}', channel_id='{channel_id}'): ... ... ![screenshot](https://tqdm.github.io/img/screenshot-discord.png) """ from warnings import warn from requests import Session from requests.utils...
156
5,337
tqdm
benchmarks/benchmarks.py
.py
# Write the benchmarking functions here. # See "Writing benchmarks" in the asv docs for more information. from functools import partial class Comparison: """Running time of wrapped empty loops""" def __init__(self, length): try: from time import process_time self.time = process...
90
2,380
tqdm
tests/tests_contrib_logging.py
.py
# pylint: disable=missing-module-docstring, missing-class-docstring # pylint: disable=missing-function-docstring, no-self-use import logging import logging.handlers import sys from io import StringIO import pytest from tqdm import tqdm from tqdm.contrib.logging import _get_first_found_console_logging_handler from tqd...
187
7,449
tqdm
tests/tests_tk.py
.py
"""Test `tqdm.tk`.""" from .tests_tqdm import importorskip def test_tk_import(): """Test `tqdm.tk` import""" importorskip('tqdm.tk')
8
143
tqdm
tests/tests_pandas.py
.py
from tqdm import tqdm from .tests_tqdm import StringIO, closing, importorskip, mark, skip pytestmark = mark.slow np = importorskip('numpy') random = importorskip('numpy.random') rand = random.rand randint = random.randint pd = importorskip('pandas') def test_pandas_setup(): """Test tqdm.pandas()""" with cl...
224
8,263
tqdm
tests/tests_itertools.py
.py
""" Tests for `tqdm.contrib.itertools`. """ import itertools as it import pytest from tqdm.contrib import itertools as tit def no_len(iterable): yield from iterable def test_chain(capsys): """Test contrib.itertools.chain""" a = range(9) assert list(tit.chain(a, a)) == list(it.chain(a, a)) asse...
118
3,877
tqdm
tests/tests_asyncio.py
.py
"""Tests `tqdm.asyncio`.""" import asyncio from functools import partial from sys import platform from time import time from tqdm.asyncio import tarange, tqdm_asyncio from .tests_tqdm import StringIO, closing, mark tqdm = partial(tqdm_asyncio, miniters=0, mininterval=0) trange = partial(tarange, miniters=0, mininter...
185
4,713