{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "33faf7ad-a3fd-4ac4-a0c3-52e507ed49df", "metadata": {}, "outputs": [], "source": [ "x = 1" ] }, { "cell_type": "code", "execution_count": 2, "id": "481fb4bf-c1b9-47da-927f-3cfdfe4b49ec", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Simple case\n", "x" ] }, { "cell_type": "code", "execution_count": 3, "id": "2f0c65a5-0a0e-4080-afce-5a8ed0d706df", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Only skip the last expression\n", "x # B018\n", "x" ] }, { "cell_type": "code", "execution_count": 4, "id": "5a3fd75d-26d9-44f7-b013-1684aabfd0ae", "metadata": {}, "outputs": [], "source": [ "# Nested expressions isn't relevant\n", "if True:\n", " x" ] }, { "cell_type": "code", "execution_count": 5, "id": "e00e1afa-b76c-4774-be2a-7223641579e4", "metadata": {}, "outputs": [], "source": [ "# Semicolons shouldn't affect the output\n", "x;" ] }, { "cell_type": "code", "execution_count": 6, "id": "05eab5b9-e2ba-4954-8ef3-b035a79573fe", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Semicolons with multiple expressions\n", "x; x" ] }, { "cell_type": "code", "execution_count": 7, "id": "9cbbddc5-83fc-4fdb-81ab-53a3912ae898", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Comments, newlines and whitespace\n", "x # comment\n", "\n", "# another comment" ] } ], "metadata": { "kernelspec": { "display_name": "Python (ruff-playground)", "language": "python", "name": "ruff-playground" }, "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.3" } }, "nbformat": 4, "nbformat_minor": 5 }