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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HKUDS/nanobot | https://github.com/HKUDS/nanobot | null | null | null | null | 41,574 | null | null | mit | null | null | null | null | null | null | null | nanobot/channels/slack.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:09.734338 | """Slack channel implementation using Socket Mode."""
import asyncio
import re
from pathlib import Path
from typing import Any
import httpx
from loguru import logger
from pydantic import Field
from slack_sdk.socket_mode.request import SocketModeRequest
from slack_sdk.socket_mode.response import SocketModeResponse
fro... |
HKUDS/nanobot | https://github.com/HKUDS/nanobot | null | null | null | null | 41,574 | null | null | mit | null | null | null | null | null | null | null | nanobot/channels/websocket.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:09.785945 | """WebSocket server channel: nanobot acts as a WebSocket server and serves connected clients."""
from __future__ import annotations
import asyncio
import base64
import binascii
import email.utils
import hashlib
import hmac
import http
import json
import mimetypes
import re
import secrets
import shutil
import ssl
impo... |
HKUDS/nanobot | https://github.com/HKUDS/nanobot | null | null | null | null | 41,574 | null | null | mit | null | null | null | null | null | null | null | nanobot/channels/telegram.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:09.794316 | """Telegram channel implementation using python-telegram-bot."""
from __future__ import annotations
import asyncio
import re
import time
import unicodedata
from contextlib import suppress
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Literal
from loguru import logger
from pydanti... |
HKUDS/nanobot | https://github.com/HKUDS/nanobot | null | null | null | null | 41,574 | null | null | mit | null | null | null | null | null | null | null | nanobot/channels/weixin.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:09.846677 | """Personal WeChat (微信) channel using HTTP long-poll API.
Uses the ilinkai.weixin.qq.com API for personal WeChat messaging.
No WebSocket, no local WeChat client needed — just HTTP requests with a
bot token obtained via QR code login.
Protocol reverse-engineered from ``@tencent-weixin/openclaw-weixin`` v1.0.3.
"""
fr... |
HKUDS/nanobot | https://github.com/HKUDS/nanobot | null | null | null | null | 41,574 | null | null | mit | null | null | null | null | null | null | null | nanobot/channels/wecom.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:10.523871 | """WeCom (Enterprise WeChat) channel implementation using wecom_aibot_sdk."""
import asyncio
import base64
import hashlib
import importlib.util
import os
import re
from collections import OrderedDict
from pathlib import Path
from typing import Any
from loguru import logger
from nanobot.bus.events import OutboundMess... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/make_width_table.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.392571 | """Generates a width table for Unicode characters.
This script generates a width table for Unicode characters that are not
narrow (width 1). The table is written to src/black/_width_table.py (note
that although this file is generated, it is checked into Git) and is used
by the char_width() function in src/black/string... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | action/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.400840 | import os
import re
import shlex
import shutil
import sys
from pathlib import Path
from subprocess import PIPE, STDOUT, run
ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"])
ENV_PATH = ACTION_PATH / ".black-env"
ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin")
OPTIONS = os.getenv("INPUT_OPTION... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/fuzz.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.417875 | """Property-based tests for Black.
By Zac Hatfield-Dodds, based on my Hypothesmith tool for source code
generation. You can run this file with `python`, `pytest`, or (soon)
a coverage-guided fuzzer I'm working on.
"""
import hypothesmith
from hypothesis import HealthCheck, given, settings
from hypothesis import stra... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/generate_schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.418782 | import json
from typing import IO, Any
import click
import black
def generate_schema_from_click(
cmd: click.Command,
) -> dict[str, Any]:
result: dict[str, dict[str, Any]] = {}
for param in cmd.params:
if not isinstance(param, click.Option) or param.is_eager:
continue
assert... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/check_pre_commit_rev_in_example.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.421818 | """
Check that the rev value in the example pre-commit configuration matches
the latest version of Black. This saves us from forgetting to update that
during the release process.
Why can't we just use `rev: stable` and call it a day? Well pre-commit
won't auto update the hook as you may expect (and for good reasons, s... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.432619 | #
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup --------------------------------------------------------------
# If extensions (or ... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/diff_shades_gha_helper.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:13.476978 | """Helper script for psf/black's diff-shades Github Actions integration.
diff-shades is a tool for analyzing what happens when you run Black on
OSS code capturing it for comparisons or other usage. It's used here to
help measure the impact of a change *before* landing it (in particular
posting a comment on completion ... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/check_version_in_basics_example.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.021355 | """
Check that the rev value in the example from ``the_basics.md`` matches
the latest version of Black. This saves us from forgetting to update that
during the release process.
"""
import os
import sys
import commonmark
from bs4 import BeautifulSoup
def main(changes: str, the_basics: str) -> None:
changes_html ... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/release.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.042790 | #!/usr/bin/env python3
"""
Tool to help automate changes needed in commits during and after releases
"""
from __future__ import annotations
import argparse
import logging
import re
import sys
from datetime import datetime
from pathlib import Path
from subprocess import run
LOG = logging.getLogger(__name__)
NEW_VERS... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/migrate-black.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.057093 | #!/usr/bin/env python3
# check out every commit added by the current branch, blackify them,
# and generate diffs to reconstruct the original commits, but then
# blackified
import logging
import os
import sys
from subprocess import PIPE, Popen, check_output, run
def git(*args: str) -> str:
return check_output(["gi... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | profiling/mix_small.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.065778 | config = some.Structure(
globalMap = {
103310322020340: [100000031211103,101042000320420,100100001202021,112320301100420,110101024402203,112001202000203,112101112010031,102130400200010,100401014300441,103000401422033],
110040120003212: [114413100031332,102101001412002,100210000032130,214000110100040... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/brackets.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.080791 | """Builds on top of nodes.py to track brackets."""
from collections.abc import Iterable, Sequence
from dataclasses import dataclass, field
from typing import Final, Union
from black.nodes import (
BRACKET,
CLOSING_BRACKETS,
COMPARATORS,
LOGIC_OPERATORS,
MATH_OPERATORS,
OPENING_BRACKETS,
UN... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | scripts/release_tests.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.086603 | #!/usr/bin/env python3
import unittest
from pathlib import Path
from shutil import rmtree
from tempfile import TemporaryDirectory
from typing import Any
from unittest.mock import Mock, patch
from release import SourceFiles, tuple_calver # type: ignore
class FakeDateTime:
"""Used to mock the date to test genera... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.105184 | import io
import json
import platform
import re
import sys
import tokenize
import traceback
from collections.abc import (
Collection,
Generator,
MutableMapping,
Sequence,
)
from contextlib import nullcontext
from dataclasses import replace
from datetime import datetime, timezone
from enum import Enum
fr... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.116796 | """Caching of formatted files with feature-based invalidation."""
import hashlib
import os
import pickle
import sys
import tempfile
from collections.abc import Iterable
from dataclasses import dataclass, field
from pathlib import Path
from typing import NamedTuple
from platformdirs import user_cache_dir
from _black_... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/concurrency.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.964988 | """
Formatting many files at once via multiprocessing. Contains entrypoint and utilities.
NOTE: this module is only imported if we need to format several files at once.
"""
from __future__ import annotations
import asyncio
import logging
import os
import signal
import sys
import traceback
from collections.abc import... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/handle_ipynb_magics.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.968379 | """Functions to process IPython magics with."""
import ast
import collections
import dataclasses
import re
import secrets
import string
from collections.abc import Collection
from functools import lru_cache
from importlib.util import find_spec
from typing import TypeGuard
from black.mode import Mode
from black.output... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/debug.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.970190 | from collections.abc import Iterator
from dataclasses import dataclass, field
from typing import Any, TypeVar, Union
from black.nodes import Visitor
from black.output import out
from black.parsing import lib2to3_parse
from blib2to3.pgen2 import token
from blib2to3.pytree import Leaf, Node, type_repr
LN = Union[Leaf, ... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/const.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.971931 | DEFAULT_LINE_LENGTH = 88
DEFAULT_EXCLUDES = r"/(\.direnv|\.eggs|\.git|\.hg|\.ipynb_checkpoints|\.mypy_cache|\.nox|\.pytest_cache|\.ruff_cache|\.tox|\.svn|\.venv|\.vscode|__pypackages__|_build|buck-out|build|dist|venv)/" # noqa: B950
DEFAULT_INCLUDES = r"(\.pyi?|\.ipynb)$"
STDIN_PLACEHOLDER = "__BLACK_STDIN_FILENAME__"... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/comments.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.973446 | import re
from collections.abc import Collection, Iterator
from dataclasses import dataclass
from functools import lru_cache
from typing import Final, Union
from black.mode import Mode
from black.nodes import (
CLOSING_BRACKETS,
STANDALONE_COMMENT,
STATEMENT,
WHITESPACE,
container_of,
first_lea... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/files.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.974660 | import io
import os
import sys
from collections.abc import Iterable, Iterator, Sequence
from functools import lru_cache
from pathlib import Path
from re import Pattern
from typing import TYPE_CHECKING, Any, Union
from mypy_extensions import mypyc_attr
from packaging.specifiers import InvalidSpecifier, Specifier, Speci... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/linegen.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:14.999535 | """
Generating lines of code.
"""
import re
import sys
from collections.abc import Collection, Iterator
from dataclasses import replace
from enum import Enum, auto
from functools import partial, wraps
from typing import Union, cast
from black.brackets import (
COMMA_PRIORITY,
DOT_PRIORITY,
STRING_PRIORITY... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/output.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.579927 | """Nice output for Black.
The double calls are for patching purposes in tests.
"""
import json
import re
import tempfile
from typing import Any
from click import echo, style
from mypy_extensions import mypyc_attr
@mypyc_attr(patchable=True)
def _out(message: str | None = None, nl: bool = True, **styles: Any) -> No... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/parsing.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.581132 | """
Parse Python code and perform AST validation.
"""
import ast
import sys
import warnings
from collections.abc import Collection, Iterator
from black.mode import VERSION_TO_FEATURES, Feature, TargetVersion, supports_feature
from black.nodes import syms
from blib2to3 import pygram
from blib2to3.pgen2 import driver
f... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/numerics.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.582597 | """
Formatting numeric literals.
"""
from blib2to3.pytree import Leaf
def format_hex(text: str) -> str:
"""
Formats a hexadecimal string like "0x12B3"
"""
before, after = text[:2], text[2:]
return f"{before}{after.upper()}"
def format_scientific_notation(text: str) -> str:
"""Formats a nume... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/ranges.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.606063 | """Functions related to Black's formatting by line ranges feature."""
import difflib
from collections.abc import Collection, Iterator, Sequence
from dataclasses import dataclass
from black.nodes import (
LN,
STANDALONE_COMMENT,
Leaf,
Node,
Visitor,
first_leaf,
furthest_ancestor_with_last_l... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/report.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.643273 | """
Summarize Black runs to users.
"""
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from click import style
from black.output import err, out
class Changed(Enum):
NO = 0
CACHED = 1
YES = 2
class NothingChanged(UserWarning):
"""Raised when reformatted code is th... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/rusty.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.644972 | """An error-handling model influenced by that used by the Rust programming language
See https://doc.rust-lang.org/book/ch09-00-error-handling.html.
"""
from typing import Generic, TypeVar, Union
T = TypeVar("T")
E = TypeVar("E", bound=Exception)
class Ok(Generic[T]):
def __init__(self, value: T) -> None:
... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/nodes.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.716072 | """
blib2to3 Node/Leaf transformation-related utility functions.
"""
from collections.abc import Iterator
from typing import Final, Generic, Literal, TypeGuard, TypeVar, Union
from mypy_extensions import mypyc_attr
from black.cache import CACHE_DIR
from black.mode import Mode, Preview
from black.strings import get_s... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/mode.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:15.830236 | """Data structures configuring Black behavior.
Mostly around Python language feature support per version and Black configuration
chosen by the user.
"""
from dataclasses import dataclass, field
from enum import Enum, auto
from hashlib import sha256
from operator import attrgetter
from typing import Final
from black.... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/lines.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.052107 | import itertools
import math
from collections.abc import Callable, Iterator, Sequence
from dataclasses import dataclass, field
from typing import NamedTuple, Optional, TypeVar, Union, cast
from black.brackets import COMMA_PRIORITY, DOT_PRIORITY, BracketTracker
from black.mode import Mode, Preview
from black.nodes impo... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.643125 | import importlib.resources
import json
from typing import Any
def get_schema(tool_name: str = "black") -> Any:
"""Get the stored complete schema for black's settings."""
assert tool_name == "black", "Only black is supported."
pkg = "black.resources"
fname = "black.schema.json"
schema = importlib... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blackd/middlewares.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.643946 | from collections.abc import Awaitable, Callable, Collection, Iterable
from aiohttp import web
from aiohttp.typedefs import Middleware
from aiohttp.web_middlewares import middleware
from aiohttp.web_request import Request
from aiohttp.web_response import StreamResponse
Handler = Callable[[Request], Awaitable[StreamRes... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/strings.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.765209 | """
Simple formatting on strings. Further string formatting code is in trans.py.
"""
import re
import sys
from functools import lru_cache
from re import Match, Pattern
from typing import Final
from black._width_table import WIDTH_TABLE
from blib2to3.pytree import Leaf
STRING_PREFIX_CHARS: Final = "fturbFTURB" # All... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blackd/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.774154 | import asyncio
import logging
import os
from concurrent.futures import Executor, ProcessPoolExecutor
from datetime import datetime, timezone
from functools import cache, partial
from multiprocessing import freeze_support
try:
from aiohttp import web
from multidict import MultiMapping
from .middlewares imp... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blackd/client.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:16.973154 | import aiohttp
from aiohttp.typedefs import StrOrURL
import black
_DEFAULT_HEADERS = {"Content-Type": "text/plain; charset=utf-8"}
class BlackDClient:
def __init__(
self,
url: StrOrURL = "http://localhost:9090",
line_length: int | None = None,
skip_source_first_line: bool = False... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/literals.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.267563 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Safely evaluate Python string literals without using eval()."""
import re
simple_escapes: dict[str, str] = {
"a": "\a",
"b": "\b",
"f": "\f",
"n": "\n",
"r": "\r",
"t": "\t"... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/black/trans.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.268439 | """
String transformers that can split and merge strings.
"""
import re
from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
from dataclasses import dataclass
from typing import Any, ClassVar, Final, Literal, TypeVar, Uni... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/grammar.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.360025 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""This module defines the data structures used to represent a grammar.
These are a bit arcane because they are derived from the data
structures used by Python's 'pgen' parser generator.
There's also ... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/driver.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.379979 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
# Modifications:
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Parser driver.
This provides a high-level interface to parse a file into a synta... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/pgen.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.450242 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
import os
from collections.abc import Iterator, Sequence
from typing import IO, Any, NoReturn, Union
from blib2to3.pgen2 import grammar, token, tokenize
from blib2to3.pgen2.tokenize import TokenInfo
P... |
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:17.587142 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""The pgen2 package."""
|
psf/black | https://github.com/psf/black | null | null | null | null | 41,487 | null | null | mit | null | null | null | null | null | null | null | src/blib2to3/pgen2/conv.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:21.932501 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
# mypy: ignore-errors
"""Convert graminit.[ch] spit out by pgen to Python code.
Pgen is the Python parser generator. It is useful to quickly create a
parser from a grammar file in Python's grammar no... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.282357 | """
Import all adapters from the current directory
and make them available for import as
adapter_module.AdapterName
"""
# pylint: disable=wildcard-import,relative-import
from os.path import dirname, basename, isfile, join
import glob
__all__ = [
basename(f)[:-3]
for f in glob.glob(join(dirname(__file__),... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | bin/app.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.290891 | #!/usr/bin/env python
# vim: set encoding=utf-8
# pylint: disable=wrong-import-position,wrong-import-order
"""
Main server program.
Configuration parameters:
path.internal.malformed
path.internal.static
path.internal.templates
path.log.main
path.log.queries
"""
from __future__ import print_funct... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/cmd.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.292278 | """ """
# pylint: disable=unused-argument,abstract-method
import os.path
import re
from subprocess import Popen, PIPE
from .adapter import Adapter
def _get_abspath(path):
"""Find absolute path of the specified `path`
according to its
"""
if path.startswith("/"):
return path
import __m... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/cheat_sheets.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.295140 | """
Implementation of the adapter for the native cheat.sh cheat sheets repository,
cheat.sheets. The cheat sheets repository is hierarchically structured: cheat
sheets covering programming languages are are located in subdirectories.
"""
# pylint: disable=relative-import
import os
import glob
from .git_adapter impo... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/adapter.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.296340 | """
`Adapter`, base class of the adapters.
Configuration parameters:
path.repositories
"""
import abc
import os
from six import with_metaclass
from config import CONFIG
class AdapterMC(type):
"""
Adapter Metaclass.
Defines string representation of adapters
"""
def __repr__(cls):
if... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | bin/clean_cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.302855 | import sys
import redis
REDIS = redis.Redis(host="localhost", port=6379, db=0)
for key in sys.argv[1:]:
REDIS.delete(key)
|
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | bin/release.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.357409 | #!/usr/bin/env python
from __future__ import print_function
from datetime import datetime
import os
from os import path
import re
import shutil
import subprocess
from subprocess import Popen
import sys
SHARE_DIR = path.join(path.dirname(__file__), "../share/")
def run(args):
return Popen(args, stdout=sys.stdou... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | bin/srv.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.385378 | #!/usr/bin/env python
#
# Serving cheat.sh with `gevent`
#
from gevent.monkey import patch_all
from gevent.pywsgi import WSGIServer
patch_all()
import os
import sys
from app import app, CONFIG
if "--debug" in sys.argv:
# Not all debug mode features are available under `gevent`
# https://github.com/pallets... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/cheat_cheat.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.407532 | """
Adapter for https://github.com/cheat/cheat
Cheatsheets are located in `cheat/cheatsheets/`
Each cheat sheet is a separate file without extension
"""
# pylint: disable=relative-import,abstract-method
from .git_adapter import GitRepositoryAdapter
class Cheat(GitRepositoryAdapter):
"""
cheat/cheat adapter... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/git_adapter.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.878229 | """
Implementation of `GitRepositoryAdapter`, adapter that is used to handle git repositories
"""
import glob
import os
from .adapter import Adapter # pylint: disable=relative-import
def _get_filenames(path):
return [os.path.split(topic)[1] for topic in glob.glob(path)]
class RepositoryAdapter(Adapter):
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/learnxiny.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.925414 | """
Adapters for the cheat sheets from the Learn X in Y project
Configuration parameters:
log.level
"""
# pylint: disable=relative-import
from __future__ import print_function
import os
import re
from config import CONFIG
from .git_adapter import GitRepositoryAdapter
class LearnXinY(GitRepositoryAdapter):
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/question.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.940489 | """
Configuration parameters:
path.internal.bin.upstream
"""
# pylint: disable=relative-import
from __future__ import print_function
import os
import re
from subprocess import Popen, PIPE
from polyglot.detect import Detector
from polyglot.detect.base import UnknownLanguage
from config import CONFIG
from langu... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/internal.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.949351 | """
Configuration parameters:
frontend.styles
path.internal.pages
"""
import sys
import os
import collections
try:
from rapidfuzz import process, fuzz
_USING_FUZZYWUZZY = False
except ImportError:
from fuzzywuzzy import process, fuzz
_USING_FUZZYWUZZY = True
from config import CONFIG
from ... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/latenz.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.950557 | """
Adapter for the curlable latencies numbers (chubin/late.nz)
This module can be an example of a adapter for a python project.
The adapter exposes one page ("latencies") and several its aliases
("latencies", "late.nz", "latency")
"""
# pylint: disable=relative-import
import sys
import os
from .git_adapter import G... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/rosetta.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.951716 | """
Implementation of RosettaCode Adapter.
Exports:
Rosetta(GitRepositoryAdapter)
"""
# pylint: disable=relative-import
import os
import glob
import yaml
from .git_adapter import GitRepositoryAdapter
from .cheat_sheets import CheatSheets
class Rosetta(GitRepositoryAdapter):
"""
Adapter for RosettaCod... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/upstream.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.988034 | """
Adapter for an external cheat sheets service (i.e. for cheat.sh)
Configuration parameters:
upstream.url
upstream.timeout
"""
# pylint: disable=relative-import
import textwrap
import requests
from config import CONFIG
from .adapter import Adapter
def _are_you_offline():
return textwrap.dedent(
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/adapter/tldr.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.989258 | """
Adapter for https://github.com/cheat/cheat
Cheatsheets are located in `pages/*/`
Each cheat sheet is a separate file with extension .md
The pages are formatted with a markdown dialect
"""
# pylint: disable=relative-import,abstract-method
import re
import os
from .git_adapter import GitRepositoryAdapter
class... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/buttons.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:24.990560 | TWITTER_BUTTON = """
<a href="https://twitter.com/igor_chubin" class="twitter-follow-button" data-show-count="false" data-button="grey">Follow @igor_chubin</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.058489 | """
Cache implementation.
Currently only two types of cache are allowed:
* "none" cache switched off
* "redis" use redis for cache
Configuration parameters:
cache.type = redis | none
cache.redis.db
cache.redis.host
cache.redis.port
"""
import os
import json
from config import CONFIG
_RE... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/cheat_wrapper.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.495255 | """
Main cheat.sh wrapper.
Parse the query, get answers from getters (using get_answer),
visualize it using frontends and return the result.
Exports:
cheat_wrapper()
"""
import re
import json
from routing import get_answers, get_topics_list
from search import find_answers_by_keyword
from languages_data import L... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.561489 | """
Global configuration of the project.
All configurable parameters are stored in the global variable CONFIG,
the only variable which is exported from the module.
Default values of all configuration parameters are specified
in the `_CONFIG` dictionary. Those parameters can be overridden
by three means:
* config ... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/fmt/comments.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.599325 | """
Extract text from the text-code stream and comment it.
Supports three modes of normalization and commenting:
1. Don't add any comments
2. Add comments
3. Remove text, leave code only
Since several operations are quite expensive,
it actively uses caching.
Exported functions:
beautify(text, lang,... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/fmt/markdown.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.606358 | """
Markdown support.
Exports:
format_text(text, config=None, highlighter=None):
Uses external pygments formatters for highlighting (passed as an argument).
"""
import re
import ansiwrap
import colored
def format_text(text, config=None, highlighter=None):
"""
Renders `text` according to markdown rules.... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/frontend/ansi.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.653894 | """
ANSI frontend.
Exports:
visualize(answer_data, request_options)
Format:
answer_data = {
'answers': '...',}
answers = [answer,...]
answer = {
'topic': '...',
'topic_type': '...',
'answer': '...',
'format': 'ansi|code|markdown|text...',
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/cheat_wrapper_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.683257 | from cheat_wrapper import _add_section_name
unchanged = """
python/:list
ls
+
g++
g/+
clang++
btrfs~volume
:intro
:cht.sh
python/copy+file
python/rosetta/:list
emacs:go-mode/:list
g++g++
"""
split = """
python copy file
python/copy file
python file
python/file
python+file
python/file
g++ -O1
g++/-O1
"""
def tes... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/fetch.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.705560 | """
Repositories fetch and update
This module makes real network and OS interaction,
and the adapters only say how exctly this interaction
should be done.
Configuration parameters:
* path.log.fetch
"""
from __future__ import print_function
import sys
import logging
import os
import subprocess
import textwrap
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/fmt/internal.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:25.737068 | """
Colorize internal cheat sheets.
Will be merged with panela later.
"""
import re
from colorama import Fore, Back, Style
import colored
PALETTES = {
0: {
1: Fore.WHITE,
2: Style.DIM,
},
1: {
1: Fore.CYAN,
2: Fore.GREEN,
3: colored.fg("orange_3"),
4: Style... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/frontend/html.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.105230 | """
Configuration parameters:
path.internal.ansi2html
"""
import sys
import os
import re
from subprocess import Popen, PIPE
MYDIR = os.path.abspath(os.path.join(__file__, "..", ".."))
sys.path.append("%s/lib/" % MYDIR)
# pylint: disable=wrong-import-position
from config import CONFIG
from globals import error
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/globals.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.152078 | """
Global functions that our used everywhere in the project.
Please, no global variables here.
For the configuration related things see `config.py`
"""
from __future__ import print_function
import sys
import logging
def fatal(text):
"""
Fatal error function.
The function is being used in the standalon... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/languages_data.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.174887 | """
Programming languages information.
Will be (probably) moved to a separate file/directory
from the project tree.
"""
import pygments.lexers
LEXER = {
"assembly": pygments.lexers.NasmLexer,
"awk": pygments.lexers.AwkLexer,
"bash": pygments.lexers.BashLexer,
"basic": pygments.lexers.QBasicLexer,
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/options.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.195184 | """
Parse query arguments.
"""
def parse_args(args):
"""
Parse arguments and options.
Replace short options with their long counterparts.
"""
result = {
"add_comments": True,
}
query = ""
newargs = {}
for key, val in args.items():
if val == "" or val == [] or val =... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/limits.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.195886 | """
Connection limitation.
Number of connections from one IP is limited.
We have nothing against scripting and automated queries.
Even the opposite, we encourage them. But there are some
connection limits that even we can't handle.
Currently the limits are quite restrictive, but they will be relaxed
in the future.
Us... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/panela/colors.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.208497 | import os
import json
COLORS_JSON = os.path.join(os.path.dirname(os.path.abspath(__file__)), "colors.json")
COLOR_TABLE = json.loads(open(COLORS_JSON, "r").read())
VALID_COLORS = [x["hexString"] for x in COLOR_TABLE]
HEX_TO_ANSI = {x["hexString"]: x["colorId"] for x in COLOR_TABLE}
def rgb_from_str(s):
# s start... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/panela/panela_colors.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.263753 | # vim: encoding=utf-8
import os
import sys
import colored
import itertools
from globals import MYDIR
"""
After panela will be ready for it, it will be split out in a separate project,
that will be used for all chubin's console services.
There are several features that not yet implemented (see ___doc___ in Panela)
T... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/post.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.269853 | """
POST requests processing.
Currently used only for new cheat sheets submission.
Configuration parameters:
path.spool
"""
import string
import os
import random
from config import CONFIG
def _save_cheatsheet(topic_name, cheatsheet):
"""
Save posted cheat sheet `cheatsheet` with `topic_name`
in the... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/postprocessing.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.282517 | import search
import fmt.comments
def postprocess(answer, keyword, options, request_options=None):
answer = _answer_add_comments(answer, request_options=request_options)
answer = _answer_filter_by_keyword(
answer, keyword, options, request_options=request_options
)
return answer
def _answer_... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/routing.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:26.357351 | """
Queries routing and caching.
Exports:
get_topics_list()
get_answers()
"""
import random
import re
from typing import Any, Dict, List
import cache
import adapter.cheat_sheets
import adapter.cmd
import adapter.internal
import adapter.latenz
import adapter.learnxiny
import adapter.question
import adapter.r... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/search.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:27.002535 | """
Very naive search implementation. Just a placeholder.
Exports:
find_answer_by_keyword()
It should be implemented on the adapter basis:
1. adapter.search(keyword) returns list of matching answers
* maybe with some initial weight
2. ranking is done
3. sorted results are returned
4. eag... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/standalone.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:27.003162 | """
Standalone wrapper for the cheat.sh server.
"""
from __future__ import print_function
import sys
import textwrap
try:
import urlparse
except ModuleNotFoundError:
import urllib.parse as urlparse
import config
config.CONFIG["cache.type"] = "none"
import cheat_wrapper
import options
def show_usage():
... |
chubin/cheat.sh | https://github.com/chubin/cheat.sh | null | null | null | null | 41,320 | null | null | mit | null | null | null | null | null | null | null | lib/stateful_queries.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:27.153358 | """
Support for the stateful queries
"""
import cache
def save_query(client_id, query):
"""
Save the last query `query` for the client `client_id`
"""
cache.put("l:%s" % client_id, query)
def last_query(client_id):
"""
Return the last query for the client `client_id`
"""
return cach... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/client_server/run_server.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.906535 | from time import sleep
from vnpy.event import EventEngine, Event
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy.trader.event import EVENT_LOG
from vnpy.trader.object import LogData
from vnpy_ctp import CtpGateway
from vnpy_rpcservice import RpcServiceApp
from vnp... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.918994 | # Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or mo... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/candle_chart/run.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.928136 | from datetime import datetime
from vnpy.trader.ui import create_qapp, QtCore
from vnpy.trader.constant import Exchange, Interval
from vnpy.trader.database import get_database
from vnpy.chart import ChartWidget, VolumeItem, CandleItem
if __name__ == "__main__":
app = create_qapp()
database = get_database()
... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/simple_rpc/test_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.929157 | from time import sleep
from typing import Any
from vnpy.rpc import RpcClient
class TestClient(RpcClient):
"""
Test RpcClient
"""
def __init__(self) -> None:
"""
Constructor
"""
super().__init__()
def callback(self, topic: str, data: Any) -> None:
"""
... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/no_ui/run.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.930609 | import multiprocessing
import sys
from time import sleep
from datetime import datetime, time
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine, LogEngine
from vnpy.trader.logger import INFO, logger
from vnpy_ctp import CtpGateway
from vnpy_ctastrateg... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/simple_rpc/test_server.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.932527 | from time import sleep, time
from vnpy.rpc import RpcServer
class TestServer(RpcServer):
"""
Test RpcServer
"""
def __init__(self):
"""
Constructor
"""
super().__init__()
self.register(self.add)
def add(self, a, b):
"""
Test function
... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/client_server/run_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.933353 | from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy_rpcservice import RpcGateway
from vnpy_ctastrategy import CtaStrategyApp
def main():
""""""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainE... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/veighna_trader/demo_script.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.940235 | from time import sleep
from vnpy_scripttrader import ScriptEngine
def run(engine: ScriptEngine):
"""
脚本策略的主函数说明:
1. 唯一入参是脚本引擎ScriptEngine对象,通用它来完成查询和请求操作
2. 该函数会通过一个独立的线程来启动运行,区别于其他策略模块的事件驱动
3. while循环的维护,请通过engine.strategy_active状态来判断,实现可控退出
脚本策略的应用举例:
1. 自定义篮子委托执行执行算法
2. 股指期货和一篮子股票... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/veighna_trader/run.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:29.940729 | from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy_ctp import CtpGateway
# from vnpy_ctptest import CtptestGateway
# from vnpy_mini import MiniGateway
# from vnpy_femas import FemasGateway
# from vnpy_sopt import SoptGateway
# from... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | examples/data_recorder/data_recorder.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:30.021098 | """
该程序使用VeighNa框架通过CTP接口连接到期货市场,并自动录制指定交易所和品种的行情数据。
适合初学者了解VeighNa框架的基本用法和数据录制流程。
"""
# 加载Python标准库
from logging import INFO
from time import sleep
# 加载VeighNa核心框架
from vnpy.event import EventEngine, Event
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine, LogEngine
from vnpy.trader... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | tests/test_alpha101.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:30.493612 | import pytest
import polars as pl
import numpy as np
from datetime import datetime, timedelta
from vnpy.alpha.dataset.utility import calculate_by_expression
def create_test_df(n_symbols: int = 50, n_days: int = 300) -> pl.DataFrame:
"""
Create test DataFrame with extreme values.
Columns: dat... |
vnpy/vnpy | https://github.com/vnpy/vnpy | null | null | null | null | 40,081 | null | null | mit | null | null | null | null | null | null | null | vnpy/alpha/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:21:30.521372 | from .logger import logger
from .dataset import AlphaDataset, Segment, to_datetime
from .model import AlphaModel
from .strategy import AlphaStrategy, BacktestingEngine
from .lab import AlphaLab
__all__ = [
"logger",
"AlphaDataset",
"Segment",
"to_datetime",
"AlphaModel",
"AlphaStrategy",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.