Drop support for Python 2.

This commit is contained in:
Dion Moult
2024-05-07 12:17:46 +10:00
parent 7e13ed746e
commit 89c4cbeb05
17 changed files with 2 additions and 67 deletions
@@ -30,10 +30,6 @@ Example:
model = ifcopenshell.open("/path/to/model.ifc") model = ifcopenshell.open("/path/to/model.ifc")
""" """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import sys import sys
import zipfile import zipfile
@@ -17,10 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools import functools
import importlib import importlib
import numbers import numbers
@@ -17,8 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
import sys import sys
import nodes import nodes
import templates import templates
@@ -17,13 +17,10 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
import io import io
import string import string
import operator import operator
import collections import collections
import bootstrap import bootstrap
class Node: class Node:
+1 -13
View File
@@ -17,11 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import annotations
import os import os
import re import re
import numbers import numbers
@@ -34,13 +29,6 @@ from typing import Optional, Any
from . import ifcopenshell_wrapper from . import ifcopenshell_wrapper
from .entity_instance import entity_instance from .entity_instance import entity_instance
try:
# Python 2
basestring
except NameError:
# Python 3 or newer
basestring = (str, bytes)
class Transaction: class Transaction:
def __init__(self, ifc_file): def __init__(self, ifc_file):
@@ -403,7 +391,7 @@ class file(object):
def __getitem__(self, key): def __getitem__(self, key):
if isinstance(key, numbers.Integral): if isinstance(key, numbers.Integral):
return entity_instance(self.wrapped_data.by_id(key), self) return entity_instance(self.wrapped_data.by_id(key), self)
elif isinstance(key, basestring): elif isinstance(key, (str, bytes)):
return entity_instance(self.wrapped_data.by_guid(str(key)), self) return entity_instance(self.wrapped_data.by_guid(str(key)), self)
def by_id(self, id: int) -> ifcopenshell.entity_instance: def by_id(self, id: int) -> ifcopenshell.entity_instance:
@@ -18,9 +18,6 @@
"""Geometry processing and analysis""" """Geometry processing and analysis"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def _has_occ(): def _has_occ():
@@ -16,10 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import sys import sys
import time import time
@@ -16,10 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import sys import sys
import logging import logging
@@ -17,11 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import annotations
import os import os
import sys import sys
import operator import operator
@@ -17,20 +17,12 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random import random
import operator import operator
import warnings import warnings
from collections import namedtuple from collections import namedtuple
from collections.abc import Iterable
try: # python 3.3+
from collections.abc import Iterable
except ImportError: # python 2
from collections import Iterable
import OCC import OCC
@@ -18,9 +18,6 @@
"""Reads and writes encoded GlobalIds""" """Reads and writes encoded GlobalIds"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import uuid import uuid
import string import string
@@ -17,10 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from . import ifcopenshell_wrapper from . import ifcopenshell_wrapper
version = ifcopenshell_wrapper.version() version = ifcopenshell_wrapper.version()
@@ -17,10 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time import time
import uuid import uuid
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import numpy as np import numpy as np
import ifcopenshell import ifcopenshell
from typing import Any, Union from typing import Any, Union
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import ifcopenshell import ifcopenshell
import ifcopenshell.util.element import ifcopenshell.util.element
from typing import Any, Callable, Optional, Union, Literal, overload from typing import Any, Callable, Optional, Union, Literal, overload
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>. # along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import re import re
import pathlib import pathlib
import ifcopenshell import ifcopenshell
@@ -32,8 +32,6 @@ Available flags:
- ``--fields``: Output more detailed information about failed entities (available only with ``--json``). - ``--fields``: Output more detailed information about failed entities (available only with ``--json``).
""" """
from __future__ import print_function
import os import os
import sys import sys
import json import json