mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-30 14:52:55 +01:00
Merge branch 'dev' into #350/add-nox-support
This commit is contained in:
commit
f956856d4c
17
.github/workflows/pr.yml
vendored
Normal file
17
.github/workflows/pr.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
checks: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: DavidAnson/markdownlint-cli2-action@v17
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
wtfpython-pypi/build/
|
|
||||||
wtfpython-pypi/dist/
|
|
||||||
wtfpython-pypi/wtfpython.egg-info
|
|
||||||
|
|
||||||
# Python-specific byte-compiled files should be ignored
|
# Python-specific byte-compiled files should be ignored
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
15
.markdownlint.yaml
vendored
Normal file
15
.markdownlint.yaml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# MD013/line-length
|
||||||
|
MD013:
|
||||||
|
line_length: 120
|
||||||
|
|
||||||
|
# no-duplicate-heading - Multiple headings with the same content (Ignore multiple `Explanation` headings)
|
||||||
|
MD024: false
|
||||||
|
|
||||||
|
# no-trailing-punctuation - Trailing punctuation in heading (Ignore exclamation marks in headings)
|
||||||
|
MD026: false
|
||||||
|
|
||||||
|
# no-inline-html : Inline HTML (HTML is used for centered and theme specific images)
|
||||||
|
MD033: false
|
||||||
|
|
||||||
|
# no-inline-html : Bare URL used (site should be attributed transparently, because otherwise we have to un-necesarily explain where the link directs)
|
||||||
|
MD034: false
|
7
.pre-commit-config.yaml
vendored
Normal file
7
.pre-commit-config.yaml
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
default_language_version:
|
||||||
|
python: python3.12
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
||||||
|
rev: v0.14.0
|
||||||
|
hooks:
|
||||||
|
- id: markdownlint-cli2
|
11
irrelevant/wtf.ipynb
vendored
11
irrelevant/wtf.ipynb
vendored
@ -10,7 +10,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Translations: [Chinese \u4e2d\u6587](https://github.com/leisurelicht/wtfpython-cn) | [Vietnamese Ti\u1ebfng Vi\u1ec7t](https://github.com/vuduclyunitn/wtfptyhon-vi) | [Add translation](https://github.com/satwikkansal/wtfpython/issues/new?title=Add%20translation%20for%20[LANGUAGE]&body=Expected%20time%20to%20finish:%20[X]%20weeks.%20I%27ll%20start%20working%20on%20it%20from%20[Y].)\n",
|
"Translations: [Chinese \u4e2d\u6587](https://github.com/leisurelicht/wtfpython-cn) | [Vietnamese Ti\u1ebfng Vi\u1ec7t](https://github.com/vuduclyunitn/wtfptyhon-vi) | [Add translation](https://github.com/satwikkansal/wtfpython/issues/new?title=Add%20translation%20for%20[LANGUAGE]&body=Expected%20time%20to%20finish:%20[X]%20weeks.%20I%27ll%20start%20working%20on%20it%20from%20[Y].)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Other modes: [Interactive](https://colab.research.google.com/github/satwikkansal/wtfpython/blob/master/irrelevant/wtf.ipynb) | [CLI](https://pypi.python.org/pypi/wtfpython)\n",
|
"Other modes: [Interactive](https://colab.research.google.com/github/satwikkansal/wtfpython/blob/master/irrelevant/wtf.ipynb)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Python, being a beautifully designed high-level and interpreter-based programming language, provides us with many features for the programmer's comfort. But sometimes, the outcomes of a Python snippet may not seem obvious at first sight.\n",
|
"Python, being a beautifully designed high-level and interpreter-based programming language, provides us with many features for the programmer's comfort. But sometimes, the outcomes of a Python snippet may not seem obvious at first sight.\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -71,15 +71,6 @@
|
|||||||
" - If the answer is no (which is perfectly okay), take a deep breath, and read the explanation (and if you still don't understand, shout out! and create an issue [here](https://github.com/satwikkansal/wtfpython/issues/new)).\n",
|
" - If the answer is no (which is perfectly okay), take a deep breath, and read the explanation (and if you still don't understand, shout out! and create an issue [here](https://github.com/satwikkansal/wtfpython/issues/new)).\n",
|
||||||
" - If yes, give a gentle pat on your back, and you may skip to the next example.\n",
|
" - If yes, give a gentle pat on your back, and you may skip to the next example.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"PS: You can also read WTFPython at the command line using the [pypi package](https://pypi.python.org/pypi/wtfpython),\n",
|
|
||||||
"```sh\n",
|
|
||||||
"$ pip install wtfpython -U\n",
|
|
||||||
"$ wtfpython\n",
|
|
||||||
"```\n",
|
|
||||||
"---\n",
|
|
||||||
"\n",
|
|
||||||
"# \ud83d\udc40 Examples\n",
|
|
||||||
"\n",
|
|
||||||
"\n\n## Hosted notebook instructions\n\nThis is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because, \n- they either require a version of Python that's not supported in the hosted runtime.\n- or they can't be reproduced in the notebook envrinonment.\n\nThe 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\n\n```py\n>>> import sys\n>>> sys.version\n# Prints out Python version here.\n```\n\nThat 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!\n\n---\n"
|
"\n\n## Hosted notebook instructions\n\nThis is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because, \n- they either require a version of Python that's not supported in the hosted runtime.\n- or they can't be reproduced in the notebook envrinonment.\n\nThe 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\n\n```py\n>>> import sys\n>>> sys.version\n# Prints out Python version here.\n```\n\nThat 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!\n\n---\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
9
translations/ru-russian/README.md
vendored
9
translations/ru-russian/README.md
vendored
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Переводы: [English Original](https://github.com/satwikkansal/wtfpython) [Chinese 中文](https://github.com/robertparley/wtfpython-cn) | [Vietnamese Tiếng Việt](https://github.com/vuduclyunitn/wtfptyhon-vi) | [Spanish Español](https://web.archive.org/web/20220511161045/https://github.com/JoseDeFreitas/wtfpython-es) | [Korean 한국어](https://github.com/buttercrab/wtfpython-ko) | [Russian Русский](https://github.com/satwikkansal/wtfpython/tree/master/translations/ru-russian) | [German Deutsch](https://github.com/BenSt099/wtfpython) | [Add translation](https://github.com/satwikkansal/wtfpython/issues/new?title=Add%20translation%20for%20[LANGUAGE]&body=Expected%20time%20to%20finish:%20[X]%20weeks.%20I%27ll%20start%20working%20on%20it%20from%20[Y].)
|
Переводы: [English Original](https://github.com/satwikkansal/wtfpython) [Chinese 中文](https://github.com/robertparley/wtfpython-cn) | [Vietnamese Tiếng Việt](https://github.com/vuduclyunitn/wtfptyhon-vi) | [Spanish Español](https://web.archive.org/web/20220511161045/https://github.com/JoseDeFreitas/wtfpython-es) | [Korean 한국어](https://github.com/buttercrab/wtfpython-ko) | [Russian Русский](https://github.com/satwikkansal/wtfpython/tree/master/translations/ru-russian) | [German Deutsch](https://github.com/BenSt099/wtfpython) | [Add translation](https://github.com/satwikkansal/wtfpython/issues/new?title=Add%20translation%20for%20[LANGUAGE]&body=Expected%20time%20to%20finish:%20[X]%20weeks.%20I%27ll%20start%20working%20on%20it%20from%20[Y].)
|
||||||
|
|
||||||
Альтернативные способы: [Интерактивный сайт](https://wtfpython-interactive.vercel.app) | [Интерактивный Jupiter notebook](https://colab.research.google.com/github/satwikkansal/wtfpython/blob/master/irrelevant/wtf.ipynb) | [CLI](https://pypi.python.org/pypi/wtfpython)
|
Альтернативные способы: [Интерактивный сайт](https://wtfpython-interactive.vercel.app) | [Интерактивный Jupiter notebook](https://colab.research.google.com/github/satwikkansal/wtfpython/blob/master/irrelevant/wtf.ipynb)
|
||||||
|
|
||||||
Python, будучи прекрасно спроектированным высокоуровневым языком программирования, предоставляет множество возможностей для удобства программиста. Но иногда поведение Python кода могут показаться запутывающим на первый взгляд.
|
Python, будучи прекрасно спроектированным высокоуровневым языком программирования, предоставляет множество возможностей для удобства программиста. Но иногда поведение Python кода могут показаться запутывающим на первый взгляд.
|
||||||
|
|
||||||
@ -215,13 +215,6 @@ PS: Если вы уже читали **wtfpython** раньше, с измен
|
|||||||
- Если ответ отрицательный (что совершенно нормально), сделать глубокий вдох и прочитать объяснение (а если пример все еще непонятен, и создайте [issue](https://github.com/satwikkansal/wtfpython/issues/new)).
|
- Если ответ отрицательный (что совершенно нормально), сделать глубокий вдох и прочитать объяснение (а если пример все еще непонятен, и создайте [issue](https://github.com/satwikkansal/wtfpython/issues/new)).
|
||||||
- Если "да", ощутите мощь своих познаний в Python и переходите к следующему примеру.
|
- Если "да", ощутите мощь своих познаний в Python и переходите к следующему примеру.
|
||||||
|
|
||||||
PS: Вы также можете читать WTFPython в командной строке, используя [pypi package](https://pypi.python.org/pypi/wtfpython),
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip install wtfpython -U
|
|
||||||
wtfpython
|
|
||||||
```
|
|
||||||
|
|
||||||
# 👀 Примеры
|
# 👀 Примеры
|
||||||
|
|
||||||
## Раздел: Напряги мозги!
|
## Раздел: Напряги мозги!
|
||||||
|
2386
wtfpython-pypi/content.md
vendored
2386
wtfpython-pypi/content.md
vendored
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
|||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
setup(name='wtfpython',
|
|
||||||
version='0.2',
|
|
||||||
description='What the f*ck Python!',
|
|
||||||
author="Satwik Kansal",
|
|
||||||
maintainer="Satwik Kansal",
|
|
||||||
maintainer_email='satwikkansal@gmail.com',
|
|
||||||
url='https://github.com/satwikkansal/wtfpython',
|
|
||||||
platforms='any',
|
|
||||||
license="WTFPL 2.0",
|
|
||||||
long_description="An interesting collection of subtle & tricky Python Snippets"
|
|
||||||
" and features.",
|
|
||||||
keywords="wtfpython gotchas snippets tricky",
|
|
||||||
packages=find_packages(),
|
|
||||||
entry_points = {
|
|
||||||
'console_scripts': ['wtfpython = wtf_python.main:load_and_read']
|
|
||||||
},
|
|
||||||
classifiers=[
|
|
||||||
'Development Status :: 4 - Beta',
|
|
||||||
|
|
||||||
'Environment :: Console',
|
|
||||||
'Environment :: MacOS X',
|
|
||||||
'Environment :: Win32 (MS Windows)',
|
|
||||||
|
|
||||||
'Intended Audience :: Science/Research',
|
|
||||||
'Intended Audience :: Developers',
|
|
||||||
'Intended Audience :: Education',
|
|
||||||
'Intended Audience :: End Users/Desktop',
|
|
||||||
|
|
||||||
'Operating System :: OS Independent',
|
|
||||||
|
|
||||||
'Programming Language :: Python :: 3',
|
|
||||||
'Programming Language :: Python :: 2',
|
|
||||||
|
|
||||||
'Topic :: Documentation',
|
|
||||||
'Topic :: Education',
|
|
||||||
'Topic :: Scientific/Engineering',
|
|
||||||
'Topic :: Software Development'],
|
|
||||||
)
|
|
@ -1,42 +0,0 @@
|
|||||||
from os.path import dirname, join, realpath
|
|
||||||
|
|
||||||
import pydoc
|
|
||||||
try:
|
|
||||||
from urllib.request import urlretrieve
|
|
||||||
except ImportError:
|
|
||||||
from urllib import urlretrieve
|
|
||||||
|
|
||||||
url = ("http://raw.githubusercontent.com/satwikkansal/"
|
|
||||||
"wtfpython/master/README.md")
|
|
||||||
|
|
||||||
file_path = join(dirname(dirname(realpath(__file__))), "content.md")
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_updated_doc():
|
|
||||||
"""
|
|
||||||
Fetch the latest version of the file at `url` and save it to `file_path`.
|
|
||||||
If anything goes wrong, do nothing.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
print("Fetching the latest version...")
|
|
||||||
urlretrieve(url, file_path)
|
|
||||||
print("Done!")
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
print("Uh oh, failed to check for the latest version, "
|
|
||||||
"using the local version for now.")
|
|
||||||
|
|
||||||
|
|
||||||
def render_doc():
|
|
||||||
with open(file_path, 'r', encoding="utf-8") as f:
|
|
||||||
content = f.read()
|
|
||||||
pydoc.pager(content)
|
|
||||||
|
|
||||||
|
|
||||||
def load_and_read():
|
|
||||||
fetch_updated_doc()
|
|
||||||
render_doc()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__== "__main__":
|
|
||||||
load_and_read()
|
|
8
wtfpython-pypi/wtfpython
vendored
8
wtfpython-pypi/wtfpython
vendored
@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from wtf_python.main import load_and_read
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(load_and_read())
|
|
Loading…
Reference in New Issue
Block a user