90
90
npt ,
91
91
)
92
92
from pandas .compat import PYPY
93
- from pandas .compat ._constants import REF_COUNT
93
+ from pandas .compat ._constants import (
94
+ REF_COUNT ,
95
+ WARNING_CHECK_DISABLED ,
96
+ )
94
97
from pandas .compat ._optional import import_optional_dependency
95
98
from pandas .compat .numpy import function as nv
96
99
from pandas .errors import (
@@ -7285,7 +7288,7 @@ def fillna(
7285
7288
"""
7286
7289
inplace = validate_bool_kwarg (inplace , "inplace" )
7287
7290
if inplace :
7288
- if not PYPY and using_copy_on_write ():
7291
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
7289
7292
if sys .getrefcount (self ) <= REF_COUNT :
7290
7293
warnings .warn (
7291
7294
_chained_assignment_method_msg ,
@@ -7294,6 +7297,7 @@ def fillna(
7294
7297
)
7295
7298
elif (
7296
7299
not PYPY
7300
+ and not WARNING_CHECK_DISABLED
7297
7301
and not using_copy_on_write ()
7298
7302
and self ._is_view_after_cow_rules ()
7299
7303
):
@@ -7588,7 +7592,7 @@ def ffill(
7588
7592
downcast = self ._deprecate_downcast (downcast , "ffill" )
7589
7593
inplace = validate_bool_kwarg (inplace , "inplace" )
7590
7594
if inplace :
7591
- if not PYPY and using_copy_on_write ():
7595
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
7592
7596
if sys .getrefcount (self ) <= REF_COUNT :
7593
7597
warnings .warn (
7594
7598
_chained_assignment_method_msg ,
@@ -7597,6 +7601,7 @@ def ffill(
7597
7601
)
7598
7602
elif (
7599
7603
not PYPY
7604
+ and not WARNING_CHECK_DISABLED
7600
7605
and not using_copy_on_write ()
7601
7606
and self ._is_view_after_cow_rules ()
7602
7607
):
@@ -7792,7 +7797,7 @@ def bfill(
7792
7797
downcast = self ._deprecate_downcast (downcast , "bfill" )
7793
7798
inplace = validate_bool_kwarg (inplace , "inplace" )
7794
7799
if inplace :
7795
- if not PYPY and using_copy_on_write ():
7800
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
7796
7801
if sys .getrefcount (self ) <= REF_COUNT :
7797
7802
warnings .warn (
7798
7803
_chained_assignment_method_msg ,
@@ -7801,6 +7806,7 @@ def bfill(
7801
7806
)
7802
7807
elif (
7803
7808
not PYPY
7809
+ and not WARNING_CHECK_DISABLED
7804
7810
and not using_copy_on_write ()
7805
7811
and self ._is_view_after_cow_rules ()
7806
7812
):
@@ -7963,7 +7969,7 @@ def replace(
7963
7969
7964
7970
inplace = validate_bool_kwarg (inplace , "inplace" )
7965
7971
if inplace :
7966
- if not PYPY and using_copy_on_write ():
7972
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
7967
7973
if sys .getrefcount (self ) <= REF_COUNT :
7968
7974
warnings .warn (
7969
7975
_chained_assignment_method_msg ,
@@ -7972,6 +7978,7 @@ def replace(
7972
7978
)
7973
7979
elif (
7974
7980
not PYPY
7981
+ and not WARNING_CHECK_DISABLED
7975
7982
and not using_copy_on_write ()
7976
7983
and self ._is_view_after_cow_rules ()
7977
7984
):
@@ -8415,7 +8422,7 @@ def interpolate(
8415
8422
inplace = validate_bool_kwarg (inplace , "inplace" )
8416
8423
8417
8424
if inplace :
8418
- if not PYPY and using_copy_on_write ():
8425
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
8419
8426
if sys .getrefcount (self ) <= REF_COUNT :
8420
8427
warnings .warn (
8421
8428
_chained_assignment_method_msg ,
@@ -8424,6 +8431,7 @@ def interpolate(
8424
8431
)
8425
8432
elif (
8426
8433
not PYPY
8434
+ and not WARNING_CHECK_DISABLED
8427
8435
and not using_copy_on_write ()
8428
8436
and self ._is_view_after_cow_rules ()
8429
8437
):
@@ -9057,7 +9065,7 @@ def clip(
9057
9065
inplace = validate_bool_kwarg (inplace , "inplace" )
9058
9066
9059
9067
if inplace :
9060
- if not PYPY and using_copy_on_write ():
9068
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
9061
9069
if sys .getrefcount (self ) <= REF_COUNT :
9062
9070
warnings .warn (
9063
9071
_chained_assignment_method_msg ,
@@ -9066,6 +9074,7 @@ def clip(
9066
9074
)
9067
9075
elif (
9068
9076
not PYPY
9077
+ and not WARNING_CHECK_DISABLED
9069
9078
and not using_copy_on_write ()
9070
9079
and self ._is_view_after_cow_rules ()
9071
9080
):
@@ -10975,7 +10984,7 @@ def where(
10975
10984
"""
10976
10985
inplace = validate_bool_kwarg (inplace , "inplace" )
10977
10986
if inplace :
10978
- if not PYPY and using_copy_on_write ():
10987
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
10979
10988
if sys .getrefcount (self ) <= REF_COUNT :
10980
10989
warnings .warn (
10981
10990
_chained_assignment_method_msg ,
@@ -10984,6 +10993,7 @@ def where(
10984
10993
)
10985
10994
elif (
10986
10995
not PYPY
10996
+ and not WARNING_CHECK_DISABLED
10987
10997
and not using_copy_on_write ()
10988
10998
and self ._is_view_after_cow_rules ()
10989
10999
):
@@ -11058,7 +11068,7 @@ def mask(
11058
11068
) -> Self | None :
11059
11069
inplace = validate_bool_kwarg (inplace , "inplace" )
11060
11070
if inplace :
11061
- if not PYPY and using_copy_on_write ():
11071
+ if not PYPY and not WARNING_CHECK_DISABLED and using_copy_on_write ():
11062
11072
if sys .getrefcount (self ) <= REF_COUNT :
11063
11073
warnings .warn (
11064
11074
_chained_assignment_method_msg ,
@@ -11067,6 +11077,7 @@ def mask(
11067
11077
)
11068
11078
elif (
11069
11079
not PYPY
11080
+ and not WARNING_CHECK_DISABLED
11070
11081
and not using_copy_on_write ()
11071
11082
and self ._is_view_after_cow_rules ()
11072
11083
):
0 commit comments