Skip to content

Add missing type annotations #6950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared-bindings/hashlib/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//| |see_cpython_module| :mod:`cpython:hashlib`.
//| """
//|
//| def new(name, data=b"") -> hashlib.Hash:
//| def new(name: str, data: bytes=b"") -> hashlib.Hash:
//| """Returns a Hash object setup for the named algorithm. Raises ValueError when the named
//| algorithm is unsupported.
//|
Expand Down
12 changes: 6 additions & 6 deletions shared-bindings/usb/core/Device.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_
MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj,
(mp_obj_t)&usb_core_device_get_manufacturer_obj);

//| def write(self, endpoint: int, data: ReadableBuffer, timeout = None) -> int:
//| def write(self, endpoint: int, data: ReadableBuffer, timeout:Optional[int] = None) -> int:
//| """Write data to a specific endpoint on the device.
//|
//| :param int endpoint: the bEndpointAddress you want to communicate with.
Expand Down Expand Up @@ -159,7 +159,7 @@ STATIC mp_obj_t usb_core_device_write(size_t n_args, const mp_obj_t *pos_args, m
MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_write_obj, 2, usb_core_device_write);


//| def read(self, endpoint: int, size_or_buffer: array.array, timeout = None) -> int:
//| def read(self, endpoint: int, size_or_buffer: array.array, timeout:Optional[int] = None) -> int:
//| """Read data from the endpoint.
//|
//| :param int endpoint: the bEndpointAddress you want to communicate with.
Expand All @@ -186,8 +186,8 @@ STATIC mp_obj_t usb_core_device_read(size_t n_args, const mp_obj_t *pos_args, mp
}
MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_read_obj, 2, usb_core_device_read);

//| def ctrl_transfer(self, bmRequestType, bRequest, wValue=0, wIndex=0,
//| data_or_wLength: Optional[array.array] = None, timeout = None) -> int:
//| def ctrl_transfer(self, bmRequestType:int, bRequest:int, wValue:int=0, wIndex:int=0,
//| data_or_wLength: Optional[array.array] = None, timeout:Optional[int] = None) -> int:
//| """Do a control transfer on the endpoint 0. The parameters bmRequestType,
//| bRequest, wValue and wIndex are the same of the USB Standard Control
//| Request format.
Expand Down Expand Up @@ -254,7 +254,7 @@ STATIC mp_obj_t usb_core_device_is_kernel_driver_active(mp_obj_t self_in, mp_obj
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_is_kernel_driver_active_obj, usb_core_device_is_kernel_driver_active);

//| def detach_kernel_driver(self, interface: int):
//| def detach_kernel_driver(self, interface: int) -> None:
//| """Stop CircuitPython from using the interface. If successful, you
//| will then be able to perform I/O. CircuitPython will automatically
//| re-start using the interface on reload.
Expand All @@ -271,7 +271,7 @@ STATIC mp_obj_t usb_core_device_detach_kernel_driver(mp_obj_t self_in, mp_obj_t
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_detach_kernel_driver_obj, usb_core_device_detach_kernel_driver);

//| def attach_kernel_driver(self, interface: int):
//| def attach_kernel_driver(self, interface: int) -> None:
//| """Allow CircuitPython to use the interface if it wants to.
//|
//| :param int interface: the device interface number to allow CircuitPython to use
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/usb/core/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ NORETURN void mp_raise_usb_core_USBTimeoutError(void) {
}


//| def find(find_all=False, *, idVendor=None, idProduct=None):
//| def find(find_all:bool=False, *, idVendor:Optional[int]=None, idProduct:Optional[int]=None) -> Device:
//| """Find the first device that matches the given requirements or, if
//| find_all is True, return a generator of all matching devices.
//|
Expand Down