Skip to content

Commit bfdd71b

Browse files
authored
Merge pull request satwikkansal#374 from satwikkansal/dev
Merge dev branch into master
2 parents ceec5fd + 83078d0 commit bfdd71b

File tree

10 files changed

+728
-344
lines changed

10 files changed

+728
-344
lines changed

.github/workflows/pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on: [pull_request]
2+
3+
permissions:
4+
contents: read
5+
pull-requests: read
6+
checks: write
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Write git diff to temp file
18+
run: |
19+
git fetch origin
20+
git diff origin/${{ github.base_ref }} --unified=0 *.md translations/*/*.md \
21+
> ${{ runner.temp }}/diff.md
22+
- uses: DavidAnson/markdownlint-cli2-action@v17
23+
with:
24+
globs: "${{ runner.temp }}/diff.md"

.markdownlint.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MD013:
2+
line_length: 120
3+
4+
# no-duplicate-heading - Multiple headings with the same content (Ignore multiple `Explanation` headings)
5+
MD024: false
6+
7+
# no-trailing-punctuation - Trailing punctuation in heading (Ignore exclamation marks in headings)
8+
MD026: false
9+
10+
# no-inline-html : Inline HTML (HTML is used for centered and theme specific images)
11+
MD033: false
12+
13+
# no-inline-html : Bare URL used (site should be attributed transparently, because otherwise we have to un-necesarily explain where the link directs)
14+
MD034: false
15+
16+
# first-line-h1 : First line in a file should be a top-level heading (Ignore because diff file will never have valid heading)
17+
MD041: false

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
default_language_version:
2+
python: python3.12
3+
repos:
4+
- repo: https://github.com/DavidAnson/markdownlint-cli2
5+
rev: v0.14.0
6+
hooks:
7+
- id: markdownlint-cli2

README.md

Lines changed: 476 additions & 343 deletions
Large diffs are not rendered by default.

noxfile.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from typing import TYPE_CHECKING
2+
3+
import nox
4+
5+
6+
if TYPE_CHECKING:
7+
from nox.sessions import Session
8+
9+
python_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"]
10+
11+
@nox.session(python=python_versions, reuse_venv=True)
12+
def tests(session: "Session") -> None:
13+
_ = session.run("python", "snippets/2_tricky_strings.py")

poetry.lock

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[tool.poetry]
2+
name = "wtfpython"
3+
version = "3.0.0"
4+
description = "What the f*ck Python!"
5+
authors = ["Satwik Kansal <discuss@satwikkansal.xyz>"]
6+
license = "WTFPL 2.0"
7+
readme = "README.md"
8+
9+
[tool.poetry.dependencies]
10+
python = "^3.9"
11+
nox = "^2024.10.9"
12+
13+
14+
[build-system]
15+
requires = ["poetry-core"]
16+
build-backend = "poetry.core.masonry.api"

snippets/2_tricky_strings.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 1
2+
assert id("some_string") == id("some" + "_" + "string")
3+
assert id("some_string") == id("some_string")
4+
5+
# 2
6+
a = "wtf"
7+
b = "wtf"
8+
assert a is b
9+
10+
a = "wtf!"
11+
b = "wtf!"
12+
assert a is b
13+
14+
# 3
15+
a, b = "wtf!", "wtf!"
16+
assert a is b
17+
18+
a = "wtf!"; b = "wtf!"
19+
assert a is b

snippets/__init__.py

Whitespace-only changes.

translations/ru-russian/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ False
559559

560560
Интерпретатор не понимает, что до выполнения выражения `y = 257` целое число со значением `257` уже создано, и поэтому он продолжает создавать другой объект в памяти.
561561

562-
Подобная оптимизация применима и к другим **изменяемым** объектам, таким как пустые кортежи. Поскольку списки являются изменяемыми, поэтому `[] is []` вернет `False`, а `() is ()` вернет `True`. Это объясняет наш второй фрагмент. Перейдем к третьему,
562+
Подобная оптимизация применима и к другим **неизменяемым** объектам, таким как пустые кортежи. Поскольку списки являются изменяемыми, поэтому `[] is []` вернет `False`, а `() is ()` вернет `True`. Это объясняет наш второй фрагмент. Перейдем к третьему,
563563

564564
**И `a`, и `b` ссылаются на один и тот же объект при инициализации одним и тем же значением в одной и той же строке**.
565565

0 commit comments

Comments
 (0)