Skip to content

Commit

Permalink
Typing corrections (#109)
Browse files Browse the repository at this point in the history
* Correct typing of SMBus.fd

At initialization SMBus.fd is None making the correct typing
Optional[int].

* Correct typing of SMBus.enable_pec

enable_pec's enable parameter has a default value that was not captured
in the typing information.

* Correct typing of SMBus.force

SMBus.force is never set to None unless a user manually sets it as such.
Additionally, no logic checks if SMBus.force is None, only if it is
True, making False and None equivalent in this case.
  • Loading branch information
yodaldevoid authored Jul 7, 2024
1 parent 6724759 commit 865af1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions smbus2/smbus2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class i2c_rdwr_ioctl_data(Structure):
def create(*i2c_msg_instances: Sequence[i2c_msg]) -> "i2c_rdwr_ioctl_data": ...

class SMBus:
fd: int = ...
fd: Optional[int] = ...
funcs: I2cFunc = ...
address: Optional[int] = ...
force: Optional[bool] = ...
force: bool = ...
pec: int = ...
def __init__(
self, bus: _UnionT[None, int, str] = ..., force: bool = ...
Expand All @@ -97,7 +97,7 @@ class SMBus:
) -> None: ...
def open(self, bus: _UnionT[int, str]) -> None: ...
def close(self) -> None: ...
def enable_pec(self, enable: bool) -> None: ...
def enable_pec(self, enable: bool = ...) -> None: ...
def write_quick(self, i2c_addr: int, force: Optional[bool] = ...) -> None: ...
def read_byte(self, i2c_addr: int, force: Optional[bool] = ...) -> int: ...
def write_byte(
Expand Down

0 comments on commit 865af1e

Please sign in to comment.