@@ -135,21 +135,21 @@ def __init__(self, file_like, spec, mmap=True, keep_file_open=False):
135
135
self ._lock = Lock ()
136
136
137
137
def __del__ (self ):
138
- ''' If this ``ArrayProxy`` was created with ``keep_file_open=True``,
138
+ """ If this ``ArrayProxy`` was created with ``keep_file_open=True``,
139
139
the open file object is closed if necessary.
140
- '''
140
+ """
141
141
if hasattr (self , '_opener' ) and not self ._opener .closed :
142
142
self ._opener .close ()
143
143
self ._opener = None
144
144
145
145
def __getstate__ (self ):
146
- ''' Returns the state of this ``ArrayProxy`` during pickling. '''
146
+ """ Returns the state of this ``ArrayProxy`` during pickling. """
147
147
state = self .__dict__ .copy ()
148
148
state .pop ('_lock' , None )
149
149
return state
150
150
151
151
def __setstate__ (self , state ):
152
- ''' Sets the state of this ``ArrayProxy`` during unpickling. '''
152
+ """ Sets the state of this ``ArrayProxy`` during unpickling. """
153
153
self .__dict__ .update (state )
154
154
self ._lock = Lock ()
155
155
@@ -184,10 +184,18 @@ def is_proxy(self):
184
184
185
185
@contextmanager
186
186
def _get_fileobj (self ):
187
- '''Create and return a new ``ImageOpener``, or return an existing one.
188
- one. The specific behaviour depends on the value of the
189
- ``keep_file_open`` flag that was passed to ``__init__``.
190
- '''
187
+ """Create and return a new ``ImageOpener``, or return an existing one.
188
+
189
+ The specific behaviour depends on the value of the ``keep_file_open``
190
+ flag that was passed to ``__init__``.
191
+
192
+
193
+ Yields
194
+ ------
195
+ ImageOpener
196
+ A newly created ``ImageOpener`` instance, or an existing one,
197
+ which provides access to the file.
198
+ """
191
199
if self ._keep_file_open :
192
200
if not hasattr (self , '_opener' ):
193
201
self ._opener = ImageOpener (self .file_like )
@@ -197,10 +205,10 @@ def _get_fileobj(self):
197
205
yield opener
198
206
199
207
def get_unscaled (self ):
200
- ''' Read of data from file
208
+ """ Read of data from file
201
209
202
210
This is an optional part of the proxy API
203
- '''
211
+ """
204
212
with self ._get_fileobj () as fileobj :
205
213
raw_data = array_from_file (self ._shape ,
206
214
self ._dtype ,
@@ -228,7 +236,7 @@ def __getitem__(self, slicer):
228
236
return apply_read_scaling (raw_data , self ._slope , self ._inter )
229
237
230
238
def reshape (self , shape ):
231
- ''' Return an ArrayProxy with a new shape, without modifying data '''
239
+ """ Return an ArrayProxy with a new shape, without modifying data """
232
240
size = np .prod (self ._shape )
233
241
234
242
# Calculate new shape if not fully specified
0 commit comments