Skip to content

Commit

Permalink
doctests: suppress more print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jan 11, 2024
1 parent 2e6e6e6 commit a3da419
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions fafbseg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
# GNU General Public License for more details.
"""Collection of utility functions."""

import collections
import requests
import os
import six
import requests
import collections

import numpy as np

from concurrent import futures
from pathlib import Path
from tqdm.auto import tqdm
from functools import wraps
from urllib.parse import urlparse, urlencode
from concurrent import futures
from collections.abc import Iterable
from pathlib import Path
from urllib.parse import urlparse, urlencode

use_pbars = True

Expand All @@ -34,10 +35,11 @@

def never_cache(function):
"""Decorate to prevent caching of server responses."""

@wraps(function)
def wrapper(*args, **kwargs):
# Find CATMAID instances
instances = [v for k, v in kwargs.items() if '_instance' in k]
instances = [v for k, v in kwargs.items() if "_instance" in k]

# Keep track of old caching settings
old_values = [i.caching for i in instances]
Expand All @@ -55,6 +57,7 @@ def wrapper(*args, **kwargs):
rm.caching = old
# Return result
return res

return wrapper


Expand Down Expand Up @@ -269,7 +272,7 @@ def download_cache_file(url, filename=None, force_reload=False, verbose=True):
fp = cache_dir / Path(url).name

if not fp.exists() or force_reload:
if verbose:
if verbose and not os.environ.get("FAFBSEG_TESTING", False):
print(
f"Caching {fp.name} from {urlparse(url).netloc}... ", end="", flush=True
)
Expand Down

0 comments on commit a3da419

Please sign in to comment.