Skip to content

Commit

Permalink
Merge pull request #795 from utf/tqdm-auto
Browse files Browse the repository at this point in the history
Use tqdm.auto to avoid warnings on tqdm imports.
  • Loading branch information
rkingsbury authored Jun 8, 2023
2 parents 6d89f0a + 8f843d8 commit 3176c62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/maggma/cli/multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from concurrent.futures import ProcessPoolExecutor
from logging import getLogger
from types import GeneratorType
from typing import Any, Awaitable, Callable, Dict, Optional
from typing import Any, Callable, Dict, Optional

from aioitertools import enumerate
from tqdm import tqdm
from tqdm.auto import tqdm

from maggma.utils import primed

Expand Down Expand Up @@ -87,7 +87,9 @@ async def process_and_release(self, idx):
async def get_from_iterator(self):
loop = get_event_loop()
async for idx, item in enumerate(self.iterator):
future = loop.run_in_executor(self.executor, safe_dispatch, (self.func, item))
future = loop.run_in_executor(
self.executor, safe_dispatch, (self.func, item)
)

self.tasks[idx] = future

Expand Down
2 changes: 1 addition & 1 deletion src/maggma/cli/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from types import GeneratorType

from tqdm import tqdm
from tqdm.auto import tqdm

from maggma.core import Builder
from maggma.utils import grouper, primed
Expand Down
2 changes: 1 addition & 1 deletion src/maggma/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pymongo.collection import Collection

# import tqdm Jupyter widget if running inside Jupyter
from tqdm.autonotebook import tqdm
from tqdm.auto import tqdm


def primed(iterable: Iterable) -> Iterable:
Expand Down

0 comments on commit 3176c62

Please sign in to comment.