Test bed for what is now Tornadose
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 asyncio | |
from threading import Event, Thread | |
class EventLoopThread(Thread): | |
def __init__(self): | |
super().__init__() | |
self.loop = None | |
self.ready = Event() |
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
"""Example of how to use webargs with Tornado to read form data which includes file uploads.""" | |
from dataclasses import dataclass, field | |
from typing import List, Optional | |
from marshmallow_dataclass import class_schema | |
from marshmallow.fields import Raw | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, RequestHandler |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
"""A simple demonstration of running background tasks with Tornado. | |
Here I am using a basic TCP server which handles streams and keeps | |
them open while asynchronously performing a fake task in the | |
background. In order to test it, simply telnet to localhost port 8080 | |
and start typing things to see that the server receives the messages. | |
The advantage to running on an executor instead of conventional | |
threads is that we can more easily shut it down by stopping the | |
tornado IO loop. |
With the Mercurial convert
extention, you can rename branches, move,
and filter files. As an example, say we have a repo with only the
default
branch which is to be imported into a super-repository.
For starters, we will want all our files in the child repo to be in a subdirectory of the parent repo and not include the child's
Testing using Pygal to render plots server-side and embed them in a
web page via a <canvas>
.
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 codecs | |
import json | |
from typing import Union | |
import h5py | |
import numpy as np | |
import pandas as pd | |
vlen = np.vectorize(len) | |
vencode = np.vectorize(codecs.encode) |
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
/* | |
Simple jQuery calls to replace RST admonitions with Bootstrap | |
alerts. | |
This is intended to work with the pelican-bootstrap3 Pelican theme, | |
but may also work with others. | |
This script is public domain. | |
*/ |
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 sys | |
from PyQt5.QtWidgets import * | |
from PyQt5.QtGui import * | |
class MainWindow(QWidget): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.setWindowTitle('Multiline lambdas') |