repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Classification/Custom/training_params.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:50.743493 | import torch
from torch.optim import SGD
from torchvision.models import resnet50, inception_v3, mobilenet_v2, densenet121
model = resnet50(pretrained=False)
def resnet50_train_params():
model = resnet50(pretrained=False)
return {
"model": model,
"optimizer": SGD,
"weight_d... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Classification/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:51.081089 | import os, re
from typing import Union
from typing import List, Tuple
import numpy as np
import torch
from torchvision.models import resnet50, densenet121, mobilenet_v2, inception_v3
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
import traceback
from ..backend_check.model_exte... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:51.470571 | import os
import time
import math
import json
import warnings
from typing import List, Union, Tuple, Dict
from collections import defaultdict
import numpy as np
from PIL import Image
import cv2
import torch
from torch.cuda import amp
from torch.utils.data import DataLoader
from torch.optim import SGD, lr_scheduler
fro... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/yolo/compute_loss.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:52.262189 | import math
import torch
import torch.nn as nn
# This new loss function is based on https://github.com/ultralytics/yolov3/blob/master/utils/loss.py
def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9):
# Returns the IoU of box1 to box2. box1 is 4, box2 is nx4
box2 = box2.T
... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/yolo/custom_anchors.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:52.533479 | import random
import torch
import numpy as np
from scipy.cluster.vq import kmeans
# This new anchor generator function is based on https://github.com/ultralytics/yolov3/blob/master/utils/autoanchor.py
def generate_anchors(dataset, n=9, img_size=416, thr=4.0, gen=1000, verbose=True):
""" Creates kmeans-evolved an... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/yolo/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:52.957756 | import os
import warnings
from typing import Tuple, List
import cv2 as cv
import numpy as np
import torch
from torch.utils.data import Dataset
from torchvision import transforms
from ....yolov3.utils import prepare_image
class LoadImagesAndLabels(Dataset):
def __init__(self, path : str, net_dim=(416, 416), trai... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/yolo/metric.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:53.130886 | import math
import warnings
import numpy as np
import torch
# This new metric functions is based on https://github.com/ultralytics/yolov3/blob/master/utils/metric.py
def ap_per_class(tp, conf, pred_cls, target_cls):
""" Compute the average precision, given the recall and precision curves.
Source: https://git... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/Custom/yolo/validate.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:53.607659 | import os
import numpy as np
import torch
from torchvision.ops import box_iou
from ....yolov3.utils import get_predictions
from .metric import ap_per_class
from tqdm import tqdm
# This new validation function is based on https://github.com/ultralytics/yolov3/blob/master/val.py
def xywh2xyxy(box_coord : torch.Tenso... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Detection/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:53.699434 | import os, warnings
from tkinter import Image
from collections import defaultdict
from typing import List, Tuple, Dict, Union
from PIL import Image
import torchvision
import numpy as np
from enum import Enum
import torch
import cv2
from typing import Union, List
from ..yolov3.yolov3 import YoloV3
from ..yolov3.tiny_y... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/object_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.454418 | from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "retinanet_resnet50_fpn_coco-eeacb38b.pth")) # Download the model via this link https://github.com/OlafenwaMoses/Ima... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/image_prediction.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.463589 | from imageai.Classification import ImageClassification
import os
execution_path = os.getcwd()
prediction = ImageClassification()
prediction.setModelTypeAsResNet50()
prediction.setModelPath(os.path.join(execution_path, "resnet50-19c8e357.pth")) # Download the model via this link https://github.com/OlafenwaMoses/ImageA... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Classification/Custom/data_transformation.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.472291 | from torchvision import transforms
data_transforms1 = {
"train":transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(
... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/video_object_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.488810 | from imageai.Detection import VideoObjectDetection
import os
execution_path = os.getcwd()
detector = VideoObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath(os.path.join(execution_path, "yolov3.pt")) # https://github.com/OlafenwaMoses/ImageAI/releases/download/3.0.0-pretrained/yolov3.pt
detector.... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/video_analysis_per_second.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.510890 | from imageai.Detection import VideoObjectDetection
import os
from matplotlib import pyplot as plt
execution_path = os.getcwd()
color_index = {'bus': 'red', 'handbag': 'steelblue', 'giraffe': 'orange', 'spoon': 'gray', 'cup': 'yellow', 'chair': 'green', 'elephant': 'pink', 'truck': 'indigo', 'motorcycle': 'azure', 'r... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/video_analysis_per_frame.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.541162 | from imageai.Detection import VideoObjectDetection
import os
from matplotlib import pyplot as plt
execution_path = os.getcwd()
color_index = {'bus': 'red', 'handbag': 'steelblue', 'giraffe': 'orange', 'spoon': 'gray', 'cup': 'yellow', 'chair': 'green', 'elephant': 'pink', 'truck': 'indigo', 'motorcycle': 'azure', 'r... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | examples/video_custom_object_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.590564 | from imageai.Detection import VideoObjectDetection
import os
execution_path = os.getcwd()
detector = VideoObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath(os.path.join(execution_path, "yolov3.pt")) # https://github.com/OlafenwaMoses/ImageAI/releases/download/3.0.0-pretrained/yolov3.pt
detector.... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/Classification/Custom/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.628634 | import time, warnings
import os
import copy
import re
import json
from typing import List, Tuple, Union
from PIL import Image
import numpy as np
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
from torchvision import datasets
from torchvision import transforms
from torchvision.models import mob... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/backend_check/backend_check.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.831765 | try:
import torch
import torchvision
except:
try:
import tensorflow
import keras
raise RuntimeError("Dependency error!!! It appears you are trying to use ImageAI with a Tensorflow backend. ImageAI now uses PyTorch as backed as from version 3.0.2 . If you want to use the Tensorflow m... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/backend_check/model_extension.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:54.943954 | import os
def extension_check(file_path: str):
if file_path.endswith(".h5"):
raise RuntimeError("You are trying to use a Tensorflow model with ImageAI. ImageAI now uses PyTorch as backed as from version 3.0.2 . If you want to use the Tensorflow models or a customly trained '.h5' model, install ImageAI 2.1.... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/densenet121/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.057424 | import os, warnings
from pathlib import Path
from typing import List, Tuple
import torch, torchvision
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
warnings.filterwarnings("once", category=ResourceWarning)
class DenseNet121Pretrained:
"""
An implementation that allo... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/inceptionv3/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.066363 | import os, warnings
from pathlib import Path
from typing import List, Tuple
import torch, torchvision
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
warnings.filterwarnings("once", category=ResourceWarning)
class InceptionV3Pretrained:
"""
An implementation that allo... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/mobilenetv2/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.067731 | import os, warnings
from pathlib import Path
from typing import List, Tuple
import torch, torchvision
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
warnings.filterwarnings("once", category=ResourceWarning)
class MobileNetV2Pretrained:
"""
An implementation that allo... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/resnet50/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.074270 | import os, warnings
from typing import List, Tuple
import torch, torchvision
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
warnings.filterwarnings("once", category=ResourceWarning)
class ResNet50Pretrained:
"""
An implementation that allows for easy classification o... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/retinanet/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.140844 |
from torchvision.io import ImageReadMode
import torch
from PIL import Image, ImageColor, ImageDraw, ImageFont
from typing import List, Optional, Union, Tuple, BinaryIO
import numpy as np
import math
import warnings
import pathlib
def read_file(path: str) -> torch.Tensor:
"""
Reads and outputs the bytes conten... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/yolov3/tiny_yolov3.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.197425 | from typing import Union, List, Tuple, Optional
import torch
import torch.nn as nn
import numpy as np
from .yolov3 import DetectionLayer, ConvLayer
class YoloV3Tiny(nn.Module):
def __init__(
self,
anchors : Union[List[int], Tuple[int,...]],
num_classes : int=80,
... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/yolov3/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.371749 | import math
from typing import Union, List, Tuple
import torch
import numpy as np
import cv2 as cv
from torchvision.ops import batched_nms
def draw_bbox_and_label(x : torch.Tensor, label : str, img : np.ndarray) -> np.ndarray:
"""
Draws the predicted bounding boxes on the original image.
"""
x1,y1,x2... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai/yolov3/yolov3.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.556791 | from typing import Union, List, Tuple, Optional
import torch
import torch.nn as nn
import numpy as np
from .utils import transform_prediction
def noop(x):
return x
class DetectionLayer(nn.Module):
def __init__(
self,
anchors : Union[List[int], Tuple[int, ...]],
anchor_m... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Classification/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.646000 | import tensorflow as tf
from PIL import Image
import numpy as np
from matplotlib.cbook import deprecated
class ImageClassification:
"""
This is the image classification class in the ImageAI library. It provides support for 4 different models which are:
ResNet, MobileNetV2, DenseNet and Inception V3. After... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Classification/Custom/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.659568 | import tensorflow as tf
from PIL import Image
import time
import numpy as np
import os
import warnings
from matplotlib.cbook import deprecated
import json
class ClassificationModelTrainer:
"""
This is the Classification Model training class, that allows you to define a deep learning network
from th... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Detection/Custom/callbacks.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.668705 | from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint
import tensorflow as tf
import numpy as np
import warnings
class CustomTensorBoard(TensorBoard):
""" to log the loss after each batch
"""
def __init__(self, log_every=1, **kwargs):
super(CustomTensorBoard, self).__init__(**kwar... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Detection/Custom/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.701099 | import os
import re
import numpy as np
import json
from imageai.Detection.Custom.voc import parse_voc_annotation
from imageai.Detection.YOLO.yolov3 import yolov3_main, yolov3_train, dummy_loss
from imageai.Detection.Custom.generator import BatchGenerator
from imageai.Detection.Custom.utils.utils import normalize, evalu... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Detection/Custom/evaluate.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.730246 | #! /usr/bin/env python
import argparse
import os
import json
from imageai.Detection.Custom.voc import parse_voc_annotation
from imageai.Detection.Custom.generator import BatchGenerator
from imageai.Detection.Custom.utils.utils import normalize, evaluate
from keras.models import load_model
def _main_(args):
confi... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Detection/Custom/gen_anchors.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.747641 | import random
import numpy as np
from imageai.Detection.Custom.voc import parse_voc_annotation
def IOU(ann, centroids):
w, h = ann
similarities = []
for centroid in centroids:
c_w, c_h = centroid
if c_w >= w and c_h >= h:
similarity = w*h/(c_w*c_h)
elif c_w >= w and ... |
OlafenwaMoses/ImageAI | https://github.com/OlafenwaMoses/ImageAI | null | null | null | null | 8,868 | null | null | mit | null | null | null | null | null | null | null | imageai_tf_deprecated/Detection/Custom/generator.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:55.812633 | import cv2
import copy
import numpy as np
from tensorflow.keras.utils import Sequence
from imageai.Detection.Custom.utils.bbox import BoundBox, bbox_iou
from imageai.Detection.Custom.utils.image import apply_random_scale_and_crop, random_distort_image, random_flip, correct_bounding_boxes
class BatchGenerator(Sequence)... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/implementations/multimodal_processors.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.486402 | #!/usr/bin/env python3
"""
Multimodal Processors - Cross-Modal Processing Components
========================================================
Production-ready multimodal processing implementations.
Minimal code, maximal signal ratio.
Usage:
from multimodal_processors import TextEncoder, ImageEncoder, CrossModalFu... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/benchmarks/long_context_evaluation.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.499278 | #!/usr/bin/env python3
"""
Long Context Evaluation - Performance Measurement
=================================================
Benchmarking system for long context processing.
Minimal code, maximal signal ratio.
Usage:
from long_context_evaluation import PerformanceBenchmark, ScalabilityAnalyzer
benchmar... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/implementations/attention_mechanisms.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.599960 | #!/usr/bin/env python3
"""
Custom Attention Mechanisms
===========================
Production-ready attention implementations for context engineering.
Minimal code, maximal signal ratio.
Usage:
from attention_mechanisms import StandardAttention, SparseAttention, StreamingAttention
attention = SparseAtten... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/benchmarks/processing_metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.621865 | #!/usr/bin/env python3
"""
Processing Metrics - Quality Assessment Tools
=============================================
Production-ready quality assessment for context processing systems.
Minimal code, maximal signal ratio.
Usage:
from processing_metrics import QualityMetrics, CoherenceEvaluator, InformationPreser... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/implementations/refinement_loops.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.624125 | #!/usr/bin/env python3
"""
Refinement Loops - Self-Improvement Algorithms
==============================================
Production-ready iterative context improvement implementations.
Minimal code, maximal signal ratio.
Usage:
from refinement_loops import QualityAssessor, IterativeRefiner, MetaController
... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/01_context_retrieval_generation/templates/assembly_patterns.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.625640 | # Context Engineering Course - Module 01: Context Retrieval & Generation
# Assembly Patterns - Production-Ready Context Assembly Implementations
#
# Mathematical Foundation: C = A(c₁, c₂, ..., cₙ) with optimization and pattern composition
# Research Grounding: Based on systematic analysis of 1400+ papers (arXiv:2507.1... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/01_context_retrieval_generation/labs/prompt_engineering_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.747914 | #!/usr/bin/env python3
"""
Context Engineering Course - Prompt Engineering Laboratory
==========================================================
A comprehensive, research-backed implementation of advanced prompt engineering techniques
based on "A Survey of Context Engineering for Large Language Models" and formal cont... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/00_mathematical_foundations/exercises/math_foundations_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.900386 | # Mathematical Foundations Lab - Interactive Exploration
# Context Engineering Course: From Foundations to Frontier Systems
# Module 00: Mathematical Foundations - Interactive Laboratory
"""
Mathematical Foundations Lab: Interactive Exploration
====================================================
This laboratory note... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/01_context_retrieval_generation/labs/dynamic_assembly_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.921137 | # Context Engineering Course - Module 01: Context Retrieval & Generation
# Lab: Dynamic Assembly - Context Orchestration
#
# Learning Objectives:
# 1. Understand mathematical formalization of context assembly: C = A(c₁, c₂, ..., cₙ)
# 2. Implement practical assembly functions with optimization
# 3. Build component int... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/01_context_retrieval_generation/labs/knowledge_retrieval_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:58.922568 | """
Knowledge Retrieval Lab: Vector Databases and Semantic Search
==============================================================
Context Engineering Course - Module 01.2 Laboratory
Building on Context Engineering Survey (arXiv:2507.13334)
This lab provides hands-on experience with vector databases, semantic search,
a... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/labs/long_context_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.099540 | #!/usr/bin/env python3
"""
Long Context Processing Lab - Context Engineering Course
========================================================
A practical, industry-ready implementation of long context processing techniques.
Designed for immediate use in production while teaching core concepts.
Learning Objectives:
- M... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/labs/multimodal_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.272490 | #!/usr/bin/env python3
"""
Multimodal Context Processing Lab
=================================
Context Engineering Course - Module 02: Context Processing
Production-ready multimodal context integration for text, image, and audio.
Learning Objectives:
- Build unified multimodal representations
- Implement cross-modal ... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/labs/self_refinement_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.279512 | #!/usr/bin/env python3
"""
Self-Refinement Context Processing Lab
======================================
Context Engineering Course - Module 02: Context Processing
Production-ready implementation of iterative context improvement systems.
Learning Objectives:
- Implement self-assessment mechanisms for context quality
... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/01_min_prompt.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.286015 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Minimal Prompt Exploration: Fundamentals of Context Engineering
==============================================================
This notebook introduces the core principles of context engineering by exploring minimal, atomic prompts and their direct impact on LLM outpu... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/03_context_management/labs/memory_management_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.300323 | """
Memory Management Lab - Context Engineering
==========================================
A comprehensive implementation of memory hierarchies and context management
for large language model applications. This lab provides both educational
demonstrations and production-ready components for managing context windows,
m... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 00_COURSE/02_context_processing/labs/structured_data_lab.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.300894 | #!/usr/bin/env python3
"""
Structured Data Context Processing Lab
======================================
Context Engineering Course - Module 02: Context Processing
Production-ready knowledge graph and structured data integration.
Learning Objectives:
- Build and query knowledge graphs for context enhancement
- Implem... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/02_expand_context.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.365944 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context Expansion Techniques: From Prompts to Layered Context
=============================================================
This guide presents hands-on strategies for evolving basic prompts into layered, information-rich
contexts that enhance LLM performance. The focu... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/04_rag_recipes.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.485637 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context-Engineering: RAG Recipes for Retrieval-Augmented Generation
===================================================================
This module demonstrates practical implementations of Retrieval-Augmented
Generation (RAG) patterns for enhancing LLM contexts with e... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/05_prompt_programs.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.536467 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context-Engineering: Prompt Programs for Structured Reasoning
============================================================
This module introduces prompt programming: a structured approach to designing
prompts as executable programs with compositional operations, state ... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/03_control_loops.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.550085 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context-Engineering: Control Loops for Multi-Step LLM Interactions
=================================================================
This module demonstrates how to implement control flow mechanisms
for orchestrating complex multi-step LLM interactions. Building on
the... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/06_schema_design.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.686927 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context-Engineering: Schema Design for Structured Context
========================================================
This module focuses on designing structured schemas for LLM context,
enabling more consistent, verifiable, and composable interactions.
Schema-driven cont... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 10_guides_zero_to_hero/07_recursive_patterns.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.881863 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Context-Engineering: Recursive Patterns for Self-Improving Contexts
==================================================================
This module explores recursive patterns in context engineering - approaches
that enable LLMs to extend, refine, and evolve their own c... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/prompt_program_template.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.887862 | """
Prompt Program Template
----------------------
This template provides a structured framework for creating prompt programs -
code-like structures for guiding LLM reasoning through explicit, step-by-step
instructions. Prompt programs combine the flexibility of natural language
with the rigor of programming construct... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/field_protocol_shells.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.888597 | """
Field Protocol Shells - Reusable templates for implementing field protocols
This module provides a framework for parsing, validating, and executing field protocols
defined in the Pareto-lang format. It includes base classes and utilities for implementing
the core protocols in the Context Engineering repository.
B... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/field_resonance_measure.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.926628 | """
Field Resonance Measurement Tool
--------------------------------
This module provides tools for measuring resonance, coherence, and other properties
of neural fields in context engineering applications. It enables quantitative
assessment of field states to guide optimization and tuning.
Usage:
# Initialize a... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/control_loop.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.937709 | """
Context-Engineering Control Loop Template
----------------------------------------
This template provides a flexible control loop implementation for orchestrating
context-based interactions with language models. It allows for:
1. Multi-step reasoning processes
2. State tracking across interactions
3. Dynamic cont... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/recursive_context.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:59.981531 | """
Recursive Context Framework
============================================
Secure, minimal, pragmatic implementation of recursive context improvement.
Reduces complexity while adding production security.
Security: Zero trust architecture with input validation, output sanitization,
rate limiting, and secure credent... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | 20_templates/scoring_functions.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:00.093332 | """
Context-Engineering Scoring Functions
------------------------------------
This module provides scoring functions to evaluate context quality and model responses
in context engineering applications. It includes metrics for:
1. Relevance - How well content relates to the query or objective
2. Coherence - How logic... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | cognitive-tools/cognitive-programs/program-library.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:00.122055 | """
Cognitive Programs Library - Advanced Context Engineering
Comprehensive collection of cognitive programs operationalizing cutting-edge research:
- IBM Zurich: Cognitive Tools Architecture (Brown et al., 2025)
- Princeton ICML: Emergent Symbolic Mechanisms (Yang et al., 2025)
- Indiana University: Quantum Semanti... |
davidkimai/Context-Engineering | https://github.com/davidkimai/Context-Engineering | null | null | null | null | 8,801 | null | null | mit | null | null | null | null | null | null | null | cognitive-tools/cognitive-programs/program-examples.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:00.167863 | """
Cognitive Programs Examples - Interactive Demonstrations
Comprehensive examples showcasing the integration of all six research streams:
- IBM Zurich: Cognitive Tools Architecture
- Princeton ICML: Emergent Symbolic Mechanisms
- Indiana University: Quantum Semantic Framework
- Singapore-MIT: Memory-Reasoning Syne... |
garrettj403/SciencePlots | https://github.com/garrettj403/SciencePlots | null | null | null | null | 8,795 | null | null | mit | null | null | null | null | null | null | null | examples/plot-examples.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:07.456440 | """Plot examples of SciencePlot styles."""
# %%
import numpy as np
import matplotlib.pyplot as plt
import scienceplots # noqa: F401
import os
# Check we are in examples dir
current_dir = os.getcwd().lower()
if current_dir.endswith("scienceplots"):
os.chdir("./examples")
# Create 'figures' folder if it does not ... |
garrettj403/SciencePlots | https://github.com/garrettj403/SciencePlots | null | null | null | null | 8,795 | null | null | mit | null | null | null | null | null | null | null | src/scienceplots/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:07.458445 | import os # pathlib.Path.walk not available in Python <3.12
import matplotlib.pyplot as plt
import scienceplots
from .styles_discovery import read_styles_in_folders
# register the bundled stylesheets in the matplotlib style library
scienceplots_path = scienceplots.__path__[0]
styles_path = os.path.join(scienceplots_... |
garrettj403/SciencePlots | https://github.com/garrettj403/SciencePlots | null | null | null | null | 8,795 | null | null | mit | null | null | null | null | null | null | null | src/scienceplots/tests/test_scienceplots.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:07.477201 | """Test suite of SciencePlots
"""
import matplotlib.pyplot as plt
def test_matplotlib_required_api_existence():
"""Check if all functions and attributes used by scienceplots are available
in matplotlib.
"""
assert hasattr(plt.style, "core")
assert hasattr(plt.style.core, "read_style_directory")
... |
garrettj403/SciencePlots | https://github.com/garrettj403/SciencePlots | null | null | null | null | 8,795 | null | null | mit | null | null | null | null | null | null | null | src/scienceplots/styles_discovery.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:07.509165 | import os
import matplotlib.pyplot as plt
def read_styles_in_folders(root_path):
"""
Reads all stylesheets in the given path and its subfolders.
Parameters
----------
root_path : str
Path to the root folder containing the stylesheets and other subfolders
with stylesheets.
Re... |
garrettj403/SciencePlots | https://github.com/garrettj403/SciencePlots | null | null | null | null | 8,795 | null | null | mit | null | null | null | null | null | null | null | src/scienceplots/tests/conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:07.580928 | """
Configuration of SciencePlots tests
"""
import pytest
import scienceplots
import numpy as np
import os
from pathlib import Path
STYLES_PATH = Path(scienceplots.__path__[0], "styles")
def get_styles_in_dir(dir):
"""
Input: directory path
Output: set of matplotlib styles filenames (without trailing '... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.831525 | from flask import Flask
from flask_bootstrap import Bootstrap
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_pagedown import PageDown
from config import config
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/errors.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.845626 | from flask import jsonify
from app.exceptions import ValidationError
from . import api
def bad_request(message):
response = jsonify({'error': 'bad request', 'message': message})
response.status_code = 400
return response
def unauthorized(message):
response = jsonify({'error': 'unauthorized', 'messag... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/comments.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.848712 | from flask import jsonify, request, g, url_for, current_app
from .. import db
from ..models import Post, Permission, Comment
from . import api
from .decorators import permission_required
@api.route('/comments/')
def get_comments():
page = request.args.get('page', 1, type=int)
pagination = Comment.query.order_... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/authentication.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.849856 | from flask import g, jsonify
from flask_httpauth import HTTPBasicAuth
from ..models import User
from . import api
from .errors import unauthorized, forbidden
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(email_or_token, password):
if email_or_token == '':
return False
if password =... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/decorators.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.873105 | from functools import wraps
from flask import g
from .errors import forbidden
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not g.current_user.can(permission):
return forbidden('Insufficient permissions')
... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/auth/forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.874937 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, Length, Email, Regexp, EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(FlaskForm):
email = StringField('Email', validators=[D... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/posts.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.882657 | from flask import jsonify, request, g, url_for, current_app
from .. import db
from ..models import Post, Permission
from . import api
from .decorators import permission_required
from .errors import forbidden
@api.route('/posts/')
def get_posts():
page = request.args.get('page', 1, type=int)
pagination = Post.... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/users.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.890127 | from flask import jsonify, request, current_app, url_for
from . import api
from ..models import User, Post
@api.route('/users/<int:id>')
def get_user(id):
user = User.query.get_or_404(id)
return jsonify(user.to_json())
@api.route('/users/<int:id>/posts/')
def get_user_posts(id):
user = User.query.get_or... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/api/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:09.893123 | from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, posts, users, comments, errors
|
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/auth/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.424402 | from flask import render_template, redirect, request, url_for, flash
from flask_login import login_user, logout_user, login_required, \
current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/email.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.453640 | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Mess... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/decorators.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.475176 | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permission):
abort(4... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/fake.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.475711 | from random import randint
from sqlalchemy.exc import IntegrityError
from faker import Faker
from . import db
from .models import User, Post
def users(count=100):
fake = Faker()
i = 0
while i < count:
u = User(email=fake.email(),
username=fake.user_name(),
passwor... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/main/forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.489958 | from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, BooleanField, SelectField,\
SubmitField
from wtforms.validators import DataRequired, Length, Email, Regexp
from wtforms import ValidationError
from flask_pagedown.fields import PageDownField
from ..models import Role, User
class NameF... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/main/errors.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.490468 | from flask import render_template, request, jsonify
from . import main
@main.app_errorhandler(403)
def forbidden(e):
if request.accept_mimetypes.accept_json and \
not request.accept_mimetypes.accept_html:
response = jsonify({'error': 'forbidden'})
response.status_code = 403
ret... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/main/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.501257 | from flask import render_template, redirect, url_for, abort, flash, request,\
current_app, make_response
from flask_login import login_required, current_user
from flask_sqlalchemy import get_debug_queries
from . import main
from .forms import EditProfileForm, EditProfileAdminForm, PostForm,\
CommentForm
from ..... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/main/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.503051 | from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
|
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | app/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:10.531545 | from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request, url_for
from flask_login import UserMixin, Ano... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | config.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:11.028985 | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
MAIL_SERVER = os.environ.get('MAIL_SERVER', 'smtp.googlemail.com')
MAIL_PORT = int(os.environ.get('MAIL_PORT', '587'))
MAIL_USE_TLS = os.environ.get('MAIL_US... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | migrations/env.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:11.072417 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | flasky.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:11.108841 | import os
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
import sys
... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | tests/test_basics.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:12.090729 | import unittest
from flask import current_app
from app import create_app, db
class BasicsTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
def tearDown(self):
... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | tests/test_api.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:12.121107 | import unittest
import json
import re
from base64 import b64encode
from app import create_app, db
from app.models import User, Role, Post, Comment
class APITestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_cont... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | tests/test_selenium.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:12.515075 | import re
import threading
import time
import unittest
from selenium import webdriver
from app import create_app, db, fake
from app.models import Role, User, Post
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
# start Chrome
options = webdri... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | tests/test_user_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:12.515664 | import unittest
import time
from datetime import datetime
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission, Follow
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
... |
miguelgrinberg/flasky | https://github.com/miguelgrinberg/flasky | null | null | null | null | 8,761 | null | null | mit | null | null | null | null | null | null | null | tests/test_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:17.626498 | import re
import unittest
from app import create_app, db
from app.models import User, Role
class FlaskClientTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
Role.i... |
bottlepy/bottle | https://github.com/bottlepy/bottle | null | null | null | null | 8,759 | null | null | mit | null | null | null | null | null | null | null | test/test_fileupload.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:24.007402 | # -*- coding: utf-8 -*-
''' Tests for the FileUpload wrapper. '''
import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO, tob
import tempfile
class TestFileUpload(unittest.TestCase):
def test_name(self):
self.assertEqual(FileUpload(None, 'abc', None).name, 'abc')
def... |
bottlepy/bottle | https://github.com/bottlepy/bottle | null | null | null | null | 8,759 | null | null | mit | null | null | null | null | null | null | null | test/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:24.015030 | from __future__ import with_statement
from .tools import chdir
import unittest
import sys, os
try:
import coverage
coverage.process_startup()
except ImportError:
pass
import bottle
bottle.debug(True)
|
bottlepy/bottle | https://github.com/bottlepy/bottle | null | null | null | null | 8,759 | null | null | mit | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:24.027595 | # -*- coding: utf-8 -*-
import sys
import os
import time
# Use the matching bottle version, not a globally installed one.
bottle_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
sys.path.insert(0, bottle_dir)
import bottle
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
... |
bottlepy/bottle | https://github.com/bottlepy/bottle | null | null | null | null | 8,759 | null | null | mit | null | null | null | null | null | null | null | test/test_contextlocals.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:24.035838 | # -*- coding: utf-8 -*-
'''
Some objects are context-local, meaning that they have different values depending on the context they are accessed from. A context is currently defined as a thread.
'''
import unittest
import bottle
import threading
def run_thread(func):
t = threading.Thread(target=func)
t.start()... |
bottlepy/bottle | https://github.com/bottlepy/bottle | null | null | null | null | 8,759 | null | null | mit | null | null | null | null | null | null | null | test/test_exc.py | null | null | null | null | null | null | Python | 2026-05-04T02:08:24.045010 | import bottle
from .tools import ServerTestBase
class SomeError(Exception):
pass
class TestAppException(ServerTestBase):
def test_no_exc(self):
@bottle.route('/')
def test(): return 'test'
self.assertBody('test', '/')
def test_memory_error(self):
@bottle.route('/')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.