Skip to content

Commit

Permalink
Merge pull request #44 from albireox/re-nested-sets
Browse files Browse the repository at this point in the history
Fix FutureWarning due to nested sets in re in Python 3.7
  • Loading branch information
weaverba137 committed Jul 19, 2018
2 parents d7f5261 + fe01c4a commit d579cfb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ env:
- PYTHON_VERSION=3.4 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.5 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.6 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.7 SETUP_CMD='egg_info'

matrix:

Expand Down Expand Up @@ -102,6 +103,8 @@ matrix:
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.11
- os: linux
env: NUMPY_VERSION=1.12
- os: linux
env: PYTHON_VERSION=3.7 NUMPY_VERSION=1.14

# Try numpy pre-release
- os: linux
Expand Down
2 changes: 2 additions & 0 deletions docs/pydl/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ planned for the Summer or Fall of 2018.
* Add :mod:`astropy.units` support to :func:`~pydl.goddard.astro.airtovac`
and :func:`~pydl.goddard.astro.vactoair` (PR `#41`_).
* Change Exelis to Harris Geospatial (PR `#42`_).
* Fix ``FutureWarning`` in ``re`` in Python 3.7 due to nested sets (PR `#44`_).

.. _`#42`: https://github.com/weaverba137/pydl/pull/42
.. _`#41`: https://github.com/weaverba137/pydl/pull/41
.. _`#40`: https://github.com/weaverba137/pydl/pull/40
.. _`#37`: https://github.com/weaverba137/pydl/issues/37.
.. _`#44`: https://github.com/weaverba137/pydl/pull/44

0.6.0 (2017-09-19)
------------------
Expand Down
7 changes: 4 additions & 3 deletions pydl/pydlutils/yanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ def type(self, structure, variable):
definition = defl
else:
definition = defu
typere = re.compile(r'(\S+)\s+{0}([[<].*[]>]|);'.format(variable))
typere = re.compile(
r'(\S+)\s+{0}([\[<].*[\]>]|);'.format(variable))
(typ, array) = typere.search(definition[0]).groups()
var_type = typ + array.replace('<', '[').replace('>', ']')
cache[variable] = var_type
Expand Down Expand Up @@ -499,7 +500,7 @@ def isarray(self, structure, variable):
result = cache[variable]
except KeyError:
typ = self.type(structure, variable)
character_array = re.compile(r'char[[<]\d*[]>][[<]\d*[]>]')
character_array = re.compile(r'char[\[<]\d*[\]>][\[<]\d*[\]>]')
if ((character_array.search(typ) is not None) or
(typ.find('char') < 0 and (typ.find('[') >= 0 or
typ.find('<') >= 0))):
Expand Down Expand Up @@ -1075,7 +1076,7 @@ def _parse(self):
for d in definitions:
d = d.replace(';', '')
(datatype, column) = re.split(r'\s+', d)
column = re.sub(r'[[<].*[]>]$', '', column)
column = re.sub(r'[\[<].*[\]>]$', '', column)
self._symbols[name.upper()].append(column)
self[name.upper()][column] = list()
# Remove lines containing only comments
Expand Down

0 comments on commit d579cfb

Please sign in to comment.