Commit ddc2b23b authored by Ole Streicher's avatar Ole Streicher

New upstream version 1.0.2 (taken directly from git, not from pypi)

parent 98ef166b
1.0.2 (2016-02-29)
------------------
- Renamed package to ASDF. [#190]
- Stopped support for Python 2.6 [#191]
1.0.1 (2016-01-08)
------------------
- Fixed installation from the source tarball on Python 3. [#187]
- Fixed error handling when opening ASDF files not supported by the current
version of pyasdf. [#178]
version of asdf. [#178]
- Fixed parse error that could occur sometimes when YAML data was read from
a stream. [#183]
......
Metadata-Version: 1.0
Name: asdf
Version: 1.0.1
Version: 1.0.2
Summary: Python tools to handle ASDF files
Home-page: http://github.com/spacetelescope/pyasdf
Author: Erik Bray, Michael Droettboom
......
pyasdf
======
asdf
====
Python library for reading and writing ASDF files.
......
......@@ -4,7 +4,7 @@
from __future__ import absolute_import, division, unicode_literals, print_function
"""
pyasdf: Python library for reading and writing Advanced Scientific
asdf: Python library for reading and writing Advanced Scientific
Data Format (ASDF) files
"""
......@@ -22,17 +22,17 @@ if _PYASDF_SETUP_ is False:
try:
import yaml as _
except ImportError:
raise ImportError("pyasdf requires pyyaml")
raise ImportError("asdf requires pyyaml")
try:
import jsonschema as _
except ImportError:
raise ImportError("pyasdf requires jsonschema")
raise ImportError("asdf requires jsonschema")
try:
import numpy as _
except ImportError:
raise ImportError("pyasdf requires numpy")
raise ImportError("asdf requires numpy")
from .asdf import AsdfFile
from .asdftypes import AsdfType
......
......@@ -29,11 +29,11 @@ from .tags.core import AsdfObject, Software, HistoryEntry
def get_asdf_library_info():
"""
Get information about pyasdf to include in the asdf_library entry
Get information about asdf to include in the asdf_library entry
in the Tree.
"""
return Software({
'name': 'pyasdf',
'name': 'asdf',
'version': version.version,
'homepage': 'http://github.com/spacetelescope/pyasdf',
'author': 'Space Telescope Science Institute'
......@@ -66,7 +66,7 @@ class AsdfFile(versioning.VersionedMixin):
version : str, optional
The ASDF version to use when writing out. If not
provided, it will write out in the latest version
supported by pyasdf.
supported by asdf.
"""
if extensions is None or extensions == []:
self._extensions = extension._builtin_extension_list
......@@ -287,8 +287,8 @@ class AsdfFile(versioning.VersionedMixin):
For the given AsdfFile ``ff``, add an external reference to the data in
an external file::
>>> import pyasdf
>>> flat = pyasdf.open("http://stsci.edu/reference_files/flat.asdf") # doctest: +SKIP
>>> import asdf
>>> flat = asdf.open("http://stsci.edu/reference_files/flat.asdf") # doctest: +SKIP
>>> ff.tree['flat_field'] = flat.make_reference(['data']) # doctest: +SKIP
"""
return reference.make_reference(self, path)
......@@ -659,7 +659,7 @@ class AsdfFile(versioning.VersionedMixin):
version : str, optional
The ASDF version to write out. If not provided, it will
write out in the latest version supported by pyasdf.
write out in the latest version supported by asdf.
"""
fd = self._fd
......@@ -793,7 +793,7 @@ class AsdfFile(versioning.VersionedMixin):
version : str, optional
The ASDF version to write out. If not provided, it will
write out in the latest version supported by pyasdf.
write out in the latest version supported by asdf.
"""
original_fd = self._fd
......@@ -930,7 +930,7 @@ class AsdfFile(versioning.VersionedMixin):
software : dict or list of dict
A description of the software used. It should not include
pyasdf itself, as that is automatically notated in the
asdf itself, as that is automatically notated in the
`asdf_library` entry.
Each dict must have the following keys:
......
......@@ -250,7 +250,7 @@ class AsdfTypeIndex(object):
warning_string = None
else:
warning_string = (
"'{0}' with version {1} found in file, but pyasdf only "
"'{0}' with version {1} found in file, but asdf only "
"understands version {2}.".format(
name,
semver.format_version(*version),
......
......@@ -3,7 +3,7 @@
from __future__ import absolute_import, division, unicode_literals, print_function
# this contains imports plugins that configure py.test for pyasdf tests.
# this contains imports plugins that configure py.test for asdf tests.
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the source tree.
......
......@@ -93,7 +93,7 @@ class AsdfExtension(object):
alongside as data alongside Python module::
return [('http://nowhere.org/schemas/custom/1.0.0/',
pyasdf.util.filepath_to_url(
asdf.util.filepath_to_url(
os.path.join(SCHEMA_PATH, 'stsci.edu')) +
'/{url_suffix}.yaml'
)]
......
......@@ -70,7 +70,7 @@ class Resolver(object):
self._prefix + "_suffix": uri[len(mapping[0]):]
}
return mapping[1].format(**format_tokens)
return len(mapping[0]), mapping[1].format(**format_tokens)
return None
return _map_func
......@@ -83,11 +83,18 @@ class Resolver(object):
return tuple(normalized)
def __call__(self, input):
candidates = []
for mapper in self._mapping:
output = mapper(input)
if output is not None:
return output
return input
if isinstance(output, tuple):
candidates.append(output)
elif output is not None:
candidates.append((six.MAXSIZE, output))
if len(candidates):
candidates.sort()
return candidates[-1][1]
else:
return input
def __hash__(self):
return hash(self._mapping)
......
......@@ -30,8 +30,8 @@ def get_package_data(): # pragma: no cover
root))
return {
str('pyasdf.schemas'): schemas,
str('pyasdf.reference_files'): reference_files
str('asdf.schemas'): schemas,
str('asdf.reference_files'): reference_files
}
......
......@@ -15,7 +15,7 @@ class Stream(ndarray.NDArrayType):
Save a double-precision array with 1024 columns, one row at a
time::
>>> from pyasdf import AsdfFile, Stream
>>> from asdf import AsdfFile, Stream
>>> import numpy as np
>>> ff = AsdfFile()
>>> ff.tree['streamed'] = Stream([1024], np.float64)
......
......@@ -6,5 +6,5 @@ from __future__ import absolute_import, division, unicode_literals, print_functi
def get_package_data(): # pragma: no cover
return {
str('pyasdf.tags.fits.tests'): ['data/*.fits']
str('asdf.tags.fits.tests'): ['data/*.fits']
}
......@@ -24,11 +24,11 @@ class AffineType(TransformType):
translation = node['translation']
if matrix.shape != (2, 2):
raise NotImplementedError(
"pyasdf currently only supports 2x2 (2D) rotation transformation "
"asdf currently only supports 2x2 (2D) rotation transformation "
"matrices")
if translation.shape != (2,):
raise NotImplementedError(
"pyasdf currently only supports 2D translation transformations.")
"asdf currently only supports 2D translation transformations.")
return modeling.projections.AffineTransformation2D(
matrix=matrix, translation=translation)
......
......@@ -17,6 +17,7 @@ import pytest
from .. import asdf
from .. import asdftypes
from .. import extension
from .. import util
from .. import versioning
......@@ -109,7 +110,7 @@ a: !core/complex-42.0.0
assert len(w) == 1
assert str(w[0].message) == (
"'tag:stsci.edu:asdf/core/complex' with version 42.0.0 found in file, "
"but pyasdf only understands version 1.0.0.")
"but asdf only understands version 1.0.0.")
# Make sure warning is repeatable
buff.seek(0)
......@@ -120,7 +121,7 @@ a: !core/complex-42.0.0
assert len(w) == 1
assert str(w[0].message) == (
"'tag:stsci.edu:asdf/core/complex' with version 42.0.0 found in file, "
"but pyasdf only understands version 1.0.0.")
"but asdf only understands version 1.0.0.")
# If the major and minor match, there should be no warning.
yaml = """
......@@ -180,3 +181,27 @@ def test_versioned_writing():
del versioning._version_map['42.0.0']
versioning.supported_versions.pop()
def test_longest_match():
class FancyComplexExtension(object):
@property
def types(self):
return []
@property
def tag_mapping(self):
return []
@property
def url_mapping(self):
return [('http://stsci.edu/schemas/asdf/core/',
'FOOBAR/{url_suffix}')]
l = extension.AsdfExtensionList(
[extension.BuiltinExtension(), FancyComplexExtension()])
assert l.url_mapping(
'http://stsci.edu/schemas/asdf/core/asdf-1.0.0') == 'FOOBAR/asdf-1.0.0'
assert l.url_mapping(
'http://stsci.edu/schemas/asdf/transform/transform-1.0.0') != 'FOOBAR/transform-1.0.0'
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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