Skip to content

Commit

Permalink
updated deprecation warnings for Writer.write(timestep)
Browse files Browse the repository at this point in the history
now started in 1.0 and targets v2.0
  • Loading branch information
richardjgowers committed Jun 5, 2020
1 parent 46c15af commit e15108f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions package/MDAnalysis/coordinates/DCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ def write_next_timestep(self, ag):
if isinstance(ag, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ts = ag
Expand Down
5 changes: 3 additions & 2 deletions package/MDAnalysis/coordinates/GRO.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def write(self, obj):
*resName* and *atomName* are truncated to a maximum of 5 characters
.. versionchanged:: 0.16.0
`frame` kwarg has been removed
.. versionchanged:: 0.19.1
.. versionchanged:: 1.0.0
Deprecated calling with Timestep, use AtomGroup or Universe
"""
# write() method that complies with the Trajectory API
Expand All @@ -371,7 +371,8 @@ def write(self, obj):
except AttributeError:
if isinstance(obj, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, and will be removed in 1.0; '
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ag_or_ts = obj.copy()
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/coordinates/TRJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,14 @@ def write_next_timestep(self, ag):
----------
ag : AtomGroup or Universe
.. versionchanged:: 0.19.1
.. versionchanged:: 1.0.0
Deprecated using Timestep
Added ability to use either AtomGroup or Universe
"""
if isinstance(ag, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ts = ag
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/coordinates/TRR.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ def write_next_timestep(self, ag):
<FormatWriter>.write(AtomGroup/Universe/TimeStep)
The normal write() method takes a more general input
.. versionchanged:: 0.19.1
.. versionchanged:: 1.0.0
Deprecated the use of Timestep as arguments to write. Use either a AtomGroup or Universe
"""
if isinstance(ag, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ts = ag
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/coordinates/XTC.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ def write_next_timestep(self, ag):
<FormatWriter>.write(AtomGroup/Universe/TimeStep)
The normal write() method takes a more general input
.. versionchanged:: 0.19.1
.. versionchanged:: 1.0.0
Deprecated using Timestep
Added ability to use either AtomGroup or Universe
"""
if isinstance(ag, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ts = ag
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/coordinates/XYZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def write(self, obj):
except AttributeError:
if isinstance(obj, base.Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, and will be removed in 1.0; '
'Passing a Timestep to write is deprecated, '
'and will be removed in 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)
ts = obj
Expand Down
5 changes: 3 additions & 2 deletions package/MDAnalysis/coordinates/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2204,12 +2204,13 @@ def write(self, obj):
The size of the `obj` must be the same as the number of atoms provided
when setting up the trajectory.
.. versionchanged:: 0.19.1
.. versionchanged:: 1.0.0
Deprecated the use of Timestep as arguments to write. Use either a AtomGroup or Universe
"""
if isinstance(obj, Timestep):
warnings.warn(
'Passing a Timestep to write is deprecated, and will be removed 1.0; '
'Passing a Timestep to write is deprecated, '
'and will be removed 2.0; '
'use either an AtomGroup or Universe',
DeprecationWarning)

Expand Down

0 comments on commit e15108f

Please sign in to comment.