Skip to content

Commit

Permalink
Dropped Python 3.8: remove unnecessary `from __future__ import annota…
Browse files Browse the repository at this point in the history
…tions` statements
  • Loading branch information
PierreRaybaut committed Nov 6, 2024
1 parent e2ea090 commit ae359f6
Show file tree
Hide file tree
Showing 27 changed files with 9 additions and 57 deletions.
5 changes: 3 additions & 2 deletions doc/dev/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Moreover, the following guidelines should be followed:
should follow the `Google style <http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#Comments>`_.

* Add typing annotations for all functions and methods. The annotations should
use the future syntax (``from __future__ import annotations``) and the
``if TYPE_CHECKING`` pattern to avoid circular imports (see
use the future syntax ``from __future__ import annotations`` (see
`PEP 563 <https://www.python.org/dev/peps/pep-0563/>`_)
and the ``if TYPE_CHECKING`` pattern to avoid circular imports (see
`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_).

.. note::
Expand Down
2 changes: 0 additions & 2 deletions guidata/configtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
.. autofunction:: add_image_module_path
"""

from __future__ import annotations

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

from __future__ import annotations

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

from __future__ import annotations

import inspect
from typing import TYPE_CHECKING, Any

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

"""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: 0 additions & 2 deletions guidata/dataset/qtitemwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
Example: ChoiceWidget <--> ChoiceItem, ImageChoiceItem
"""

from __future__ import annotations

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

from __future__ import annotations

import argparse
import enum
import os
Expand Down
11 changes: 6 additions & 5 deletions guidata/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ 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: 0 additions & 2 deletions guidata/io/h5fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
HDF5 files (.h5)
"""

from __future__ import annotations

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

from __future__ import annotations

from typing import Any

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

# 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: 0 additions & 2 deletions guidata/qthelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
.. autofunction:: save_restore_stds
"""

from __future__ import annotations

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

# guitest: show

from __future__ import annotations

import numpy as np

from guidata.dataset import create_dataset_from_func
Expand Down
2 changes: 0 additions & 2 deletions guidata/tests/unit/test_h5fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* 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: 0 additions & 2 deletions guidata/tests/unit/test_jsonfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* 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: 0 additions & 2 deletions guidata/tests/widgets/test_arrayeditor_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

# guitest: show

from __future__ import annotations

from typing import Any

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

from __future__ import annotations

import os
import sys
from typing import Literal
Expand Down
2 changes: 0 additions & 2 deletions guidata/utils/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
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: 0 additions & 2 deletions guidata/utils/genreqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
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: 0 additions & 2 deletions guidata/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
.. autofunction:: decode_fs_string
"""

from __future__ import annotations

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

from __future__ import annotations

import platform
import sys

Expand Down
2 changes: 0 additions & 2 deletions guidata/widgets/arrayeditor/arrayeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
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: 0 additions & 2 deletions guidata/widgets/arrayeditor/arrayhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
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: 0 additions & 2 deletions guidata/widgets/arrayeditor/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
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: 0 additions & 2 deletions guidata/widgets/arrayeditor/editorwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Array editor widget"""

from __future__ import annotations

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

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

from __future__ import annotations

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

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

from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np
Expand Down

0 comments on commit ae359f6

Please sign in to comment.