Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .yapfignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pytest.ini
Makefile
*.txt
*.ini
11 changes: 4 additions & 7 deletions labelbox/schema/annotation_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from typing import Any, BinaryIO, Dict, List, Union, TYPE_CHECKING, cast

import backoff
from google.api_core import retry
from labelbox import parser
import requests
from tqdm import tqdm # type: ignore
Expand Down Expand Up @@ -109,12 +109,9 @@ def wait_until_done(self,
pbar.update(100 - pbar.n)
pbar.close()

@backoff.on_exception(
backoff.expo,
(labelbox.exceptions.ApiLimitError, labelbox.exceptions.TimeoutError,
labelbox.exceptions.NetworkError),
max_tries=10,
jitter=None)
@retry.Retry(predicate=retry.if_exception_type(
labelbox.exceptions.ApiLimitError, labelbox.exceptions.TimeoutError,
labelbox.exceptions.NetworkError))
def __backoff_refresh(self) -> None:
self.refresh()

Expand Down
10 changes: 4 additions & 6 deletions labelbox/schema/bulk_import_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from pathlib import Path
import pydantic
import backoff
from google.api_core import retry
from labelbox import parser
import requests
from pydantic import BaseModel, root_validator, validator
Expand Down Expand Up @@ -197,11 +197,9 @@ def wait_until_done(self, sleep_time_seconds: int = 5) -> None:
time.sleep(sleep_time_seconds)
self.__exponential_backoff_refresh()

@backoff.on_exception(
backoff.expo, (lb_exceptions.ApiLimitError, lb_exceptions.TimeoutError,
lb_exceptions.NetworkError),
max_tries=10,
jitter=None)
@retry.Retry(predicate=retry.if_exception_type(lb_exceptions.ApiLimitError,
lb_exceptions.TimeoutError,
lb_exceptions.NetworkError))
def __exponential_backoff_refresh(self) -> None:
self.refresh()

Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[mypy]

[mypy-backoff.*]
ignore_missing_imports = True

[mypy-google.*]
ignore_missing_imports = True

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
backoff==1.10.0
geojson
google-api-core>=1.22.1
imagesize
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
url="https://labelbox.com",
packages=setuptools.find_packages(),
install_requires=[
"backoff==1.10.0", "requests>=2.22.0", "google-api-core>=1.22.1",
"pydantic>=1.8,<2.0", "tqdm", "python-dateutil>=2.8.2,<2.9.0"
"requests>=2.22.0", "google-api-core>=1.22.1", "pydantic>=1.8,<2.0",
"tqdm", "python-dateutil>=2.8.2,<2.9.0"
],
extras_require={
'data': [
Expand Down