mirror of https://github.com/astral-sh/ruff
229 lines
3.7 KiB
Plaintext
229 lines
3.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "palRUQyD-U6u"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"some_string = \"123123\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "UWdDLRyf-Zz0"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"some_computation = 1 + 1"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "YreT1sTr-c32"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"some_computation"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "V48ppml7-h0f"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"def fn():\n",
|
|
" print(\"Hey!\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "cscw_8Xv-lYQ"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"fn()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E301\n",
|
|
"class Class:\n",
|
|
" \"\"\"Class for minimal repo.\"\"\"\n",
|
|
"\n",
|
|
" def method(cls) -> None:\n",
|
|
" pass\n",
|
|
" @classmethod\n",
|
|
" def cls_method(cls) -> None:\n",
|
|
" pass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E302\n",
|
|
"def a():\n",
|
|
" pass\n",
|
|
"\n",
|
|
"def b():\n",
|
|
" pass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E303\n",
|
|
"def fn():\n",
|
|
" _ = None\n",
|
|
"\n",
|
|
"\n",
|
|
" # arbitrary comment\n",
|
|
"\n",
|
|
" def inner(): # E306 not expected (pycodestyle detects E306)\n",
|
|
" pass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E303"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"def fn():\n",
|
|
"\tpass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E304\n",
|
|
"@decorator\n",
|
|
"\n",
|
|
"def function():\n",
|
|
" pass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E305:7:1\n",
|
|
"def fn():\n",
|
|
" print()\n",
|
|
"\n",
|
|
" # comment\n",
|
|
"\n",
|
|
" # another comment\n",
|
|
"fn()\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# E306:3:5\n",
|
|
"def a():\n",
|
|
" x = 1\n",
|
|
" def b():\n",
|
|
" pass\n",
|
|
"# end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Ok\n",
|
|
"def function1():\n",
|
|
"\tpass\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n",
|
|
"def function2():\n",
|
|
"\tpass\n",
|
|
"# end"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"colab": {
|
|
"provenance": []
|
|
},
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.7"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|