Skip to content

Commit df32433

Browse files
committed
Remove redundant contextlib.closing
1 parent ebf9fc4 commit df32433

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sphinx_autobuild/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"""Generic utilities."""
22

33
import socket
4-
from contextlib import closing
54

65

76
def find_free_port():
87
"""Find and return a free port number.
98
109
Shout-out to https://stackoverflow.com/a/45690594/1931274!
1110
"""
12-
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
11+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
1312
s.bind(("", 0))
1413
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
1514
return s.getsockname()[1]

0 commit comments

Comments
 (0)