.. autoclass:: rug.stocktwits.UnofficialAPI :members:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextlib import contextmanager | |
class X(object): | |
@contextmanager | |
def y(self): | |
print("before") | |
x = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ python /tmp/class_contextmanager.py | |
before | |
1 | |
after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import setuptools | |
from eagle import __version__, __description__ | |
# Long description | |
with open("description.rst", "r") as f: | |
long_description = f.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DummyWebServer(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-Type", "application/json") | |
self.end_headers() | |
# Parse query string. | |
params = parse_qs(urlparse(self.path).query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup_server(): | |
""" | |
Kicks off DummyWebServer. | |
""" | |
server = HTTPServer((HOST, PORT), DummyWebServer) | |
server.serve_forever() | |
# Start dummy server in a thread. | |
server_thread = threading.Thread(target=setup_server, daemon=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "app"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import django | |
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "app"))) | |
os.environ["DJANGO_SETTINGS_MODULE"] = "richy.settings.dev" | |
django.setup() |