Open hgalytoby opened 2 years ago
Receives bytes, but can also give to memoryview. (buffer.getbuffer() -> memoryview)
But pycharm will show a warning.
source code https://github.com/alexdelorenzo/aiopath/blob/main/aiopath/path.py#L180
# type-check for the buffer interface before truncating the file view = memoryview(data)
I don't quite understand what this means.
I originally used getvalue, but after reading this https://stackoverflow.com/questions/61319551/when-should-one-use-bytesio-getvalue-instead-of-getbuffer, it seems that getbuffer would be better.
Everything works, it's just that I don't want pycharm to have a warning, I just want to know, thanks.
async def resize(path, size: Tuple[int, int] = (200, 200)): img = Image.open(path) buffer = io.BytesIO() if img.mode == 'P': img = img.convert('RGB') img.thumbnail(size=size) img.save(buffer, format=img.format.lower()) await AsyncPath(path).write_bytes(buffer.getbuffer())
Receives bytes, but can also give to memoryview. (buffer.getbuffer() -> memoryview)
But pycharm will show a warning.
source code https://github.com/alexdelorenzo/aiopath/blob/main/aiopath/path.py#L180
I don't quite understand what this means.
I originally used getvalue, but after reading this https://stackoverflow.com/questions/61319551/when-should-one-use-bytesio-getvalue-instead-of-getbuffer, it seems that getbuffer would be better.
Everything works, it's just that I don't want pycharm to have a warning, I just want to know, thanks.