mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 11:46:56 +00:00
downstream: express: drop Python 2 fallbacks
This commit is contained in:
@@ -23,10 +23,7 @@ import itertools
|
|||||||
|
|
||||||
from pyparsing import *
|
from pyparsing import *
|
||||||
|
|
||||||
try:
|
from functools import reduce
|
||||||
from functools import reduce
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Expression:
|
class Expression:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import functools
|
import functools
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def indent(n, s):
|
def indent(n, s):
|
||||||
@@ -36,15 +37,4 @@ class Base:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def emit(self):
|
def emit(self):
|
||||||
import platform
|
Path(self.file_name).write_text(repr(self), encoding="utf-8")
|
||||||
|
|
||||||
if tuple(map(int, platform.python_version_tuple())) < (2, 8):
|
|
||||||
from io import open as unicode_open
|
|
||||||
|
|
||||||
unicode_type = unicode
|
|
||||||
else:
|
|
||||||
unicode_open = open
|
|
||||||
unicode_type = lambda x, *args, **kwargs: x
|
|
||||||
f = unicode_open(self.file_name, "w", encoding="utf-8")
|
|
||||||
f.write(unicode_type(repr(self), encoding="utf-8", errors="ignore"))
|
|
||||||
f.close()
|
|
||||||
|
|||||||
@@ -18,14 +18,9 @@
|
|||||||
|
|
||||||
|
|
||||||
import nodes
|
import nodes
|
||||||
import platform
|
|
||||||
import collections
|
import collections
|
||||||
import pyparsing
|
import pyparsing
|
||||||
|
|
||||||
if tuple(map(int, platform.python_version_tuple())) < (2, 7):
|
|
||||||
import ordereddict
|
|
||||||
|
|
||||||
collections.OrderedDict = ordereddict.OrderedDict
|
|
||||||
|
|
||||||
# According to ISO 10303-11 7.1.2: Letters: "... The case of
|
# According to ISO 10303-11 7.1.2: Letters: "... The case of
|
||||||
# letters is significant only within explicit string literals."
|
# letters is significant only within explicit string literals."
|
||||||
@@ -101,7 +96,7 @@ class Schema:
|
|||||||
for d in schema_declarations
|
for d in schema_declarations
|
||||||
if d.rule == "RuleDeclaration"
|
if d.rule == "RuleDeclaration"
|
||||||
]
|
]
|
||||||
|
|
||||||
self.types = sort([(t.name, t) for t in declarations if isinstance(t, nodes.TypeDeclaration)])
|
self.types = sort([(t.name, t) for t in declarations if isinstance(t, nodes.TypeDeclaration)])
|
||||||
self.entities = sort([(t.name, t) for t in declarations if isinstance(t, nodes.EntityDeclaration)])
|
self.entities = sort([(t.name, t) for t in declarations if isinstance(t, nodes.EntityDeclaration)])
|
||||||
self.rules = sort([(t.name, t) for t in declarations if isinstance(t, nodes.RuleDeclaration)])
|
self.rules = sort([(t.name, t) for t in declarations if isinstance(t, nodes.RuleDeclaration)])
|
||||||
|
|||||||
Reference in New Issue
Block a user