Skip to content

Commit

Permalink
Revert "removing python 3.4 support"
Browse files Browse the repository at this point in the history
This reverts commit 3e6ed07.
  • Loading branch information
SteveDoyle2 committed Jan 24, 2018
1 parent 3e6ed07 commit df8658e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyNastran/op2/op2_interface/op2_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from struct import unpack, Struct
from collections import Counter
from typing import List
from six import string_types, iteritems, PY2, PY3
from six import string_types, iteritems, PY2, PY3, b
from six.moves import range

from numpy import array
Expand Down
9 changes: 5 additions & 4 deletions pyNastran/op2/tables/geom/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
defines readers for BDF objects in the OP2 DYNAMIC/DYNAMICS table
"""
from __future__ import print_function
from six import b
from struct import unpack, Struct
import numpy as np

Expand Down Expand Up @@ -274,9 +275,9 @@ def _read_eigc(self, data, n):
ndata = len(data)
nfields = (ndata - n) // 4
datan = data[n:]
ints = unpack(self._endian + b'%ii' % nfields, datan)
floats = unpack(self._endian + b'%if' % nfields, datan)
strings = unpack(self._endian + b'4s'* nfields, datan)
ints = unpack(b(self._uendian + '%ii' % nfields), datan)
floats = unpack(b(self._uendian + '%if' % nfields), datan)
strings = unpack(b(self._uendian + '4s'* nfields), datan)
#print('ints = ', ints)
#print('floats = ', floats)
#print('strings = ', strings)
Expand Down Expand Up @@ -508,7 +509,7 @@ def _read_eigrl(self, data, n):
def _read_epoint(self, data, n):
"""EPOINT(707,7,124) - Record 12"""
npoints = (len(data) - n) // 4
fmt = self._endian + b'%ii' % npoints
fmt = b(self._uendian + '%ii' % npoints)
nids = unpack(fmt, data[n:])
if self.is_debug_file:
self.binary_debug.write('EPOINT=%s\n' % str(nids))
Expand Down
3 changes: 2 additions & 1 deletion pyNastran/op2/tables/geom/ept.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import (nested_scopes, generators, division, absolute_import,
print_function, unicode_literals)
from struct import unpack, Struct
from six import b
from six.moves import range

import numpy as np
Expand Down Expand Up @@ -227,7 +228,7 @@ def _read_pbarl(self, data, n):
if pid > 100000000:
raise RuntimeError('bad parsing...')
expected_length = valid_types[beam_type]
iformat = self._endian + b'%if' % expected_length
iformat = b(self._uendian + '%if' % expected_length)

ndelta = expected_length * 4
data_in += list(unpack(iformat, data[n:n+ndelta]))
Expand Down
3 changes: 2 additions & 1 deletion pyNastran/op2/tables/geom/geom2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# pylint: disable=W0612,C0103
### pyldint: disable=W0612,C0103,C0302,W0613,R0914,R0201
from struct import unpack, Struct
from six import b
from six.moves import range

from pyNastran.bdf.cards.elements.elements import CGAP, PLOTEL
Expand Down Expand Up @@ -1734,7 +1735,7 @@ def _read_spoint(self, data, n):
(5551,49,105) - the marker for Record 118
"""
npoints = (len(data) - n) // 4
fmt = self._endian + '%ii' % npoints
fmt = b(self._uendian + '%ii' % npoints)
nids = unpack(fmt, data[n:])
if self.is_debug_file:
self.binary_debug.write('SPOINT=%s\n' % str(nids))
Expand Down
7 changes: 4 additions & 3 deletions pyNastran/op2/tables/geom/geom4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pylint: disable=C0111,C0103,C1801
from __future__ import print_function
from struct import unpack, Struct
from six import b
from six.moves import range
import numpy as np

Expand Down Expand Up @@ -305,8 +306,8 @@ def _read_mpc(self, data, n):
ndata = len(data)
nfields = (ndata - n) // 4
datan = data[n:]
ints = unpack(self._endian + b'%ii' % nfields, datan)
floats = unpack(self._endian + b'%if' % nfields, datan)
ints = unpack(b(self._uendian + '%ii' % nfields), datan)
floats = unpack(b(self._uendian + '%if' % nfields), datan)

i = 0
nentries = 0
Expand Down Expand Up @@ -1030,7 +1031,7 @@ def _read_suport(self, data, n):
def _read_suport1(self, data, n):
"""SUPORT1(10100,101,472) - Record 60"""
nfields = (len(data) - n) // 4 - 2
out = unpack(self._endian + b'%ii' % nfields, data[n:n+nfields*4])
out = unpack(b(self._uendian + '%ii' % nfields), data[n:n+nfields*4])

i = 0
nsuports = 0
Expand Down
11 changes: 6 additions & 5 deletions pyNastran/op2/tables/minor_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from __future__ import print_function, unicode_literals
from struct import unpack
from six import b
import numpy as np
import scipy # type: ignore
from pyNastran.op2.tables.matrix import Matrix
Expand Down Expand Up @@ -231,7 +232,7 @@ def _read_fol(self):

nfloats = (ndata - 8) // 4
assert nfloats * 4 == (ndata - 8)
fmt = self._endian + b'%sf' % nfloats
fmt = b(self._uendian + '%sf' % nfloats)
freqs = np.array(list(unpack(fmt, data[8:])), dtype='float32')
self._frequencies = freqs
if self.is_debug_file:
Expand Down Expand Up @@ -898,19 +899,19 @@ def _get_matrix_row_fmt_nterms_nfloats(self, nvalues, tout):
if tout == 1:
nfloats = nvalues
nterms = nvalues
fmt = self._endian + b'i %if' % nfloats
fmt = b(self._uendian + 'i %if' % nfloats)
elif tout == 2:
nfloats = nvalues // 2
nterms = nvalues // 2
fmt = self._endian + b'i %id' % nfloats
fmt = b(self._uendian + 'i %id' % nfloats)
elif tout == 3:
nfloats = nvalues
nterms = nvalues // 2
fmt = self._endian + b'i %if' % nfloats
fmt = b(self._uendian + 'i %if' % nfloats)
elif tout == 4:
nfloats = nvalues // 2
nterms = nvalues // 4
fmt = self._endian + b'i %id' % nfloats
fmt = b(self._uendian + 'i %id' % nfloats)
else:
raise RuntimeError('tout = %s' % tout)
return fmt, nfloats, nterms
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
1 change: 1 addition & 0 deletions setup_no_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
1 change: 1 addition & 0 deletions setup_no_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down

0 comments on commit df8658e

Please sign in to comment.