polish code with new pre-commit rule (#2923)

This commit is contained in:
Zero Rains
2025-07-19 23:19:27 +08:00
committed by GitHub
parent b8676d71a8
commit 25698d56d1
424 changed files with 14307 additions and 13518 deletions

View File

@@ -20,16 +20,16 @@ import socket
def get_hostname_ip():
"""
Get the system's hostname and primary IP address.
Returns:
tuple: A tuple containing:
- hostname (str): The system's hostname
- ip_address (str): The primary IP address associated with the hostname
Raises:
socket.gaierror: If the hostname cannot be resolved to an IP address
"""
hostname = socket.gethostname()
ip_address = socket.gethostbyname(hostname)
return hostname, ip_address