things are clicking together

This commit is contained in:
2021-01-20 16:40:20 -05:00
parent ea39f082be
commit b017f9ceea
21 changed files with 1716 additions and 92 deletions
+3
View File
@@ -1,3 +1,5 @@
.
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@@ -134,3 +136,4 @@ Pipfile
Pipfile.lock
t.py
repl-tweet.py
.DS_Store
+6
View File
@@ -0,0 +1,6 @@
Update version marker in:
- ./pyproject.toml
- ./docs/_sphinx/conf.py
$ poetry publish --build
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

+46
View File
@@ -0,0 +1,46 @@
<!-- GitHub Logo -->
<a href="https://github.com/replit/replit-py" class="github-corner" aria-label="View source on GitHub">
<svg width="80" height="80" viewBox="0 0 250 250"
style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg>
</a>
<style>
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
0%,
100% {
transform: rotate(0)
}
20%,
60% {
transform: rotate(-25deg)
}
40%,
80% {
transform: rotate(10deg)
}
}
@media (max-width:500px) {
.github-corner:hover .octo-arm {
animation: none
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}
</style>
+23
View File
@@ -0,0 +1,23 @@
<h1>Replit-py!</h1>
<p>
<em>A helpful Python package that helps you build excellent things inside Repls!</em>
</p>
<p class="logo">
<a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/evalbot.png', 1) }}" title="Replit's Evalbot" />
</a>
</p>
<p></p>
<h3>Useful Links</h3>
<ul>
<li><a href="https://docs.repl.it/">Replit Documentation</a></li>
<li><a href="https://github.com/replit/replit-py">Replit-py @ GitHub</a></li>
<li><a href="https://pypi.org/pypi/replit">Replit-py @ PyPI</a></li>
<li><a href="https://github.com/replit/replit-py">Issue Tracker</a></li>
</ul>
<hr />
<p>
<iframe src="https://ghbtns.com/github-btn.html?user=replit&repo=replit-py&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>
+19 -8
View File
@@ -7,7 +7,7 @@
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# add these directoricdes to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
@@ -19,12 +19,12 @@ sys.path.append(os.path.abspath("../src"))
# -- Project information -----------------------------------------------------
project = "replit"
copyright = "2020, repl.it"
author = "repl.it"
project = "replit-py"
copyright = "2021"
author = "<a href='https://repl.it/'>Replit</a>"
# The full version, including alpha/beta/rc tags
release = "1.3.0"
release = "3.0.0"
# -- General configuration ---------------------------------------------------
@@ -36,7 +36,8 @@ extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"sphinx_rtd_theme",
]
# Add any paths that contain templates here, relative to this directory.
@@ -53,12 +54,22 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "conf.py"]
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_theme_options = {
'show_powered_by': False
}
html_sidebars = {
'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html',
'hacks.html'],
'**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',
'sourcelink.html', 'searchbox.html', 'hacks.html']
}
# Custom css
html_css_files = ["css/darktheme.css"]
# html_css_files = ["css/darktheme.css"]
View File
View File
+88
View File
@@ -0,0 +1,88 @@
.. replit documentation master file, created by
sphinx-quickstart on Mon Jun 22 18:35:18 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Replit-py's API Guide!
=================================
.. figure:: https://github.com/kennethreitz42/replit-py/blob/kr-cleanup/ext/readme.gif?raw=true
This repository is the home for the ``replit`` Python package, which
provides:
- A fully-featured database client for `Repl.it DB`_. `[docs]`_
- A **work in progress** Repl.it user profile lookup. `[docs]`_
- A Flask application decorator for ensuring Repl.it Auth required on
specific routes. `[docs]`_
& other helpful toys and utilities, like…
- A simple audio library that can play tones and audio files!
- Some helpful functions for displaying ANSI colors within interactive
terminal sessions.
Its worth noting…
~~~~~~~~~~~~~~~~~~
The `Repl.it`_ Python environment does not require any platform-specific
code, however, these optional utilities provide additional platform
features in a simple and accessible way.
*Example*: `Repl.it DB`_ is an HTTP service, but an optional Python
client (here!) is available.
.. _Repl.it DB: https://docs.repl.it/misc/database
.. _[docs]: https://example.com
.. _Repl.it: https://repl.it/
.. toctree::
:maxdepth: 2
:caption: Contents:
Module contents
---------------
.. automodule:: replit
:members:
:undoc-members:
:show-inheritance:
replit.database module
----------------------
.. automodule:: replit.database
:members:
:undoc-members:
:show-inheritance:
replit.audio module
-------------------
.. automodule:: replit.audio
:members:
:undoc-members:
:show-inheritance:
replit.users module
-------------------
.. automodule:: replit.users
:members:
:undoc-members:
:show-inheritance:
replit.maqpy module
-------------------
.. automodule:: replit.web
:members:
:undoc-members:
:show-inheritance:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
-14
View File
@@ -1,14 +0,0 @@
/* Body dark theme */
body {
background: #333;
color: #fff;
}
.wy-nav-content {
background: #444;
}
/* Use original color inside of code blocks */
.highlight {
color: #404040;
}
-50
View File
@@ -1,50 +0,0 @@
.. replit documentation master file, created by
sphinx-quickstart on Mon Jun 22 18:35:18 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Replit Python Module Documentation
==================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Module contents
---------------
.. automodule:: replit
:members:
:undoc-members:
:show-inheritance:
replit.database module
----------------------
.. automodule:: replit.database
:members:
:undoc-members:
:show-inheritance:
replit.audio module
-------------------
.. automodule:: replit.audio
:members:
:undoc-members:
:show-inheritance:
replit.maqpy module
-------------------
.. automodule:: replit.maqpy
:members:
:undoc-members:
:show-inheritance:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
View File
View File
Generated
+1523
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,9 +1,9 @@
[tool.poetry]
name = "replitdev"
version = "2.2.11"
name = "replit"
version = "3.0.0"
description = "A library for interacting with features of repl.it"
authors = ["mat <pypi@matdoes.dev>", "Scoder12 <pypi@scoder12.ml>", "AllAwesome497", "Repl.it <contact@repl.it>"]
license = "MIT"
authors = ["Repl.it <contact@repl.it>", "mat <pypi@matdoes.dev>", "kennethreitz <me@kennethreitz.org>", "Scoder12 <pypi@scoder12.ml>", "AllAwesome497", ]
license = "ISC"
readme = "README.md"
repository = "https://github.com/replit/replit-py"
homepage = "https://github.com/replit/replit-py"
+2 -3
View File
@@ -1,11 +1,10 @@
"""Async and dict-like interfaces for interacting with Repl.it Database."""
from collections import abc
import json
from typing import Any, Dict, Iterator, Tuple
import urllib
from collections import abc
from typing import Any, Dict, Iterator, Tuple
import aiohttp
import requests
+1 -1
View File
@@ -32,7 +32,7 @@ def user_data(username: str) -> JSONKey:
return db.jsonkey(username, dict)
current_user_data = LocalProxy(lambda: user_data(flask.request.auth.name))
current_user_data = LocalProxy(lambda: user_data(flask.request.user_info.name))
# Syntax sugar.
App = ReplitApp
+1 -1
View File
@@ -178,7 +178,7 @@ def authed_ratelimit(
nonlocal last_reset
nonlocal num_requests
name = flask.request.auth.name
name = flask.request.user_info.name
now = time.time()
if now - last_reset >= period:
-11
View File
@@ -1,11 +0,0 @@
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "Hello, World!"
app.run(host="0.0.0.0")