Skip to content

Commit

Permalink
Supported passing the separators to the constructors. (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Jul 15, 2024
1 parent ce3730a commit 49ac2eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions leads/comm/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from leads.comm.prototype import Callback


def create_client(port: int = 16900, callback: Callback = Callback()) -> Client:
def create_client(port: int = 16900, callback: Callback = Callback(), separator: bytes = b";") -> Client:
"""
Create a client service.
:param port: the port to which the client connects
:param callback: the callback methods
:param separator: the separator that splits messages into sentences
:return: the client service
"""
return Client(port, callback)
return Client(port, callback, separator)


def start_client(server_address: str, target: Client = create_client(), parallel: bool = False) -> Client:
Expand Down
5 changes: 3 additions & 2 deletions leads/comm/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from leads.comm.server.server import Server


def create_server(port: int = 16900, callback: Callback = Callback()) -> Server:
def create_server(port: int = 16900, callback: Callback = Callback(), separator: bytes = b";") -> Server:
"""
Create a server service.
:param port: the port on which the server listens
:param callback: the callback methods
:param separator: the separator that splits messages into sentences
:return: the server service
"""
return Server(port, callback)
return Server(port, callback, separator)


def start_server(target: Server = create_server(), parallel: bool = False) -> Server:
Expand Down

0 comments on commit 49ac2eb

Please sign in to comment.