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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/backends/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.680862 | r"""
Hh ____
HP "HHF:. `._ :.,-'"" "-.
F F" :::..'"" "-. `.
F , \ \ "BACKENDS"
F j\ / ; `.
| j `. ` A \
| | ;_ . 8 \
J F\_,'| "`-----.\ j `. ... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.684782 | """
'||
... ... .... ... ... ... ... .... ||
||' || '|. | || || | '' .|| ||
|| | '|.| ||| ||| .|' || ||
||...' '| | | '|..'|' .||.
|| .. |
'''' ''
Created by Dylan Araps.
"""
import argparse
import logging
import os
import s... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/backends/fast_colorthief.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.686475 | """
Generate a colorscheme using fast_colorthief.
"""
import logging
import sys
try:
import fast_colorthief
except ImportError:
logging.error("fast_colorthief wasn't found on your system.")
logging.error("Try another backend. (wal --backend)")
sys.exit(1)
from .. import util
def gen_colors(img):
... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/backends/haishoku.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.687401 | """
Generate a colorscheme using Haishoku.
"""
import logging
import sys
try:
from haishoku.haishoku import Haishoku
except ImportError:
logging.error("Haishoku wasn't found on your system.")
logging.error("Try another backend. (wal --backend)")
sys.exit(1)
from .. import colors
from .. import util
... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/backends/colorz.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.710219 | """
Generate a colorscheme using Colorz.
"""
import logging
import sys
try:
import colorz
except ImportError:
logging.error("colorz wasn't found on your system.")
logging.error("Try another backend. (wal --backend)")
sys.exit(1)
from .. import colors
from .. import util
def gen_colors(img):
"""... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/backends/wal.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:53.739737 | """
Generate a colorscheme using imagemagick.
"""
import logging
import re
import shutil
import subprocess
import sys
from .. import util
def imagemagick(color_count, img, magick_command):
"""Call Imagemagick to generate a scheme."""
flags = ["-resize", "25%", "-colors", str(color_count),
"-uniq... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/image.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.240784 | """
Get the image file.
"""
import logging
import os
import random
import re
import sys
from .settings import CACHE_DIR
from . import util
from . import wallpaper
def get_image_dir_recursive(img_dir):
"""Get all images in a directory recursively."""
current_wall = wallpaper.get()
current_wall = os.path.b... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/settings.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.302062 | """
'||
... ... .... ... ... ... ... .... ||
||' || '|. | || || | '' .|| ||
|| | '|.| ||| ||| .|' || ||
||...' '| | | '|..'|' .||.
|| .. |
'''' ''
Created by Dylan Araps.
"""
import os
import platform
__version__ = "3.3.1"... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/reload.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.303052 | """
Reload programs.
"""
import logging
import os
import shutil
import subprocess
from .settings import CACHE_DIR, MODULE_DIR, OS
from . import util
def tty(tty_reload):
"""Load colors in tty."""
tty_script = os.path.join(CACHE_DIR, "colors-tty.sh")
term = os.environ.get("TERM")
if tty_reload and te... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/theme.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.304540 | """
Theme file handling.
"""
import logging
import os
import random
import sys
from .settings import CACHE_DIR, CONF_DIR, MODULE_DIR
from . import util
def list_out():
"""List all themes in a pretty format."""
dark_themes = [theme.name.replace(".json", "")
for theme in list_themes()]
l... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/scripts/gtk_reload.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.307979 | #!/usr/bin/env python2
"""
Small Python 2 script to reload GTK2 themes.
This uses Python2 since this requires 'send_clientmessage_toall()'
which isn't available in Python 3.
Original source: https://crunchbang.org/forums/viewtopic.php?id=39646
"""
try:
import gtk
except ImportError:
print("[ERROR] gtk_reload:... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/sequences.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.312393 | """
Send sequences to all open terminals.
"""
import glob
import logging
import os
from .settings import CACHE_DIR, OS
from . import util
def set_special(index, color, iterm_name="h", alpha=100):
"""Convert a hex color to a special sequence."""
if OS == "Darwin" and iterm_name:
return "\033]P%s%s\033... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/export.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.342881 | """
Export colors in various formats.
"""
import logging
import os
import re
from . import util
from .settings import CACHE_DIR, CONF_DIR, MODULE_DIR
def template(colors, input_file, output_file=None):
"""Read template file, substitute markers and
save the file elsewhere."""
# pylint: disable-msg=too-... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.343460 | """
Misc helper functions.
"""
import colorsys
import json
import logging
import os
import platform
import re
import shutil
import subprocess
import sys
class Color:
"""Color formats."""
alpha_num = "100"
def __init__(self, hex_color):
self.hex_color = hex_color
def __str__(self):
re... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | pywal/wallpaper.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.352752 | """Set the wallpaper."""
import ctypes
import logging
import os
import re
import shutil
import subprocess
import urllib.parse
from .settings import HOME, OS, CACHE_DIR
from . import util
def get_desktop_env():
"""Identify the current running desktop environment."""
desktop = os.environ.get("XDG_CURRENT_DESKT... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:54.355275 | """wal - setup.py"""
import sys
import setuptools
try:
import pywal
except ImportError:
print("error: pywal requires Python 3.5 or greater.")
sys.exit(1)
LONG_DESC = open('README.md').read()
VERSION = pywal.__version__
DOWNLOAD = "https://github.com/dylanaraps/pywal/archive/%s.tar.gz" % VERSION
setuptool... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | tests/test_sequences.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:55.321203 | """Test sequence functions."""
import unittest
import platform
from pywal import sequences
from pywal import util
# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
class Testsequences(unittest.TestCase):
"""Test the sequence functions."""
def test_set_special(self):
"... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | tests/test_colors.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:55.334760 | """Test imagemagick functions."""
import unittest
from pywal import colors
class TestGenColors(unittest.TestCase):
"""Test the gen_colors functions."""
def test_gen_colors(self):
"""> Generate a colorscheme."""
result = colors.get("tests/test_files/test.jpg")
self.assertEqual(len(res... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | tests/test_image.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:55.477959 | """Test image functions."""
import unittest
from pywal import image
class TestImage(unittest.TestCase):
"""Test image functions."""
def test_get_img(self):
"""> Validate image file."""
result = image.get("tests/test_files/test.jpg")
self.assertIn("tests/test_files/test.jpg", result)
... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | tests/test_util.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:55.589683 | """Test util functions."""
import unittest
import os
from pywal import util
# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
class TestUtil(unittest.TestCase):
"""Test the util functions."""
def test_read_file(self):
"""> Read colors from a file."""
result =... |
dylanaraps/pywal | https://github.com/dylanaraps/pywal | null | null | null | null | 9,069 | null | null | mit | null | null | null | null | null | null | null | tests/test_export.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:55.606039 | """Test export functions."""
import unittest
import unittest.mock
import shutil
import os
from pywal import export
from pywal import util
COLORS = util.read_file_json("tests/test_files/test_file.json")
COLORS["colors"].update(COLORS["special"])
TMP_DIR = "/tmp/wal"
class TestExportColors(unittest.TestCase):
"... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/apikey02.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.480587 | from ninja.security import APIKeyHeader
class ApiKey(APIKeyHeader):
param_name = "X-API-Key"
def authenticate(self, request, key):
if key == "supersecret":
return key
header_key = ApiKey()
@api.get("/headerkey", auth=header_key)
def apikey(request):
return f"Token = {request.auth}... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/code001.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.481864 | from ninja import NinjaAPI
from ninja.security import django_auth
api = NinjaAPI()
@api.get("/pets", auth=django_auth)
def pets(request):
return f"Authenticated user {request.auth}"
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/global01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.482911 | from ninja import NinjaAPI, Form
from ninja.security import HttpBearer
class GlobalAuth(HttpBearer):
def authenticate(self, request, token):
if token == "supersecret":
return token
api = NinjaAPI(auth=GlobalAuth())
# @api.get(...)
# def ...
# @api.post(...)
# def ...
@api.post("/token", a... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/index001.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.487691 | from django.contrib import admin
from django.urls import path
from ninja import NinjaAPI
api = NinjaAPI()
@api.get("/add")
def add(request, a: int, b: int):
return {"result": a + b}
urlpatterns = [
path("admin/", admin.site.urls),
path("api/", api.urls),
]
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/code002.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.488577 | def ip_whitelist(request):
if request.META["REMOTE_ADDR"] == "8.8.8.8":
return "8.8.8.8"
@api.get("/ipwhitelist", auth=ip_whitelist)
def ipwhitelist(request):
return f"Authenticated client, IP = {request.auth}"
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/bearer01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.489091 | from ninja.security import HttpBearer
class AuthBearer(HttpBearer):
def authenticate(self, request, token):
if token == "supersecret":
return token
@api.get("/bearer", auth=AuthBearer())
def bearer(request):
return {"token": request.auth}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/bearer02.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.494014 | from ninja import NinjaAPI
from ninja.security import HttpBearer
api = NinjaAPI()
class InvalidToken(Exception):
pass
@api.exception_handler(InvalidToken)
def on_invalid_token(request, exc):
return api.create_response(request, {"detail": "Invalid token supplied"}, status=401)
class AuthBearer(HttpBearer):
... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/apikey01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.494859 | from ninja.security import APIKeyQuery
from someapp.models import Client
class ApiKey(APIKeyQuery):
param_name = "api_key"
def authenticate(self, request, key):
try:
return Client.objects.get(key=key)
except Client.DoesNotExist:
pass
api_key = ApiKey()
@api.get("/a... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/apikey03.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.518467 | from ninja.security import APIKeyCookie
class CookieKey(APIKeyCookie):
def authenticate(self, request, key):
if key == "supersecret":
return key
cookie_key = CookieKey()
@api.get("/cookiekey", auth=cookie_key)
def apikey(request):
return f"Token = {request.auth}"
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/basic01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:58.547943 | from ninja.security import HttpBasicAuth
class BasicAuth(HttpBasicAuth):
def authenticate(self, request, username, password):
if username == "admin" and password == "secret":
return username
@api.get("/basic", auth=BasicAuth())
def basic(request):
return {"httpuser": request.auth}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/body/code01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.575159 | from typing import Optional
from ninja import Schema
class Item(Schema):
name: str
description: Optional[str] = None
price: float
quantity: int
@api.post("/items")
def create(request, item: Item):
return item
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/body/code02.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.576512 | from ninja import Schema
class Item(Schema):
name: str
description: str = None
price: float
quantity: int
@api.put("/items/{item_id}")
def update(request, item_id: int, item: Item):
return {"item_id": item_id, "item": item.dict()}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/authentication/multiple01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.578527 | from ninja.security import APIKeyQuery, APIKeyHeader
class AuthCheck:
def authenticate(self, request, key):
if key == "supersecret":
return key
class QueryKey(AuthCheck, APIKeyQuery):
pass
class HeaderKey(AuthCheck, APIKeyHeader):
pass
@api.get("/multiple", auth=[QueryKey(), Head... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/form/code01.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.579779 | from ninja import Form, Schema
class Item(Schema):
name: str
description: str = None
price: float
quantity: int
@api.post("/items")
def create(request, item: Form[Item]):
return item
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/form/code02.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.581436 | from ninja import Form, Schema
class Item(Schema):
name: str
description: str = None
price: float
quantity: int
@api.post("/items/{item_id}")
def update(request, item_id: int, q: str, item: Form[Item]):
return {"item_id": item_id, "item": item.dict(), "q": q}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/body/code03.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.582614 | from ninja import Schema
class Item(Schema):
name: str
description: str = None
price: float
quantity: int
@api.post("/items/{item_id}")
def update(request, item_id: int, item: Item, q: str):
return {"item_id": item_id, "item": item.dict(), "q": q}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/form/code03.py | null | null | null | null | null | null | Python | 2026-05-04T02:06:59.583479 | from ninja import Form, Schema
from typing import Annotated, TypeVar
from pydantic import WrapValidator
from pydantic_core import PydanticUseDefault
def _empty_str_to_default(v, handler, info):
if isinstance(v, str) and v == '':
raise PydanticUseDefault
return handler(v)
T = TypeVar('T')
EmptyStrToD... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/compatibility/streaming.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:05.700458 | """Compatibility layer for async streaming responses.
Django 4.2+ supports passing async iterators to StreamingHttpResponse.
On older versions, async generators must be eagerly consumed into a list.
TODO: When dropping Django < 4.2 support:
1. Remove this module entirely.
2. In AsyncOperation._async_stream_respon... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/query/code03.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:05.701562 | from datetime import date
@api.get("/example")
def example(request, s: str = None, b: bool = None, d: date = None, i: int = None):
return [s, b, d, i]
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/query/code010.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.026414 | import datetime
from typing import List
from pydantic import Field
from ninja import Query, Schema
class Filters(Schema):
limit: int = 100
offset: int = None
query: str = None
category__in: List[str] = Field(None, alias="categories")
@api.get("/filter")
def events(request, filters: Query[Filters])... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/query/code01.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.075706 | weapons = ["Ninjato", "Shuriken", "Katana", "Kama", "Kunai", "Naginata", "Yari"]
@api.get("/weapons")
def list_weapons(request, limit: int = 10, offset: int = 0):
return weapons[offset: offset + limit]
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.140380 | """Django Ninja - Fast Django REST framework"""
__version__ = "1.6.2"
from pydantic import Field
from ninja.files import UploadedFile
from ninja.filter_schema import FilterConfigDict, FilterLookup, FilterSchema
from ninja.main import NinjaAPI
from ninja.openapi.docs import Redoc, Swagger
from ninja.orm import ModelS... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/compatibility/files.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.141355 | from typing import Any, List
from asgiref.sync import iscoroutinefunction, sync_to_async
from django.conf import settings
from django.http import HttpRequest
from django.utils.decorators import sync_and_async_middleware
from ninja.conf import settings as ninja_settings
from ninja.params.models import FileModel
FIX_M... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/query/code02.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.142649 | weapons = ["Ninjato", "Shuriken", "Katana", "Kama", "Kunai", "Naginata", "Yari"]
@api.get("/weapons/search")
def search_weapons(request, q: str, offset: int = 0):
results = [w for w in weapons if q in w.lower()]
return results[offset : offset + 10]
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/compatibility/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.417557 | import sys
from typing import Union
__all__ = ["UNION_TYPES", "get_annotations_from_namespace"]
# python3.10+ syntax of creating a union or optional type (with str | int)
# UNION_TYPES allows to check both universes if types are a union
try:
from types import UnionType
UNION_TYPES = (Union, UnionType)
excep... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/constants.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.425298 | from typing import Any, Dict, Optional
__all__ = ["NOT_SET"]
class NOT_SET_TYPE:
def __repr__(self) -> str: # pragma: no cover
return f"{__name__}.{self.__class__.__name__}"
def __copy__(self) -> Any:
return NOT_SET
def __deepcopy__(self, memodict: Optional[Dict] = None) -> Any:
... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.426749 | from math import inf
from typing import Dict, Optional, Set, Tuple
from django.conf import settings as django_settings
from pydantic import BaseModel, ConfigDict, Field
class Settings(BaseModel):
model_config = ConfigDict(from_attributes=True)
# Pagination
PAGINATION_CLASS: str = Field(
"ninja.pa... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/decorators.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:06.864303 | from functools import partial
from typing import Any, Callable, Tuple
from typing_extensions import Literal
from ninja.operation import Operation
from ninja.types import TCallable
from ninja.utils import contribute_operation_callback
# Type for decorator modes
DecoratorMode = Literal["operation", "view"]
# Since @a... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/files.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:07.085623 | from typing import Any, Callable, Dict
from django.core.files.uploadedfile import UploadedFile as DjangoUploadedFile
from pydantic_core import core_schema
__all__ = ["UploadedFile"]
class UploadedFile(DjangoUploadedFile):
@classmethod
def __get_pydantic_json_schema__(
cls, core_schema: Any, handler:... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/filter_schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:07.088088 | import warnings
from typing import Any, List, Optional, TypeVar, Union, cast
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q, QuerySet
from pydantic import ConfigDict
from pydantic.fields import FieldInfo
from typing_extensions import Literal
from .constants import NOT_SET
from ... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:07.089514 | from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
)
from django.http import HttpRequest, HttpResponse
from django.urls import URLPattern, URLResolver, reverse
from django.utils.module_loading import import_string
... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/management/commands/export_openapi_schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:07.912487 | import json
from pathlib import Path
from typing import Any, Optional
from django.core.management.base import BaseCommand, CommandError, CommandParser
from django.urls.base import resolve
from django.utils.module_loading import import_string
from ninja.main import NinjaAPI
from ninja.management.utils import command_d... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/management/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:07.941812 | import textwrap
from typing import Type
from django.core.management.base import BaseCommand
def command_docstring(cmd: Type[BaseCommand]) -> str:
base_args = []
if cmd is not BaseCommand: # pragma: no branch
base_parser = cmd().create_parser("base", "")
for group in base_parser._action_group... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/errors.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:08.687174 | import logging
import traceback
from functools import partial
from typing import TYPE_CHECKING, Generic, List, Optional, TypeVar
import pydantic
from django.conf import settings
from django.http import Http404, HttpRequest, HttpResponse
from ninja.types import DictStrAny
if TYPE_CHECKING:
from ninja import Ninja... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/openapi/docs.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:08.767850 | import json
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.urls import reverse
from ninja.constants import NOT_SET
from ninja... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/openapi/urls.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:08.797254 | from functools import partial
from typing import TYPE_CHECKING, Any, List
from django.urls import path
from .views import default_home, openapi_json, openapi_view
if TYPE_CHECKING:
from ninja import NinjaAPI # pragma: no cover
__all__ = ["get_openapi_urls", "get_root_url"]
def get_openapi_urls(api: "NinjaAPI... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | docs/src/tutorial/path/code010.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:09.154067 | import datetime
from ninja import Schema, Path
class PathDate(Schema):
year: int
month: int
day: int
def value(self):
return datetime.date(self.year, self.month, self.day)
@api.get("/events/{year}/{month}/{day}")
def events(request, date: Path[PathDate]):
return {"date": date.value()}
|
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/openapi/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:09.265813 | import itertools
import re
from http.client import responses
from typing import TYPE_CHECKING, Any, Dict, Generator, List, Optional, Set, Tuple
from django.utils.termcolors import make_style
from pydantic.json_schema import JsonSchemaMode
from ninja.constants import NOT_SET
from ninja.operation import Operation
from ... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/orm/factory.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:09.290775 | import itertools
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, cast
from django.db.models import Field as DjangoField
from django.db.models import ManyToManyRel, ManyToOneRel, Model
from pydantic import create_model as create_pydantic_model
from ninja.errors import ConfigError
from ... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/orm/fields.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:10.128392 | import datetime
from decimal import Decimal
from typing import Any, Callable, Dict, List, Tuple, Type, TypeVar, Union, no_type_check
from uuid import UUID
from django.db.models import ManyToManyField
from django.db.models.fields import Field as DjangoField
from pydantic import IPvAnyAddress
from pydantic.fields import... |
vitalik/django-ninja | https://github.com/vitalik/django-ninja | null | null | null | null | 9,034 | null | null | mit | null | null | null | null | null | null | null | ninja/openapi/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:10.234795 | from typing import TYPE_CHECKING, Any, NoReturn
from django.http import Http404, HttpRequest, HttpResponse
from ninja.openapi.docs import DocsBase
from ninja.responses import Response
if TYPE_CHECKING:
# if anyone knows a cleaner way to make mypy happy - welcome
from ninja import NinjaAPI # pragma: no cover... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | bump_npm.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.394041 | #!/usr/bin/env python
from __future__ import annotations
import json
import re
from pathlib import Path
def replace_package_json(package_json: Path, new_version: str, deps: bool = False) -> tuple[Path, str]:
content = package_json.read_text()
content, r_count = re.subn(r'"version": *".*?"', f'"version": "{ne... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/auth.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.398524 | from __future__ import annotations as _annotations
import asyncio
import json
import os
from dataclasses import asdict
from typing import Annotated, Literal, TypeAlias
from fastapi import APIRouter, Depends, Request
from fastui import AnyComponent, FastUI
from fastui import components as c
from fastui.auth import Aut... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.401336 | from __future__ import annotations as _annotations
import sys
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.responses import HTMLResponse, PlainTextResponse
from fastui import prebuilt_html
from fastui.auth import fastapi_auth_exception_handling
from fastui.dev import dev_fastapi... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/auth_user.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.408941 | import json
from dataclasses import asdict, dataclass
from datetime import datetime, timedelta
from typing import Annotated, Any
import jwt
from fastapi import Header, HTTPException
from fastui.auth import AuthRedirect
from typing_extensions import Self
JWT_SECRET = 'secret'
@dataclass
class User:
email: str | ... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/components_list.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.414827 | from __future__ import annotations as _annotations
import asyncio
from fastapi import APIRouter
from fastui import AnyComponent, FastUI
from fastui import components as c
from fastui.events import GoToEvent, PageEvent
from .shared import demo_page
router = APIRouter()
def panel(*components: AnyComponent) -> AnyCo... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.416312 | from __future__ import annotations as _annotations
import enum
from collections import defaultdict
from datetime import date
from typing import Annotated, Literal, TypeAlias
from fastapi import APIRouter, Request, UploadFile
from fastui import AnyComponent, FastUI
from fastui import components as c
from fastui.events... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/sse.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.419939 | import asyncio
from collections.abc import AsyncIterable
from itertools import chain
from fastapi import APIRouter
from fastui import FastUI
from fastui import components as c
from starlette.responses import StreamingResponse
router = APIRouter()
async def canned_ai_response_generator() -> AsyncIterable[str]:
p... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.424730 | from __future__ import annotations as _annotations
from fastapi import APIRouter
from fastui import AnyComponent, FastUI
from fastui import components as c
from .shared import demo_page
router = APIRouter()
@router.get('/', response_model=FastUI, response_model_exclude_none=True)
def api_index() -> list[AnyCompone... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/shared.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.427964 | from __future__ import annotations as _annotations
from fastui import AnyComponent
from fastui import components as c
from fastui.events import GoToEvent
def demo_page(*components: AnyComponent, title: str | None = None) -> list[AnyComponent]:
return [
c.PageTitle(text=f'FastUI Demo — {title}' if title e... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/tables.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.496759 | from datetime import date
from functools import cache
from pathlib import Path
import pydantic
from fastapi import APIRouter
from fastui import AnyComponent, FastUI
from fastui import components as c
from fastui.components.display import DisplayLookup, DisplayMode
from fastui.events import BackEvent, GoToEvent
from py... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | demo/tests.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:21.997437 | import re
import pytest
from dirty_equals import IsList, IsStr
from fastapi.testclient import TestClient
from . import app
@pytest.fixture
def client():
with TestClient(app) as test_client:
yield test_client
def test_index(client: TestClient):
r = client.get('/')
assert r.status_code == 200, r... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | docs/plugins.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.020710 | import os
import re
from typing import Match
from mkdocs.config import Config
from mkdocs.structure.files import Files
from mkdocs.structure.pages import Page
try:
import pytest
except ImportError:
pytest = None
def on_pre_build(config: Config):
pass
def on_files(files: Files, config: Config) -> File... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.055445 | from pydantic import AliasGenerator, ConfigDict
from pydantic import BaseModel as _BaseModel
from pydantic.alias_generators import to_camel
class BaseModel(_BaseModel):
model_config = ConfigDict(alias_generator=AliasGenerator(serialization_alias=to_camel))
|
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/auth/github.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.075448 | from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING, cast
from urllib.parse import urlencode
from pydantic import BaseModel, SecretStr, TypeAdapter, field_validator
fr... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/class_name.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.077058 | # could be renamed to something general if there's more to add
from typing import Annotated, Literal
from pydantic import Field
from typing_extensions import TypeAliasType
ClassName = TypeAliasType('ClassName', str | list['ClassName'] | dict[str, bool | None] | None)
ClassNameField = Annotated[ClassName, Field(serial... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/auth/shared.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.091590 | import json
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from .. import AnyComponent, FastUI, events
from .. import components as c
if TYPE_CHECKING:
from fastapi import FastAPI
__all__ = 'AuthError', 'AuthRedirect', 'fastapi_auth_exception_handling'
class AuthException(ABC, Exception):... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/components/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.099262 | """
Component definitions.
All CamelCase names in the namespace should be components.
"""
import typing as _t
import pydantic as _p
import typing_extensions as _te
from pydantic_core import core_schema as _core_schema
from .. import class_name as _class_name
from .. import events
from .. import types as _types
from ... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.126958 | import argparse
from pathlib import Path
from . import __version__, generate_typescript
def cli():
parser = argparse.ArgumentParser(prog='FastUI', description='FastUI CLI.')
parser.add_argument(
'--version',
action='version',
version=f'fastui {__version__}',
)
subparsers = pa... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.150422 | import typing as _t
import pydantic
from .components import AnyComponent
__version__ = '0.9.0'
__all__ = 'AnyComponent', 'FastUI', 'prebuilt_html'
class FastUI(pydantic.RootModel):
"""
The root component of a FastUI application.
"""
root: list[AnyComponent]
@pydantic.field_validator('root', m... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/auth/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.157356 | from .github import GitHubAuthProvider, GitHubEmail, GitHubExchange, GithubUser
from .shared import AuthError, AuthRedirect, fastapi_auth_exception_handling
__all__ = (
'GitHubAuthProvider',
'GitHubExchange',
'GithubUser',
'GitHubEmail',
'AuthError',
'AuthRedirect',
'fastapi_auth_exception_... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/components/display.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.570327 | import enum
import typing as _t
from abc import ABC
import annotated_types as _at
import pydantic
import typing_extensions as _te
from pydantic_core import core_schema as _core_schema
from .. import class_name as _class_name
from .. import events
from .. import types as _types
from ..base import BaseModel
__all__ = ... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/components/tables.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.601286 | import typing as _t
import pydantic
import typing_extensions as _te
from pydantic_core import core_schema as _core_schema
from .. import class_name as _class_name
from .. import types as _types
from ..base import BaseModel
from . import display
# TODO allow dataclasses and typed dicts here too
# In Python 3.14, wh... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/events.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.652223 | from typing import Annotated, Literal
from pydantic import Field
from typing_extensions import TypeAliasType
from .base import BaseModel
ContextType = TypeAliasType('ContextType', dict[str, str | int])
class PageEvent(BaseModel, defer_build=True):
name: str
push_path: str | None = None
context: Context... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.658956 | import json
import typing as _t
from itertools import groupby
from mimetypes import MimeTypes
from operator import itemgetter
import pydantic
import pydantic_core
import typing_extensions as _te
from pydantic_core import core_schema
try:
import fastapi
from fastapi import params as fastapi_params
from sta... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/dev.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.682524 | import asyncio
import os
import signal
import typing as _t
from contextlib import asynccontextmanager
try:
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from starlette import types
except ImportError as e:
raise ImportError('fastui.dev requires fastapi to be installed, ins... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/generate_typescript.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.712575 | from __future__ import annotations as _annotations
import re
import subprocess
from pathlib import Path
from typing import Any, cast
from pydantic import ImportString, TypeAdapter
from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue
from pydantic_core import core_schema, to_json
def main(python_obje... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/json_schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.739362 | import json
import re
import typing as _t
import typing_extensions as _ta
from pydantic import BaseModel
from .components.forms import (
FormField,
FormFieldBoolean,
FormFieldFile,
FormFieldInput,
FormFieldSelect,
FormFieldSelectSearch,
FormFieldTextarea,
InputHtmlType,
)
if _t.TYPE_C... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/components/forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.764259 | import typing as _t
from abc import ABC
import pydantic
import typing_extensions as _te
from .. import class_name as _class_name
from .. import events, forms
from .. import types as _types
from ..base import BaseModel
if _t.TYPE_CHECKING:
from . import AnyComponent
InputHtmlType = _t.Literal['text', 'date', 'da... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_auth_github.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.764743 | from datetime import datetime
import pytest
from fastapi import FastAPI
from fastui.auth import AuthError, GitHubAuthProvider, GitHubEmail
from fastui.auth.github import EXCHANGE_CACHE
from httpx import ASGITransport, AsyncClient
from pydantic import SecretStr
@pytest.fixture
def github_requests() -> list[str]:
... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/fastui/types.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:22.794308 | import typing as _t
import pydantic
import typing_extensions as _te
from pydantic.json_schema import CoreRef, GenerateJsonSchema, JsonRef
from pydantic_core import core_schema
IS_PYDANTIC_211_OR_GREATER = tuple(int(v) for v in pydantic.VERSION.split('.')[:2]) >= (2, 11)
# TODO: replace with https://docs.pydantic.de... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_auth_shared.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.183033 | import pytest
from fastapi import FastAPI
from fastui.auth import AuthError, AuthRedirect, fastapi_auth_exception_handling
from starlette.testclient import TestClient
@pytest.fixture(name='app')
def app_fixture() -> FastAPI:
app = FastAPI()
fastapi_auth_exception_handling(app)
@app.post('/do-redirect/')
... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_components.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.183665 | """
Simple tests of component creation.
NOTE: we do NOT want to exhaustively construct every component just for the same of it -
that's just testing pydantic!
"""
from fastui import FastUI, components
from pydantic import HttpUrl
def test_div_text():
div = components.Div(components=[components.Text(text='hello w... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_tables_display.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.297650 | import pytest
from fastui import components
from fastui.components import display
from pydantic import BaseModel, Field, computed_field
class User(BaseModel):
id: int
name: str = Field(title='Name')
@computed_field(title='Representation')
@property
def representation(self) -> str:
return ... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_prebuilt_html.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.298259 | from fastui import prebuilt_html
def test_prebuilt_html():
html = prebuilt_html()
assert html.startswith('<!doctype html>')
assert 'https://cdn.jsdelivr.net/npm/@pydantic/fastui-prebuilt' in html
assert '<title></title>' in html
assert '<meta name="fastui:APIRootUrl"' not in html
assert '<meta... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_json_schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.365062 | from dirty_equals import IsPartialDict
from fastapi import FastAPI
from fastui import FastUI, components
from fastui.generate_typescript import generate_json_schema
from httpx import ASGITransport, AsyncClient
async def test_json_schema():
schema = generate_json_schema(FastUI)
assert schema == {
'$def... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_dev.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:23.365913 | from unittest.mock import patch
from fastui.dev import dev_fastapi_app
from httpx import ASGITransport, AsyncClient
def mock_signal(_sig, on_signal):
on_signal()
async def test_dev_connect():
with patch('fastui.dev.signal.signal', new=mock_signal):
app = dev_fastapi_app()
async with app.rou... |
pydantic/FastUI | https://github.com/pydantic/FastUI | null | null | null | null | 8,962 | null | null | mit | null | null | null | null | null | null | null | src/python-fastui/tests/test_forms.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:24.101368 | import enum
from contextlib import asynccontextmanager
from io import BytesIO
from typing import Annotated
import pytest
from fastapi import HTTPException
from fastui import components
from fastui.forms import FormFile, Textarea, fastui_form
from pydantic import BaseModel, Field
from starlette.datastructures import Fo... |
snakers4/silero-vad | https://github.com/snakers4/silero-vad | null | null | null | null | 8,947 | null | null | mit | null | null | null | null | null | null | null | tests/test_basic.py | null | null | null | null | null | null | Python | 2026-05-04T02:07:26.541338 | from silero_vad import load_silero_vad, read_audio, get_speech_timestamps
import torch
torch.set_num_threads(1)
def test_jit_model():
model = load_silero_vad(onnx=False)
for path in ["tests/data/test.wav", "tests/data/test.opus", "tests/data/test.mp3"]:
audio = read_audio(path, sampling_rate=16000)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.