encode / apistar

The Web API toolkit. 🛠
https://docs.apistar.com
BSD 3-Clause "New" or "Revised" License
5.57k stars 411 forks source link

Undefined names: import ParseError, ValidationError for line 85 #679

Closed cclauss closed 2 years ago

cclauss commented 3 years ago

ParseError and ValidationError are both used on line 85 but they are not defined or imported.

flake8 testing of https://github.com/encode/apistar on Python 3.9.0rc2+

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./apistar/cli.py:85:17: F821 undefined name 'ParseError'
        except (ParseError, ValidationError) as exc:
                ^
./apistar/cli.py:85:29: F821 undefined name 'ValidationError'
        except (ParseError, ValidationError) as exc:
                            ^
./apistar/schemas/autodetermine.py:15:20: F821 undefined name 'OPEN_API'
            return OPEN_API.validate(value, strict=strict)
                   ^
./apistar/schemas/autodetermine.py:17:20: F821 undefined name 'SWAGGER'
            return SWAGGER.validate(value, strict=strict)
                   ^
4     F821 undefined name 'ParseError'
4

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead, these tests are focus on runtime safety and correctness: