Skip to content

Commit

Permalink
refactor: Simplify code in client.py and server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cauliyang committed Sep 1, 2023
1 parent b1ccf1f commit 80e1634
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pxblat/server/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def __init__(
self._basic_option.withGenome(genome)
if genome_data_dir is not None:
self._basic_option.withGenomeDataDir(genome_data_dir)
if seq_dir is not None:
self._basic_option.withSeqDir(str(seq_dir))

self._basic_option.withSeqDir(str(seq_dir))

self._wait_ready = wait_ready
self._wait_timeout = wait_timeout
Expand Down
7 changes: 6 additions & 1 deletion src/pxblat/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def stop(self):
if self._process is not None:
self._process.terminate()

self._is_open = False
self._is_ready = False

def status(self, *, instance=False) -> dict[str, str] | Status:
"""Retrieves the status of the gfServer instance.
Expand Down Expand Up @@ -347,7 +350,9 @@ def create_option() -> ServerOption:

def __str__(self) -> str:
"""Return server option as a string."""
return f"Server({self.host}, {self.port}, ready: {self.is_ready()} open: {self.is_open()} {self.option})"
return f"Server({self.host}, {self.port}, ready: {self.is_ready()} open: {self.is_open()}\n {self.option})"

__repr__ = __str__

def __enter__(self):
"""Starts the gfServer instance in blocking mode when used as a context manager."""
Expand Down

0 comments on commit 80e1634

Please sign in to comment.