flake8-assignment-expressions-1.0.0
توضیحات
A flake8 plugin that disallows assignment expressions
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | flake8-assignment-expressions-1.0.0 |
| نام | flake8-assignment-expressions |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Nermin Dedovic |
| ایمیل نویسنده | nermin_dedovic@hotmail.com |
| آدرس صفحه اصلی | https://github.com/GambitingMan/flake8_assignment_expressions |
| آدرس اینترنتی | https://pypi.org/project/flake8-assignment-expressions/ |
| مجوز | MIT |
# flake8_expression_assignments
A flake8 plugin that disallows assignment expressions.
## Installation
`pip install flake8_assignment_expressions`
## Flake8 codes
| Code | Description |
|--------|--------------------------------------------------------|
| ASE101 | Line contains assignment expression |
## Why
Assignment expressions/the walrus operator was introduced in Python 3.8.
If you want to keep assignment expressions out of your own or your companies'
repositories, use this plugin.
This plugin will encourage you to rewrite code like
```python
import os
if environment := os.getenv("ENVIRONMENT"):
print(f"You are currently on the {environment} environment.")
```
into
```python
import os
environment = os.getenv("ENVIRONMENT")
if environment:
print(f"You are currently on the {environment} environment.")
```
## Running as a pre-commit hook
See [pre-commit](https://github.com/pre-commit/pre-commit) for instructions.
Sample `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8_assignment_expressions]
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.7 | flake8 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl flake8-assignment-expressions-1.0.0:
pip install flake8-assignment-expressions-1.0.0.whl
نصب پکیج tar.gz flake8-assignment-expressions-1.0.0:
pip install flake8-assignment-expressions-1.0.0.tar.gz