Skip to content

Commit

Permalink
python 3.7 support
Browse files Browse the repository at this point in the history
- replace `raise StopIteration` by `return`
https://www.python.org/dev/peps/pep-0479/#examples-of-breakage
- replace time.clock() by time.time() since we don't really care which time it is but the latter still works
  • Loading branch information
HENDRIX-ZT2 committed Sep 18, 2019
1 parent 440c61c commit cf2d5c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pyffi/object_models/xml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ def __init__(cls, name, bases, dct):
# which takes care of the class creation
cls.logger.debug("Parsing %s and generating classes."
% xml_file_name)
start = time.clock()
start = time.time()
try:
parser.parse(xml_file)
finally:
xml_file.close()
cls.logger.debug("Parsing finished in %.3f seconds."
% (time.clock() - start))
% (time.time() - start))


class FileFormat(pyffi.object_models.FileFormat, metaclass=MetaFileFormat):
Expand Down
2 changes: 1 addition & 1 deletion pyffi/object_models/xml/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __next__(cls):
cls.__i += 1
return (cls._enumkeys[cls.__i-1], cls._enumvalues[cls.__i-1])
else:
raise StopIteration
return

def __getitem__(cls, key):
if key in cls._enumkeys:
Expand Down
4 changes: 2 additions & 2 deletions pyffi/object_models/xsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def __init__(cls, name, bases, dct):

# parse the XSD file
cls.logger.debug("Parsing %s and generating classes." % xsdfilename)
start = time.clock()
start = time.time()
try:
# create nodes for every element in the XSD tree
schema = Tree.node_factory(
Expand All @@ -535,7 +535,7 @@ def __init__(cls, name, bases, dct):
# generate attributes
schema.attribute_walker(cls)
cls.logger.debug("Parsing finished in %.3f seconds."
% (time.clock() - start))
% (time.time() - start))

class Type(object):
_node = None
Expand Down

0 comments on commit cf2d5c7

Please sign in to comment.