Skip to content

Commit d8b7b9e

Browse files
committed
simplified it to use TQDM's inbuild envvar
1 parent c0c6487 commit d8b7b9e

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

roboflow/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def get_conditional_configuration_variable(key, default):
7575
DEFAULT_JOB_NAME = "Annotated via API"
7676

7777
RF_WORKSPACES = get_conditional_configuration_variable("workspaces", default={})
78-
TQDM_DESCRIPTIONS = os.getenv("TQDM_DESCRIPTIONS", "true")
78+
TQDM_DISABLE = os.getenv("TQDM_DISABLE", None)
7979

8080
def load_roboflow_api_key(workspace_url=None):
8181
if os.getenv("ROBOFLOW_API_KEY") is not None:

roboflow/core/version.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import yaml
1313
from dotenv import load_dotenv
1414
from tqdm import tqdm
15-
1615
from roboflow.config import (
1716
API_URL,
1817
APP_URL,
@@ -23,7 +22,7 @@
2322
TYPE_OBJECT_DETECTION,
2423
TYPE_SEMANTIC_SEGMENTATION,
2524
UNIVERSE_URL,
26-
TQDM_DESCRIPTIONS
25+
TQDM_DISABLE
2726
)
2827
from roboflow.core.dataset import Dataset
2928
from roboflow.models.classification import ClassificationModel
@@ -741,10 +740,7 @@ def bar_progress(current, total, width=80):
741740
# write the zip file to the desired location
742741
with open(location + "/roboflow.zip", "wb") as f:
743742
total_length = int(response.headers.get("content-length"))
744-
if TQDM_DESCRIPTIONS == "false":
745-
desc = None
746-
else:
747-
desc = f"Downloading Dataset Version Zip in {location} to {format}:"
743+
desc = None if TQDM_DISABLE else f"Downloading Dataset Version Zip in {location} to {format}:"
748744
for chunk in tqdm(
749745
response.iter_content(chunk_size=1024),
750746
desc=desc,
@@ -771,10 +767,7 @@ def __extract_zip(self, location, format):
771767
Raises:
772768
RuntimeError: If there is an error unzipping the file
773769
""" # noqa: E501 // docs
774-
if TQDM_DESCRIPTIONS == "false":
775-
desc = None
776-
else:
777-
desc = f"Extracting Dataset Version Zip to {location} in {format}:"
770+
desc = None if TQDM_DISABLE else f"Extracting Dataset Version Zip to {location} in {format}:"
778771
with zipfile.ZipFile(location + "/roboflow.zip", "r") as zip_ref:
779772
for member in tqdm(
780773
zip_ref.infolist(),

0 commit comments

Comments
 (0)