Skip to content

Commit 95c35f9

Browse files
authored
chore: remove future import (#66)
1 parent a0de47c commit 95c35f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+74
-299
lines changed

cytomine/cytomine.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,26 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
try:
2318
from json.decoder import JSONDecodeError
2419
except ImportError:
2520
# Python 2
2621
JSONDecodeError = ValueError
2722

28-
import logging
2923
import base64
24+
import functools
3025
import hashlib
3126
import hmac
32-
import sys
27+
import logging
3328
import os
34-
import requests
3529
import shutil
36-
import warnings
37-
import functools
30+
import sys
3831
import time
39-
from time import strftime, gmtime
40-
from future.builtins import bytes
32+
import warnings
4133
from argparse import ArgumentParser
34+
from time import gmtime, strftime
35+
36+
import requests
4237
from cachecontrol import CacheControlAdapter
4338
from requests_toolbelt import MultipartEncoder
4439
from requests_toolbelt.utils import dump
@@ -729,8 +724,12 @@ def upload_image(self, filename, id_storage, id_project=None,
729724
return False
730725

731726
def _process_upload_response(self, response_data):
727+
from .models.image import (
728+
AbstractImage,
729+
ImageInstance,
730+
ImageInstanceCollection,
731+
)
732732
from .models.storage import UploadedFile
733-
from .models.image import AbstractImage, ImageInstance, ImageInstanceCollection
734733

735734
self._logger.debug("Entering _process_upload_response(response_data=%s)", response_data)
736735

cytomine/models/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@
5151
Term,
5252
TermCollection,
5353
)
54-
from .project import (
55-
Project,
56-
ProjectCollection,
57-
)
54+
from .project import Project, ProjectCollection
5855
from .property import (
5956
AttachedFile,
6057
AttachedFileCollection,

cytomine/models/_utilities/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from .parallel import generic_download, makedirs, is_false
18-
from .dump import generic_image_dump, DumpError
19-
from .pattern_matching import resolve_pattern, is_iterable
17+
from .dump import DumpError, generic_image_dump
18+
from .parallel import generic_download, is_false, makedirs
19+
from .pattern_matching import is_iterable, resolve_pattern

cytomine/models/_utilities/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
except ImportError:
2323
import Queue as queue
2424

25-
from threading import Thread
2625
from multiprocessing import cpu_count
26+
from threading import Thread
2727

2828

2929
def is_false(v):

cytomine/models/annotation.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
2317
import os
24-
import re
2518

2619
from cytomine.cytomine import Cytomine
27-
from cytomine.models.collection import Collection, CollectionPartialUploadException
20+
from cytomine.models.collection import Collection
2821
from cytomine.models.model import Model
29-
from ._utilities import generic_image_dump, generic_download, is_false
22+
23+
from ._utilities import generic_download, generic_image_dump, is_false
3024

3125

3226
class Annotation(Model):

cytomine/models/collection.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,22 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
2317
# Importing collections.abc objects from collections is deprecated
2418
# since python 3.3.
2519
from sys import version_info
20+
2621
if version_info.major < 3 or \
2722
(version_info.major == 3 and version_info.minor < 3):
2823
from collections import MutableSequence
2924
else:
3025
from collections.abc import MutableSequence
3126

32-
import six
3327
import copy
3428

29+
import six
30+
3531
from cytomine.cytomine import Cytomine
32+
3633
from ._utilities.parallel import generic_chunk_parallel
3734

3835

cytomine/models/image.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
23-
import re
2417
import os
18+
import re
2519

2620
from cytomine.cytomine import Cytomine, deprecated
2721
from cytomine.models.collection import Collection
2822
from cytomine.models.model import Model
23+
2924
from ._utilities import generic_image_dump
3025

3126

cytomine/models/imagegroup.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
import re
23-
import os
24-
2517
__author__ = "Rubens Ulysse <urubens@uliege.be>"
2618
__contributors__ = ["Marée Raphaël <raphael.maree@uliege.be>", "Mormont Romain <r.mormont@uliege.be>"]
2719
__copyright__ = "Copyright 2010-2022 University of Liège, Belgium, http://www.cytomine.be/"

cytomine/models/model.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
17+
import json
2218

2319
import six
24-
import json
2520

2621
from cytomine.cytomine import Cytomine
2722

cytomine/models/ontology.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
from cytomine.cytomine import Cytomine
23-
24-
2518
from cytomine.models.collection import Collection
2619
from cytomine.models.model import Model
2720

cytomine/models/project.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
from cytomine import Cytomine
23-
24-
2518
from cytomine.models.collection import Collection
2619
from cytomine.models.model import Model
2720

cytomine/models/property.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,12 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
import re
2318

24-
2519
from cytomine.cytomine import Cytomine
2620
from cytomine.models.annotation import Annotation
2721
from cytomine.models.collection import Collection, DomainCollection
28-
from cytomine.models.model import Model, DomainModel
22+
from cytomine.models.model import DomainModel, Model
2923

3024

3125
class Property(DomainModel):

cytomine/models/social.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
2317
from cytomine.models.collection import Collection
2418
from cytomine.models.model import Model
2519

cytomine/models/storage.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217

2318
from cytomine.models.collection import Collection
2419
from cytomine.models.model import Model

cytomine/models/track.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
22-
2317
from cytomine.cytomine import Cytomine
2418
from cytomine.models.collection import Collection
2519
from cytomine.models.model import Model

cytomine/models/user.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217

2318
from cytomine.cytomine import Cytomine
2419
from cytomine.models.collection import Collection

cytomine/utilities/annotations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from cytomine.models import AnnotationCollection
22

3-
43
REVIEWED_INCLUDE = 1
54
REVIEWED_ONLY = 2
65
REVIEWED_EXCLUDE = 0

examples/add_annotation.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
2117

2218
import logging
2319
import sys
@@ -26,9 +22,12 @@
2622
from shapely.geometry import Point, box
2723

2824
from cytomine import Cytomine
29-
from cytomine.models import Property, Annotation, AnnotationTerm, AnnotationCollection
30-
31-
25+
from cytomine.models import (
26+
Annotation,
27+
AnnotationCollection,
28+
AnnotationTerm,
29+
Property,
30+
)
3231

3332
logging.basicConfig()
3433
logger = logging.getLogger("cytomine.client")

examples/add_annotation_links.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
2117

2218
import logging
2319
import sys
@@ -26,8 +22,13 @@
2622
from shapely.geometry import Point, box
2723

2824
from cytomine import Cytomine
29-
from cytomine.models import Annotation, AnnotationCollection, \
30-
ImageGroupImageInstanceCollection, AnnotationGroup, AnnotationLink
25+
from cytomine.models import (
26+
Annotation,
27+
AnnotationCollection,
28+
AnnotationGroup,
29+
AnnotationLink,
30+
ImageGroupImageInstanceCollection,
31+
)
3132

3233
logging.basicConfig()
3334
logger = logging.getLogger("cytomine.client")

examples/add_imagegroup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,10 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
import logging
2318
import sys
2419
from argparse import ArgumentParser
2520

26-
2721
from cytomine import Cytomine
2822
from cytomine.models import ImageGroup, ImageGroupImageInstance
2923
from cytomine.models.image import ImageInstanceCollection

examples/add_ontology.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@
1414
# * See the License for the specific language governing permissions and
1515
# * limitations under the License.
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
21-
2217
import logging
2318
import sys
2419
from argparse import ArgumentParser
2520

2621
from cytomine import Cytomine
27-
from cytomine.models.ontology import Ontology, Term, RelationTerm, TermCollection
28-
29-
22+
from cytomine.models.ontology import (
23+
Ontology,
24+
RelationTerm,
25+
Term,
26+
TermCollection,
27+
)
3028

3129
logging.basicConfig()
3230
logger = logging.getLogger("cytomine.client")

0 commit comments

Comments
 (0)