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
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 |
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, field | |
from enum import StrEnum | |
class Types(StrEnum): | |
JOB = 'job' | |
STORY = 'story' | |
COMMENT = 'comment' | |
POLL = 'poll' | |
POLLOPT = 'pollopt' |
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 typing import Coroutine, Callable, Awaitable | |
from signal import signal, SIGINT, SIGTERM | |
class QueueItem: | |
def __init__(self, coroutine: Callable | Awaitable | Coroutine, *args, **kwargs): | |
self.coroutine = coroutine | |
self.args = args | |
self.kwargs = kwargs |
OlderNewer