Skip to content

Commit

Permalink
Revert "Dropped Python 3.8: remove unnecessary `from __future__ impor…
Browse files Browse the repository at this point in the history
…t annotations` statements"

This reverts commit ae359f6.
  • Loading branch information
PierreRaybaut committed Nov 6, 2024
1 parent ae359f6 commit 4dae9dd
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 6 deletions.
2 changes: 2 additions & 0 deletions guidata/configtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
.. autofunction:: add_image_module_path
"""

from __future__ import annotations

import gettext
import os
import os.path as osp
Expand Down
2 changes: 2 additions & 0 deletions guidata/dataset/autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
classes.
"""

from __future__ import annotations

import logging
import re
from inspect import Parameter, Signature
Expand Down
2 changes: 2 additions & 0 deletions guidata/dataset/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
.. autofunction:: guidata.dataset.create_dataset_from_dict
"""

from __future__ import annotations

import inspect
from typing import TYPE_CHECKING, Any

Expand Down
2 changes: 2 additions & 0 deletions guidata/dataset/note_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

"""Sphinx directive to display a note about how to instanciate a dataset class"""

from __future__ import annotations

from typing import TYPE_CHECKING, Type

from docutils import nodes
Expand Down
2 changes: 2 additions & 0 deletions guidata/dataset/qtitemwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Example: ChoiceWidget <--> ChoiceItem, ImageChoiceItem
"""

from __future__ import annotations

import datetime
import os
import os.path as osp
Expand Down
2 changes: 2 additions & 0 deletions guidata/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Execution environmnent utilities
"""

from __future__ import annotations

import argparse
import enum
import os
Expand Down
11 changes: 5 additions & 6 deletions guidata/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ def end(self, section: str) -> None:
section (str): The name of the section to end.
"""
sect = self.option.pop(-1)
assert sect == section, (
"Ending section does not match the current section: %s != %s"
% (
sect,
section,
)
assert (
sect == section
), "Ending section does not match the current section: %s != %s" % (
sect,
section,
)


Expand Down
2 changes: 2 additions & 0 deletions guidata/io/h5fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
HDF5 files (.h5)
"""

from __future__ import annotations

import datetime
import sys
from collections.abc import Callable, Sequence
Expand Down
2 changes: 2 additions & 0 deletions guidata/io/inifmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Configuration files (.ini)
"""

from __future__ import annotations

from typing import Any

from guidata.io.base import BaseIOHandler, GroupContext, WriterMixin
Expand Down
2 changes: 2 additions & 0 deletions guidata/io/jsonfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

# pylint: disable=invalid-name # Allows short reference names like x, y, ...

from __future__ import annotations

import json
import os
from collections.abc import Callable, Sequence
Expand Down
2 changes: 2 additions & 0 deletions guidata/qthelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
.. autofunction:: save_restore_stds
"""

from __future__ import annotations

import os
import os.path as osp
import sys
Expand Down
2 changes: 2 additions & 0 deletions guidata/tests/unit/test_dataset_from_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

# guitest: show

from __future__ import annotations

import numpy as np

from guidata.dataset import create_dataset_from_func
Expand Down
2 changes: 2 additions & 0 deletions guidata/tests/unit/test_h5fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* Serialize and deserialize a data model, handling versioning and compatibility breaks.
"""

from __future__ import annotations

import atexit
import os
import os.path as osp
Expand Down
2 changes: 2 additions & 0 deletions guidata/tests/unit/test_jsonfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* Serialize and deserialize a data model, handling versioning and compatibility breaks.
"""

from __future__ import annotations

import atexit
import os
import os.path as osp
Expand Down
2 changes: 2 additions & 0 deletions guidata/tests/widgets/test_arrayeditor_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

# guitest: show

from __future__ import annotations

from typing import Any

import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions guidata/tests/widgets/test_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Test dark/light theme switching
"""

from __future__ import annotations

import os
import sys
from typing import Literal
Expand Down
2 changes: 2 additions & 0 deletions guidata/utils/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
source code (Utilities/__init___.py) Copyright © 2003-2009 Detlev Offenbach
"""

from __future__ import annotations

import os
import re
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32
Expand Down
2 changes: 2 additions & 0 deletions guidata/utils/genreqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
This module is derived from the `genreqs.py` module of the `DataLab` project.
"""

from __future__ import annotations

import configparser as cp
import os
import os.path as osp
Expand Down
2 changes: 2 additions & 0 deletions guidata/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
.. autofunction:: decode_fs_string
"""

from __future__ import annotations

import collections.abc
import ctypes
import locale
Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"""

from __future__ import annotations

import platform
import sys

Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/arrayeditor/arrayeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Module that provides array editor dialog boxes to edit various types of NumPy arrays
"""

from __future__ import annotations

from typing import Generic

import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/arrayeditor/arrayhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
models/widgets and views. They handle data access and changes.
"""

from __future__ import annotations

import copy
from typing import Any, Generic, TypeVar, Union, cast

Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/arrayeditor/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Data models for the array editor widget.
"""

from __future__ import annotations

from abc import abstractmethod
from collections.abc import Callable
from functools import reduce
Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/arrayeditor/editorwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Array editor widget"""

from __future__ import annotations

import io
from typing import Any, Generic, Sequence, cast

Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/dockable.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
into a QMainWindow.
"""

from __future__ import annotations

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QDockWidget, QWidget

Expand Down
2 changes: 2 additions & 0 deletions guidata/widgets/objecteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"""

from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np
Expand Down

0 comments on commit 4dae9dd

Please sign in to comment.