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 subprocess | |
import json | |
import argparse | |
from typing import Iterable | |
try: | |
from rich_argparse import RichHelpFormatter | |
except ImportError: | |
RichHelpFormatter = argparse.HelpFormatter |
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 dataclasses import dataclass | |
from typing import AsyncGenerator | |
from fastapi import Depends, FastAPI, Request | |
from fastapi.responses import StreamingResponse | |
from fastapi.testclient import TestClient | |
from msgpack import Packer, Unpacker | |
@dataclass |
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 math | |
import random | |
# the colorsys module is required for color conversion | |
from colorsys import hsv_to_rgb | |
# the theory for this colour generator was taken from; | |
# http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ | |
def pretty_colours(how_many): | |
"""uses golden ratio to create pleasant/pretty colours |
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 fastapi import FastAPI | |
app = FastAPI () |
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 fastapi.testclient import TestClient | |
from fastapi import FastAPI, Depends, Form | |
from pydantic import BaseModel | |
app = FastAPI() | |
def form_body(cls): | |
cls.__signature__ = cls.__signature__.replace( |
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
To whom this may concern, | |
I would like to begin by saying that I would have liked to submit this appeal much earlier - and had more time to work on it - however, I have been working on group assignments in all the time I've not been in classes, in hope that my work would end up being worth something. | |
So, I just wanted to quickly and briefly touch on a few things. | |
Firstly, procrastination. It bears worth mentioning that this is far from a new problem, though it has been a larger problem in recent years. I believe my primary problem is that the way in which I usually procrastinate is my hobby - which itself is very similar to a large part of the coursework I must complete for my degree. Namely, in regards to the programming work I do for my degree, and the tinkering I do as a hobby. It was recommended that I reach out to Curtin Counselling in regards to the Procrastination Workshop I was informed they held every so often - though to my subsequent disappointment, the last one for this year had already run in |
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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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 collections | |
class InheritDict(collections.UserDict): | |
def __init__(self, data, parent=None): | |
for k, v in data.items(): | |
if isinstance(data[k], dict): | |
data[k] = InheritDict(data[k], self) | |
super().__init__(data) |
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 decorator(*arguments): | |
# this function recieves arguments passed to the decorator | |
def real_decorator(function): | |
# this function recieves the function we are decorating | |
def wrapper(*args, **kwargs): | |
# this function recieves the arguments intended for the function we are decorating | |
# print(args, kwargs) | |
# print(inspect.getargspec(function)) | |
# print('args', arguments) |
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 types | |
class Pipeline(object): | |
def __init__(self, source): | |
if type(source) == types.FunctionType: | |
self.pipe = source() | |
else: | |
self.pipe = source |
NewerOlder