Skip to content

Commit

Permalink
chore: remove future import (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
bathienle authored Nov 7, 2024
1 parent a0de47c commit 95c35f9
Show file tree
Hide file tree
Showing 46 changed files with 74 additions and 299 deletions.
25 changes: 12 additions & 13 deletions cytomine/cytomine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,26 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

try:
from json.decoder import JSONDecodeError
except ImportError:
# Python 2
JSONDecodeError = ValueError

import logging
import base64
import functools
import hashlib
import hmac
import sys
import logging
import os
import requests
import shutil
import warnings
import functools
import sys
import time
from time import strftime, gmtime
from future.builtins import bytes
import warnings
from argparse import ArgumentParser
from time import gmtime, strftime

import requests
from cachecontrol import CacheControlAdapter
from requests_toolbelt import MultipartEncoder
from requests_toolbelt.utils import dump
Expand Down Expand Up @@ -729,8 +724,12 @@ def upload_image(self, filename, id_storage, id_project=None,
return False

def _process_upload_response(self, response_data):
from .models.image import (
AbstractImage,
ImageInstance,
ImageInstanceCollection,
)
from .models.storage import UploadedFile
from .models.image import AbstractImage, ImageInstance, ImageInstanceCollection

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

Expand Down
5 changes: 1 addition & 4 deletions cytomine/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@
Term,
TermCollection,
)
from .project import (
Project,
ProjectCollection,
)
from .project import Project, ProjectCollection
from .property import (
AttachedFile,
AttachedFileCollection,
Expand Down
6 changes: 3 additions & 3 deletions cytomine/models/_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from .parallel import generic_download, makedirs, is_false
from .dump import generic_image_dump, DumpError
from .pattern_matching import resolve_pattern, is_iterable
from .dump import DumpError, generic_image_dump
from .parallel import generic_download, is_false, makedirs
from .pattern_matching import is_iterable, resolve_pattern
2 changes: 1 addition & 1 deletion cytomine/models/_utilities/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
except ImportError:
import Queue as queue

from threading import Thread
from multiprocessing import cpu_count
from threading import Thread


def is_false(v):
Expand Down
12 changes: 3 additions & 9 deletions cytomine/models/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


import os
import re

from cytomine.cytomine import Cytomine
from cytomine.models.collection import Collection, CollectionPartialUploadException
from cytomine.models.collection import Collection
from cytomine.models.model import Model
from ._utilities import generic_image_dump, generic_download, is_false

from ._utilities import generic_download, generic_image_dump, is_false


class Annotation(Model):
Expand Down
11 changes: 4 additions & 7 deletions cytomine/models/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,22 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


# Importing collections.abc objects from collections is deprecated
# since python 3.3.
from sys import version_info

if version_info.major < 3 or \
(version_info.major == 3 and version_info.minor < 3):
from collections import MutableSequence
else:
from collections.abc import MutableSequence

import six
import copy

import six

from cytomine.cytomine import Cytomine

from ._utilities.parallel import generic_chunk_parallel


Expand Down
9 changes: 2 additions & 7 deletions cytomine/models/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


import re
import os
import re

from cytomine.cytomine import Cytomine, deprecated
from cytomine.models.collection import Collection
from cytomine.models.model import Model

from ._utilities import generic_image_dump


Expand Down
8 changes: 0 additions & 8 deletions cytomine/models/imagegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import re
import os

__author__ = "Rubens Ulysse <[email protected]>"
__contributors__ = ["Marée Raphaël <[email protected]>", "Mormont Romain <[email protected]>"]
__copyright__ = "Copyright 2010-2022 University of Liège, Belgium, http://www.cytomine.be/"
Expand Down
7 changes: 1 addition & 6 deletions cytomine/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import json

import six
import json

from cytomine.cytomine import Cytomine

Expand Down
7 changes: 0 additions & 7 deletions cytomine/models/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from cytomine.cytomine import Cytomine


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

Expand Down
7 changes: 0 additions & 7 deletions cytomine/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from cytomine import Cytomine


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

Expand Down
8 changes: 1 addition & 7 deletions cytomine/models/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import re


from cytomine.cytomine import Cytomine
from cytomine.models.annotation import Annotation
from cytomine.models.collection import Collection, DomainCollection
from cytomine.models.model import Model, DomainModel
from cytomine.models.model import DomainModel, Model


class Property(DomainModel):
Expand Down
6 changes: 0 additions & 6 deletions cytomine/models/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


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

Expand Down
5 changes: 0 additions & 5 deletions cytomine/models/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


from cytomine.models.collection import Collection
from cytomine.models.model import Model
Expand Down
6 changes: 0 additions & 6 deletions cytomine/models/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


from cytomine.cytomine import Cytomine
from cytomine.models.collection import Collection
from cytomine.models.model import Model
Expand Down
5 changes: 0 additions & 5 deletions cytomine/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


from cytomine.cytomine import Cytomine
from cytomine.models.collection import Collection
Expand Down
1 change: 0 additions & 1 deletion cytomine/utilities/annotations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from cytomine.models import AnnotationCollection


REVIEWED_INCLUDE = 1
REVIEWED_ONLY = 2
REVIEWED_EXCLUDE = 0
Expand Down
13 changes: 6 additions & 7 deletions examples/add_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import logging
import sys
Expand All @@ -26,9 +22,12 @@
from shapely.geometry import Point, box

from cytomine import Cytomine
from cytomine.models import Property, Annotation, AnnotationTerm, AnnotationCollection


from cytomine.models import (
Annotation,
AnnotationCollection,
AnnotationTerm,
Property,
)

logging.basicConfig()
logger = logging.getLogger("cytomine.client")
Expand Down
13 changes: 7 additions & 6 deletions examples/add_annotation_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import logging
import sys
Expand All @@ -26,8 +22,13 @@
from shapely.geometry import Point, box

from cytomine import Cytomine
from cytomine.models import Annotation, AnnotationCollection, \
ImageGroupImageInstanceCollection, AnnotationGroup, AnnotationLink
from cytomine.models import (
Annotation,
AnnotationCollection,
AnnotationGroup,
AnnotationLink,
ImageGroupImageInstanceCollection,
)

logging.basicConfig()
logger = logging.getLogger("cytomine.client")
Expand Down
6 changes: 0 additions & 6 deletions examples/add_imagegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import logging
import sys
from argparse import ArgumentParser


from cytomine import Cytomine
from cytomine.models import ImageGroup, ImageGroupImageInstance
from cytomine.models.image import ImageInstanceCollection
Expand Down
14 changes: 6 additions & 8 deletions examples/add_ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@
# * See the License for the specific language governing permissions and
# * limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import logging
import sys
from argparse import ArgumentParser

from cytomine import Cytomine
from cytomine.models.ontology import Ontology, Term, RelationTerm, TermCollection


from cytomine.models.ontology import (
Ontology,
RelationTerm,
Term,
TermCollection,
)

logging.basicConfig()
logger = logging.getLogger("cytomine.client")
Expand Down
Loading

0 comments on commit 95c35f9

Please sign in to comment.