Skip to content

Commit

Permalink
Updates code using 2to3 (#3)
Browse files Browse the repository at this point in the history
* Updates code using 2to3
  • Loading branch information
jasonb5 authored Nov 16, 2020
1 parent d527b30 commit ab4a227
Show file tree
Hide file tree
Showing 20 changed files with 592 additions and 477 deletions.
8 changes: 8 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bumpversion]
current_version = 8.1.0
commit = True
tag = True

[bumpversion:file:setup.py]

[bumpversion:file:feedstock-xmgrace/recipe/meta.yaml]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
output/
2 changes: 1 addition & 1 deletion Doc/xmgrace_tutorial_Numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# it is recomended to run it usibng parser.py or just read it

print 'it is recomended to run this file using parser.py or just read it'
print('it is recomended to run this file using parser.py or just read it')

TEMPDIR = './'

Expand Down
10 changes: 5 additions & 5 deletions Doc/xmgrace_tutorial_cdms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# it is recomended to run it usibng parser.py or just read it

print 'it is recomended to run this file using parser.py or just read it'
print('it is recomended to run this file using parser.py or just read it')

# ******************************************************************************
#
Expand All @@ -18,12 +18,12 @@
elif len(sys.argv) > 1:
TESTDIR = sys.argv[1] + '/'
if not os.path.isdir(TESTDIR):
print 'Cannot find the tutorials data directory, please pass path as first argument.'
print 'e.g.: python getting_started.py ../cdat_tutorial_data'
print('Cannot find the tutorials data directory, please pass path as first argument.')
print('e.g.: python getting_started.py ../cdat_tutorial_data')
sys.exit()
if not os.path.exists(TESTDIR + 'model.ctl'):
print 'Cannot find the tutorials data, please pass path as first argument.'
print 'e.g.: python getting_started.py ../cdat_tutorial_data'
print('Cannot find the tutorials data, please pass path as first argument.')
print('e.g.: python getting_started.py ../cdat_tutorial_data')
sys.exit()

TEMPDIR = './'
Expand Down
16 changes: 8 additions & 8 deletions Lib/ValidationFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def checkInStringsListInt(self, name, value, values):
i = i + 1
elif isinstance(value, int) or \
(isinstance(value, float) and int(value) == value):
if value not in range(len(values)):
if value not in list(range(len(values))):
raise ValueError(err)
else:
return int(value)
Expand All @@ -66,15 +66,15 @@ def checkInStringsListInt(self, name, value, values):

def isNumber(value):
if isinstance(value, int) or isinstance(
value, long) or isinstance(value, float):
value, int) or isinstance(value, float):
return 1
return 0


def checkPositiveInt(self, name, value):
if not isNumber(value):
raise ValueError(name + ' must be an integer')
elif (not (isinstance(value, int) or isinstance(value, long)) and
elif (not (isinstance(value, int) or isinstance(value, int)) and
(not int(value) == value)):
raise ValueError(name + ' must be an integer')
elif value < 0:
Expand All @@ -84,7 +84,7 @@ def checkPositiveInt(self, name, value):

def checkPositiveNumber(self, name, value):
if not (isinstance(value, int) or isinstance(
value, long) or isinstance(value, float)):
value, int) or isinstance(value, float)):
raise ValueError(name + ' must be an integer or a float')
elif value < 0:
raise ValueError(name + ' must be positve')
Expand Down Expand Up @@ -227,7 +227,7 @@ def checkTickLocation(self, name, value):
elif isListorTuple(value):
val = value
else:
val = value.keys()
val = list(value.keys())
# Now checks that the location are actually numbers
for v in val:
if not isNumber(v):
Expand Down Expand Up @@ -257,7 +257,7 @@ def checkTickValues(self, name, value):
elif isListorTuple(value):
val = []
else:
val = value.keys()
val = list(value.keys())
# Now checks that the location are actually numbers
for v in val:
if not isNumber(v):
Expand All @@ -266,7 +266,7 @@ def checkTickValues(self, name, value):
if isinstance(value, dict):
self.loc = val
vals = []
for v in value.keys():
for v in list(value.keys()):
vals.append(value[v])
value = vals
val = []
Expand Down Expand Up @@ -410,7 +410,7 @@ def checkChar(self, name, value):
raise ValueError(name + " must be a single character")
return ord(value.strip())
elif isinstance(value, int):
if value not in range(256):
if value not in list(range(256)):
raise ValueError(name + ' not in range(256)')
return value
else:
Expand Down
2 changes: 1 addition & 1 deletion Lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from xmgrace import * # noqa
from .xmgrace import * # noqa
Loading

0 comments on commit ab4a227

Please sign in to comment.