@@ -118,7 +118,7 @@ the ``pandas.util._decorators.deprecate``:
118
118
119
119
from pandas.util._decorators import deprecate
120
120
121
- deprecate(' old_func' , ' new_func' , ' 1.1.0' )
121
+ deprecate(" old_func" , " new_func" , " 1.1.0" )
122
122
123
123
Otherwise, you need to do it manually:
124
124
@@ -135,7 +135,7 @@ Otherwise, you need to do it manually:
135
135
Use new_func instead.
136
136
"""
137
137
warnings.warn(
138
- ' Use new_func instead.' ,
138
+ " Use new_func instead." ,
139
139
FutureWarning ,
140
140
stacklevel = find_stack_level(),
141
141
)
@@ -179,6 +179,7 @@ The appropriate way to annotate this would be as follows
179
179
180
180
str_type = str
181
181
182
+
182
183
class SomeClass2 :
183
184
str : str_type = None
184
185
@@ -190,8 +191,8 @@ In some cases you may be tempted to use ``cast`` from the typing module when you
190
191
191
192
from pandas.core.dtypes.common import is_number
192
193
193
- def cannot_infer_bad (obj : Union[str , int , float ]):
194
194
195
+ def cannot_infer_bad (obj : Union[str , int , float ]):
195
196
if is_number(obj):
196
197
...
197
198
else : # Reasonably only str objects would reach this but...
@@ -203,7 +204,6 @@ The limitation here is that while a human can reasonably understand that ``is_nu
203
204
.. code-block :: python
204
205
205
206
def cannot_infer_good (obj : Union[str , int , float ]):
206
-
207
207
if isinstance (obj, str ):
208
208
return obj.upper()
209
209
else :
@@ -222,6 +222,7 @@ For example, quite a few functions in pandas accept a ``dtype`` argument. This c
222
222
223
223
from pandas._typing import Dtype
224
224
225
+
225
226
def as_type (dtype : Dtype) -> ... :
226
227
...
227
228
@@ -428,6 +429,7 @@ be located.
428
429
import pandas as pd
429
430
import pandas._testing as tm
430
431
432
+
431
433
def test_getitem_listlike_of_ints ():
432
434
ser = pd.Series(range (5 ))
433
435
@@ -635,25 +637,29 @@ as a comment to a new test.
635
637
import pandas as pd
636
638
637
639
638
- @pytest.mark.parametrize (' dtype' , [' int8' , ' int16' , ' int32' , ' int64' ])
640
+ @pytest.mark.parametrize (" dtype" , [" int8" , " int16" , " int32" , " int64" ])
639
641
def test_dtypes (dtype ):
640
642
assert str (np.dtype(dtype)) == dtype
641
643
642
644
643
645
@pytest.mark.parametrize (
644
- ' dtype' , [' float32' , pytest.param(' int16' , marks = pytest.mark.skip),
645
- pytest.param(' int32' , marks = pytest.mark.xfail(
646
- reason = ' to show how it works' ))])
646
+ " dtype" ,
647
+ [
648
+ " float32" ,
649
+ pytest.param(" int16" , marks = pytest.mark.skip),
650
+ pytest.param(" int32" , marks = pytest.mark.xfail(reason = " to show how it works" )),
651
+ ],
652
+ )
647
653
def test_mark (dtype ):
648
- assert str (np.dtype(dtype)) == ' float32'
654
+ assert str (np.dtype(dtype)) == " float32"
649
655
650
656
651
657
@pytest.fixture
652
658
def series ():
653
659
return pd.Series([1 , 2 , 3 ])
654
660
655
661
656
- @pytest.fixture (params = [' int8' , ' int16' , ' int32' , ' int64' ])
662
+ @pytest.fixture (params = [" int8" , " int16" , " int32" , " int64" ])
657
663
def dtype (request ):
658
664
return request.param
659
665
@@ -722,10 +728,16 @@ for details <https://hypothesis.readthedocs.io/en/latest/index.html>`_.
722
728
import json
723
729
from hypothesis import given, strategies as st
724
730
725
- any_json_value = st.deferred(lambda: st.one_of(
726
- st.none(), st.booleans(), st.floats(allow_nan=False), st.text(),
727
- st.lists(any_json_value), st.dictionaries(st.text(), any_json_value)
728
- ))
731
+ any_json_value = st.deferred(
732
+ lambda: st.one_of(
733
+ st.none(),
734
+ st.booleans(),
735
+ st.floats(allow_nan=False),
736
+ st.text(),
737
+ st.lists(any_json_value),
738
+ st.dictionaries(st.text(), any_json_value),
739
+ )
740
+ )
729
741
730
742
731
743
@given(value=any_json_value)
0 commit comments