Skip to content

Commit 4e43629

Browse files
jbrockmendeljorisvandenbossche
authored andcommitted
CLN: remove merge-pr script, clean Exception in tm, doc (#28442)
1 parent 9ef67b1 commit 4e43629

File tree

5 files changed

+8
-346
lines changed

5 files changed

+8
-346
lines changed

doc/source/user_guide/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4845,7 +4845,7 @@ The above example creates a partitioned dataset that may look like:
48454845
from shutil import rmtree
48464846
try:
48474847
rmtree('test')
4848-
except Exception:
4848+
except OSError:
48494849
pass
48504850
48514851
.. _io.sql:

pandas/tests/groupby/aggregate/test_other.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,7 @@ def test_agg_consistency():
385385
# agg with ([]) and () not consistent
386386
# GH 6715
387387
def P1(a):
388-
try:
389-
return np.percentile(a.dropna(), q=1)
390-
except Exception:
391-
return np.nan
388+
return np.percentile(a.dropna(), q=1)
392389

393390
df = DataFrame(
394391
{

pandas/tests/test_downstream.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def test_dask(df):
5050
assert ddf.compute() is not None
5151

5252

53+
@pytest.mark.filterwarnings("ignore:Panel class is removed")
5354
def test_xarray(df):
5455

5556
xarray = import_module("xarray") # noqa

pandas/util/testing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def ensure_clean(filename=None, return_filelike=False):
511511
finally:
512512
try:
513513
os.close(fd)
514-
except Exception:
514+
except OSError:
515515
print(
516516
"Couldn't close file descriptor: {fdesc} (file: {fname})".format(
517517
fdesc=fd, fname=filename
@@ -520,7 +520,7 @@ def ensure_clean(filename=None, return_filelike=False):
520520
try:
521521
if os.path.exists(filename):
522522
os.remove(filename)
523-
except Exception as e:
523+
except OSError as e:
524524
print("Exception on removing file: {error}".format(error=e))
525525

526526

@@ -539,7 +539,7 @@ def ensure_clean_dir():
539539
finally:
540540
try:
541541
rmtree(directory_name)
542-
except Exception:
542+
except OSError:
543543
pass
544544

545545

@@ -2675,7 +2675,8 @@ class for all warnings. To check that no warning is returned,
26752675
for m in clear:
26762676
try:
26772677
m.__warningregistry__.clear()
2678-
except Exception:
2678+
except AttributeError:
2679+
# module may not have __warningregistry__
26792680
pass
26802681

26812682
saw_warning = False

0 commit comments

Comments
 (0)