Skip to content

Commit 38bc77f

Browse files
thoradeadeas31
authored andcommitted
add from builtins import to all files
add from __future__ import and move "from" imports to the top
1 parent 6fb9693 commit 38bc77f

4 files changed

Lines changed: 47 additions & 34 deletions

File tree

OMPython/OMParser/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232
Version: 1.0
3333
"""
3434

35-
import sys
35+
from __future__ import absolute_import
36+
from __future__ import division
37+
from __future__ import print_function
38+
from builtins import int, range
3639

37-
from builtins import int
40+
import sys
3841

3942
result = dict()
4043

OMPython/OMTypedParser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
__status__ = "Prototype"
3636
__maintainer__ = "https://openmodelica.org"
3737

38-
import sys
38+
from __future__ import absolute_import
39+
from __future__ import division
40+
from __future__ import print_function
41+
from builtins import int, range
3942

4043
from pyparsing import (
4144
Combine,
@@ -55,6 +58,7 @@
5558
replaceWith,
5659
)
5760

61+
import sys
5862

5963
def convertNumbers(s, l, toks):
6064
n = toks[0]

OMPython/__init__.py

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ class which means it will use OMCSessionZMQ by default. If you want to use
2727
That format is harder to use.
2828
"""
2929

30+
from __future__ import absolute_import
31+
from __future__ import division
32+
from __future__ import print_function
33+
from builtins import int, range
34+
from copy import deepcopy
35+
from distutils import spawn
36+
37+
import abc
38+
import csv
39+
import getpass
40+
import logging
41+
import os
42+
import platform
43+
import subprocess
44+
import sys
45+
import tempfile
46+
import time
47+
import uuid
48+
import xml.etree.ElementTree as ET
49+
50+
import numpy as np
51+
import pyparsing
52+
53+
54+
if sys.platform == 'darwin':
55+
# On Mac let's assume omc is installed here and there might be a broken omniORB installed in a bad place
56+
sys.path.append('/opt/local/lib/python2.7/site-packages/')
57+
sys.path.append('/opt/openmodelica/lib/python2.7/site-packages/')
58+
59+
# TODO: replace this with the new parser
60+
from OMPython import OMTypedParser, OMParser
61+
3062
__license__ = """
3163
This file is part of OpenModelica.
3264
@@ -58,35 +90,6 @@ class which means it will use OMCSessionZMQ by default. If you want to use
5890
Version: 1.1
5991
"""
6092

61-
from builtins import int, range
62-
from copy import deepcopy
63-
from distutils import spawn
64-
65-
import abc
66-
import csv
67-
import getpass
68-
import logging
69-
import os
70-
import platform
71-
import subprocess
72-
import sys
73-
import tempfile
74-
import time
75-
import uuid
76-
import xml.etree.ElementTree as ET
77-
78-
import numpy as np
79-
import pyparsing
80-
81-
82-
if sys.platform == 'darwin':
83-
# On Mac let's assume omc is installed here and there might be a broken omniORB installed in a bad place
84-
sys.path.append('/opt/local/lib/python2.7/site-packages/')
85-
sys.path.append('/opt/openmodelica/lib/python2.7/site-packages/')
86-
87-
# TODO: replace this with the new parser
88-
from OMPython import OMTypedParser, OMParser
89-
9093
# Logger Defined
9194
logger = logging.getLogger('OMPython')
9295
logger.setLevel(logging.DEBUG)

tests/test_OMParser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import unittest
2-
1+
from __future__ import absolute_import
2+
from __future__ import division
3+
from __future__ import print_function
34
from builtins import int
45

56
from OMPython import OMParser
67

8+
import unittest
9+
710
typeCheck = OMParser.typeCheck
811

912

0 commit comments

Comments
 (0)