mirror of
https://github.com/satwikkansal/wtfpython.git
synced 2025-07-21 13:31:14 +02:00
* Fix .gitignore issue
* Add pypi package 🚀
This commit is contained in:
0
wtfpython-pypi/wtf_python/__init__.py
Normal file
0
wtfpython-pypi/wtf_python/__init__.py
Normal file
BIN
wtfpython-pypi/wtf_python/__init__.pyc
vendored
Normal file
BIN
wtfpython-pypi/wtf_python/__init__.pyc
vendored
Normal file
Binary file not shown.
BIN
wtfpython-pypi/wtf_python/__pycache__/__init__.cpython-35.pyc
vendored
Normal file
BIN
wtfpython-pypi/wtf_python/__pycache__/__init__.cpython-35.pyc
vendored
Normal file
Binary file not shown.
BIN
wtfpython-pypi/wtf_python/__pycache__/main.cpython-35.pyc
vendored
Normal file
BIN
wtfpython-pypi/wtf_python/__pycache__/main.cpython-35.pyc
vendored
Normal file
Binary file not shown.
35
wtfpython-pypi/wtf_python/main.py
Normal file
35
wtfpython-pypi/wtf_python/main.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import pydoc
|
||||
try:
|
||||
from urllib.request import urlretrieve
|
||||
except ImportError:
|
||||
from urllib import urlretrieve
|
||||
|
||||
url = ("https://raw.githubusercontent.com/satwikkansal/"
|
||||
"wtfpython/master/README.md")
|
||||
file_name = "content.md"
|
||||
|
||||
|
||||
def fetch_updated_doc():
|
||||
try:
|
||||
print("Fetching the latest version...")
|
||||
urlretrieve(url, file_name)
|
||||
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_name, 'r') as f:
|
||||
content = f.read()
|
||||
pydoc.pager(content)
|
||||
|
||||
|
||||
def load_and_read():
|
||||
fetch_updated_doc()
|
||||
render_doc()
|
||||
|
||||
|
||||
if __name__== "__main__":
|
||||
load_and_read()
|
BIN
wtfpython-pypi/wtf_python/main.pyc
vendored
Normal file
BIN
wtfpython-pypi/wtf_python/main.pyc
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user