import asyncio
from collections import defaultdict
from fastapi import WebSocket
import { SetMetadata } from '@nestjs/common';
export enum Role {
User = 'user',
Editor = 'editor',
Admin = 'admin',
use std::cmp::{Ordering, Reverse};
#[derive(Debug, Clone)]
pub struct ScheduledTask<T> {
pub priority: u8,
pub seq: u64,
use std::collections::HashMap;
use std::sync::{Arc, Mutex, PoisonError};
#[derive(Default)]
struct Metrics {
per_endpoint: HashMap<String, u64>,
class Cart < ApplicationRecord
has_many :cart_items, dependent: :destroy
EXPIRY_WINDOW = 2.hours
scope :active, -> { where(state: :active) }
package com.example.notifications;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import java.io.IOException;
Rails.application.routes.draw do
resources :articles do
resources :comments, shallow: true, only: %i[index new create show edit update destroy]
end
root "articles#index"
import base64
import json
from django.core.exceptions import BadRequest
class Order < ApplicationRecord
has_many :line_items, inverse_of: :order, dependent: :destroy
accepts_nested_attributes_for :line_items,
allow_destroy: true,
reject_if: ->(attrs) { attrs["product_id"].blank? && attrs["quantity"].blank? }
import { z } from "zod";
export const signupSchema = z
.object({
email: z.string().min(1, "Email is required").email("Enter a valid email"),
username: z
import io
import os
from uuid import uuid4
from PIL import Image, UnidentifiedImageError
ALLOWED_FORMATS = {"JPEG", "PNG", "WEBP"}
package export
import (
"encoding/csv"
"log"
"net/http"