@@ -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
@@ -641,9 +643,13 @@ as a comment to a new test.
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
654
assert str (np.dtype(dtype)) == ' float32'
649
655
@@ -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