mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
polish code with new pre-commit rule (#2923)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user