├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── new_snippet.md │ └── translation.md ├── PULL_REQUEST_TEMPLATE │ ├── common.md │ ├── new_snippet.md │ └── translation.md └── workflows │ └── pr.yml ├── .gitignore ├── .markdownlint.yaml ├── .pre-commit-config.yaml ├── .travis.yml ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── LICENSE ├── README.md ├── code-of-conduct.md ├── images ├── logo.svg ├── logo_dark_theme.svg ├── string-intern │ ├── string_interning.svg │ └── string_interning_dark_theme.svg └── tic-tac-toe │ ├── after_board_initialized.svg │ ├── after_board_initialized_dark_theme.svg │ ├── after_row_initialized.svg │ └── after_row_initialized_dark_theme.svg ├── irrelevant ├── insert_ids.py ├── notebook_generator.py ├── notebook_instructions.md ├── obsolete │ ├── add_categories │ ├── generate_contributions.py │ ├── initial.md │ └── parse_readme.py └── wtf.ipynb ├── mixed_tabs_and_spaces.py ├── noxfile.py ├── poetry.lock ├── pyproject.toml ├── snippets ├── 2_tricky_strings.py └── __init__.py └── translations ├── fa-farsi └── README.md └── ru-russian ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── README.md └── code-of-conduct.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-vendored 2 | *.py linguist-vendored=false 3 | README.md linguist-language=Python 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a problem and provide necessary context 4 | title: 'Fix ...' 5 | labels: 'bug' 6 | 7 | --- 8 | 9 | 14 | ## What's wrong 15 | 16 | 17 | 18 | ## How it should work? 19 | 20 | 21 | 22 | ## Checklist before calling for maintainers 23 | 24 | * [ ] Have you checked to ensure there aren't other open [Issues](../issues) for the same problem? 25 | 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new_snippet.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New snippet 3 | about: Suggest new gotcha and try to explain it 4 | title: 'New snippet: ...' 5 | labels: 'new snippets' 6 | --- 7 | 8 | 13 | ## Description 14 | 15 | ## Snippet preview 16 | 17 | ## Checklist before calling for maintainers 18 | 19 | * [ ] Have you checked to ensure there aren't other open [Issues](../issues) for the same update/change? 20 | * [ ] Have you checked that this snippet is not similar to any of the existing snippets? 21 | 22 | * [ ] Have you added an `Explanation` section? It shall include the reasons for changes and why you'd like us to include them 23 | 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/translation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Translation 3 | about: Request a new traslation and start working on it (if possible) 4 | title: 'Translate to ...' 5 | labels: 'translations' 6 | 7 | --- 8 | 9 | 10 | ## Checklist before calling for maintainers 11 | 12 | * [ ] Have you checked to ensure there aren't other open [Issues](../issues) for the same translation? 13 | * [ ] Do you wish to make a translation by yourself? 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/common.md: -------------------------------------------------------------------------------- 1 | ## #(issue number): Summarize your changes 2 | 3 | 5 | 6 | Closes # (issue number) 7 | 8 | ## Checklist before requesting a review 9 | 10 | - [ ] Have you followed the guidelines in [CONTRIBUTING.md](../CONTRIBUTING.md)? 11 | - [ ] Have you performed a self-review? 12 | - [ ] Have you added yourself into [CONTRIBUTORS.md](../CONTRIBUTORS.md)? 13 | 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/new_snippet.md: -------------------------------------------------------------------------------- 1 | ## #(issue number): Summarize your changes 2 | 3 | 5 | 6 | Closes # (issue number) 7 | 8 | ## Checklist before requesting a review 9 | 10 | - [ ] Have you written simple and understandable explanation? 11 | - [ ] Have you added new snippet into `snippets/` with suitable name and number? 12 | - [ ] Have you updated Table of content? (later will be done by pre-commit) 13 | - [ ] Have you followed the guidelines in [CONTRIBUTING.md](../CONTRIBUTING.md)? 14 | - [ ] Have you performed a self-review? 15 | - [ ] Have you added yourself into [CONTRIBUTORS.md](../CONTRIBUTORS.md)? 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/translation.md: -------------------------------------------------------------------------------- 1 | ## #(issue number): Translate to ... 2 | 3 | 4 | 5 | Closes # (issue number) 6 | 7 | ## Checklist before requesting a review 8 | 9 | - [ ] Have you fetched the latest `master` branch? 10 | - [ ] Have you translated all snippets? 11 | - [ ] Have you followed the guidelines in [CONTRIBUTING.md](../CONTRIBUTING.md)? 12 | - [ ] Have you performed a self-review? 13 | - [ ] Have you added yourself into [CONTRIBUTORS.md](../CONTRIBUTORS.md)? 14 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 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 }} *.md translations/*/*.md \ 21 | | sed -n '/^+/p' | sed '/^+++/d' | sed 's/^+//' \ 22 | > ${{ runner.temp }}/diff.md 23 | - name: Output diff 24 | run: cat ${{ runner.temp }}/diff.md 25 | - name: Check diff with markdownlint 26 | uses: DavidAnson/markdownlint-cli2-action@v17 27 | with: 28 | globs: "${{ runner.temp }}/diff.md" 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules 4 | npm-debug.log 5 | 6 | # Python-specific byte-compiled files should be ignored 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | irrelevant/.ipynb_checkpoints/ 12 | 13 | irrelevant/.python-version 14 | 15 | .idea/ 16 | .vscode/ 17 | 18 | # Virtual envitonments 19 | venv/ 20 | .venv/ 21 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 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 18 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | default_language_version: 2 | python: python3.12 3 | repos: 4 | - repo: https://github.com/DavidAnson/markdownlint-cli2 5 | rev: v0.17.0 6 | hooks: 7 | - id: markdownlint-cli2 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | install: pip install flake8 3 | script: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Getting Started 4 | 5 | Contributions are made to this repo via Issues and Pull Requests (PRs). A few general guidelines that cover both: 6 | 7 | - Search for existing Issues and PRs before creating your own. 8 | - We work hard to makes sure issues are handled in a timely manner but, depending on the impact, it could take a while to investigate the root cause. A friendly ping in the comment thread to the submitter or a contributor can help draw attention if your issue is blocking. 9 | 10 | ## Issues 11 | 12 | All kinds of patches are welcome. Feel free to even suggest some catchy and funny titles for the existing Examples. The goal is to make this collection as interesting to read as possible. Here are a few ways through which you can contribute, 13 | 14 | - If you are interested in translating the project to another language, please feel free to open up an issue using `translation` template, and let me know if you need any kind of help. 15 | - If the changes you suggest are significant, filing an issue before submitting the actual patch will be appreciated. If you'd like to work on the issue (highly encouraged), you can mention that you're interested in working on it while creating the issue and get assigned to it. 16 | - If you're adding a new example, it is highly recommended to create an issue using `new_snippet` template to discuss it before submitting a patch. You can use the following template for adding a new example: 17 | 18 |
19 | ### ▶ Some fancy Title *
20 | The asterisk at the end of the title indicates the example was not present in the first release and has been recently added.
21 | 
22 | ```py
23 | # Setting up the code.
24 | # Preparation for the magic...
25 | ```
26 | 
27 | **Output (Python version):**
28 | ```py
29 | >>> triggering_statement
30 | Probably unexpected output
31 | ```
32 | (Optional): One line describing the unexpected output.
33 | 
34 | #### 💡 Explanation:
35 | * Brief explanation of what's happening and why is it happening.
36 |   ```py
37 |   Setting up examples for clarification (if necessary)
38 |   ```
39 |   **Output:**
40 |   ```py
41 |   >>> trigger # some example that makes it easy to unveil the magic
42 |   # some justified output
43 |   ```
44 | ```
45 | 
46 | 47 | ## Pull requests 48 | 49 | - Try to be consistent with the namings and the values you use with the variables. For instance, most variable names in the project are along the lines of `some_string`, `some_list`, `some_dict`, etc. You'd see a lot of `x`s for single letter variable names, and `"wtf"` as values for strings. There's no strictly enforced scheme in the project as such, but you can take a glance at other examples to get a gist. 50 | - Try to be as creative as possible to add that element of "surprise" in the setting up part of an example. Sometimes this may mean writing a snippet a sane programmer would never write. 51 | - Also, feel free to add your name to the [contributors list](/CONTRIBUTORS.md). 52 | 53 | ## Common questions 54 | 55 | - What is is this after every snippet title (###) in the README: ? Should it be added manually or can it be ignored when creating new snippets? 56 | - That's a random UUID, it is used to keep identify the examples across multiple translations of the project. As a contributor, you don't have to worry about behind the scenes of how it is used, you just have to add a new random UUID to new examples in that format. 57 | - Where should new snippets be added? Top/bottom of the section, doesn't ? 58 | - There are multiple things that are considered to decide the order (the dependency on the other examples, difficulty level, category, etc). I'd suggest simply adding the new example at the bottom of a section you find more fitting (or just add it to the Miscellaneous section). Its order will be taken care of in future revisions. 59 | - What's the difference between the sections (the first two feel very similar)? 60 | - The section "Strain your brain" contains more contrived examples that you may not really encounter in real life, whereas the section "Slippery Slopes" contains examples that have the potential to be encountered more frequently while programming. 61 | - Before the table of contents it says that `markdown-toc -i README.md --maxdepth 3` was used to create it. The pip package `markdown-toc` does not contain neither `-i` nor `--maxdepth` flags. Which package is meant, or what version of that package? Should the new table of contents entry for the snippet be created with the above command or created manually (in case the above command does more than only add the entry)? 62 | - `markdown-toc` will be replaced in the near future, follow the [issue](https://github.com/satwikkansal/wtfpython/issues/351) to check the progress. 63 | - We use the [markdown-toc](https://www.npmjs.com/package/markdown-toc) npm package to generate ToC. It has some issues with special characters though (I'm not sure if it's fixed yet). More often than not, I just end up inserting the toc link manually at the right place. The tool is handy when I have to big reordering, otherwise just updating toc manually is more convenient imo. 64 | 65 | If you have any questions feel free to ask on [this issue](https://github.com/satwikkansal/wtfpython/issues/269) (thanks to [@LiquidFun](https://github.com/LiquidFun) for starting it). 66 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Following are the wonderful people (in no specific order) who have contributed their examples to wtfpython. 2 | 3 | | Contributor | Github | Issues | 4 | |-------------|--------|--------| 5 | | Lucas-C | [Lucas-C](https://github.com/Lucas-C) | [#36](https://github.com/satwikkansal/wtfpython/issues/36) | 6 | | MittalAshok | [MittalAshok](https://github.com/MittalAshok) | [#23](https://github.com/satwikkansal/wtfpython/issues/23) | 7 | | asottile | [asottile](https://github.com/asottile) | [#40](https://github.com/satwikkansal/wtfpython/issues/40) | 8 | | MostAwesomeDude | [MostAwesomeDude](https://github.com/MostAwesomeDude) | [#1](https://github.com/satwikkansal/wtfpython/issues/1) | 9 | | tukkek | [tukkek](https://github.com/tukkek) | [#11](https://github.com/satwikkansal/wtfpython/issues/11), [#26](https://github.com/satwikkansal/wtfpython/issues/26) | 10 | | PiaFraus | [PiaFraus](https://github.com/PiaFraus) | [#9](https://github.com/satwikkansal/wtfpython/issues/9) | 11 | | chris-rands | [chris-rands](https://github.com/chris-rands) | [#32](https://github.com/satwikkansal/wtfpython/issues/32) | 12 | | sohaibfarooqi | [sohaibfarooqi](https://github.com/sohaibfarooqi) | [#63](https://github.com/satwikkansal/wtfpython/issues/63) | 13 | | ipid | [ipid](https://github.com/ipid) | [#145](https://github.com/satwikkansal/wtfpython/issues/145) | 14 | | roshnet | [roshnet](https://github.com/roshnet) | [#140](https://github.com/satwikkansal/wtfpython/issues/140) | 15 | | daidai21 | [daidai21](https://github.com/daidai21) | [#137](https://github.com/satwikkansal/wtfpython/issues/137) | 16 | | scidam | [scidam](https://github.com/scidam) | [#136](https://github.com/satwikkansal/wtfpython/issues/136) | 17 | | pmjpawelec | [pmjpawelec](https://github.com/pmjpawelec) | [#121](https://github.com/satwikkansal/wtfpython/issues/121) | 18 | | leisurelicht | [leisurelicht](https://github.com/leisurelicht) | [#112](https://github.com/satwikkansal/wtfpython/issues/112) | 19 | | mishaturnbull | [mishaturnbull](https://github.com/mishaturnbull) | [#108](https://github.com/satwikkansal/wtfpython/issues/108) | 20 | | MuseBoy | [MuseBoy](https://github.com/MuseBoy) | [#101](https://github.com/satwikkansal/wtfpython/issues/101) | 21 | | Ghost account | N/A | [#96](https://github.com/satwikkansal/wtfpython/issues/96) | 22 | | koddo | [koddo](https://github.com/koddo) | [#80](https://github.com/satwikkansal/wtfpython/issues/80), [#73](https://github.com/satwikkansal/wtfpython/issues/73) | 23 | | jab | [jab](https://github.com/jab) | [#77](https://github.com/satwikkansal/wtfpython/issues/77) | 24 | | Jongy | [Jongy](https://github.com/Jongy) | [#208](https://github.com/satwikkansal/wtfpython/issues/208), [#210](https://github.com/satwikkansal/wtfpython/issues/210), [#233](https://github.com/satwikkansal/wtfpython/issues/233) | 25 | | Diptangsu Goswami | [diptangsu](https://github.com/diptangsu) | [#193](https://github.com/satwikkansal/wtfpython/issues/193) | 26 | | Charles | [charles-l](https://github.com/charles-l) | [#245](https://github.com/satwikkansal/wtfpython/issues/245) | 27 | | LiquidFun | [LiquidFun](https://github.com/LiquidFun) | [#267](https://github.com/satwikkansal/wtfpython/issues/267) | 28 | 29 | --- 30 | 31 | **Translations** 32 | 33 | | Translator | Github | Language | 34 | |-------------|--------|--------| 35 | | leisurelicht | [leisurelicht](https://github.com/leisurelicht) | [Chinese](https://github.com/leisurelicht/wtfpython-cn) | 36 | | vuduclyunitn | [vuduclyunitn](https://github.com/vuduclyunitn) | [Vietnamese](https://github.com/vuduclyunitn/wtfptyhon-vi) | 37 | | José De Freitas | [JoseDeFreitas](https://github.com/JoseDeFreitas) | [Spanish](https://github.com/JoseDeFreitas/wtfpython-es) | 38 | | Vadim Nifadev | [nifadyev](https://github.com/nifadyev) | [Russian](https://github.com/satwikkansal/wtfpython/tree/master/translations/ru-russian) | 39 | 40 | Thank you all for your time and making wtfpython more awesome! :smile: 41 | 42 | PS: This list is updated after every major release, if I forgot to add your contribution here, please feel free to raise a Pull request. 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2018 Satwik Kansal 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | education, socio-economic status, nationality, personal appearance, race, 10 | religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | -------------------------------------------------------------------------------- /images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /images/logo_dark_theme.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /images/string-intern/string_interning.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
PyStringObject
PyStringObject
"wtf!"
"wtf!"
a
a
PyStringObject
PyStringObject
"wtf!"
"wtf!"
b
b
PyStringObject
PyStringObject
"wtf!"
"wtf!"
a
a
b
b
Text is not SVG - cannot display
5 | -------------------------------------------------------------------------------- /images/string-intern/string_interning_dark_theme.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
PyStringObject
PyStringObject
"wtf!"
"wtf!"
a
a
PyStringObject
PyStringObject
"wtf!"
"wtf!"
b
b
PyStringObject
PyStringObject
"wtf!"
"wtf!"
a
a
b
b
Text is not SVG - cannot display
5 | -------------------------------------------------------------------------------- /images/tic-tac-toe/after_board_initialized.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
" "
" "
" "
" "
" "
" "
row
row
board[0]
board[0]
board[1]
board[1]
board[2]
board[2]
Text is not SVG - cannot display
-------------------------------------------------------------------------------- /images/tic-tac-toe/after_board_initialized_dark_theme.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
" "
" "
" "
" "
" "
" "
row
row
board[0]
board[0]
board[1]
board[1]
board[2]
board[2]
Text is not SVG - cannot display
-------------------------------------------------------------------------------- /images/tic-tac-toe/after_row_initialized.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
" "
" "
" "
" "
" "
" "
row
row
Text is not SVG - cannot display
-------------------------------------------------------------------------------- /images/tic-tac-toe/after_row_initialized_dark_theme.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
" "
" "
" "
" "
" "
" "
row
row
Text is not SVG - cannot display
-------------------------------------------------------------------------------- /irrelevant/insert_ids.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | 3 | new_file = [] 4 | original_file = [] 5 | 6 | fname = "../README.md" 7 | 8 | 9 | def generate_random_id_comment(): 10 | random_id = uuid.uuid4() 11 | return f"" 12 | 13 | 14 | with open(fname, "r") as f: 15 | original_file = f.readlines() 16 | 17 | 18 | for line in original_file: 19 | new_file.append(line) 20 | if line.strip().startswith("### "): 21 | new_file.append(generate_random_id_comment()) 22 | 23 | with open(fname, "w") as f: 24 | f.write("".join(new_file)) 25 | -------------------------------------------------------------------------------- /irrelevant/notebook_generator.py: -------------------------------------------------------------------------------- 1 | """ 2 | An inefficient monolithic piece of code that'll generate jupyter notebook 3 | from the projects main README. 4 | 5 | PS: If you are a recruiter, please don't judge me by this piece of code. I wrote it 6 | in hurry. I know this is messy and can be simplified, but I don't want to change it 7 | much because it just works. 8 | 9 | Simplifictions and improvements through patches are more than welcome however :) 10 | 11 | 12 | #TODOs 13 | 14 | - CLI arguments for running this thing 15 | - Add it to prepush hook 16 | - Add support for skip comments, to skip examples that are not meant for notebook environment. 17 | - Use templates? 18 | """ 19 | 20 | import json 21 | import os 22 | import pprint 23 | 24 | fpath = os.path.join(os.path.dirname( __file__ ), '..', 'README.md') 25 | examples = [] 26 | 27 | # The globals 28 | current_example = 1 29 | sequence_num = 1 30 | current_section_name = "" 31 | 32 | 33 | STATEMENT_PREFIXES = ["...", ">>> ", "$ "] 34 | 35 | HOSTED_NOTEBOOK_INSTRUCTIONS = """ 36 | 37 | ## Hosted notebook instructions 38 | 39 | This is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because, 40 | - they either require a version of Python that's not supported in the hosted runtime. 41 | - or they can't be reproduced in the notebook envrinonment. 42 | 43 | The expected outputs are already present in collapsed cells following the code cells. The Google colab provides Python2 (2.7) and Python3 (3.6, default) runtimes. You can switch among these for Python2 specific examples. For examples specific to other minor versions, you can simply refer to collapsed outputs (it's not possible to control the minor version in hosted notebooks as of now). You can check the active version using 44 | 45 | ```py 46 | >>> import sys 47 | >>> sys.version 48 | # Prints out Python version here. 49 | ``` 50 | 51 | That being said, most of the examples do work as expected. If you face any trouble, feel free to consult the original content on wtfpython and create an issue in the repo. Have fun! 52 | 53 | --- 54 | """ 55 | 56 | 57 | def generate_code_block(statements, output): 58 | """ 59 | Generates a code block that executes the given statements. 60 | 61 | :param statements: The list of statements to execute. 62 | :type statements: list(str) 63 | """ 64 | global sequence_num 65 | result = { 66 | "type": "code", 67 | "sequence_num": sequence_num, 68 | "statements": statements, 69 | "output": output 70 | } 71 | sequence_num += 1 72 | return result 73 | 74 | 75 | def generate_markdown_block(lines): 76 | """ 77 | Generates a markdown block from a list of lines. 78 | """ 79 | global sequence_num 80 | result = { 81 | "type": "markdown", 82 | "sequence_num": sequence_num, 83 | "value": lines 84 | } 85 | sequence_num += 1 86 | return result 87 | 88 | 89 | def is_interactive_statement(line): 90 | for prefix in STATEMENT_PREFIXES: 91 | if line.lstrip().startswith(prefix): 92 | return True 93 | return False 94 | 95 | 96 | def parse_example_parts(lines, title, current_line): 97 | """ 98 | Parse the given lines and return a dictionary with two keys: 99 | build_up, which contains all the text before an H4 (explanation) is encountered, 100 | and 101 | explanation, which contains all the text after build_up until --- or another H3 is encountered. 102 | """ 103 | parts = { 104 | "build_up": [], 105 | "explanation": [] 106 | } 107 | content = [title] 108 | statements_so_far = [] 109 | output_so_far = [] 110 | next_line = current_line 111 | # store build_up till an H4 (explanation) is encountered 112 | while not (next_line.startswith("#### ")or next_line.startswith('---')): 113 | # Watching out for the snippets 114 | if next_line.startswith("```py"): 115 | # It's a snippet, whatever found until now is text 116 | is_interactive = False 117 | output_encountered = False 118 | if content: 119 | parts["build_up"].append(generate_markdown_block(content)) 120 | content = [] 121 | 122 | next_line = next(lines) 123 | 124 | while not next_line.startswith("```"): 125 | if is_interactive_statement(next_line): 126 | is_interactive = True 127 | if (output_so_far): 128 | parts["build_up"].append(generate_code_block(statements_so_far, output_so_far)) 129 | statements_so_far, output_so_far = [], [] 130 | statements_so_far.append(next_line) 131 | else: 132 | # can be either output or normal code 133 | if is_interactive: 134 | output_so_far.append(next_line) 135 | elif output_encountered: 136 | output_so_far.append(next_line) 137 | else: 138 | statements_so_far.append(next_line) 139 | next_line = next(lines) 140 | 141 | # Snippet is over 142 | parts["build_up"].append(generate_code_block(statements_so_far, output_so_far)) 143 | statements_so_far, output_so_far = [], [] 144 | next_line = next(lines) 145 | else: 146 | # It's a text, go on. 147 | content.append(next_line) 148 | next_line = next(lines) 149 | 150 | # Explanation encountered, save any content till now (if any) 151 | if content: 152 | parts["build_up"].append(generate_markdown_block(content)) 153 | 154 | # Reset stuff 155 | content = [] 156 | statements_so_far, output_so_far = [], [] 157 | 158 | # store lines again until --- or another H3 is encountered 159 | while not (next_line.startswith("---") or 160 | next_line.startswith("### ")): 161 | if next_line.lstrip().startswith("```py"): 162 | # It's a snippet, whatever found until now is text 163 | is_interactive = False 164 | if content: 165 | parts["explanation"].append(generate_markdown_block(content)) 166 | content = [] 167 | 168 | next_line = next(lines) 169 | 170 | while not next_line.lstrip().startswith("```"): 171 | if is_interactive_statement(next_line): 172 | is_interactive = True 173 | if (output_so_far): 174 | parts["explanation"].append(generate_code_block(statements_so_far, output_so_far)) 175 | statements_so_far, output_so_far = [], [] 176 | statements_so_far.append(next_line) 177 | else: 178 | # can be either output or normal code 179 | if is_interactive: 180 | output_so_far.append(next_line) 181 | else: 182 | statements_so_far.append(next_line) 183 | next_line = next(lines) 184 | 185 | # Snippet is over 186 | parts["explanation"].append(generate_code_block(statements_so_far, output_so_far)) 187 | statements_so_far, output_so_far = [], [] 188 | next_line = next(lines) 189 | else: 190 | # It's a text, go on. 191 | content.append(next_line) 192 | next_line = next(lines) 193 | 194 | # All done 195 | if content: 196 | parts["explanation"].append(generate_markdown_block(content)) 197 | 198 | return next_line, parts 199 | 200 | 201 | def remove_from_beginning(tokens, line): 202 | for token in tokens: 203 | if line.lstrip().startswith(token): 204 | line = line.replace(token, "") 205 | return line 206 | 207 | 208 | def inspect_and_sanitize_code_lines(lines): 209 | """ 210 | Remove lines from the beginning of a code block that are not statements. 211 | 212 | :param lines: A list of strings, each representing a line in the code block. 213 | :returns is_print_present, sanitized_lines: A boolean indicating whether print was present in the original code and a list of strings representing 214 | sanitized lines. The latter may be an empty list if all input lines were removed as comments or whitespace (and thus did not contain any statements). 215 | This function does not remove blank lines at the end of `lines`. 216 | """ 217 | tokens_to_remove = STATEMENT_PREFIXES 218 | result = [] 219 | is_print_present = False 220 | for line in lines: 221 | line = remove_from_beginning(tokens_to_remove, line) 222 | if line.startswith("print ") or line.startswith("print("): 223 | is_print_present = True 224 | result.append(line) 225 | return is_print_present, result 226 | 227 | 228 | def convert_to_cells(cell_contents, read_only): 229 | """ 230 | Converts a list of dictionaries containing markdown and code cells into a Jupyter notebook. 231 | 232 | :param cell_contents: A list of dictionaries, each 233 | dictionary representing either a markdown or code cell. Each dictionary should have the following keys: "type", which is either "markdown" or "code", 234 | and "value". The value for type = 'markdown' is the content as string, whereas the value for type = 'code' is another dictionary with two keys, 235 | statements and output. The statements key contains all lines in between ```py\n``` (including) until ```\n```, while output contains all lines after 236 | ```.output py\n```. 237 | :type cell_contents: List[Dict] 238 | 239 | :param read_only (optional): If True then only print outputs are included in converted 240 | cells. Default False 241 | :type read_only (optional): bool 242 | 243 | :returns A Jupyter notebook containing all cells from input parameter `cell_contents`. 244 | Each converted cell has metadata attribute collapsed set to true if it's code-cell otherwise None if it's markdow-cell. 245 | """ 246 | cells = [] 247 | for stuff in cell_contents: 248 | if stuff["type"] == "markdown": 249 | # todo add metadata later 250 | cells.append( 251 | { 252 | "cell_type": "markdown", 253 | "metadata": {}, 254 | "source": stuff["value"] 255 | } 256 | ) 257 | elif stuff["type"] == "code": 258 | if read_only: 259 | # Skip read only 260 | # TODO: Fix 261 | cells.append( 262 | { 263 | "cell_type": "markdown", 264 | "metadata": {}, 265 | "source": ["```py\n"] + stuff["statements"] + ["```\n"] + ["```py\n"] + stuff['output'] + ["```\n"] 266 | } 267 | ) 268 | continue 269 | 270 | is_print_present, sanitized_code = inspect_and_sanitize_code_lines(stuff["statements"]) 271 | if is_print_present: 272 | cells.append( 273 | { 274 | "cell_type": "code", 275 | "metadata": { 276 | "collapsed": True, 277 | 278 | }, 279 | "execution_count": None, 280 | "outputs": [{ 281 | "name": "stdout", 282 | "output_type": "stream", 283 | "text": stuff["output"] 284 | }], 285 | "source": sanitized_code 286 | } 287 | ) 288 | else: 289 | cells.append( 290 | { 291 | "cell_type": "code", 292 | "execution_count": None, 293 | "metadata": { 294 | "collapsed": True 295 | }, 296 | "outputs": [{ 297 | "data": { 298 | "text/plain": stuff["output"] 299 | }, 300 | "output_type": "execute_result", 301 | "metadata": {}, 302 | "execution_count": None 303 | }], 304 | "source": sanitized_code 305 | } 306 | ) 307 | 308 | return cells 309 | 310 | 311 | def convert_to_notebook(pre_examples_content, parsed_json, post_examples_content): 312 | """ 313 | Convert a JSON file containing the examples to a Jupyter Notebook. 314 | """ 315 | result = { 316 | "cells": [], 317 | "metadata": {}, 318 | "nbformat": 4, 319 | "nbformat_minor": 2 320 | } 321 | 322 | notebook_path = "wtf.ipynb" 323 | 324 | result["cells"] += convert_to_cells([generate_markdown_block(pre_examples_content)], False) 325 | 326 | for example in parsed_json: 327 | parts = example["parts"] 328 | build_up = parts.get("build_up") 329 | explanation = parts.get("explanation") 330 | read_only = example.get("read_only") 331 | 332 | if build_up: 333 | result["cells"] += convert_to_cells(build_up, read_only) 334 | 335 | if explanation: 336 | result["cells"] += convert_to_cells(explanation, read_only) 337 | 338 | result["cells"] += convert_to_cells([generate_markdown_block(post_examples_content)], False) 339 | 340 | #pprint.pprint(result, indent=2) 341 | with open(notebook_path, "w") as f: 342 | json.dump(result, f, indent=2) 343 | 344 | 345 | with open(fpath, 'r+', encoding="utf-8") as f: 346 | lines = iter(f.readlines()) 347 | line = next(lines) 348 | result = [] 349 | pre_examples_phase = True 350 | pre_stuff = [] 351 | post_stuff = [] 352 | try: 353 | while True: 354 | if line.startswith("## "): 355 | pre_examples_phase = False 356 | # A section is encountered 357 | current_section_name = line.replace("## ", "").strip() 358 | section_text = [] 359 | line = next(lines) 360 | # Until a new section is encountered 361 | while not (line.startswith("## ") or line.startswith("# ")): 362 | # check if it's a H3 363 | if line.startswith("### "): 364 | # An example is encountered 365 | title_line = line 366 | line = next(lines) 367 | read_only = False 368 | while line.strip() == "" or line.startswith('' in line: 371 | read_only = True 372 | line = next(lines) 373 | 374 | example_details = { 375 | "id": current_example, 376 | "title": title_line.replace("### ", ""), 377 | "section": current_section_name, 378 | "read_only": read_only 379 | } 380 | line, example_details["parts"] = parse_example_parts(lines, title_line, line) 381 | result.append(example_details) 382 | current_example += 1 383 | else: 384 | section_text.append(line) 385 | line = next(lines) 386 | else: 387 | if pre_examples_phase: 388 | pre_stuff.append(line) 389 | else: 390 | post_stuff.append(line) 391 | line = next(lines) 392 | 393 | except StopIteration as e: 394 | #pprint.pprint(result, indent=2) 395 | pre_stuff.append(HOSTED_NOTEBOOK_INSTRUCTIONS) 396 | result.sort(key = lambda x: x["read_only"]) 397 | convert_to_notebook(pre_stuff, result, post_stuff) 398 | -------------------------------------------------------------------------------- /irrelevant/notebook_instructions.md: -------------------------------------------------------------------------------- 1 | ## Generating the notebook 2 | 3 | - Expand the relative links in README.md to absolute ones 4 | - Remove the TOC in README.md (because Google colab generates its own anyway) 5 | - Reorder the examples, so that the ones that work are upfront. 6 | - Run the `notebook_generator.py`, it will generate a notebook named `wtf.ipynb` 7 | - Revert the README.md changes (optional) 8 | -------------------------------------------------------------------------------- /irrelevant/obsolete/add_categories: -------------------------------------------------------------------------------- 1 | Skipping lines? 2 | a 3 | 4 | Well, something is fishy... 5 | a 6 | 7 | Time for some hash brownies! 8 | f 9 | 10 | Evaluation time discrepancy 11 | f 12 | 13 | Modifying a dictionary while iterating over it 14 | c 15 | 16 | Deleting a list item while iterating over it 17 | c 18 | 19 | Backslashes at the end of string 20 | f 21 | 22 | Brace yourself! 23 | t* 24 | 25 | "this" is love :heart: 26 | t* 27 | 28 | Okay Python, Can you make me fly? 29 | t* 30 | 31 | `goto`, but why? 32 | t* 33 | 34 | Let's meet Friendly Language Uncle For Life 35 | t* 36 | 37 | Inpinity 38 | t* 39 | 40 | Strings can be tricky sometimes 41 | f* 42 | 43 | `+=` is faster 44 | m 45 | 46 | Let's make a giant string! 47 | m 48 | 49 | Yes, it exists! 50 | t 51 | 52 | `is` is not what it is! 53 | f 54 | 55 | `is not ...` is not `is (not ...)` 56 | f 57 | 58 | The function inside loop sticks to the same output 59 | f 60 | 61 | Loop variables leaking out of local scope! 62 | c 63 | 64 | A tic-tac-toe where X wins in the first attempt! 65 | f 66 | 67 | Beware of default mutable arguments! 68 | c 69 | 70 | Same operands, different story! 71 | c 72 | 73 | Mutating the immutable! 74 | f 75 | 76 | Using a variable not defined in scope 77 | c 78 | 79 | The disappearing variable from outer scope 80 | f 81 | 82 | Return return everywhere! 83 | f 84 | 85 | When True is actually False 86 | f 87 | 88 | Be careful with chained operations 89 | c 90 | 91 | Name resolution ignoring class scope 92 | c 93 | 94 | From filled to None in one instruction... 95 | f 96 | 97 | Explicit typecast of strings 98 | m 99 | 100 | Class attributes and instance attributes 101 | f 102 | 103 | Catching the Exceptions! 104 | f 105 | 106 | Midnight time doesn't exist? 107 | f 108 | 109 | What's wrong with booleans? 110 | f 111 | 112 | Needle in a Haystack 113 | c 114 | 115 | Teleportation 116 | a* 117 | 118 | yielding None 119 | f 120 | 121 | The surprising comma 122 | f 123 | 124 | For what? 125 | f 126 | 127 | not knot! 128 | f 129 | 130 | Subclass relationships 131 | f* 132 | 133 | Mangling time! 134 | t* 135 | 136 | Deep down, we're all the same. 137 | f* 138 | 139 | Half triple-quoted strings 140 | f 141 | 142 | Implicit key type conversion 143 | f* 144 | 145 | Stubborn `del` operator 146 | c* 147 | 148 | Let's see if you can guess this? 149 | f 150 | 151 | Minor Ones 152 | m -------------------------------------------------------------------------------- /irrelevant/obsolete/generate_contributions.py: -------------------------------------------------------------------------------- 1 | """ 2 | This script parses the README.md and generates the table 3 | `CONTRIBUTORS.md`. 4 | 5 | No longer works since we've moved on contributors to CONTRIBUTORS.md entirely. 6 | """ 7 | 8 | import pprint 9 | import re 10 | import requests 11 | 12 | regex = ("[sS]uggested by @(\S+) in \[this\]\(https:\/\/github\.com\/satwikkansal" 13 | "\/wtf[pP]ython\/issues\/(\d+)\) issue") 14 | 15 | 16 | fname = "README.md" 17 | contribs = {} 18 | 19 | table_header = """ 20 | | Contributor | Github | Issues | 21 | |-------------|--------|--------| 22 | """ 23 | 24 | table_row = '| {} | [{}](https://github.com/{}) | {} |' 25 | issue_format = '[#{}](https:/github.com/satwikkansal/wtfpython/issues/{})' 26 | rows_so_far = [] 27 | 28 | github_rest_api = "https://api.github.com/users/{}" 29 | 30 | 31 | with open(fname, 'r') as f: 32 | file_content = f.read() 33 | matches = re.findall(regex, file_content) 34 | for match in matches: 35 | if contribs.get(match[0]) and match[1] not in contribs[match[0]]: 36 | contribs[match[0]].append(match[1]) 37 | else: 38 | contribs[match[0]] = [match[1]] 39 | 40 | for handle, issues in contribs.items(): 41 | issue_string = ', '.join([issue_format.format(i, i) for i in issues]) 42 | resp = requests.get(github_rest_api.format(handle)) 43 | name = handle 44 | if resp.status_code == 200: 45 | pprint.pprint(resp.json()['name']) 46 | else: 47 | print(handle, resp.content) 48 | rows_so_far.append(table_row.format(name, 49 | handle, 50 | handle, 51 | issue_string)) 52 | 53 | print(table_header + "\n".join(rows_so_far)) 54 | -------------------------------------------------------------------------------- /irrelevant/obsolete/parse_readme.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | This inefficient module would parse the README.md in the initial version of 5 | WTFPython, and enable me to categorize and reorder a hell lot of examples with 6 | the help of the file `add_categories` (part of which is automatically 7 | generated). 8 | 9 | After the refactor, this module would not work now with necessary updates in 10 | the code. 11 | """ 12 | 13 | try: 14 | raw_input # Python 2 15 | except NameError: 16 | raw_input = input # Python 3 17 | 18 | 19 | fname = "README.md" 20 | snippets = [] 21 | 22 | with open(fname, 'r') as f: 23 | lines = iter(f.readlines()) 24 | line = lines.next() 25 | 26 | try: 27 | while True: 28 | # check if it's a H3 29 | if line.startswith("### "): 30 | title = line.replace("### ", "") 31 | description = [] 32 | next_line = lines.next() 33 | 34 | # store lines till an H4 (explanation) is encountered 35 | while not next_line.startswith("#### "): 36 | description.append(next_line) 37 | next_line = lines.next() 38 | 39 | explanation = [] 40 | # store lines again until --- or another H3 is encountered 41 | while not (next_line.startswith("---") or 42 | next_line.startswith("### ")): 43 | explanation.append(next_line) 44 | next_line = lines.next() 45 | 46 | # Store the results finally 47 | snippets.append({ 48 | "title": title, 49 | "description": '\n'.join(description), 50 | "explanation": '\n'.join(explanation) 51 | }) 52 | 53 | line = next_line 54 | 55 | else: 56 | line = lines.next() 57 | 58 | except StopIteration: 59 | snippets.append({ 60 | "title": title, 61 | "description": '\n'.join(description), 62 | "explanation": '\n'.join(explanation) 63 | }) 64 | 65 | ''' 66 | # Create a file 67 | file_content = "\n\n".join([snip["title"] for snip in snippets]) 68 | 69 | with open("add_categories", "w") as f: 70 | f.write(file_content) 71 | ''' 72 | 73 | snips_by_title = {} 74 | 75 | with open("add_categories", "r") as f: 76 | content = iter(f.readlines()) 77 | try: 78 | while True: 79 | title = content.next() 80 | cat = content.next().strip() 81 | is_new = True if cat[-1]=="*" else False 82 | cat = cat.replace('*','') 83 | snips_by_title[title] = { 84 | "category": cat, 85 | "is_new": is_new 86 | } 87 | content.next() 88 | except StopIteration: 89 | pass 90 | 91 | for idx, snip in enumerate(snippets): 92 | snippets[idx]["category"] = snips_by_title[snip["title"]]["category"] 93 | snippets[idx]["is_new"] = snips_by_title[snip["title"]]["is_new"] 94 | 95 | 96 | snips_by_cat = {} 97 | for snip in snippets: 98 | cat = snip["category"] 99 | if not snips_by_cat.get(cat): 100 | snips_by_cat[cat] = [] 101 | snips_by_cat[cat].append(snip) 102 | 103 | snippet_template = """ 104 | 105 | ### ▶ {title}{is_new} 106 | 107 | {description} 108 | 109 | {explanation} 110 | 111 | --- 112 | """ 113 | 114 | category_template = """ 115 | --- 116 | 117 | ## {category} 118 | 119 | {content} 120 | """ 121 | 122 | result = "" 123 | 124 | category_names = { 125 | "a": "Appearances are Deceptive!", 126 | "t": "The Hiddent treasures", 127 | "f": "Strain your Brain", 128 | "c": "Be careful of these", 129 | "m": "Miscallaneous" 130 | } 131 | 132 | categories_in_order = ["a", "t", "f", "c", "m"] 133 | 134 | for category in categories_in_order: 135 | snips = snips_by_cat[category] 136 | for i, snip in enumerate(snips): 137 | print(i, ":", snip["title"]) 138 | content = "" 139 | for _ in snips: 140 | snip = snips[int(raw_input())] 141 | is_new = " *" if snip["is_new"] else "" 142 | content += snippet_template.format(title=snip["title"].strip(), 143 | is_new=is_new, 144 | description=snip["description"].strip().replace("\n\n", "\n"), 145 | explanation=snip["explanation"].strip().replace("\n\n", "\n")) 146 | result += category_template.format(category=category_names[category], content=content.replace("\n\n\n", "\n\n")) 147 | 148 | with open("generated.md", "w") as f: 149 | f.write(result.replace("\n\n\n", "\n\n")) 150 | 151 | print("Done!") 152 | -------------------------------------------------------------------------------- /mixed_tabs_and_spaces.py: -------------------------------------------------------------------------------- 1 | def square(x): 2 | sum_so_far = 0 3 | for _ in range(x): 4 | sum_so_far += x 5 | return sum_so_far # noqa: E999 # pylint: disable=mixed-indentation Python 3 will raise a TabError here 6 | 7 | print(square(10)) 8 | -------------------------------------------------------------------------------- /noxfile.py: -------------------------------------------------------------------------------- 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") 14 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. 2 | 3 | [[package]] 4 | name = "argcomplete" 5 | version = "3.5.1" 6 | description = "Bash tab completion for argparse" 7 | optional = false 8 | python-versions = ">=3.8" 9 | files = [ 10 | {file = "argcomplete-3.5.1-py3-none-any.whl", hash = "sha256:1a1d148bdaa3e3b93454900163403df41448a248af01b6e849edc5ac08e6c363"}, 11 | {file = "argcomplete-3.5.1.tar.gz", hash = "sha256:eb1ee355aa2557bd3d0145de7b06b2a45b0ce461e1e7813f5d066039ab4177b4"}, 12 | ] 13 | 14 | [package.extras] 15 | test = ["coverage", "mypy", "pexpect", "ruff", "wheel"] 16 | 17 | [[package]] 18 | name = "colorama" 19 | version = "0.4.6" 20 | description = "Cross-platform colored terminal text." 21 | optional = false 22 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" 23 | files = [ 24 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, 25 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, 26 | ] 27 | 28 | [[package]] 29 | name = "colorlog" 30 | version = "6.8.2" 31 | description = "Add colours to the output of Python's logging module." 32 | optional = false 33 | python-versions = ">=3.6" 34 | files = [ 35 | {file = "colorlog-6.8.2-py3-none-any.whl", hash = "sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33"}, 36 | {file = "colorlog-6.8.2.tar.gz", hash = "sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44"}, 37 | ] 38 | 39 | [package.dependencies] 40 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 41 | 42 | [package.extras] 43 | development = ["black", "flake8", "mypy", "pytest", "types-colorama"] 44 | 45 | [[package]] 46 | name = "distlib" 47 | version = "0.3.9" 48 | description = "Distribution utilities" 49 | optional = false 50 | python-versions = "*" 51 | files = [ 52 | {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, 53 | {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, 54 | ] 55 | 56 | [[package]] 57 | name = "filelock" 58 | version = "3.16.1" 59 | description = "A platform independent file lock." 60 | optional = false 61 | python-versions = ">=3.8" 62 | files = [ 63 | {file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"}, 64 | {file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"}, 65 | ] 66 | 67 | [package.extras] 68 | docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4.1)"] 69 | testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.2)", "pytest (>=8.3.3)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.4)"] 70 | typing = ["typing-extensions (>=4.12.2)"] 71 | 72 | [[package]] 73 | name = "nox" 74 | version = "2024.10.9" 75 | description = "Flexible test automation." 76 | optional = false 77 | python-versions = ">=3.8" 78 | files = [ 79 | {file = "nox-2024.10.9-py3-none-any.whl", hash = "sha256:1d36f309a0a2a853e9bccb76bbef6bb118ba92fa92674d15604ca99adeb29eab"}, 80 | {file = "nox-2024.10.9.tar.gz", hash = "sha256:7aa9dc8d1c27e9f45ab046ffd1c3b2c4f7c91755304769df231308849ebded95"}, 81 | ] 82 | 83 | [package.dependencies] 84 | argcomplete = ">=1.9.4,<4" 85 | colorlog = ">=2.6.1,<7" 86 | packaging = ">=20.9" 87 | tomli = {version = ">=1", markers = "python_version < \"3.11\""} 88 | virtualenv = ">=20.14.1" 89 | 90 | [package.extras] 91 | tox-to-nox = ["jinja2", "tox"] 92 | uv = ["uv (>=0.1.6)"] 93 | 94 | [[package]] 95 | name = "packaging" 96 | version = "24.1" 97 | description = "Core utilities for Python packages" 98 | optional = false 99 | python-versions = ">=3.8" 100 | files = [ 101 | {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, 102 | {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, 103 | ] 104 | 105 | [[package]] 106 | name = "platformdirs" 107 | version = "4.3.6" 108 | description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." 109 | optional = false 110 | python-versions = ">=3.8" 111 | files = [ 112 | {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, 113 | {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, 114 | ] 115 | 116 | [package.extras] 117 | docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] 118 | test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] 119 | type = ["mypy (>=1.11.2)"] 120 | 121 | [[package]] 122 | name = "tomli" 123 | version = "2.0.2" 124 | description = "A lil' TOML parser" 125 | optional = false 126 | python-versions = ">=3.8" 127 | files = [ 128 | {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, 129 | {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, 130 | ] 131 | 132 | [[package]] 133 | name = "virtualenv" 134 | version = "20.27.0" 135 | description = "Virtual Python Environment builder" 136 | optional = false 137 | python-versions = ">=3.8" 138 | files = [ 139 | {file = "virtualenv-20.27.0-py3-none-any.whl", hash = "sha256:44a72c29cceb0ee08f300b314848c86e57bf8d1f13107a5e671fb9274138d655"}, 140 | {file = "virtualenv-20.27.0.tar.gz", hash = "sha256:2ca56a68ed615b8fe4326d11a0dca5dfbe8fd68510fb6c6349163bed3c15f2b2"}, 141 | ] 142 | 143 | [package.dependencies] 144 | distlib = ">=0.3.7,<1" 145 | filelock = ">=3.12.2,<4" 146 | platformdirs = ">=3.9.1,<5" 147 | 148 | [package.extras] 149 | docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] 150 | test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] 151 | 152 | [metadata] 153 | lock-version = "2.0" 154 | python-versions = "^3.9" 155 | content-hash = "af91619c8e62e649ee538e51a248ef2fc1e4f4495e7748b3b551685aa47b404e" 156 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "wtfpython" 3 | version = "3.0.0" 4 | description = "What the f*ck Python!" 5 | authors = ["Satwik Kansal "] 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" 17 | -------------------------------------------------------------------------------- /snippets/2_tricky_strings.py: -------------------------------------------------------------------------------- 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 20 | -------------------------------------------------------------------------------- /snippets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/satwikkansal/wtfpython/9323b863218670404405e0a0b9f54d2841a7452e/snippets/__init__.py -------------------------------------------------------------------------------- /translations/ru-russian/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Приветствуются все виды изменений. Не стесняйтесь предлагать броские и смешные названия для существующих примеров. Цель - сделать эту коллекцию как можно более интересной для чтения. Вот несколько способов, с помощью которых вы можете внести свой вклад, 2 | 3 | - Если вы заинтересованы в переводе проекта на другой язык (некоторые люди уже делали это в прошлом), пожалуйста, не стесняйтесь открыть тему и дайте мне знать, если вам нужна какая-либо помощь. 4 | - Если изменения, которые вы предлагаете, значительны, то создание issue перед внесением изменений будет оценено по достоинству. Если вы хотите поработать над issue (это очень рекомендуется), выразите свою заинтересованность и вы будете назначены исполнителем. 5 | - Если вы добавляете новый пример, настоятельно рекомендуется создать issue, чтобы обсудить ее перед отправкой изменений. Для добавления нового примера вы можете использовать следующий шаблон: 6 | 7 |
 8 | ### ▶ Какое-то причудливое название. *
 9 | * в конце названия означает, что пример был добавлен недавно.
10 | 
11 | ```py
12 | # Подготовка кода.
13 | # Подготовка к волшебству...
14 | ```
15 | 
16 | **Вывод (версия Python):**
17 | ```py
18 | >>> triggering_statement
19 | Вероятно, неожиданный вывод
20 | 
21 | ```
22 | (Необязательно): Одна строка, описывающая неожиданный вывод.
23 | 
24 | #### 💡 Объяснение:
25 | * Краткое объяснение того, что происходит и почему это происходит.
26 |   ```py
27 |   Подготовка примеров для пояснения (при необходимости)
28 |   ```
29 | 
30 |   **Вывод:**
31 |   ```py
32 |   >>> trigger # пример, облегчающий понимание магии
33 |   # обоснованный вывод
34 |   ```
35 | 
36 | 37 | Несколько моментов, которые стоит учитывать при написании примера, 38 | 39 | - Если вы решили отправить новый пример без создания issue и обсуждения, пожалуйста, проверьте проект, чтобы убедиться, что в нем уже нет похожих примеров. 40 | - Старайтесь быть последовательными в именах и значениях, которые вы используете для переменных. Например, большинство имен переменных в проекте имеют вид `some_string`, `some_list`, `some_dict` и т.д. Вы увидите много `x` для однобуквенных имен переменных, и `"wtf"` в качестве значений для строк. В проекте нет строгой схемы, как таковой, но вы можете взглянуть на другие примеры, чтобы понять суть. 41 | - Старайтесь быть как можно более креативными, чтобы добавить элемент "сюрприза" во время подготовки примеров. Иногда это может означать написание фрагмента, который здравомыслящий программист никогда бы не написал. 42 | - Также не стесняйтесь добавлять свое имя в список [контрибьюторов](/CONTRIBUTORS.md). 43 | 44 | **Некоторые часто задаваемые вопросы** 45 | 46 | Что это такое после каждого заголовка сниппета (###) в README: ? Нужно ли его добавлять вручную или можно игнорировать при создании новых сниппетов? 47 | 48 | Это случайный UUID, он используется для идентификации примеров в нескольких переводах проекта. Как контрибьютор, вы не должны беспокоиться о том, как он используется, вы просто должны добавлять новый случайный UUID к новым примерам в этом формате. 49 | 50 | Куда следует добавлять новые сниппеты? В начало/в конец раздела? 51 | 52 | При определении порядка учитывается множество факторов (зависимость от других примеров, уровень сложности, категория и т.д.). Я бы предложил просто добавить новый пример в конец раздела, который вы считаете более подходящим (или просто добавить его в раздел "Разное"). О его порядке можно будет позаботиться в будущих редакциях. 53 | 54 | В чем разница между разделами (первые два очень похожи)? 55 | 56 | Раздел "Напрягите мозг" содержит более надуманные примеры, с которыми вы не столкнетесь в реальной жизни, в то время как раздел "Скользкие склоны" содержит примеры, с которыми можно чаще сталкиваться при программировании. 57 | 58 | Перед оглавлением написано, что для его создания использовался markdown-toc -i README.md --maxdepth 3. Пакет pip markdown-toc не содержит ни флагов -i, ни --maxdepth. Какой пакет имеется в виду, или какая версия этого пакета? 59 | Должна ли новая запись в оглавлении для фрагмента быть создана с помощью вышеуказанной команды или вручную (в случае, если вышеуказанная команда делает больше, чем просто добавляет запись)? 60 | 61 | Мы используем пакет [markdown-toc](https://www.npmjs.com/package/markdown-toc) npm для создания ToC (содержание). Однако у него есть некоторые проблемы со специальными символами (не уверен, что они уже исправлены). Чаще всего я просто вставляю ссылку toc вручную в нужное место. Инструмент удобен, когда мне нужно сделать большую перестановку, в остальных случаях просто обновлять toc вручную удобнее. 62 | 63 | Если у вас есть вопросы, не стесняйтесь спрашивать в [issue](https://github.com/satwikkansal/wtfpython/issues/269) (спасибо [@LiquidFun](https://github.com/LiquidFun) за ее создание). 64 | -------------------------------------------------------------------------------- /translations/ru-russian/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Ниже перечислены (без определенного порядка) замечательные люди, которые внесли вклад в развитие wtfpython. 2 | 3 | | Автор | Github | Issues | 4 | |-------------|--------|--------| 5 | | Lucas-C | [Lucas-C](https://github.com/Lucas-C) | [#36](https://github.com/satwikkansal/wtfpython/issues/36) | 6 | | MittalAshok | [MittalAshok](https://github.com/MittalAshok) | [#23](https://github.com/satwikkansal/wtfpython/issues/23) | 7 | | asottile | [asottile](https://github.com/asottile) | [#40](https://github.com/satwikkansal/wtfpython/issues/40) | 8 | | MostAwesomeDude | [MostAwesomeDude](https://github.com/MostAwesomeDude) | [#1](https://github.com/satwikkansal/wtfpython/issues/1) | 9 | | tukkek | [tukkek](https://github.com/tukkek) | [#11](https://github.com/satwikkansal/wtfpython/issues/11), [#26](https://github.com/satwikkansal/wtfpython/issues/26) | 10 | | PiaFraus | [PiaFraus](https://github.com/PiaFraus) | [#9](https://github.com/satwikkansal/wtfpython/issues/9) | 11 | | chris-rands | [chris-rands](https://github.com/chris-rands) | [#32](https://github.com/satwikkansal/wtfpython/issues/32) | 12 | | sohaibfarooqi | [sohaibfarooqi](https://github.com/sohaibfarooqi) | [#63](https://github.com/satwikkansal/wtfpython/issues/63) | 13 | | ipid | [ipid](https://github.com/ipid) | [#145](https://github.com/satwikkansal/wtfpython/issues/145) | 14 | | roshnet | [roshnet](https://github.com/roshnet) | [#140](https://github.com/satwikkansal/wtfpython/issues/140) | 15 | | daidai21 | [daidai21](https://github.com/daidai21) | [#137](https://github.com/satwikkansal/wtfpython/issues/137) | 16 | | scidam | [scidam](https://github.com/scidam) | [#136](https://github.com/satwikkansal/wtfpython/issues/136) | 17 | | pmjpawelec | [pmjpawelec](https://github.com/pmjpawelec) | [#121](https://github.com/satwikkansal/wtfpython/issues/121) | 18 | | leisurelicht | [leisurelicht](https://github.com/leisurelicht) | [#112](https://github.com/satwikkansal/wtfpython/issues/112) | 19 | | mishaturnbull | [mishaturnbull](https://github.com/mishaturnbull) | [#108](https://github.com/satwikkansal/wtfpython/issues/108) | 20 | | MuseBoy | [MuseBoy](https://github.com/MuseBoy) | [#101](https://github.com/satwikkansal/wtfpython/issues/101) | 21 | | Ghost account | N/A | [#96](https://github.com/satwikkansal/wtfpython/issues/96) | 22 | | koddo | [koddo](https://github.com/koddo) | [#80](https://github.com/satwikkansal/wtfpython/issues/80), [#73](https://github.com/satwikkansal/wtfpython/issues/73) | 23 | | jab | [jab](https://github.com/jab) | [#77](https://github.com/satwikkansal/wtfpython/issues/77) | 24 | | Jongy | [Jongy](https://github.com/Jongy) | [#208](https://github.com/satwikkansal/wtfpython/issues/208), [#210](https://github.com/satwikkansal/wtfpython/issues/210), [#233](https://github.com/satwikkansal/wtfpython/issues/233) | 25 | | Diptangsu Goswami | [diptangsu](https://github.com/diptangsu) | [#193](https://github.com/satwikkansal/wtfpython/issues/193) | 26 | | Charles | [charles-l](https://github.com/charles-l) | [#245](https://github.com/satwikkansal/wtfpython/issues/245) | 27 | | LiquidFun | [LiquidFun](https://github.com/LiquidFun) | [#267](https://github.com/satwikkansal/wtfpython/issues/267) | 28 | 29 | --- 30 | 31 | **Переводчики** 32 | 33 | | Переводчик | Github | Язык | 34 | |-------------|--------|--------| 35 | | leisurelicht | [leisurelicht](https://github.com/leisurelicht) | [Chinese](https://github.com/leisurelicht/wtfpython-cn) | 36 | | vuduclyunitn | [vuduclyunitn](https://github.com/vuduclyunitn) | [Vietnamese](https://github.com/vuduclyunitn/wtfptyhon-vi) | 37 | | José De Freitas | [JoseDeFreitas](https://github.com/JoseDeFreitas) | [Spanish](https://github.com/JoseDeFreitas/wtfpython-es) | 38 | | Vadim Nifadev | [nifadyev](https://github.com/nifadyev) | [Russian](https://github.com/satwikkansal/wtfpython/tree/master/translations/ru-russian) | 39 | 40 | Спасибо всем за ваше время и за то, что делаете wtfpython еще более потрясающим! :smile: 41 | 42 | PS: Этот список обновляется после каждого крупного релиза, если я забыл добавить сюда ваш вклад, пожалуйста, не стесняйтесь сделать Pull request. 43 | -------------------------------------------------------------------------------- /translations/ru-russian/code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Кодекс Поведения участника 2 | 3 | ## Наши обязательства 4 | 5 | Мы, как участники, авторы и лидеры обязуемся сделать участие в сообществе 6 | свободным от притеснений для всех, независимо от возраста, телосложения, 7 | видимых или невидимых ограничений способности, этнической принадлежности, 8 | половых признаков, гендерной идентичности и выражения, уровня опыта, 9 | образования, социально-экономического статуса, национальности, внешности, 10 | расы, религии, или сексуальной идентичности и ориентации. 11 | 12 | Мы обещаем действовать и взаимодействовать таким образом, чтобы вносить вклад в открытое, 13 | дружелюбное, многообразное, инклюзивное и здоровое сообщество. 14 | 15 | ## Наши стандарты 16 | 17 | Примеры поведения, создающие условия для благоприятных взаимоотношений включают в себя: 18 | 19 | * Проявление доброты и эмпатии к другим участникам проекта 20 | * Уважение к чужой точке зрения и опыту 21 | * Конструктивная критика и принятие конструктивной критики 22 | * Принятие ответственности, принесение извинений тем, кто пострадал от наших ошибок 23 | и извлечение уроков из опыта 24 | * Ориентирование на то, что лучше подходит для сообщества, а не только для нас лично 25 | 26 | Примеры неприемлемого поведения участников включают в себя: 27 | 28 | * Использование выражений или изображений сексуального характера и нежелательное сексуальное внимание или домогательство в любой форме 29 | * Троллинг, оскорбительные или уничижительные комментарии, переход на личности или затрагивание политических убеждений 30 | * Публичное или приватное домогательство 31 | * Публикация личной информации других лиц, например, физического или электронного адреса, без явного разрешения 32 | * Иное поведение, которое обоснованно считать неуместным в профессиональной обстановке 33 | 34 | ## Обязанности 35 | 36 | Лидеры сообщества отвечают за разъяснение и применение наших стандартов приемлемого 37 | поведения и будут предпринимать соответствующие и честные меры по исправлению положения 38 | в ответ на любое поведение, которое они сочтут неприемлемым, угрожающим, оскорбительным или вредным. 39 | 40 | Лидеры сообщества обладают правом и обязанностью удалять, редактировать или отклонять 41 | комментарии, коммиты, код, изменения в вики, вопросы и другой вклад, который не совпадает 42 | с Кодексом Поведения, и предоставят причины принятого решения, когда сочтут нужным. 43 | 44 | ## Область применения 45 | 46 | Данный Кодекс Поведения применим во всех публичных физических и цифровых пространства сообщества, 47 | а также когда человек официально представляет сообщество в публичных местах. 48 | Примеры представления проекта или сообщества включают использование официальной электронной почты, 49 | публикации в официальном аккаунте в социальных сетях, 50 | или упоминания как представителя в онлайн или офлайн мероприятии. 51 | 52 | ## Приведение в исполнение 53 | 54 | О случаях домогательства, а так же оскорбительного или иного другого неприемлемого 55 | поведения можно сообщить ответственным лидерам сообщества с помощью email. 56 | Все жалобы будут рассмотрены и расследованы оперативно и беспристрастно. 57 | 58 | Все лидеры сообщества обязаны уважать неприкосновенность частной жизни и личную 59 | неприкосновенность автора сообщения. 60 | 61 | ## Атрибуция 62 | 63 | Данный Кодекс Поведения основан на [Кодекс Поведения участника][homepage], 64 | версии 2.0, доступной по адресу 65 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 66 | 67 | Принципы Воздействия в Сообществе были вдохновлены [Mozilla's code of conduct 68 | enforcement ladder](https://github.com/mozilla/diversity). 69 | 70 | [homepage]: https://www.contributor-covenant.org 71 | --------------------------------------------------------------------------------