Skip to content

Commit

Permalink
STYLE: Update ruff settings to require None returning type
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Lombardi <anthony.lombardi@kitware.com>
  • Loading branch information
jcfr and NicerNewerCar committed Aug 9, 2023
1 parent a847ea3 commit 9a3eca9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
26 changes: 13 additions & 13 deletions scripts/python/PyAutoscoper/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __str__(self) -> str:
class AutoscoperServerVersionMismatch(Exception):
"""Exception raised when the client attempt to connect to an unsupported server."""

def __init__(self, server_version: int):
def __init__(self, server_version: int) -> None:
self.server_version = server_version
msg = f"server_version {self.server_version}, expected_version {EXPECTED_SERVER_VERSION}"
super().__init__(msg)
Expand Down Expand Up @@ -159,7 +159,7 @@ def _openConnection(self) -> socket.socket:
s.connect((self.address, 30007))
return s

def _checkVersion(self):
def _checkVersion(self) -> None:
"""
Internal function, should not be called by a user.
Expand Down Expand Up @@ -191,7 +191,7 @@ def is_connected(self) -> bool:
except (AutoscoperServerError, AutoscoperConnectionError):
return False

def loadTrial(self, trial_file: str):
def loadTrial(self, trial_file: str) -> None:
"""
Load a trial file into the PyAutoscoper server.
Expand All @@ -216,7 +216,7 @@ def loadTrackingData(
is_cm: bool = False,
is_rad: bool = False,
interpolate: bool = False,
):
) -> None:
"""
Load tracking data into the PyAutoscoper server.
Expand Down Expand Up @@ -271,7 +271,7 @@ def saveTracking(
convert_to_cm: bool = False,
convert_to_rad: bool = False,
interpolate: bool = False,
):
) -> None:
"""
Save tracking data from the PyAutoscoper server.
Expand Down Expand Up @@ -315,7 +315,7 @@ def saveTracking(
tracking_file,
)

def loadFilters(self, camera: int, settings_file: str):
def loadFilters(self, camera: int, settings_file: str) -> None:
"""
Load filter settings into the PyAutoscoper server.
Expand All @@ -332,7 +332,7 @@ def loadFilters(self, camera: int, settings_file: str):
raise AutoscoperServerError(f"Filter settings not found: {settings_file}")
self._send_command(0x04, camera, settings_file)

def setFrame(self, frame: int):
def setFrame(self, frame: int) -> None:
"""
Set the frame to be used for the next acquisition.
Expand Down Expand Up @@ -370,7 +370,7 @@ def getPose(self, volume: int, frame: int) -> list[float]:
struct.unpack("d", response[41:49])[0],
]

def setPose(self, volume: int, frame: int, pose: list[float]):
def setPose(self, volume: int, frame: int, pose: list[float]) -> None:
"""
Set the pose of the volume at the specified frame.
Expand Down Expand Up @@ -409,7 +409,7 @@ def getNCC(self, volume: int, pose: list[float]) -> list[float]:
ncc.append(struct.unpack("d", val)[0])
return ncc

def setBackground(self, threshold: float):
def setBackground(self, threshold: float) -> None:
"""
Set the background threshold.
Expand Down Expand Up @@ -458,7 +458,7 @@ def optimizeFrame(
opt_method: OptimizationMethod,
cf_model: CostFunction,
opt_init_heuristic: OptimizationInitializationHeuristic,
):
) -> None:
"""
Optimize the pose of the volume at the specified frame.
Expand Down Expand Up @@ -521,7 +521,7 @@ def optimizeFrame(
opt_init_heuristic.value,
)

def saveFullDRR(self):
def saveFullDRR(self) -> None:
"""
Save the full DRR.
Expand All @@ -530,7 +530,7 @@ def saveFullDRR(self):
"""
self._send_command(0x0C) # 12

def closeConnection(self):
def closeConnection(self) -> None:
"""
Close the connection to the server.
Expand Down Expand Up @@ -559,7 +559,7 @@ def trackingDialog(
opt_method: OptimizationMethod = OptimizationMethod.PARTICLE_SWARM_OPTIMIZATION,
cf_model: CostFunction = CostFunction.NORMALIZED_CROSS_CORRELATION,
opt_init_heuristic: OptimizationInitializationHeuristic = OptimizationInitializationHeuristic.PREVIOUS_FRAME,
):
) -> None:
"""
Automatically tracks the volume across the given frames.
Expand Down
1 change: 0 additions & 1 deletion scripts/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ extend-ignore = [
target-version = "py38"
line-length = 120
flake8-annotations.suppress-dummy-args = true
flake8-annotations.suppress-none-returning = true
isort.known-first-party = [
"PyAutoscoper",
]
Expand Down

0 comments on commit 9a3eca9

Please sign in to comment.