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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scispacy/train_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.232259 | import json
import tqdm
from spacy.language import Language
from scispacy.per_class_scorer import PerClassScorer
from typing import Optional
def evaluate_ner(
nlp: Language, eval_data, dump_path: Optional[str] = None, verbose: bool = False
) -> PerClassScorer:
scorer = PerClassScorer()
print("Evaluating... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scispacy/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.593211 | from packaging.version import Version
import spacy
import scipy
from spacy.language import Language
from spacy.tokens import Doc
from scispacy.custom_sentence_segmenter import pysbd_sentencizer
from scispacy.custom_tokenizer import combined_rule_tokenizer
def save_model(nlp: Language, output_path: str):
nlp.to_d... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/export_umls_json.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.730475 | """
Convert a umls release to a jsonl file of concepts.
"""
import json
import argparse
from scispacy import umls_utils
def main(
meta_path: str,
output_path: str,
lang: str = None,
source: str = None,
non_suppressed: bool = True,
):
concept_details = {} # dictionary... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/install_local_packages.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.766487 | import os
from scispacy.version import VERSION
def main():
model_names = [
"en_core_sci_sm",
"en_core_sci_md",
"en_core_sci_lg",
"en_core_sci_scibert",
"en_ner_bc5cdr_md",
"en_ner_craft_md",
"en_ner_bionlp13cg_md",
"en_ner_jnlpba_md",
]
ful... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/print_out_metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.876254 | import os
import json
def main():
core_model_names = ["lg", "md", "sm", "scibert"]
ner_model_names = ["bc5cdr", "bionlp13cg", "craft", "jnlpba"]
base_path = "packages"
for core_model_name in core_model_names:
print(f"Printing results for {core_model_name}")
with open(
os.p... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/install_remote_packages.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:47.877368 | import os
from scispacy.version import VERSION
def main():
s3_prefix = "https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.4/"
model_names = [
"en_core_sci_sm",
"en_core_sci_md",
"en_core_sci_lg",
"en_core_sci_scibert",
"en_ner_bc5cdr_md",
"en_ner... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/smoke_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.185875 | import spacy
from tqdm import tqdm
from scispacy.abbreviation import AbbreviationDetector
from scispacy.linking import EntityLinker
def main():
print("Testing core models...")
print()
model_names = [
"en_core_sci_sm",
"en_core_sci_md",
"en_core_sci_lg",
"en_core_sci_sciber... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/uninstall_local_packages.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.369915 | import os
from scispacy.version import VERSION
def main():
model_names = [
"en_core_sci_sm",
"en_core_sci_md",
"en_core_sci_lg",
"en_core_sci_scibert",
"en_ner_bc5cdr_md",
"en_ner_craft_md",
"en_ner_bionlp13cg_md",
"en_ner_jnlpba_md",
]
for... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/custom_tests/test_all_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.465334 | import os
import sys
import spacy
from spacy.vocab import Vocab
import shutil
import pytest
def test_custom_segmentation(combined_all_model_fixture):
text = "Induction of cytokine expression in leukocytes by binding of thrombin-stimulated platelets. BACKGROUND: Activated platelets tether and activate myeloid leuk... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.492386 | from typing import Dict, Tuple, Optional
import os
import pytest
import spacy
from spacy.language import Language as SpacyModelType
from spacy.cli.download import download as spacy_download
from scispacy.custom_sentence_segmenter import pysbd_sentencizer
from scispacy.custom_tokenizer import combined_rule_tokenizer, ... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/custom_tests/test_custom_segmentation.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.842510 | import pytest
TEST_CASES = [
(
"LSTM networks, which we preview in Sec. 2, have been successfully",
["LSTM networks, which we preview in Sec. 2, have been successfully"],
),
(
"When the tree is simply a chain, both Eqs. 2–8 and Eqs. 9–14 reduce to the standard LSTM transitions, Eqs.... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/custom_tests/test_custom_tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:48.996396 | import pytest
TEST_CASES = [("using a bag-of-words model", ["using", "a", "bag-of-words", "model"]),
("activators of cAMP- and cGMP-dependent protein", ["activators", "of", "cAMP-", "and", "cGMP-dependent", "protein"]),
("phorbol 12-myristate 13-acetate, caused almost", ["phorbol", "12-myri... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/custom_tests/test_whitespace.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.055253 | # coding: utf-8
"""Test that tokens are created correctly for whitespace."""
from __future__ import unicode_literals
import pytest
import spacy
from spacy.language import Language as SpacyModelType
from scispacy.custom_sentence_segmenter import pysbd_sentencizer
class TestWhitespace:
nlp = spacy.load("en_cor... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_abbreviation_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.143810 | import unittest
import spacy
import pytest
from scispacy.abbreviation import (
AbbreviationDetector,
find_abbreviation,
filter_matches,
)
class TestAbbreviationDetector(unittest.TestCase):
def setUp(self):
super().setUp()
self.nlp = spacy.load("en_core_web_sm")
self.detector =... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_candidate_generation.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.178820 | import unittest
import tempfile
from scispacy.candidate_generation import CandidateGenerator, create_tfidf_ann_index, MentionCandidate
from scispacy.umls_utils import UmlsKnowledgeBase
class TestCandidateGeneration(unittest.TestCase):
def setUp(self):
super().setUp()
def test_create_index(self):
... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_data_util.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.411778 | import os
import unittest
import shutil
from scispacy.data_util import read_full_med_mentions, med_mentions_example_iterator, remove_overlapping_entities
from scispacy.data_util import read_ner_from_tsv
class TestDataUtil(unittest.TestCase):
def setUp(self):
super().setUp()
self.TEST_DIR = "/tmp/... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_file_cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.607549 | import os
import pathlib
import json
import unittest
import shutil
import pytest
from scispacy.file_cache import filename_to_url, url_to_filename
class TestFileUtils(unittest.TestCase):
def setUp(self):
super().setUp()
self.TEST_DIR = "/tmp/scispacy"
os.makedirs(self.TEST_DIR, exist_ok=Tr... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_hyponym_detector.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.696228 | # pylint: disable=no-self-use,invalid-name
import unittest
import spacy
from scispacy.hyponym_detector import HyponymDetector
class TestHyponymDetector(unittest.TestCase):
def setUp(self):
super().setUp()
self.nlp = spacy.load("en_core_sci_sm")
self.detector = HyponymDetector(self.nlp, ex... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_linking.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.697638 | import unittest
import tempfile
import spacy
from scispacy.candidate_generation import CandidateGenerator, create_tfidf_ann_index
from scispacy.linking import EntityLinker
from scispacy.linking_utils import Entity, KnowledgeBase, _iter_entities
from scispacy.umls_utils import UmlsKnowledgeBase
from scispacy.abbreviat... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_per_class_scorer.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:49.799008 |
import unittest
from scispacy.per_class_scorer import PerClassScorer
class TestPerClassScorer(unittest.TestCase):
def test_per_class_scorer_counts_correctly(self):
scorer = PerClassScorer()
predicted = [(1, 3, "PER"), (10, 12, "LOC")]
gold = [(1, 3, "PER"), (10, 12, "ORG")]
or... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_umls_semantic_type_tree.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.023945 |
import unittest
from scispacy.umls_semantic_type_tree import construct_umls_tree_from_tsv
class TestUmlsSemanticTypeTree(unittest.TestCase):
def setUp(self):
super().setUp()
self.tree = construct_umls_tree_from_tsv("tests/fixtures/test_umls_tree.tsv")
def test_tree_can_be_read_from_file(se... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_umls_utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.190162 | import unittest
from scispacy import umls_utils
class TestUtil(unittest.TestCase):
expected_concepts = [
{'concept_id': 'C0000005', 'canonical_name': '(131)I-Macroaggregated Albumin',
'types': ['T116'], 'aliases': ['(131)I-MAA']},
{'concept_id': 'C0000039', 'aliases': ['1,2-D... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_util.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.251929 | import unittest
import spacy
from scispacy.util import WhitespaceTokenizer
class TestUtil(unittest.TestCase):
def setUp(self):
super().setUp()
self.nlp = spacy.load("en_core_web_sm")
def test_whitespace_tokenizer(self):
self.nlp.tokenizer = WhitespaceTokenizer(self.nlp.vocab)
... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scispacy/version.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.520670 | _MAJOR = "0"
_MINOR = "6"
_REVISION = "2"
VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)
VERSION = "{0}.{1}.{2}".format(_MAJOR, _MINOR, _REVISION)
|
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/count_word_frequencies.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.544442 | #!/usr/bin/env python
from typing import List, Tuple
import os
import io
import sys
import tempfile
import shutil
from collections import Counter
from pathlib import Path
from multiprocessing import Pool
import plac
import spacy.util
from spacy.language import Language
sys.path.insert(0, os.path.dirname(os.path.abs... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/create_linker.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.581862 | import argparse
import os
from scispacy.candidate_generation import create_tfidf_ann_index
from scispacy.linking_utils import KnowledgeBase
def main(kb_path: str, output_path: str):
os.makedirs(output_path, exist_ok=True)
kb = KnowledgeBase(kb_path)
create_tfidf_ann_index(output_path, kb)
if __name__ ... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/convert_freqs.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.582616 | import argparse
import math
import json
from ast import literal_eval
from tqdm import tqdm
from preshed.counter import PreshCounter
from spacy.util import ensure_path
from scispacy.file_cache import cached_path
def read_freqs(freqs_loc, max_length=100, min_doc_freq=5, min_freq=50):
print("Counting freq... |
allenai/scispacy | https://github.com/allenai/scispacy | null | null | null | null | 1,947 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/evaluate_ner.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:50.617315 | from typing import Optional
import argparse
import spacy
import importlib
from thinc.api import require_gpu
from scispacy.data_util import read_full_med_mentions, read_ner_from_tsv
from scispacy.train_utils import evaluate_ner
def main(model_path: str, dataset: str, output_path: str, code: Optional[str], med_menti... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | doc/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.002577 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Configuration file for mtools documentation."""
import os
import sys
try:
import sphinx_rtd_theme
except ImportError:
sphinx_rtd_theme = None
try:
from sphinxcontrib import spelling
except ImportError as e:
print(e)
spelling = None
# If extension... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/datetime_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.014107 | from datetime import MAXYEAR, datetime, timedelta
from dateutil.tz import tzutc
from .base_filter import BaseFilter
from mtools.util import OrderedDict
from mtools.util.hci import DateTimeBoundaries
def custom_parse_dt(value):
return value
class DateTimeFilter(BaseFilter):
"""
DateTimeFilter class.
... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.015727 | from .datetime_filter import DateTimeFilter
from .fast_filter import FastFilter
from .slow_filter import SlowFilter
from .logline_filter import LogLineFilter
from .tablescan_filter import TableScanFilter
from .word_filter import WordFilter
from .mask_filter import MaskFilter
from .transaction_filter import TransactionF... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/base_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.017703 | class BaseFilter(object):
"""
Base Filter class.
All filters need to derive from it and implement their version of
filterArgs, accept, and optionally skipRemaining.
filterArgs needs to be a list of tuples with 2 elements each. The
first tuple element is the filter argument, e.g. --xyz. The sec... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/logline_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.032630 | from .base_filter import BaseFilter
from mtools.util.logevent import LogEvent
from mtools.util.pattern import json2pattern
def custom_parse_array(value):
return list(set(value.split()))
class LogLineFilter(BaseFilter):
"""LogLineFilter class."""
filterArgs = [
('--component', {
'nar... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.033552 | #!/usr/bin/env python3
"""Mtools init."""
__author__ = 'thomas@rueckstiess.net'
from mtools.version import __version__
|
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlaunch/mlaunch.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.049803 | #!/usr/bin/env python3
import argparse
import functools
import json
import os
import re
import signal
import socket
import ssl
import subprocess
import sys
import threading
import time
import warnings
from collections import defaultdict
from operator import itemgetter
import psutil
from mtools.util import OrderedDict... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/fast_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.062662 | from .base_filter import BaseFilter
class FastFilter(BaseFilter):
"""
FastFilter class.
Accept only lines that have a duration that is shorter than the specified
parameter in ms.
"""
filterArgs = [
('--fast', {'action': 'store', 'nargs': '?', 'default': False,
'ty... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/slow_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.580283 | from .base_filter import BaseFilter
class SlowFilter(BaseFilter):
"""
SlowFilter class.
Accept only lines that have a duration that is longer than the specified
parameter in ms (default 1000).
"""
filterArgs = [
('--slow', {'action': 'store', 'nargs': '?', 'default': False,
... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/mask_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.606519 | from datetime import timedelta
from .datetime_filter import DateTimeFilter
from mtools.util.cmdlinetool import InputSourceAction
class MaskFilter(DateTimeFilter):
"""
MaskFilter class.
This filter takes an argument `--mask <LOGFILE>` and another optional
argument `--mask-size <SECS>`. It will read <... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/tablescan_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.611276 | from .base_filter import BaseFilter
class TableScanFilter(BaseFilter):
"""
TableScanFilter class.
Accept only if the line contains a nscanned:[0-9] nreturned:[0-9] where
the ratio of nscanned:nreturned is > 100 and nscanned > 10000.
"""
filterArgs = [
('--scan', {
'action... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/transaction_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.611809 | import re
from .base_filter import BaseFilter
# SERVER-36461 - Filter to log slow transactions; Can be used in conjuncture with other filters
class TransactionFilter(BaseFilter):
filterArgs = [
('--transactions', {
'action': 'store_true', 'default': False,
'help': 'only output li... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/mloginfo.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.624647 | #!/usr/bin/env python3
import datetime
import inspect
import sys
import mtools.mloginfo.sections as sections
from mtools.util.cmdlinetool import LogFileTool
from mtools.util.logformat import LogFormat
class MLogInfoTool(LogFileTool):
def __init__(self):
"""Constructor: add description to argparser."""
... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/filters/word_filter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.628181 | import re
from .base_filter import BaseFilter
class WordFilter(BaseFilter):
"""Accept only if line contains any of the words specified by --word."""
filterArgs = [
('--word', {'action': 'store', 'nargs': '*',
'help': 'only output lines matching any of WORD'}),
]
def ... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.652146 | from .clients_section import ClientSection
from .connection_section import ConnectionSection
from .cursors_section import CursorSection
from .distinct_section import DistinctSection
from .query_section import QuerySection
from .restart_section import RestartSection
from .rs_info_section import RsInfoSection
from .rs_st... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mlogfilter/mlogfilter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.653213 | #!/usr/bin/env python3
import inspect
import re
import sys
from datetime import MAXYEAR, MINYEAR, datetime, timedelta
from dateutil.tz import tzutc
import mtools.mlogfilter.filters as filters
from mtools.util.cmdlinetool import LogFileTool
class MLogFilterTool(LogFileTool):
def __init__(self):
LogFile... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/base_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:53.678842 | class BaseSection(object):
"""
BaseSection class.
All sections need to derive from it and add their arguments to the
mloginfo.argparser object and determine if they are active.
"""
filterArgs = []
name = 'base'
active = False
def __init__(self, mloginfo):
"""Save command l... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/connection_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.208158 | import re
from collections import defaultdict
from .base_section import BaseSection
from mtools.util.logformat import LogFormat
try:
from mtools.util.profile_collection import ProfileCollection
except ImportError:
ProfileCollection = None
class ConnectionSection(BaseSection):
"""
ConnectionSection c... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/clients_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.221494 | import re
import json
from collections import defaultdict
from .base_section import BaseSection
from mtools.util.logformat import LogFormat
try:
from mtools.util.profile_collection import ProfileCollection
except ImportError:
ProfileCollection = None
# Constants
DELIMITER = "___"
UNKNOWN = "UNKNOWN"
class C... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/sharding_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.232265 | from collections import defaultdict, namedtuple, Counter
from difflib import SequenceMatcher
import re
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
from mtools.util.print_table import print_table
from mtools.util.logformat import LogFormat
from .base_section import BaseSection
ChunksT... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/query_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.235705 | from collections import namedtuple
from operator import itemgetter
from .base_section import BaseSection
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
from mtools.util.print_table import print_table
from mtools.util.logformat import LogFormat
try:
import numpy as np
except ImportEr... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/cursors_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.241840 | from collections import namedtuple
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
from mtools.util.print_table import print_table
from operator import itemgetter
from .base_section import BaseSection
from mtools.util.logformat import LogFormat
LogTuple = namedtuple('LogTuple', ['datetime... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/rs_info_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.247081 | from .base_section import BaseSection
from mtools.util.logformat import LogFormat
class RsInfoSection(BaseSection):
"""
RsInfoSection class.
This section determines if there is any Replica Set infomation like the
replset name in the log file and prints the available information.
"""
name = "r... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/rs_state_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.259102 | from .base_section import BaseSection
from mtools.util import OrderedDict
from mtools.util.print_table import print_table
from mtools.util.logformat import LogFormat
class RsStateSection(BaseSection):
"""
RsStateSection class.
This section determines if there were any Replica Set state changes in
the ... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/distinct_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.259750 | from collections import defaultdict
from .base_section import BaseSection
from mtools.util.logformat import LogFormat
try:
from mtools.util.profile_collection import ProfileCollection
except ImportError:
ProfileCollection = None
class DistinctSection(BaseSection):
"""
DistinctSection class.
Thi... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/storagestats_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.282094 | from collections import namedtuple
from operator import itemgetter
from .base_section import BaseSection
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
from mtools.util.print_table import print_table
from mtools.util.logformat import LogFormat
LogTuple = namedtuple('LogTuple', ['namespa... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/restart_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.282633 | from .base_section import BaseSection
from mtools.util.logformat import LogFormat
try:
from mtools.util.profile_collection import ProfileCollection
except ImportError:
ProfileCollection = None
class RestartSection(BaseSection):
"""
RestartSection class.
This section determines if there were any... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mloginfo/sections/transactions_section.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.786225 | import re
from collections import namedtuple
from operator import itemgetter
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
from mtools.util.print_table import print_table
from .base_section import BaseSection
from mtools.util.logformat import LogFormat
LogTuple = namedtuple('LogTuple',... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/mplotqueries.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.838475 | #!/usr/bin/env python3
import glob
import inspect
import os
import pickle
import sys
import uuid
from datetime import timedelta
from dateutil.tz import tzutc
from mtools import __version__
from mtools.util.cmdlinetool import LogFileTool
try:
import matplotlib
import matplotlib.pyplot as plt
from matplot... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/event_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.861218 | from mtools.mplotqueries.plottypes.base_type import BasePlotType
try:
from matplotlib.dates import date2num
except ImportError as e:
raise ImportError(f"Can't import matplotlib: {str(e)}\n\n"
"For installation instructions, see:\n"
" https://matplotlib.org/stable... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.861739 | from .scatter_type import ScatterPlotType, NScannedNPlotType
from .scatter_type import DocsExaminedPlotType, DurationLineType
from .event_type import EventPlotType, RSStatePlotType
from .range_type import RangePlotType
from .histogram_type import HistogramPlotType
from .connchurn_type import ConnectionChurnPlotType
|
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/histogram_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.863348 | import argparse
import numpy as np
from mtools.mplotqueries.plottypes.base_type import BasePlotType
try:
from matplotlib.dates import date2num, num2date
except ImportError as e:
raise ImportError(f"Can't import matplotlib: {str(e)}\n\n"
"For installation instructions, see:\n"
... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/base_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.870651 | from datetime import MAXYEAR, MINYEAR, datetime
from dateutil.tz import tzutc
from mtools.util import OrderedDict
from mtools.util.grouping import Grouping
try:
from matplotlib import cm
except ImportError as e:
raise ImportError(f"Can't import matplotlib: {str(e)}\n\n"
"For installati... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/scatter_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.871182 | import argparse
import re
from datetime import timedelta
from operator import itemgetter
from mtools.mplotqueries.plottypes.base_type import BasePlotType
try:
from matplotlib import __version__ as mpl_version
import matplotlib.pyplot as plt
from matplotlib.dates import date2num
from matplotlib.patches... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/range_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.890893 | import argparse
from datetime import timedelta
from mtools.mplotqueries.plottypes.base_type import BasePlotType
try:
from matplotlib.dates import date2num, num2date
except ImportError as e:
raise ImportError(f"Can't import matplotlib: {str(e)}\n\n"
"For installation instructions, see:\n... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mplotqueries/plottypes/connchurn_type.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:54.892739 | import argparse
import re
import numpy as np
from mtools.mplotqueries.plottypes.base_type import BasePlotType
try:
from matplotlib.dates import date2num, num2date
except ImportError as e:
raise ImportError(f"Can't import matplotlib: {str(e)}\n\n"
"For installation instructions, see:\n"... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/mtransfer/mtransfer.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.355354 | #!/usr/bin/env python
import argparse
import os
import re
import sys
import bson
import wiredtiger
from mtools.util.cmdlinetool import BaseCmdLineTool
from mtools.version import __version__
codec_options = bson.codec_options.CodecOptions(uuid_representation=bson.binary.STANDARD)
class MTransferTool(BaseCmdLineTool... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_all_help.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.423154 | import io
from operator import truediv
import sys
import pytest
from mtools.test import all_tools
@pytest.fixture(scope="function", autouse=True)
def patch_io(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', io.StringIO('my input'))
sys.stdin.name = 'foo'
sys.stdin.isatty = lambda: True
@all_too... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_all_import.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.462024 | from functools import wraps
# tools without any external dependencies
from mtools.mlogfilter.mlogfilter import MLogFilterTool
from mtools.mloginfo.mloginfo import MLogInfoTool
tools = [MLogFilterTool, MLogInfoTool]
# mlaunch depends on pymongo
try:
from mtools.mlaunch.mlaunch import MLaunchTool
tools.append... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_mlogfilter.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.474374 | import io
import json
import os
import re
import sys
from datetime import datetime, timedelta
from random import randrange
from dateutil import parser
import pytest
import mtools
from mtools.mlogfilter.mlogfilter import MLogFilterTool
from mtools.util.logevent import LogEvent
from mtools.util.logfile import LogFile
... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_mloginfo.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.480826 | import io
import os
import re
import sys
from datetime import timedelta, date
from random import randrange
import pytest
import mtools
from mtools.mloginfo.mloginfo import MLogInfoTool
from mtools.util.logfile import LogFile
@pytest.fixture(scope="function", autouse=True)
def patch_io(monkeypatch, capsys):
monk... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_mplotqueries.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.485661 | import sys
from datetime import datetime, timedelta
from random import randrange
from dateutil import parser
import pytest
import os
import mtools
from mtools.mplotqueries.mplotqueries import MPlotQueriesTool
from mtools.util.logevent import LogEvent
from mtools.util.logfile import LogFile
@pytest.fixture(scope="f... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_mlaunch_commandlines.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.488846 | import inspect
import json
import os
import shutil
from packaging import version
import pytest
from mtools.mlaunch.mlaunch import MLaunchTool
class TestMLaunch(object):
# Setup & teardown functions
def setup_method(self):
self.base_dir = 'data_test_mlaunch'
self.tool = MLaunchTool(test=Tru... |
rueckstiess/mtools | https://github.com/rueckstiess/mtools | null | null | null | null | 1,946 | null | null | apache-2.0 | null | null | null | null | null | null | null | mtools/test/test_mlaunch.py | null | null | null | null | null | null | Python | 2026-05-04T02:45:55.489559 | import inspect
import json
import os
import shutil
import sys
import time
import unittest
from bson import SON
import pytest
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
from mtools.mlaunch.mlaunch import MLaunchTool
pytestmark = pytest.mark.skip("skip all mlaunch tests for now")
cl... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/generate_openapi.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.160450 | #!/usr/bin/env python3
"""Generate OpenAPI specification for the any-llm-gateway.
This script creates the FastAPI application and exports its OpenAPI specification
to a JSON file. Writes the spec to docs/openapi.json by default.
"""
import argparse
import json
import sys
import tempfile
from pathlib import Path
from... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/check_missing_api_keys.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.160982 | #!/usr/bin/env python3
"""
Script to check which providers are being skipped due to missing API keys.
This script attempts to instantiate each provider and reports which ones
fail due to missing API keys, missing packages, or other issues.
"""
import os
import sys
from pathlib import Path
from any_llm import AnyLLM
... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/convert_to_gitbook.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.774532 | """Build the GitBook site output into site/.
Runs all doc generators, copies docs/ into site/, and writes SUMMARY.md.
The contents of site/ are pushed to the gitbook-docs branch by CI.
Usage:
python scripts/convert_to_gitbook.py
"""
from __future__ import annotations
import shutil
import subprocess
import sys
f... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/generate_llms_txt.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.800571 | #!/usr/bin/env python3
"""Generate llms.txt and llms-full.txt files after the Starlight docs build.
These files follow the llmstxt.org standard for making documentation
accessible to AI systems.
Usage:
python scripts/generate_llms_txt.py
"""
import os
import re
import sys
from pathlib import Path
DOCS_CONTENT_D... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.832885 | from importlib.metadata import PackageNotFoundError, version
from any_llm.any_llm import AnyLLM
from any_llm.api import (
acancel_batch,
acompletion,
acreate_batch,
aembedding,
alist_batches,
alist_models,
amessages,
aresponses,
aretrieve_batch,
aretrieve_batch_results,
canc... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/generate_provider_table.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.872709 | #!/usr/bin/env python3
"""Generate docs/providers.md from provider metadata in the any-llm source code.
providers.md is a build artifact - it is not committed to the repository.
Run this script (or scripts/convert_to_gitbook.py) to regenerate it locally.
Usage:
python scripts/generate_provider_table.py
"""
impor... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/generate_cookbooks.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:00.898022 | #!/usr/bin/env python3
"""Convert Jupyter notebooks in docs/cookbooks/ to GitBook-compatible .md pages.
Reads each .ipynb file, converts cells to markdown/code blocks, and writes the
result into docs/src/content/docs/cookbooks/. A Colab badge is injected at the
top of each generated page.
Usage:
python scripts/ge... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/constants.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.428212 | import builtins
from enum import StrEnum
from any_llm.exceptions import UnsupportedProviderError
INSIDE_NOTEBOOK = hasattr(builtins, "__IPYTHON__")
REASONING_FIELD_NAMES = [
"reasoning_content",
"thinking",
"think",
"chain_of_thought",
]
class LLMProvider(StrEnum):
"""String enum for supported ... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/exceptions.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.430317 | # ruff: noqa: D107
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from typing_extensions import override
if TYPE_CHECKING:
from any_llm.types.completion import ParsedChatCompletion
class AnyLLMError(Exception):
"""Base exception for all any-llm errors.
All custom exceptions i... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/any_llm.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.432223 | # Inspired by https://github.com/andrewyng/aisuite/tree/main/aisuite
from __future__ import annotations
import importlib
import os
import warnings
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar, cast, overload
from openresponses_types import ResponseResource
from... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/generate_api_docs.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.433515 | #!/usr/bin/env python3
"""Generate API reference documentation from Python source code.
Extracts docstrings and signatures from the any-llm source and generates
GitBook-compatible markdown pages. Generated files are written to
docs/src/content/docs/api/ and should never be committed to git.
Usage:
python scripts/... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/api.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.621244 | from collections.abc import AsyncIterator, Callable, Iterator, Sequence
from typing import Any
from openresponses_types import ResponseResource
from any_llm import AnyLLM
from any_llm.constants import LLMProvider
from any_llm.types.batch import Batch, BatchResult
from any_llm.types.completion import (
ChatComplet... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/env.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.623564 | import logging
import os
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
from any_llm.gateway.models.entities import Base
logger = logging.getLogger("alembic")
# this is the Alembic Config object, which provides
# access to the values within the .in... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:01.624651 | import warnings
from any_llm import __version__
warnings.warn(
"any_llm.gateway is deprecated and will be removed on May 18, 2026. "
"Migrate to the standalone package at https://github.com/mozilla-ai/gateway",
DeprecationWarning,
stacklevel=2,
)
__all__ = ["__version__"]
|
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/28d153c22616_initial_migration_with_all_models.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.094745 | """Initial migration with all models.
Revision ID: 28d153c22616
Revises:
Create Date: 2025-10-22 13:22:06.718969
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "28d153c22616"
down_revision: str | Sequence[str] | None ... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/10a6a8ead0e7_soft_delete_user_and_cascade_api_key_fk.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.096655 | """soft-delete user and cascade api key FK
Revision ID: 10a6a8ead0e7
Revises: 5911f4bbf98d
Create Date: 2026-02-24 14:02:43.506983
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "10a6a8ead0e7"
down_revision: str | Seq... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/e7c85cc73bfa_convert_budget_duration_to_seconds.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.302939 | """Convert budget duration to seconds.
Revision ID: e7c85cc73bfa
Revises: 1e382aa3a9e7
Create Date: 2025-10-29 16:39:48.908608
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "e7c85cc73bfa"
down_revision: str | Sequenc... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/5911f4bbf98d_set_null_on_user_delete_for_log_.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.303889 | """set null on user delete for log preservation
Revision ID: 5911f4bbf98d
Revises: e7c85cc73bfa
Create Date: 2026-02-24 13:24:13.439244
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "5911f4bbf98d"
down_revision: str ... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/967575f779b7_add_compound_index_usage_logs_user_id_timestamp.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.496554 | """add compound index on usage_logs(user_id, timestamp)
Revision ID: 967575f779b7
Revises: 10a6a8ead0e7
Create Date: 2026-03-13 14:00:00.000000
"""
from collections.abc import Sequence
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "967575f779b7"
down_revision: str | Sequence[str] ... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/_helpers.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.772860 | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from fastapi import HTTPException
from any_llm.gateway.db import APIKey
def resolve_user_id(
user_id_from_request: str | None,
api_key: APIKey | None,
is_master_key: bool,
*,
master_key_error: HTTPExce... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/budgets.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.839332 | from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException, Query, status
from pydantic import BaseModel, Field
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session
from any_llm.gateway.api.deps import get_db, verify_master_key
from any_llm.gateway.models.entities impo... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/embeddings.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.912431 | """OpenAI-compatible embeddings endpoint."""
import uuid
from datetime import UTC, datetime
from typing import Annotated, Any
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
from pydantic import BaseModel, Field
from sqlalchemy.orm import Session
from any_llm import AnyLLM, aembeddin... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/health.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.913663 | from typing import Any
from fastapi import APIRouter, HTTPException
from sqlalchemy import text
from any_llm.gateway import __version__
from any_llm.gateway.api.deps import get_db
from any_llm.gateway.log_config import logger
router = APIRouter(prefix="/health", tags=["health"])
@router.get("")
async def health_ch... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/chat.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:02.935894 | import uuid
from collections.abc import AsyncIterator
from datetime import UTC, datetime
from typing import Annotated, Any
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
from fastapi.responses import StreamingResponse
from pydantic import BaseModel, Field, field_validator
from sqlalch... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/alembic/versions/1e382aa3a9e7_add_per_user_budget_resets.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:03.350486 | """Add per-user budget resets.
Revision ID: 1e382aa3a9e7
Revises: 28d153c22616
Create Date: 2025-10-29 16:25:20.350313
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "1e382aa3a9e7"
down_revision: str | Sequence[str] |... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/api/routes/keys.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:03.351039 | import uuid
from datetime import datetime
from typing import Annotated, Any
from fastapi import APIRouter, Depends, HTTPException, Query, status
from pydantic import BaseModel, Field
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session
from any_llm.gateway.api.deps import get_db, verify_maste... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/auth/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:04.019807 | import hashlib
import re
import secrets
def generate_api_key() -> str:
"""Generate a new API key with prefix.
Returns:
A new API key with format 'gw-' followed by 48 random characters
Raises:
RuntimeError: If generated key doesn't match expected format (should never happen)
"""
... |
mozilla-ai/any-llm | https://github.com/mozilla-ai/any-llm | null | null | null | null | 1,943 | null | null | apache-2.0 | null | null | null | null | null | null | null | src/any_llm/gateway/auth/vertex_auth.py | null | null | null | null | null | null | Python | 2026-05-04T02:46:04.021089 | """Helper module for loading Google Cloud Vertex AI credentials."""
import atexit
import json
import os
import tempfile
from typing import Any
from fastapi import HTTPException, status
_temp_credential_file: str | None = None
def _cleanup_temp_credentials() -> None:
"""Remove temporary credential file on proce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.