Commit bbb0f787 authored by Simon Conseil's avatar Simon Conseil

Fix issue with Catalog.meta copy with astropy master

With the recent changes in Table.meta handling, a shallow copy of .meta
is done when slicing a Table, but the LowercaseOrderedDict was not
implementing .copy which was causing the .meta to be lost.

And fix some typos :)
parent 4c3aeb3d
Pipeline #3159 passed with stage
in 16 minutes and 25 seconds
......@@ -67,7 +67,7 @@ class Catalog(Table):
# These are default column names to be used if not provided by metadata.
# They are not stored in the meta directly, and therefore not written when
# the catalog is writen to disk.
# the catalog is written to disk.
_idname_default = 'ID'
_raname_default = 'RA'
_decname_default = 'DEC'
......@@ -96,7 +96,7 @@ class Catalog(Table):
if self.masked:
self.masked_invalid()
# replace Table.meta OrderedDict with a case insenstive version
# replace Table.meta OrderedDict with a case insensitive version
self.meta = LowercaseOrderedDict(self.meta)
# set column names in metadata
......
......@@ -145,13 +145,13 @@ def all_subclasses(cls):
[s for c in cls.__subclasses__() for s in all_subclasses(c)])
# Here we inherit unncessarily from OrderDict.
# This is because when mergy astropy.table.Table() objects, an explisit check
# for the metadata object is a <dict> instance
# Here we inherit unnecessarily from OrderedDict.
# This is because when merging astropy.table.Table() objects, an explicit
# check for the metadata object is a <dict> instance
class LowercaseOrderedDict(MutableMapping, OrderedDict):
"""Ordered dictonary where all strings keys are case insensitive.
"""Ordered dictionary where all strings keys are case insensitive.
i.e. keys such as 'abc', 'ABC', 'Abc' all map to the same value.
This can be useful for mimicing the storage of FITS headers.
This can be useful for mimicking the storage of FITS headers.
"""
def __init__(self, *args):
......@@ -190,3 +190,6 @@ class LowercaseOrderedDict(MutableMapping, OrderedDict):
# MutableMapping pops the first item, whereas OrderedDict pops the last
# We implement the latter.
return self._d.popitem(last)
def copy(self):
return self.__class__(self)
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