Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

python3: futurize step1

parent d26676c4
from __future__ import print_function
import setup_paths
import numpy as np
import math
......@@ -13,23 +14,23 @@ class DL_POLYParserContext(object):
self.cell = []
return
def onClose_section_run(self, backend, gIndex, section):
print "<onClose_section_run>"
print("<onClose_section_run>")
return
def onClose_section_method(self, backend, gIndex, section):
print "<onClose_section_method>"
print("<onClose_section_method>")
return
def onClose_section_system(self, backend, gIndex, section):
print "<onClose_section_system>"
print("<onClose_section_system>")
return
def onClose_dl_poly_section_md_molecule_type(self, backend, gIndex, section):
print "<onClose_molecule_type>"
print("<onClose_molecule_type>")
return
def test_adhoc(parser):
return None
for i in range(10):
ln = parser.fIn.readline()
print ln
print(ln)
parser.fIn.pushbackLine(ln)
#print len(parser.backend.openSections)
return None
......
from __future__ import print_function
import os
import sys
import re
......@@ -290,7 +291,7 @@ class DlPolyParser(object):
def Set(self, key, value):
if self.log:
self.log << "Set [%s] %-40s = %s" % (self.logtag, key, str(value)) << self.log.endl
if not self.data.has_key(key):
if key not in self.data:
self.data[key] = value
else:
raise KeyError("Key already exists: '%s'" % key)
......@@ -335,7 +336,7 @@ class DlPolyParser(object):
def ApplyBlockXyData(self, block_data, key_map):
for key_in in key_map:
key_out = key_map[key_in]
if not block_data.has_key(key_in):
if key_in not in block_data:
# Missing key in output
self.missing_keys_lh.append(key_in)
self.missing_keys_rh.append(key_out)
......@@ -346,7 +347,7 @@ class DlPolyParser(object):
key_out = key_in
self.Set(key_out, value)
for key in block_data:
if not key_map.has_key(key):
if key not in key_map:
# Missing key in transform map
self.ignored_keys.append(key)
return
......@@ -494,7 +495,7 @@ class DlPolyFrame(DlPolyParser):
def ParseFrame(self, ifs):
ln = ifs.ln()
directives = ln.split()
print directives
print(directives)
assert 'timestep' == directives[0]
# Frame meta-info
self.Set('timestep', directives[1])
......
from __future__ import print_function
# See git https://github.com/capoe/momo.git
import os
import sys
......@@ -59,7 +60,7 @@ def GenerateTreeDict(tree, element, path='', paths_rel_to=None):
child_elements, childtag_element = GenerateTreeDict(tree, child, path)
nodes = nodes + child_elements
for key in childtag_element.keys():
if tag_node.has_key(key):
if key in tag_node:
if type(tag_node[key]) != list:
tag_node[key] = [ tag_node[key], childtag_element[key] ]
else:
......@@ -198,7 +199,7 @@ class OptionsInterface(object):
except KeyError:
raise ValueError('CLIO does not know how to convert %s into a boolean.' % expr)
def InterpretAsNumpyArray(self, expr):
print "Interpret", expr
print("Interpret", expr)
array = [ float(e) for e in expr ]
array = np.array(array)
return array
......@@ -352,7 +353,7 @@ class ShellInterface(object):
mssg = self.color_dict[c] + mssg + self.color_dict['endcolor']
if h:
mssg = self.os_generate_header(mssg, t)
print mssg
print(mssg)
# LOGFILE ADAPTOR =========================================================
def ConnectToFile(self, logfile):
self.logfile = logfile
......@@ -397,7 +398,7 @@ class ShellInterface(object):
mssg = OS_COLOR_DICT[c] + mssg + OS_COLOR_DICT['endcolor']
if h:
mssg = os_generate_header(mssg, t)
print mssg
print(mssg)
return
def os_print_config(self, c=None, j=None, h=False, t="=", tl=' '):
self.sel_color = c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment