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 celery import Celery | |
app = Celery('myapp', broker='pyamqp://guest@localhost//') | |
# Configure MySQL as the result backend | |
app.conf.result_backend = 'db+mysql://user:password@localhost/mydb' | |
# Set the default queue, exchange, and routing key | |
app.conf.task_default_queue = 'default_queue' | |
app.conf.task_default_exchange = 'default_exchange' |
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 requests import Session | |
from requests import adapters | |
from urllib3 import poolmanager | |
from ssl import create_default_context, Purpose, CERT_NONE | |
class CustomHttpAdapter (adapters.HTTPAdapter): | |
def __init__(self, ssl_context=None, **kwargs): | |
self.ssl_context = ssl_context | |
super().__init__(**kwargs) |
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 time import sleep | |
from openai import OpenAI | |
question_to_be_asked = "add exception for `a = 1/0`" | |
assistant_id = "asst_sniCqROg8nEFXNBwYoz2sE64" | |
client = OpenAI(api_key="your_key_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 pydantic import BaseModel | |
from datetime import datetime | |
from time import sleep | |
print(datetime.now()) # 2023-10-26 22:43:50.878798 | |
class TestClass(BaseModel): | |
attribute_1: str | |
timestamp: datetime = datetime.now() # taking time from 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
//[dependencies] | |
// reqwest = { version = "0.10.0-alpha.2", features = ["blocking"] } | |
// tl = "0.7.7" | |
extern crate reqwest; | |
extern crate tl; | |
use std::time::Instant; | |
// need to add return type | |
fn main() { |
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
''' | |
1. Create a function for addition | |
2. expect an error | |
3. Handle the error | |
4. write a condition if there is no error | |
5. write a block of code if there is no error | |
''' | |
import logging |
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 enum import Enum | |
from fastapi import FastAPI | |
from aenum import extend_enum | |
from coolname import generate_slug | |
from models import DropDownChoices | |
class DropDownChoices(str, Enum): | |
... |