Commit 889eb61e authored by Ole Streicher's avatar Ole Streicher

New upstream version 2.3.1

parent 2596c1fc
2.3.1 (2018-12-20)
------------------
- Ensure that top-level accesses to the tree outside a closed context handler
result in an ``OSError``. [#628]
- Provide source information for ``AsdfDeprecationWarning`` that come from
extensions from external packages. [#629]
- Fix the way ``generic_io`` handles URIs and paths on Windows. [#632]
- Fix bug in ``asdftool`` that prevented ``extract`` command from being
visible. [#633]
2.3.0 (2018-11-28)
------------------
......
Metadata-Version: 1.2
Name: asdf
Version: 2.3.0
Version: 2.3.1
Summary: Python tools to handle ASDF files
Home-page: http://github.com/spacetelescope/asdf
Author: Erik Bray, Dan D'Avella, Michael Droettboom
......
......@@ -396,13 +396,13 @@ class AsdfFile(versioning.VersionedMixin):
self._tree = asdf_object
def keys(self):
return self._tree.keys()
return self.tree.keys()
def __getitem__(self, key):
return self._tree[key]
return self.tree[key]
def __setitem__(self, key, value):
self._tree[key] = value
self.tree[key] = value
@property
def comments(self):
......
......@@ -17,7 +17,7 @@ from .main import Command
__all__ = ['extract_file']
class FitsExtractor(Command): # pragma: no cover
class AsdfExtractor(Command): # pragma: no cover
"""This class is the plugin implementation for the asdftool runner."""
@classmethod
......
......@@ -192,7 +192,9 @@ class _DefaultExtensions:
def _load_installed_extensions(self, group='asdf_extensions'):
for entry_point in iter_entry_points(group=group):
ext = entry_point.load()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always', category=AsdfDeprecationWarning)
ext = entry_point.load()
if not issubclass(ext, AsdfExtension):
warnings.warn("Found entry point {}, from {} but it is not a "
"subclass of AsdfExtension, as expected. It is "
......@@ -204,6 +206,10 @@ class _DefaultExtensions:
self._package_metadata[name] = (dist.project_name, dist.version)
self._extensions.append(ext())
for warning in w:
warnings.warn('{} (from {})'.format(warning.message, name),
AsdfDeprecationWarning)
@property
def extensions(self):
# This helps avoid a circular dependency with external packages
......
......@@ -1184,7 +1184,14 @@ def get_file(init, mode='r', uri=None, close=False):
realmode = 'r+b'
else:
realmode = mode + 'b'
realpath = url2pathname(parsed.path)
# Windows paths are not URIs, and so they should not be parsed as
# such. Otherwise, the drive component of the path can get lost.
# This is not an ideal solution, but we can't use pathlib here
# because it doesn't handle URIs properly.
if sys.platform.startswith('win') and parsed.scheme in string.ascii_letters:
realpath = str(init)
else:
realpath = url2pathname(parsed.path)
if mode == 'w':
fd = atomicfile.atomic_open(realpath, realmode)
else:
......
[run]
source = {packagename}
omit =
{packagename}/_astropy_init*
{packagename}/conftest*
{packagename}/cython_version*
{packagename}/setup_package*
{packagename}/*/setup_package*
{packagename}/*/*/setup_package*
{packagename}/tests/*
{packagename}/*/tests/*
{packagename}/*/*/tests/*
{packagename}/version.*
{packagename}/compat*
{packagename}/extern*
asdf/_astropy_init*
asdf/conftest*
asdf/cython_version*
asdf/setup_package*
asdf/*/setup_package*
asdf/*/*/setup_package*
asdf/tests/*
asdf/*/tests/*
asdf/*/*/tests/*
asdf/version.*
asdf/compat*
asdf/extern*
[report]
exclude_lines =
......
......@@ -215,7 +215,11 @@ def test_access_tree_outside_handler(tmpdir):
# Accessing array data outside of handler should fail
with pytest.raises(OSError):
newf.tree['random'][0]
repr(newf.tree['random'])
# Using the top-level getattr should also fail
with pytest.raises(OSError):
repr(newf['random'])
def test_context_handler_resolve_and_inline(tmpdir):
......
......@@ -767,12 +767,13 @@ a: !core/doesnt_exist-1.0.0
with pytest.warns(None) as w:
with asdf.open(buff) as af:
assert str(af['a']) == 'hello'
# Currently there are 3 warnings since one occurs on each of the
# validation passes. It would be good to consolidate these eventually
assert len(w) == 3, helpers.display_warnings(w)
assert str(w[0].message).startswith("Unable to locate schema file")
assert str(w[1].message).startswith("Unable to locate schema file")
assert str(w[2].message).startswith(af['a']._tag)
# Currently there are 3 warnings since one occurs on each of the
# validation passes. It would be good to consolidate these
# eventually
assert len(w) == 3, helpers.display_warnings(w)
assert str(w[0].message).startswith("Unable to locate schema file")
assert str(w[1].message).startswith("Unable to locate schema file")
assert str(w[2].message).startswith(af['a']._tag)
# This is a more realistic case since we're using an external extension
yaml = """
......@@ -784,7 +785,7 @@ a: !<tag:nowhere.org:custom/doesnt_exist-1.0.0>
with pytest.warns(None) as w:
with asdf.open(buff, extensions=CustomExtension()) as af:
assert str(af['a']) == 'hello'
assert len(w) == 3, helpers.display_warnings(w)
assert str(w[0].message).startswith("Unable to locate schema file")
assert str(w[1].message).startswith("Unable to locate schema file")
assert str(w[2].message).startswith(af['a']._tag)
assert len(w) == 3, helpers.display_warnings(w)
assert str(w[0].message).startswith("Unable to locate schema file")
assert str(w[1].message).startswith("Unable to locate schema file")
assert str(w[2].message).startswith(af['a']._tag)
# Autogenerated by Astropy-affiliated package asdf's setup.py on 2018-11-28 20:32:39 UTC
# Autogenerated by Astropy-affiliated package asdf's setup.py on 2018-12-20 21:12:26 UTC
from __future__ import unicode_literals
import datetime
......@@ -187,8 +187,8 @@ def _get_repo_path(pathname, levels=None): # pragma: no cover
_packagename = "asdf"
_last_generated_version = "2.3.0"
_last_githash = "325ee5fa575c67f65ad7f90085d8c2f216c89456"
_last_generated_version = "2.3.1"
_last_githash = "d09a3410aa3a3bf772f1ff95ab797edd6f624344"
# Determine where the source code for this module
# lives. If __file__ is not a filesystem path then
......@@ -206,10 +206,10 @@ else:
major = 2
minor = 3
bugfix = 0
bugfix = 1
release = True
timestamp = datetime.datetime(2018, 11, 28, 20, 32, 39)
timestamp = datetime.datetime(2018, 12, 20, 21, 12, 26)
debug = False
astropy_helpers_version = "2.0.1"
......
......@@ -18,7 +18,7 @@ open_files_ignore = test.fits asdf.fits
asdf_schema_root = asdf-standard/schemas asdf/schemas
asdf_schema_skip_names = asdf-schema-1.0.0 draft-01
asdf_schema_skip_examples = domain-1.0.0 frame-1.0.0 frame-1.1.0
#addopts = --doctest-rst
addopts = --doctest-rst
[ah_bootstrap]
auto_use = True
......
......@@ -31,7 +31,7 @@ URL = metadata.get('url', '')
builtins._PACKAGE_NAME_ = PACKAGE_NAME
# VERSION should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
VERSION = '2.3.0'
VERSION = '2.3.1'
# Indicates if this version is a release version
RELEASE = 'dev' not in VERSION
......
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