1
+ from copy import copy as copy_func
1
2
from datetime import datetime
2
3
import operator
3
4
from textwrap import dedent
@@ -5313,7 +5314,7 @@ def _add_numeric_methods_unary(cls):
5313
5314
Add in numeric unary methods.
5314
5315
"""
5315
5316
5316
- def _make_evaluate_unary (op , opstr ):
5317
+ def _make_evaluate_unary (op , opstr : str_t ):
5317
5318
def _evaluate_numeric_unary (self ):
5318
5319
5319
5320
attrs = self ._get_attributes_dict ()
@@ -5419,7 +5420,7 @@ def _add_logical_methods(cls):
5419
5420
"""
5420
5421
)
5421
5422
5422
- def _make_logical_function (name , desc , f ):
5423
+ def _make_logical_function (name : str_t , desc : str_t , f ):
5423
5424
@Substitution (outname = name , desc = desc )
5424
5425
@Appender (_index_shared_docs ["index_" + name ])
5425
5426
@Appender (_doc )
@@ -5508,15 +5509,15 @@ def ensure_index_from_sequences(sequences, names=None):
5508
5509
return MultiIndex .from_arrays (sequences , names = names )
5509
5510
5510
5511
5511
- def ensure_index (index_like , copy = False ):
5512
+ def ensure_index (index_like , copy : bool = False ):
5512
5513
"""
5513
5514
Ensure that we have an index from some index-like object.
5514
5515
5515
5516
Parameters
5516
5517
----------
5517
- index : sequence
5518
+ index_like : sequence
5518
5519
An Index or other sequence
5519
- copy : bool
5520
+ copy : bool, default False
5520
5521
5521
5522
Returns
5522
5523
-------
@@ -5567,9 +5568,7 @@ def ensure_index(index_like, copy=False):
5567
5568
# clean_index_list does the equivalent of copying
5568
5569
# so only need to do this if not list instance
5569
5570
if copy :
5570
- from copy import copy
5571
-
5572
- index_like = copy (index_like )
5571
+ index_like = copy_func (index_like )
5573
5572
5574
5573
return Index (index_like )
5575
5574
@@ -5596,7 +5595,7 @@ def _trim_front(strings):
5596
5595
return trimmed
5597
5596
5598
5597
5599
- def _validate_join_method (method ):
5598
+ def _validate_join_method (method : str ):
5600
5599
if method not in ["left" , "right" , "inner" , "outer" ]:
5601
5600
raise ValueError (f"do not recognize join method { method } " )
5602
5601
0 commit comments