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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
brightmart/text_classification | https://github.com/brightmart/text_classification | null | null | null | null | 7,942 | null | null | mit | null | null | null | null | null | null | null | a05_HierarchicalAttentionNetwork/HAN_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:33.389806 | # -*- coding: utf-8 -*-
# HierarchicalAttention: 1.Word Encoder. 2.Word Attention. 3.Sentence Encoder 4.Sentence Attention 5.linear classifier. 2017-06-13
import tensorflow as tf
import numpy as np
import tensorflow.contrib as tf_contrib
from tensorflow.contrib import rnn
class HierarchicalAttention:
def __init__(... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/api/mail.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.392434 | import os
import smtplib
import ssl
import logging
import base64
from bs4 import BeautifulSoup
from jinja2 import Template
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import aj
DEFAULT_TEMPLATES = {
'reset_email': os.path.dirname(__file__) + '/../static/emails/reset_email.h... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/auth.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.402308 | import logging
import pexpect
import pwd
import subprocess
import syslog
from functools import wraps
from jadi import component, service, interface
import aj
from aj.api.http import BaseHttpHandler
from aj.security.verifier import ClientCertificateVerificator
from aj.util import public
@public
class SudoError(Excepti... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/api/endpoint.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.406656 | from functools import wraps
import simplejson as json
import logging
import traceback
from aj.auth import SecurityError
class EndpointError(Exception):
"""
To be raised by endpoints when a foreseen error occurs.
This exception doesn't cause a client-side crash dialog.
:param inner: inner exception
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/core.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.407893 | from __future__ import unicode_literals
import locale
import logging
import os
import psutil
import signal
import socket
import sys
import syslog
import subprocess
from jadi import Context
from importlib import reload
import aj
import aj.plugins
# from aj.auth import AuthenticationService # Test for callback with cer... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/api/http.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.415212 | import gevent
import logging
import re
import types
from jadi import interface
def url(pattern):
"""
Exposes the decorated method of your :class:`HttpPlugin` via HTTP.
Will be deprecated in favor of new decorators ( @get, @post, ... )
:param pattern: URL regex (``^`` and ``$`` are implicit)
:type... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:37.911796 | import os
import sys
import pwd
import stat
import yaml
import logging
from jadi import interface, component, service
import aj
from aj.util import public
class BaseConfig():
"""
A base class for config implementations. Your implementation must be able to save
arbitrary mixture of ``dict``, ``list``, and ... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/compat.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.025133 | import logging
import subprocess
import os
# add subprocess.check_output to Python < 2.6
if not hasattr(subprocess, 'check_output'):
def c_o(*args, **kwargs):
kwargs['stdout'] = subprocess.PIPE
popen = subprocess.Popen(*args, **kwargs)
stdout, _ = popen.communicate()
return stdout
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/gate/session.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.603158 | import time
import logging
from http.cookies import SimpleCookie
from aj.gate.gate import WorkerGate
class Session():
"""
Holds the HTTP session data
"""
last_id = 0
def __init__(self, key, gateway_middleware=None, client_info=None, auth_info=None, session_max_time=3600, **kwargs):
Sess... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/gate/gate.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.604198 | import gevent
import gipc
import greenlet
import logging
import os
import pickle
import signal
from hashlib import sha3_256
import aj
from aj.gate.stream import GateStreamServerEndpoint, GateStreamWorkerEndpoint
from aj.gate.worker import Worker
from aj.util import BroadcastQueue
from aj.security.totp import TOTP
cl... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/gate/middleware.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.605382 | import hashlib
import logging
import os
import pwd
import random
import base64
import time
import gevent
from socketio import Namespace
from http.cookies import SimpleCookie
from gevent.timeout import Timeout
from jadi import service
import aj
from aj.gate.gate import WorkerGate
from aj.gate.session import Session
fro... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/gate/stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.606333 | from gevent.lock import RLock
import binascii
import gevent.socket
import json
import os
import gipc
import logging
MSG_SIZE_LIMIT = 1024 * 1024 * 128 # 128 MB
MSG_CONTINUATION_MARKER = '\x00\x00\x00continued\x00\x00\x00'
def _seq_split(to_split):
while to_split:
yield to_split[:MSG_SIZE_LIMIT] + (MSG_... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/gate/worker.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:38.706280 | import grp
import json
import logging
import os
import pwd
import gevent
import traceback
import setproctitle
import sys
from gevent.event import Event
from jadi import Context
import aj
from aj.api.http import SocketEndpoint, HttpMiddleware
from aj.http import HttpMiddlewareAggregator, HttpContext
from aj.auth import... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/http.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:39.796655 | from datetime import datetime
import arrow
import base64
import cgi
import gevent
import tempfile
import gzip
import json
import math
import os
import re
from io import BytesIO
import pickle
import logging
from urllib.parse import unquote
from aj.api.http import BaseHttpHandler
import aj
PREFIX_REGEXP = re.compile(r... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/https_redirect.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.253781 | from gevent import pywsgi, spawn
def http_to_https(target_url):
def app(environ, start_response):
if environ['PATH_INFO'] == "/":
start_response(
'301 Move Permanently',
[
('Location', target_url),
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/security/totp.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.331940 | import qrcode
import pyotp
import base64
from io import BytesIO
class TOTP:
def __init__(self, user, secret):
self.user = user
self.totp = pyotp.TOTP(secret)
def make_b64qrcode(self):
url = f'otpauth://totp/{self.user}?secret={self.totp.secret}'
qr = qrcode.QRCode(
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/routing.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.342202 | import logging
import os
import html
import traceback
import base64
import json
from jadi import service
from aj.api.http import BaseHttpHandler, HttpPlugin
from aj.auth import SecurityError
class DeniedRouteHandler(BaseHttpHandler):
"""If client authentication is forced, and the client certificate is not valid.... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/plugins.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.343693 | import importlib.util
import logging
import os
import subprocess
import sys
import traceback
import yaml
from jadi import service
import aj
from aj.util import public
@public
class PluginProvider():
"""
A base class for plugin locator
"""
def provide(self):
"""
Should return a list o... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/log.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.365416 | import logging
import logging.handlers
import os
import sys
from termcolor import colored
from datetime import datetime
import aj
LOG_DIR = '/var/log/ajenti'
LOG_NAME = 'ajenti.log'
LOG_FILE = os.path.join(LOG_DIR, LOG_NAME)
LOG_PARAMS = {
'master_pid': None,
'tag': 'master',
}
class ConsoleHandler(logging.... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/security/verifier.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.417879 | from jadi import service
import aj
import logging
@service
class ClientCertificateVerificator():
def __init__(self, context):
self.context = context
def verify(self, x509):
serial = x509.get_serial_number()
digest = x509.digest('sha256')
if not b'sha256' in x509.get_signature_... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.827008 | from aj.util.broadcast_queue import BroadcastQueue
from aj.util.public import public
from aj.util.strings import str_fsize
from aj.util.misc import make_report, platform_select
from aj.util.lazy import LazyModule
__all__ = [
'BroadcastQueue',
'public',
'str_fsize',
'make_report',
'platform_select',... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/broadcast_queue.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.906432 | import weakref
from gevent.queue import Queue
class BroadcastQueue():
def __init__(self):
self._queues = []
def register(self):
q = Queue()
self._queues.append(weakref.ref(q))
return q
def broadcast(self, val):
for q in list(self._queues):
if q():
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/lazy.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.931306 | import logging
class LazyModule():
def __init__(self, module, obj=None):
self._module = module
self._object = obj
self._loaded = False
def __load(self):
logging.debug(f'Lazy-loading module {self._module}')
target = __import__(self._module, fromlist=[str(self._module)])... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/pidfile.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.959099 | import os
import fcntl
class PidFile():
"""
Context manager that locks a pid file. Implemented as class
not generator because daemon.py is calling .__exit__() with no parameters
instead of the None, None, None specified by PEP-343.
"""
def __init__(self, path):
self.path = path
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/misc.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:40.989290 | import subprocess
import traceback
import aj
# TODO sort this out
def platform_select(**values):
"""
Selects a value from **kwargs** depending on runtime platform
::
service = platform_select(
debian='samba',
ubuntu='smbd',
centos='smbd',
default... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/public.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.019822 | import sys
def public(f):
""""
Use a decorator to avoid retyping function/class names.
Based on an idea by Duncan Booth:
http://groups.google.com/group/comp.lang.python/msg/11cbb03e09611b8a
Improved via a suggestion by Dave Angel:
http://groups.google.com/group/comp.lang.python/msg/3d400fb22... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/entry.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.292820 | import daemon
import logging
import traceback
from datetime import datetime
from aj.util.pidfile import PidFile
def start(daemonize=False, log_level=logging.INFO, dev_mode=False, **kwargs):
"""
A wrapper for :func:`run` that optionally runs it in a forked daemon process.
:param kwargs: rest of arguments... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/util/strings.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.402680 | def str_fsize(sz):
"""
Formats file size as string (i.e., 1.2 Mb)
"""
if sz < 1024:
return f'{sz:.1f} bytes'
sz /= 1024.0
if sz < 1024:
return f'{sz:.1f} KB'
sz /= 1024.0
if sz < 1024:
return f'{sz:.1f} MB'
sz /= 1024.0
if sz < 1024:
return f'{sz:.... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/api/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.404885 | from jadi import interface, component, service, Context, NoImplementationError
__all__ = [
'interface',
'component',
'service',
'Context',
'NoImplementationError',
]
|
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.408092 | import logging
import os
import platform as pyplatform
import signal
import subprocess
__version__ = '2.2.15'
# Global state
product = None
""" Custom product name """
config = None
""" Configuration dict"""
users = None
""" Users list for auth plugin """
version = None
""" Ajenti version """
platform = None
"""... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/wsgi.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.467342 | import aj
import gevent.ssl
from geventwebsocket.handler import WebSocketHandler
from aj.security.verifier import ClientCertificateVerificator
from OpenSSL import crypto
class RequestHandler(WebSocketHandler):
def __init__(self, *args, **kwargs):
WebSocketHandler.__init__(self, *args, **kwargs)
def ru... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.515298 | #!/usr/bin/env python3
from setuptools import setup, find_packages
import platform
__requires = list(filter(None, open('requirements.txt').read().splitlines()))
if platform.python_implementation() == 'PyPy':
__requires.append('git+git://github.com/schmir/gevent@pypy-hacks')
__requires.append('git+git://github.... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-panel/setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.564752 | #!/usr/bin/env python3
from setuptools import setup
from setuptools import find_packages
# subprocess.call([sys.executable, 'ajenti-ssl-gen', socket.gethostname()], cwd=scripts_dir)
setup(
name='ajenti-panel',
version='2.2.15',
python_requires='>=3',
install_requires=[
'aj==2.2.15',
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | docs/source/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.574506 | # -*- coding: utf-8 -*-
import sys
import os
import datetime
sys.path.insert(0, os.path.abspath('../../ajenti-core'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] # 'sphinx.ext.intersphinx']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project =... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/augeas/api.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:41.978808 | import augeas
from jadi import interface
class AugeasError(Exception):
def __init__(self, aug):
self.message = None
self.data = {}
aug.dump('/')
for ep in aug.match('/augeas//error'):
self.message = aug.get(ep + '/message')
for p in aug.match(ep + '/*'):
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/auth_users/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.086719 | from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
return [
{
'attach': 'category:ge... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/auth_users/api.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.087880 | import logging
import os
import pwd
import yaml
import stat
import scrypt
from jadi import component
import aj
from aj.auth import AuthenticationProvider
from aj.config import UserConfigProvider
@component(AuthenticationProvider)
class UsersAuthenticationProvider(AuthenticationProvider):
"""
Alternate authen... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/augeas/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.110666 | """
Utility wrapper module for augeas : create endpoints and set the environment to
facilitate the use of augeas.
"""
import json
from jadi import component
from aj.api.http import get, post, HttpPlugin
from aj.api.endpoint import endpoint, EndpointReturn
from aj.plugins.augeas.api import AugeasEndpoint
@component... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/auth_users/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.132775 | """
User authentication provider based on the ajenti config file and permissions management.
"""
import os
import json
from jadi import component
import aj
from aj.auth import authorize
from aj.api.http import get, post, HttpPlugin
from aj.api.endpoint import endpoint, EndpointReturn
from aj.plugins.auth_users.api i... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/check_certificates/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.164304 | from .main import ItemProvider
from .views import Handler
def init(plugin_manager):
if 'dashboard' in plugin_manager and plugin_manager['dashboard']['imported']:
from .widget import CertWidget |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/check_certificates/api.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.198691 | import ssl
import socket
import smtplib
from datetime import datetime
from OpenSSL import crypto
now = datetime.now()
def CertLimitSSL(hostname, port):
"""
Get the SSL certificate from a host.
:param hostname: Hostname
:type hostname: string
:param port: Port
:type port: integer
:return: ... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/check_certificates/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.409206 | from jadi import component
# from aj.auth import PermissionProvider
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
return [
... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/check_certificates/views.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.565127 | """
Module to check if some certificates are still valid or not.
"""
from jadi import component
from aj.api.http import post, HttpPlugin
# from aj.auth import authorize
from aj.api.endpoint import endpoint
from .api import checkOnDom
import simplejson as json
@component(HttpPlugin)
class Handler(HttpPlugin):
def... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/core/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.633545 | # pyflakes: disable-all
from .main import *
from .views.api import *
from .views.config import *
from .views.main import *
from .views.resource_server import *
from .views.push import *
from .views.tasks import *
|
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | plugins/check_certificates/widget.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:42.677962 | from jadi import component
from aj.plugins.dashboard.api import Widget
from datetime import datetime
@component(Widget)
class CertWidget(Widget):
id = 'cert'
name = _('Certificates')
template = '/check_certificates:resources/partial/widget.html'
def __init__(self, context):
Widget.__init__(sel... |
ajenti/ajenti | https://github.com/ajenti/ajenti | null | null | null | null | 7,927 | null | null | mit | null | null | null | null | null | null | null | ajenti-core/aj/security/pwreset.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:44.542675 | import logging
import os
import simplejson as json
from itsdangerous.url_safe import URLSafeTimedSerializer
from itsdangerous.exc import SignatureExpired, BadTimeSignature, BadSignature
from jadi import component
import aj
from aj.auth import AuthenticationService
from aj.api.mail import Mail
from aj.api.http import H... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/audio.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.358023 | import os
from functools import lru_cache
from subprocess import CalledProcessError, run
from typing import Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from .utils import exact_div
# hard-coded audio hyperparameters
SAMPLE_RATE = 16000
N_FFT = 400
HOP_LENGTH = 160
CHUNK_LENGTH = 3... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.359519 | import hashlib
import io
import os
import urllib
import warnings
from typing import List, Optional, Union
import torch
from tqdm import tqdm
from .audio import load_audio, log_mel_spectrogram, pad_or_trim
from .decoding import DecodingOptions, DecodingResult, decode, detect_language
from .model import ModelDimensions... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/test_transcribe.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.374339 | import os
import pytest
import torch
import whisper
from whisper.tokenizer import get_tokenizer
@pytest.mark.parametrize("model_name", whisper.available_models())
def test_transcribe(model_name: str):
device = "cuda" if torch.cuda.is_available() else "cpu"
model = whisper.load_model(model_name).to(device)
... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/test_tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.388454 | import pytest
from whisper.tokenizer import get_tokenizer
@pytest.mark.parametrize("multilingual", [True, False])
def test_tokenizer(multilingual):
tokenizer = get_tokenizer(multilingual=False)
assert tokenizer.sot in tokenizer.sot_sequence
assert len(tokenizer.all_language_codes) == len(tokenizer.all_la... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/test_timing.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.394379 | import numpy as np
import pytest
import scipy.ndimage
import torch
from whisper.timing import dtw_cpu, dtw_cuda, median_filter
sizes = [
(10, 20),
(32, 16),
(123, 1500),
(234, 189),
]
shapes = [
(10,),
(1, 15),
(4, 5, 345),
(6, 12, 240, 512),
]
@pytest.mark.parametrize("N, M", sizes)... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/test_normalizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.402288 | import pytest
from whisper.normalizers import EnglishTextNormalizer
from whisper.normalizers.english import (
EnglishNumberNormalizer,
EnglishSpellingNormalizer,
)
@pytest.mark.parametrize("std", [EnglishNumberNormalizer(), EnglishTextNormalizer()])
def test_number_normalizer(std):
assert std("two") == "... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/decoding.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.419699 | from dataclasses import dataclass, field, replace
from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.distributions import Categorical
from .audio import CHUNK_LENGTH
from .tokenize... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/test_audio.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.421285 | import os.path
import numpy as np
from whisper.audio import SAMPLE_RATE, load_audio, log_mel_spectrogram
def test_audio():
audio_path = os.path.join(os.path.dirname(__file__), "jfk.flac")
audio = load_audio(audio_path)
assert audio.ndim == 1
assert SAMPLE_RATE * 10 < audio.shape[0] < SAMPLE_RATE * 1... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | tests/conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.470903 | import random as rand
import numpy
import pytest
def pytest_configure(config):
config.addinivalue_line("markers", "requires_cuda")
@pytest.fixture
def random():
rand.seed(42)
numpy.random.seed(42)
|
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/normalizers/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.954291 | from .basic import BasicTextNormalizer as BasicTextNormalizer
from .english import EnglishTextNormalizer as EnglishTextNormalizer
|
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/model.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.964157 | import base64
import gzip
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Dict, Iterable, Optional, Tuple
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from .decoding import decode as decode_function
from .decoding import detect... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/normalizers/basic.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.970714 | import re
import unicodedata
import regex
# non-ASCII letters that are not separated by "NFKD" normalization
ADDITIONAL_DIACRITICS = {
"œ": "oe",
"Œ": "OE",
"ø": "o",
"Ø": "O",
"æ": "ae",
"Æ": "AE",
"ß": "ss",
"ẞ": "SS",
"đ": "d",
"Đ": "D",
"ð": "d",
"Ð": "D",
"þ": ... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:51.997168 | import base64
import os
import string
from dataclasses import dataclass, field
from functools import cached_property, lru_cache
from typing import Dict, List, Optional, Tuple
import tiktoken
LANGUAGES = {
"en": "english",
"zh": "chinese",
"de": "german",
"es": "spanish",
"ru": "russian",
"ko":... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/timing.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:52.004718 | import itertools
import subprocess
import warnings
from dataclasses import dataclass
from typing import TYPE_CHECKING, List
import numba
import numpy as np
import torch
import torch.nn.functional as F
from .audio import HOP_LENGTH, SAMPLE_RATE, TOKENS_PER_SECOND
from .tokenizer import Tokenizer
if TYPE_CHECKING:
... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/triton_ops.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:52.038796 | from functools import lru_cache
import numpy as np
import torch
try:
import triton
import triton.language as tl
except ImportError:
raise RuntimeError("triton import failed; try `pip install --pre triton`")
@triton.jit
def dtw_kernel(
cost, trace, x, x_stride, cost_stride, trace_stride, N, M, BLOCK_... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:52.039695 | import json
import os
import re
import sys
import zlib
from typing import Callable, List, Optional, TextIO
system_encoding = sys.getdefaultencoding()
if system_encoding != "utf-8":
def make_safe(string):
# replaces any character not representable using the system default encoding with an '?',
# a... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/normalizers/english.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:52.049490 | import json
import os
import re
from fractions import Fraction
from typing import Iterator, List, Match, Optional, Union
from more_itertools import windowed
from .basic import remove_symbols_and_diacritics
class EnglishNumberNormalizer:
"""
Convert any spelled-out numbers into arabic numbers, while handling... |
openai/whisper | https://github.com/openai/whisper | null | null | null | null | 98,832 | null | null | mit | null | null | null | null | null | null | null | whisper/transcribe.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:52.154188 | import argparse
import os
import traceback
import warnings
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
import numpy as np
import torch
import tqdm
from .audio import (
FRAMES_PER_SECOND,
HOP_LENGTH,
N_FRAMES,
N_SAMPLES,
SAMPLE_RATE,
log_mel_spectrogram,
pad_or_trim,
)
fr... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_responses/tutorial002_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.277901 | from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
app = FastAPI()
@app.get(
"/items/{item_id}",
response_model=Item,
responses={
200: {
"content": {"image/png": {}},
"d... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_responses/tutorial004_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.279091 | from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
responses = {
404: {"description": "Item not found"},
302: {"description": "The item was moved"},
403: {"description": "Not enough privileges"},
}
app... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/advanced_middleware/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.301363 | from fastapi import FastAPI
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
app = FastAPI()
app.add_middleware(HTTPSRedirectMiddleware)
@app.get("/")
async def main():
return {"message": "Hello World"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_status_codes/tutorial001_an_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.302660 | from typing import Annotated
from fastapi import Body, FastAPI, status
from fastapi.responses import JSONResponse
app = FastAPI()
items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
@app.put("/items/{item_id}")
async def upsert_item(
item_id: str,
name: Annotated[str | N... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_status_codes/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.303870 | from fastapi import Body, FastAPI, status
from fastapi.responses import JSONResponse
app = FastAPI()
items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
@app.put("/items/{item_id}")
async def upsert_item(
item_id: str,
name: str | None = Body(default=None),
size: int ... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_responses/tutorial003_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.317251 | from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
class Message(BaseModel):
message: str
app = FastAPI()
@app.get(
"/items/{item_id}",
response_model=Item,
responses={
404: {"model": Mes... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/additional_responses/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.348524 | from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
class Message(BaseModel):
message: str
app = FastAPI()
@app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
async def read... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/advanced_middleware/tutorial003_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.863622 | from fastapi import FastAPI
from fastapi.middleware.gzip import GZipMiddleware
app = FastAPI()
app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5)
@app.get("/")
async def main():
return "somebigcontent"
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/advanced_middleware/tutorial002_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.899824 | from fastapi import FastAPI
from fastapi.middleware.trustedhost import TrustedHostMiddleware
app = FastAPI()
app.add_middleware(
TrustedHostMiddleware, allowed_hosts=["example.com", "*.example.com"]
)
@app.get("/")
async def main():
return {"message": "Hello World"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_b_an_py310/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.950759 | from typing import Annotated
from fastapi import FastAPI, Header, HTTPException
from pydantic import BaseModel
fake_secret_token = "coneofsilence"
fake_db = {
"foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"},
"bar": {"id": "bar", "title": "Bar", "description": "The bartenders"},
}
a... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_a_py310/test_main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.955552 | from fastapi.testclient import TestClient
from .main import app
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"msg": "Hello World"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_b_an_py310/test_main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.962683 | from fastapi.testclient import TestClient
from .main import app
client = TestClient(app)
def test_read_item():
response = client.get("/items/foo", headers={"X-Token": "coneofsilence"})
assert response.status_code == 200
assert response.json() == {
"id": "foo",
"title": "Foo",
"de... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_a_py310/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:57.963208 | from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_main():
return {"msg": "Hello World"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/tutorial004_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:58.835931 | from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.testclient import TestClient
items = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
yield
# clean up items
items.clear()
app = F... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/tutorial003_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:58.839373 | from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
items = {}
@app.on_event("startup")
async def startup_event():
items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
@app.get("/items/{item_id}")
async def read_items(item_id: str):
return items[item... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:58.840614 | from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
@app.get("/")
async def read_main():
return {"msg": "Hello World"}
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"msg": "... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/tutorial002_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:58.841601 | from fastapi import FastAPI
from fastapi.testclient import TestClient
from fastapi.websockets import WebSocket
app = FastAPI()
@app.get("/")
async def read_main():
return {"msg": "Hello World"}
@app.websocket("/ws")
async def websocket(websocket: WebSocket):
await websocket.accept()
await websocket.sen... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/async_tests/app_a_py310/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:58.842857 | from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Tomato"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_b_py310/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.336355 | from fastapi import FastAPI, Header, HTTPException
from pydantic import BaseModel
fake_secret_token = "coneofsilence"
fake_db = {
"foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"},
"bar": {"id": "bar", "title": "Bar", "description": "The bartenders"},
}
app = FastAPI()
class Item(Ba... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/app_testing/app_b_py310/test_main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.449640 | from fastapi.testclient import TestClient
from .main import app
client = TestClient(app)
def test_read_item():
response = client.get("/items/foo", headers={"X-Token": "coneofsilence"})
assert response.status_code == 200
assert response.json() == {
"id": "foo",
"title": "Foo",
"de... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/background_tasks/tutorial002_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.503781 | from fastapi import BackgroundTasks, Depends, FastAPI
app = FastAPI()
def write_log(message: str):
with open("log.txt", mode="a") as log:
log.write(message)
def get_query(background_tasks: BackgroundTasks, q: str | None = None):
if q:
message = f"found query: {q}\n"
background_tasks... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/authentication_error_status_code/tutorial001_an_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.506647 | from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
app = FastAPI()
class HTTPBearer403(HTTPBearer):
def make_not_authenticated_error(self) -> HTTPException:
return HTTPException(
statu... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/background_tasks/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.527863 | from fastapi import BackgroundTasks, FastAPI
app = FastAPI()
def write_notification(email: str, message=""):
with open("log.txt", mode="w") as email_file:
content = f"notification for {email}: {message}"
email_file.write(content)
@app.post("/send-notification/{email}")
async def send_notificati... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/background_tasks/tutorial002_an_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.559774 | from typing import Annotated
from fastapi import BackgroundTasks, Depends, FastAPI
app = FastAPI()
def write_log(message: str):
with open("log.txt", mode="a") as log:
log.write(message)
def get_query(background_tasks: BackgroundTasks, q: str | None = None):
if q:
message = f"found query: {... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/behind_a_proxy/tutorial001_01_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.922061 | from fastapi import FastAPI
app = FastAPI()
@app.get("/items/")
def read_items():
return ["plumbus", "portal gun"]
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/async_tests/app_a_py310/test_main.py | null | null | null | null | null | null | Python | 2026-05-04T02:15:59.946979 | import pytest
from httpx import ASGITransport, AsyncClient
from .main import app
@pytest.mark.anyio
async def test_root():
async with AsyncClient(
transport=ASGITransport(app=app), base_url="http://test"
) as ac:
response = await ac.get("/")
assert response.status_code == 200
assert r... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/behind_a_proxy/tutorial001_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.013568 | from fastapi import FastAPI, Request
app = FastAPI()
@app.get("/app")
def read_main(request: Request):
return {"message": "Hello World", "root_path": request.scope.get("root_path")}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/behind_a_proxy/tutorial003_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.061504 | from fastapi import FastAPI, Request
app = FastAPI(
servers=[
{"url": "https://stag.example.com", "description": "Staging environment"},
{"url": "https://prod.example.com", "description": "Production environment"},
],
root_path="/api/v1",
)
@app.get("/app")
def read_main(request: Request)... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/behind_a_proxy/tutorial002_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.076710 | from fastapi import FastAPI, Request
app = FastAPI(root_path="/api/v1")
@app.get("/app")
def read_main(request: Request):
return {"message": "Hello World", "root_path": request.scope.get("root_path")}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/behind_a_proxy/tutorial004_py310.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.124375 | from fastapi import FastAPI, Request
app = FastAPI(
servers=[
{"url": "https://stag.example.com", "description": "Staging environment"},
{"url": "https://prod.example.com", "description": "Production environment"},
],
root_path="/api/v1",
root_path_in_servers=False,
)
@app.get("/app")... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/bigger_applications/app_an_py310/dependencies.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.126561 | from typing import Annotated
from fastapi import Header, HTTPException
async def get_token_header(x_token: Annotated[str, Header()]):
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def get_query_token(token: str):
if token != "je... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/bigger_applications/app_an_py310/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.517064 | from fastapi import Depends, FastAPI
from .dependencies import get_query_token, get_token_header
from .internal import admin
from .routers import items, users
app = FastAPI(dependencies=[Depends(get_query_token)])
app.include_router(users.router)
app.include_router(items.router)
app.include_router(
admin.router... |
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/bigger_applications/app_an_py310/internal/admin.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.517634 | from fastapi import APIRouter
router = APIRouter()
@router.post("/")
async def update_admin():
return {"message": "Admin getting schwifty"}
|
fastapi/fastapi | https://github.com/fastapi/fastapi | null | null | null | null | 97,857 | null | null | mit | null | null | null | null | null | null | null | docs_src/bigger_applications/app_an_py310/routers/items.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:00.671774 | from fastapi import APIRouter, Depends, HTTPException
from ..dependencies import get_token_header
router = APIRouter(
prefix="/items",
tags=["items"],
dependencies=[Depends(get_token_header)],
responses={404: {"description": "Not found"}},
)
fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"... |
nvbn/thefuck | https://github.com/nvbn/thefuck | null | null | null | null | 96,792 | null | null | mit | null | null | null | null | null | null | null | tests/entrypoints/test_fix_command.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:03.395617 | import pytest
from mock import Mock
from thefuck.entrypoints.fix_command import _get_raw_command
class TestGetRawCommand(object):
def test_from_force_command_argument(self):
known_args = Mock(force_command='git brunch')
assert _get_raw_command(known_args) == ['git brunch']
def test_from_comma... |
nvbn/thefuck | https://github.com/nvbn/thefuck | null | null | null | null | 96,792 | null | null | mit | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:16:03.398957 | #!/usr/bin/env python
from setuptools import setup, find_packages
import pkg_resources
import sys
import os
import fastentrypoints
try:
if int(pkg_resources.get_distribution("pip").version.split('.')[0]) < 6:
print('pip older than 6.0 not supported, please upgrade pip with:\n\n'
' pip ins... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.