mediasoup-client-aiortc icon indicating copy to clipboard operation
mediasoup-client-aiortc copied to clipboard

Error in Python link mypy: "object" has no attribute "close"

Open ibc opened this issue 1 year ago • 0 comments

NOTE: Due to this bug, lintPython() is commented out in checkRelease() in npm-scripts.mjs. Also, in CI file, npm run lint:node is used instead of npm run lint to avoid this issue.

$ npm run lint:python


> [email protected] lint:python
> node npm-scripts.mjs lint:python

npm-scripts [INFO] [lint:python] lintPython()
npm-scripts [INFO] [lint:python] executeCmd(): cd worker && python3.10 -m flake8 && cd ..
npm-scripts [INFO] [lint:python] executeCmd(): cd worker && python3.10 -m mypy . && cd ..
channel.py:67: error: "object" has no attribute "close"  [attr-defined]
channel.py:74: error: "object" has no attribute "read"  [attr-defined]
channel.py:94: error: "object" has no attribute "write"  [attr-defined]
Found 3 errors in 1 file (checked 5 source files)

Offending code is this (one of them):

if self._writer is not None:
            self._writer.close()

Note that self._writer is defined as follows:

self._writer = Union[StreamWriter, None]

However, in theory, we are checking that it's not None but ¯_(ツ)_/¯

ibc avatar Sep 14 '23 16:09 ibc