Skip to content

Commit 77e81ca

Browse files
charlesdong1991Pingviinituutti
authored andcommitted
fix quote position (pandas-dev#24065)
1 parent d7d0db0 commit 77e81ca

22 files changed

+356
-157
lines changed

pandas/core/accessor.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def __dir__(self):
4141

4242

4343
class PandasDelegate(object):
44-
""" an abstract base class for delegating methods/properties """
44+
"""
45+
an abstract base class for delegating methods/properties
46+
"""
4547

4648
def _delegate_property_get(self, name, *args, **kwargs):
4749
raise TypeError("You cannot access the "
@@ -146,7 +148,8 @@ def add_delegate_accessors(cls):
146148
# 2. We use a UserWarning instead of a custom Warning
147149

148150
class CachedAccessor(object):
149-
"""Custom property-like object (descriptor) for caching accessors.
151+
"""
152+
Custom property-like object (descriptor) for caching accessors.
150153
151154
Parameters
152155
----------
@@ -189,7 +192,8 @@ def decorator(accessor):
189192
return decorator
190193

191194

192-
_doc = """Register a custom accessor on %(klass)s objects.
195+
_doc = """\
196+
Register a custom accessor on %(klass)s objects.
193197
194198
Parameters
195199
----------

pandas/core/arrays/base.py

+50-25
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323

2424
class ExtensionArray(object):
25-
"""Abstract base class for custom 1-D array types.
25+
"""
26+
Abstract base class for custom 1-D array types.
2627
2728
pandas will recognize instances of this class as proper arrays
2829
with a custom type and will not attempt to coerce them to objects. They
@@ -100,7 +101,8 @@ class ExtensionArray(object):
100101
# ------------------------------------------------------------------------
101102
@classmethod
102103
def _from_sequence(cls, scalars, dtype=None, copy=False):
103-
"""Construct a new ExtensionArray from a sequence of scalars.
104+
"""
105+
Construct a new ExtensionArray from a sequence of scalars.
104106
105107
Parameters
106108
----------
@@ -121,7 +123,8 @@ def _from_sequence(cls, scalars, dtype=None, copy=False):
121123

122124
@classmethod
123125
def _from_factorized(cls, values, original):
124-
"""Reconstruct an ExtensionArray after factorization.
126+
"""
127+
Reconstruct an ExtensionArray after factorization.
125128
126129
Parameters
127130
----------
@@ -143,7 +146,8 @@ def _from_factorized(cls, values, original):
143146

144147
def __getitem__(self, item):
145148
# type (Any) -> Any
146-
"""Select a subset of self.
149+
"""
150+
Select a subset of self.
147151
148152
Parameters
149153
----------
@@ -174,7 +178,8 @@ def __getitem__(self, item):
174178

175179
def __setitem__(self, key, value):
176180
# type: (Union[int, np.ndarray], Any) -> None
177-
"""Set one or more values inplace.
181+
"""
182+
Set one or more values inplace.
178183
179184
This method is not required to satisfy the pandas extension array
180185
interface.
@@ -219,7 +224,8 @@ def __setitem__(self, key, value):
219224

220225
def __len__(self):
221226
# type: () -> int
222-
"""Length of this array
227+
"""
228+
Length of this array
223229
224230
Returns
225231
-------
@@ -228,8 +234,8 @@ def __len__(self):
228234
raise AbstractMethodError(self)
229235

230236
def __iter__(self):
231-
"""Iterate over elements of the array.
232-
237+
"""
238+
Iterate over elements of the array.
233239
"""
234240
# This needs to be implemented so that pandas recognizes extension
235241
# arrays as list-like. The default implementation makes successive
@@ -243,26 +249,32 @@ def __iter__(self):
243249
@property
244250
def dtype(self):
245251
# type: () -> ExtensionDtype
246-
"""An instance of 'ExtensionDtype'."""
252+
"""
253+
An instance of 'ExtensionDtype'.
254+
"""
247255
raise AbstractMethodError(self)
248256

249257
@property
250258
def shape(self):
251259
# type: () -> Tuple[int, ...]
252-
"""Return a tuple of the array dimensions."""
260+
"""
261+
Return a tuple of the array dimensions.
262+
"""
253263
return (len(self),)
254264

255265
@property
256266
def ndim(self):
257267
# type: () -> int
258-
"""Extension Arrays are only allowed to be 1-dimensional."""
268+
"""
269+
Extension Arrays are only allowed to be 1-dimensional.
270+
"""
259271
return 1
260272

261273
@property
262274
def nbytes(self):
263275
# type: () -> int
264-
"""The number of bytes needed to store this object in memory.
265-
276+
"""
277+
The number of bytes needed to store this object in memory.
266278
"""
267279
# If this is expensive to compute, return an approximate lower bound
268280
# on the number of bytes needed.
@@ -272,7 +284,8 @@ def nbytes(self):
272284
# Additional Methods
273285
# ------------------------------------------------------------------------
274286
def astype(self, dtype, copy=True):
275-
"""Cast to a NumPy array with 'dtype'.
287+
"""
288+
Cast to a NumPy array with 'dtype'.
276289
277290
Parameters
278291
----------
@@ -315,7 +328,8 @@ def isna(self):
315328

316329
def _values_for_argsort(self):
317330
# type: () -> ndarray
318-
"""Return values for sorting.
331+
"""
332+
Return values for sorting.
319333
320334
Returns
321335
-------
@@ -365,7 +379,8 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs):
365379
return result
366380

367381
def fillna(self, value=None, method=None, limit=None):
368-
""" Fill NA/NaN values using the specified method.
382+
"""
383+
Fill NA/NaN values using the specified method.
369384
370385
Parameters
371386
----------
@@ -418,7 +433,8 @@ def fillna(self, value=None, method=None, limit=None):
418433
return new_values
419434

420435
def dropna(self):
421-
""" Return ExtensionArray without NA values
436+
"""
437+
Return ExtensionArray without NA values
422438
423439
Returns
424440
-------
@@ -462,7 +478,8 @@ def shift(self, periods=1):
462478
return self._concat_same_type([a, b])
463479

464480
def unique(self):
465-
"""Compute the ExtensionArray of unique values.
481+
"""
482+
Compute the ExtensionArray of unique values.
466483
467484
Returns
468485
-------
@@ -475,7 +492,8 @@ def unique(self):
475492

476493
def _values_for_factorize(self):
477494
# type: () -> Tuple[ndarray, Any]
478-
"""Return an array and missing value suitable for factorization.
495+
"""
496+
Return an array and missing value suitable for factorization.
479497
480498
Returns
481499
-------
@@ -499,7 +517,8 @@ def _values_for_factorize(self):
499517

500518
def factorize(self, na_sentinel=-1):
501519
# type: (int) -> Tuple[ndarray, ExtensionArray]
502-
"""Encode the extension array as an enumerated type.
520+
"""
521+
Encode the extension array as an enumerated type.
503522
504523
Parameters
505524
----------
@@ -552,7 +571,8 @@ def factorize(self, na_sentinel=-1):
552571

553572
def take(self, indices, allow_fill=False, fill_value=None):
554573
# type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
555-
"""Take elements from an array.
574+
"""
575+
Take elements from an array.
556576
557577
Parameters
558578
----------
@@ -641,7 +661,8 @@ def take(self, indices, allow_fill=False, fill_value=None):
641661

642662
def copy(self, deep=False):
643663
# type: (bool) -> ExtensionArray
644-
"""Return a copy of the array.
664+
"""
665+
Return a copy of the array.
645666
646667
Parameters
647668
----------
@@ -661,13 +682,16 @@ def copy(self, deep=False):
661682
def _formatting_values(self):
662683
# type: () -> np.ndarray
663684
# At the moment, this has to be an array since we use result.dtype
664-
"""An array of values to be printed in, e.g. the Series repr"""
685+
"""
686+
An array of values to be printed in, e.g. the Series repr
687+
"""
665688
return np.array(self)
666689

667690
@classmethod
668691
def _concat_same_type(cls, to_concat):
669692
# type: (Sequence[ExtensionArray]) -> ExtensionArray
670-
"""Concatenate multiple array
693+
"""
694+
Concatenate multiple array
671695
672696
Parameters
673697
----------
@@ -689,7 +713,8 @@ def _concat_same_type(cls, to_concat):
689713
@property
690714
def _ndarray_values(self):
691715
# type: () -> np.ndarray
692-
"""Internal pandas method for lossy conversion to a NumPy ndarray.
716+
"""
717+
Internal pandas method for lossy conversion to a NumPy ndarray.
693718
694719
This method is not part of the pandas interface.
695720

0 commit comments

Comments
 (0)