GithubHelp home page GithubHelp logo

mdczaplicki / flake8-union-none-first Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xome4ok/flake8-new-union-types

0.0 0.0 0.0 37 KB

Flake8 plugin to enforce None to be first in type union

License: MIT License

Python 100.00%

flake8-union-none-first's Introduction

flake8-new-union-types

Build Status PyPI PyPI - Python Version PyPI - License

Flake8 plugin to enforce the new Union and Optional annotation syntax defined in PEP 604.

Union[X, Y] = X | Y

Optional[X] = X | None

Note that it's impossible to use forward references in the new syntax, like this:

"X" | int

such a case can be expressed as a string containing both union terms:

"X | int"

Installation

pip install flake8-new-union-types

or if you use poetry:

poetry add --dev flake8-new-union-types

Usage

Error list

  • NU001 Use Foo | Bar syntax instead of Union (PEP 604)
  • NU002 Use Foo | None syntax instead of Optional (PEP 604)
  • NU003 Present the whole expression as a string to annotate forward refs, e.g. "int | Foo" (PEP 604)

Configuration

There is no way to configure the plugin at the moment.

flake8-union-none-first's People

Contributors

dmitriy-pryan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.