@@ -57,7 +57,7 @@ def register_writer(self, cls, format, function):
5757
5858 def load (self , cls , instance , * args , format = None , ** kwargs ):
5959 _load = self .get_loader (cls , format )
60- _load (instance , * args , ** kwargs )
60+ return _load (instance , * args , ** kwargs )
6161
6262 def write (self , cls , instance , * args , format = None , ** kwargs ):
6363 _write = self .get_writer (cls , format )
@@ -71,14 +71,17 @@ def write(self, cls, instance, *args, format=None, **kwargs):
7171
7272
7373class IO (property ):
74- """Wrap a file IO descriptor as a property."""
74+ """
75+ Custom property wrapper for IO operation descriptors.
76+ See the `astropy` source for more details/motivation.
77+ """
7578
7679 def __get__ (self , instance , owner_cls ):
7780 return self .fget (instance , owner_cls )
7881
7982
8083class IODescriptor :
81- """Base class for file IO operations, implemented as descriptors."""
84+ """Base class for file IO operation descriptors."""
8285
8386 def __init__ (self , instance , cls , op : Op , registry : Registry | None = None ):
8487 self ._registry = registry or DEFAULT_REGISTRY
@@ -107,7 +110,7 @@ class Loader(IODescriptor):
107110 def __init__ (self , instance , cls ):
108111 super ().__init__ (instance , cls , "load" , registry = DEFAULT_REGISTRY )
109112
110- def __call__ (self , * args , ** kwargs ) -> None :
113+ def __call__ (self , * args , ** kwargs ):
111114 return self .registry .load (self ._cls , self ._instance , * args , ** kwargs )
112115
113116
@@ -118,4 +121,4 @@ def __init__(self, instance, cls):
118121 super ().__init__ (instance , cls , "write" , registry = DEFAULT_REGISTRY )
119122
120123 def __call__ (self , * args , ** kwargs ) -> None :
121- return self .registry .write (self ._cls , self ._instance , * args , ** kwargs )
124+ self .registry .write (self ._cls , self ._instance , * args , ** kwargs )
0 commit comments