Skip to content

Commit 085fcd0

Browse files
committed
fix up
1 parent ffaac43 commit 085fcd0

6 files changed

Lines changed: 35 additions & 48 deletions

File tree

‎astropy/cosmology/_io/ecsv.py‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
# datatype:
2525
# - {name: name, datatype: string}
2626
...
27-
# meta: !!omap
28-
# - {Oc0: 0.2607}
27+
# meta:
28+
# Oc0: 0.2607
2929
...
3030
# schema: astropy-2.0
3131
name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -59,8 +59,8 @@
5959
# - {name: cosmology, datatype: string}
6060
# - {name: name, datatype: string}
6161
...
62-
# meta: !!omap
63-
# - {Oc0: 0.2607}
62+
# meta:
63+
# Oc0: 0.2607
6464
...
6565
# schema: astropy-2.0
6666
cosmology name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -101,8 +101,8 @@
101101
# datatype:
102102
# - {name: name, datatype: string}
103103
...
104-
# meta: !!omap
105-
# - {Oc0: 0.2607}
104+
# meta:
105+
# Oc0: 0.2607
106106
...
107107
# schema: astropy-2.0
108108
name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -126,8 +126,8 @@
126126
# datatype:
127127
# - {name: name, datatype: string}
128128
...
129-
# meta: !!omap
130-
# - {Oc0: 0.2607}
129+
# meta:
130+
# Oc0: 0.2607
131131
...
132132
# schema: astropy-2.0
133133
name Hubble Om0 Tcmb0 Neff m_nu Ob0
@@ -222,8 +222,8 @@ def read_ecsv(
222222
# datatype:
223223
# - {name: name, datatype: string}
224224
...
225-
# meta: !!omap
226-
# - {Oc0: 0.2607}
225+
# meta:
226+
# Oc0: 0.2607
227227
...
228228
# schema: astropy-2.0
229229
name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -274,8 +274,8 @@ class (or its string name) is passed as the ``cosmology`` keyword argument to
274274
# datatype:
275275
# - {name: name, datatype: string}
276276
...
277-
# meta: !!omap
278-
# - {Oc0: 0.2607}
277+
# meta:
278+
# Oc0: 0.2607
279279
...
280280
# schema: astropy-2.0
281281
name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -301,8 +301,8 @@ class (or its string name) is passed as the ``cosmology`` keyword argument to
301301
# datatype:
302302
# - {name: name, datatype: string}
303303
...
304-
# meta: !!omap
305-
# - {Oc0: 0.2607}
304+
# meta:
305+
# Oc0: 0.2607
306306
...
307307
# schema: astropy-2.0
308308
name Hubble Om0 Tcmb0 Neff m_nu Ob0
@@ -393,8 +393,8 @@ def write_ecsv(
393393
# datatype:
394394
# - {name: name, datatype: string}
395395
...
396-
# meta: !!omap
397-
# - {Oc0: 0.2607}
396+
# meta:
397+
# Oc0: 0.2607
398398
...
399399
# schema: astropy-2.0
400400
name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -432,8 +432,8 @@ def write_ecsv(
432432
# - {name: cosmology, datatype: string}
433433
# - {name: name, datatype: string}
434434
...
435-
# meta: !!omap
436-
# - {Oc0: 0.2607}
435+
# meta:
436+
# Oc0: 0.2607
437437
...
438438
# schema: astropy-2.0
439439
cosmology name H0 Om0 Tcmb0 Neff m_nu Ob0
@@ -451,8 +451,8 @@ def write_ecsv(
451451
# datatype:
452452
# - {name: name, datatype: string}
453453
...
454-
# meta: !!omap
455-
# - {Oc0: 0.2607}
454+
# meta:
455+
# Oc0: 0.2607
456456
...
457457
# schema: astropy-2.0
458458
name Hubble Om0 Tcmb0 Neff m_nu Ob0

‎astropy/cosmology/_io/yaml.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
>>> from astropy.cosmology import Planck18
1111
>>> yml = Planck18.to_format("yaml")
1212
>>> yml # doctest: +NORMALIZE_WHITESPACE
13-
"!astropy.cosmology...FlatLambdaCDM\nH0: !astropy.units.Quantity...
13+
"!astropy.cosmology.flrw.FlatLambdaCDM\nname: Planck18\nH0:...
1414
1515
>>> print(Cosmology.from_format(yml, format="yaml"))
1616
FlatLambdaCDM(name="Planck18", H0=67.66 km / (Mpc s), Om0=0.30966,
@@ -198,7 +198,7 @@ def to_yaml(cosmology, *args):
198198
--------
199199
>>> from astropy.cosmology import Planck18
200200
>>> Planck18.to_format("yaml")
201-
"!astropy.cosmology...FlatLambdaCDM\nH0: !astropy.units.Quantity...
201+
"!astropy.cosmology.flrw.FlatLambdaCDM\nname: Planck18\nH0:...
202202
"""
203203
return dump(cosmology)
204204

‎astropy/io/ascii/tests/test_ecsv.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def test_write_full():
119119
"# datatype: string",
120120
"# description: descr_str",
121121
"# meta: {meta str: 1}",
122-
"# meta: !!omap",
123-
"# - comments: [comment1, comment2]",
122+
"# meta:",
123+
"# comments: [comment1, comment2]",
124124
"# schema: astropy-2.0",
125125
"bool int64 float64 str",
126126
'False 0 0.0 "ab 0"',

‎astropy/io/misc/yaml.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@
2929
>>> td = yaml.dump(t)
3030
>>> print(td)
3131
!astropy.time.Time
32-
format: mjd
33-
in_subfmt: '*'
3432
jd1: 4857390.0
3533
jd2: -0.5
34+
format: mjd
35+
scale: utc
36+
precision: 3
37+
in_subfmt: '*'
38+
out_subfmt: '*'
3639
location: !astropy.coordinates.earth.EarthLocation
37-
ellipsoid: WGS84
3840
x: !astropy.units.Quantity
39-
unit: &id001 !astropy.units.Unit {unit: km}
4041
value: 1000.0
42+
unit: &id001 !astropy.units.Unit {unit: km}
4143
y: !astropy.units.Quantity
42-
unit: *id001
4344
value: 2000.0
44-
z: !astropy.units.Quantity
4545
unit: *id001
46+
z: !astropy.units.Quantity
4647
value: 3000.0
47-
out_subfmt: '*'
48-
precision: 3
49-
scale: utc
48+
unit: *id001
49+
ellipsoid: WGS84
5050
>>> ty = yaml.load(td)
5151
>>> ty
5252
<Time object: scale='utc' format='mjd' value=2457389.0>

‎astropy/utils/metadata/core.py‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
__all__ = ["MetaData", "MetaAttribute"]
55

66
import inspect
7-
from collections import OrderedDict
87
from collections.abc import Mapping
98
from copy import deepcopy
109
from dataclasses import is_dataclass
@@ -58,18 +57,6 @@ class MetaData:
5857
5958
>>> foo = Foo()
6059
>>> foo.meta
61-
OrderedDict()
62-
63-
If an :class:`~collections.OrderedDict` is not a good default metadata type then
64-
the ``default_factory`` keyword can be used to set the default to a different
65-
`Mapping` type, when the class is defined.'
66-
67-
>>> class Bar:
68-
... meta = MetaData(default_factory=dict)
69-
... def __init__(self, meta=None):
70-
... self.meta = meta
71-
72-
>>> Bar().meta
7360
{}
7461
7562
When accessed from the class ``.meta`` returns `None` since metadata is
@@ -79,7 +66,7 @@ class MetaData:
7966
None
8067
"""
8168

82-
def __init__(self, doc="", copy=True, *, default_factory=OrderedDict):
69+
def __init__(self, doc="", copy=True, *, default_factory=dict):
8370
self.__doc__ = doc
8471
self.copy = copy
8572
self._default_factory = default_factory

‎astropy/utils/metadata/tests/test_metadata.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class OrderedDictSubclass(OrderedDict):
2222
class MetaBaseTest:
2323
def test_none(self):
2424
d = self.test_class(*self.args)
25-
assert isinstance(d.meta, OrderedDict)
25+
assert isinstance(d.meta, dict)
2626
assert len(d.meta) == 0
2727

2828
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)