Skip to content

Commit

Permalink
fix port generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfleischer committed Dec 30, 2023
1 parent 8f66238 commit 2694fc4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/cloudmesh/common/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@


class PortGenerator:
class PortGenerator:
def __init__(self, base_port):
"""
Initializes a PortGenerator object.
def __init__(self, base_port):
"""
Initializes a PortGenerator object.
Parameters:
- base_port (int): The starting port number.
Parameters:
- base_port (int): The starting port number.
Attributes:
- base_port (int): The starting port number.
- last (int): The last generated port number.
"""
self.base_port = base_port
Attributes:
- base_port (int): The starting port number.
- last (int): The last generated port number.
"""
self.base_port = base_port

@staticmethod
def is_port_available(self, port):
"""
Check if a given port is available in use.
Expand All @@ -36,6 +36,7 @@ def is_port_available(self, port):
print(f"Port {port} is available")
return True

@staticmethod
def get_port(self, port=None, n=100):
"""
Returns an available port within a specified range starting from a port if specified.
Expand Down

0 comments on commit 2694fc4

Please sign in to comment.