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 random import choice | |
game_state = {"R": "Rock", "P": "Paper", "S": "Scissors"} | |
options = list(game_state.keys()) | |
winnings = ["RS", "PR", "SP"] | |
result = "{0} beats {1}" | |
while True: | |
computer = choice(options) | |
player = input("Enter R for Rock , P for Paper, S for Scissors, and, done to quit the game: ").upper() |
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 random import choice | |
game_state = {"R": "Rock", "P": "Paper", "S": "Scissors"} | |
options = list(game_state.keys()) | |
winnings = ["RS", "PR", "SP"] | |
result = "{0} beats {1}" | |
while True: | |
computer = choice(options) | |
player = input("Enter R for Rock , P for Paper, S for Scissors, and, done to quit the game: ").upper() |
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 random import choice | |
game_state = {"R": "Rock", "P": "Paper", "S": "Scissors"} | |
options = list(game_state.keys()) | |
winnings = ["RS", "PR", "SP"] | |
result = "{0} beats {1}" | |
while True: | |
computer = choice(options) | |
player = input("Enter R for Rock , P for Paper, S for Scissors, and, done to quit the game: ").upper() |
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 os import environ | |
from dotenv import load_dotenv, dotenv_values | |
class Config: | |
def __init__(self): | |
load_dotenv() | |
# setup non secret config variables here |
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 abc import ABC, abstractmethod | |
from fastapi import UploadFile | |
from pydantic import BaseModel, HttpUrl | |
class FileData(BaseModel): | |
""" | |
Represents the result of an upload operation | |
Attributes: |
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 asyncio | |
import logging | |
from urllib.parse import quote as urlencode | |
import boto3 | |
from botocore.exceptions import ClientError, NoCredentialsError | |
from .main import CloudUpload, FileData, UploadFile |
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 | |
import logging | |
import os | |
from azure.storage.blob import BlobServiceClient | |
from .main import CloudUpload, FileData, UploadFile | |
logger = logging.getLogger(__name__) |
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, Request, Depends | |
from fastapi.responses import RedirectResponse | |
from fastapi.templating import Jinja2Templates | |
from dotenv import load_dotenv | |
from fastfiles import S3, Local, Memory, FileData | |
load_dotenv() | |
app = FastAPI() | |
templates = Jinja2Templates(directory='.') |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>File Upload</title> | |
</head> | |
<body> | |
<main style="margin:20%"> | |
<div style="margin: auto"> | |
<h1>S3 File Upload</h1> |
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
const mongoose = require('mongoose') | |
const {ratings} = require('stars-schema') | |
const ProductSchema = new mongoose.Schema({ | |
name: String, | |
price: Number | |
}, {toObject: {getters: true}}) | |
function median(ratings){s |
OlderNewer