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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yeti-platform/yeti | https://github.com/yeti-platform/yeti | null | null | null | null | 1,977 | null | null | apache-2.0 | null | null | null | null | null | null | null | core/schemas/indicators/forensicartifact.py | null | null | null | null | null | null | Python | 2026-05-04T02:43:58.306202 | import io
import logging
import re
from typing import ClassVar, Literal
import yaml
from artifacts import definitions, reader, writer
from artifacts import errors as artifacts_errors
from pydantic import field_validator
from core.schemas import indicator
class ForensicArtifact(indicator.Indicator):
"""Represent... |
yeti-platform/yeti | https://github.com/yeti-platform/yeti | null | null | null | null | 1,977 | null | null | apache-2.0 | null | null | null | null | null | null | null | core/schemas/entities/intrusion_set.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:01.148086 | import datetime
from typing import ClassVar, Literal
from pydantic import Field
from core.helpers import now
from core.schemas import entity
class IntrusionSet(entity.Entity):
_type_filter: ClassVar[str] = "intrusion-set"
type: Literal["intrusion-set"] = "intrusion-set"
aliases: list[str] = []
firs... |
yeti-platform/yeti | https://github.com/yeti-platform/yeti | null | null | null | null | 1,977 | null | null | apache-2.0 | null | null | null | null | null | null | null | core/schemas/entities/malware.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:01.149711 | from typing import ClassVar, Literal
from core.schemas import entity
class Malware(entity.Entity):
_type_filter: ClassVar[str] = "malware"
type: Literal["malware"] = "malware"
kill_chain_phases: list[str] = []
aliases: list[str] = []
family: str = ""
|
yeti-platform/yeti | https://github.com/yeti-platform/yeti | null | null | null | null | 1,977 | null | null | apache-2.0 | null | null | null | null | null | null | null | core/schemas/entities/investigation.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:01.150283 | from typing import ClassVar, Literal
from core.schemas import entity
class Investigation(entity.Entity):
_type_filter: ClassVar[str] = "investigation"
type: Literal["investigation"] = "investigation"
reference: str = ""
|
yeti-platform/yeti | https://github.com/yeti-platform/yeti | null | null | null | null | 1,977 | null | null | apache-2.0 | null | null | null | null | null | null | null | core/schemas/entities/note.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:01.244436 | from typing import ClassVar, Literal
from core.schemas import entity
class Note(entity.Entity):
type: Literal["note"] = "note"
_type_filter: ClassVar[str] = "note"
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/components/credential.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.330702 | import os
import requests
from dotenv import load_dotenv
from loguru import logger
from pydantic import BaseModel
class ProviderError(Exception):
pass
class Credential(BaseModel):
api_key: str
api_endpoint: str
api_model: str
api_tool_model: str = "gpt-4o-mini"
@classmethod
def from_pr... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/middleware/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.345371 | # -*- coding: utf-8 -*-
# @Time : 2023/8/21 上午12:12
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/components/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.346399 | from typing import Optional
from app.components.credential import Credential
from app.components.user_manager import USER_MANAGER
async def read_user_credential(user_id: str) -> Optional[Credential]:
user = await USER_MANAGER.read(user_id=user_id)
return user.credential
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.352047 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:37
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from dotenv import load_dotenv
load_dotenv()
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/components/user_manager/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.362328 | # -*- coding: utf-8 -*-
# @Time : 2024/2/8 下午10:56
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import time
from typing import Optional
from loguru import logger
from pydantic import BaseModel
from app.components.credential import Credential
from app.const import DBNAME
from llmkira.doc_m... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/app.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.364354 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:38
from dotenv import load_dotenv
from loguru import logger
load_dotenv()
__area__ = "receiver"
# import nest_asyncio
# nest_asyncio.apply()
def run():
import asyncio
from .aps import aps_start
from .function import FunctionReceiver
from llmkira i... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/middleware/llm_task.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:05.393497 | # -*- coding: utf-8 -*-
# @Time : 2023/8/18 上午9:37
# @Author : sudoskys
# @File : llm_task.py
import os
from pprint import pprint
from typing import List, Optional
from loguru import logger
from pydantic import SecretStr
from app.components.credential import Credential
from app.components.user_manager import r... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/function.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.190754 | # -*- coding: utf-8 -*-
# @Time : 2023/8/18 下午7:08
# @Author : sudoskys
# @File : function.py
# @Software: PyCharm
__receiver__ = "llm_task"
import os
import time
from typing import Optional
import shortuuid
from aio_pika.abc import AbstractIncomingMessage
from loguru import logger
from app.components import... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/kook/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.203417 | # -*- coding: utf-8 -*-
# @Time : 2023/10/20 下午5:53
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from typing import List
from khl import HTTPRequester, Cert, api, MessageTypes
from loguru import logger
from app.middleware.llm_task import OpenaiMiddleware
from app.receiver import function
... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/aps.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.262715 | # -*- coding: utf-8 -*-
# @Time : 2023/8/18 下午8:34
# @Author : sudoskys
# @File : aps.py
# @Software: PyCharm
from pathlib import Path
from apscheduler.executors.pool import ThreadPoolExecutor
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.schedulers.asyncio import AsyncIOSched... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/slack/creat_message.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.500861 | # -*- coding: utf-8 -*-
# @Time : 2023/10/21 下午8:02
# @Author : sudoskys
# @File : creat_message.py
# @Software: PyCharm
from enum import Enum
from typing import Union
import emoji
class SlackEmoji(Enum):
robot = ":robot_face:"
check = ":white_check_mark:"
error = ":x:"
pin = ":pushpin:"
t... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/discord/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.712508 | # -*- coding: utf-8 -*-
# @Time : 2023/10/18 下午10:46
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import atexit
from typing import List
import hikari
from hikari.impl import ProxySettings
from loguru import logger
from app.middleware.llm_task import OpenaiMiddleware
from app.receiver impo... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.730580 | # -*- coding: utf-8 -*-
# @Time : 2023/10/17 下午10:02
# @Author : sudoskys
# @File : schema.py
# @Software: PyCharm
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.779143 | import time
from pydantic import Field, BaseModel, ConfigDict
class Event(BaseModel):
thead_uuid: str = Field(description="Thead UUID")
by_platform: str = Field(description="创建平台")
by_user: str = Field(description="创建用户")
expire_at: int = Field(default=60 * 60 * 24 * 1, description="expire")
crea... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/util_func.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.823507 | # -*- coding: utf-8 -*-
# @Time : 2023/10/17 下午10:02
# @Author : sudoskys
# @File : util_func.py
# @Software: PyCharm
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/slack/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.825063 | # -*- coding: utf-8 -*-
# @Time : 2023/10/21 下午6:25
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import ssl
from typing import List
from loguru import logger
from slack_sdk.web.async_client import AsyncWebClient
from app.middleware.llm_task import OpenaiMiddleware
from app.receiver import... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.831063 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:27
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from dotenv import load_dotenv
load_dotenv()
|
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/kook/http_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:06.947536 | # -*- coding: utf-8 -*-
# @Time : 2023/10/20 下午5:33
# @Author : sudoskys
# @File : http_client.py
# @Software: PyCharm
import requests
class KookHttpClient(object):
def __init__(self, token):
self.base_url = "https://www.kookapp.cn"
self.bot_token = token
def request(self, method, url,... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/app.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.053120 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:18
# @Author : sudoskys
# @File : app.py
# @Software: PyCharm
from dotenv import load_dotenv
from loguru import logger
from llmkira import load_from_entrypoint, get_entrypoint_plugins
load_dotenv()
__area__ = "sender"
# import nest_asyncio
# nest_asyncio.apply(... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/receiver_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.076683 | # -*- coding: utf-8 -*-
# @Time : 2023/9/25 下午10:48
# @Author : sudoskys
# @File : receiver_client.py
# @Software: PyCharm
#####
# This file is not a top-level schematic file!
#####
import asyncio
import os
import time
from abc import ABCMeta, abstractmethod
from typing import Optional, Tuple, List, Dict
import... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/receiver/telegram/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.214190 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:46
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import asyncio
from typing import List
import telebot
import telegramify_markdown
from loguru import logger
from telebot.async_telebot import AsyncTeleBot
from telegramify_markdown import markdo... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/discord/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.278079 | # -*- coding: utf-8 -*-
# @Time : 2023/10/18 下午10:22
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import base64
import binascii
import random
from typing import List
import crescent
import hikari
from hikari import Intents
from hikari.impl import ProxySettings
from loguru import logger
fro... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/discord/event.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.308190 | # -*- coding: utf-8 -*-
# @Time : 2023/10/19 下午6:30
# @Author : sudoskys
# @File : event.py
# @Software: PyCharm
from app.setting.discord import BotSetting
def help_message():
return """
`{prefix}chat` - Chat with me :)
`{prefix}task` - Ask me do things with `func_enable`
**Slash Command**
... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/kook/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.336180 | # -*- coding: utf-8 -*-
# @Time : 2023/10/20 下午5:33
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import random
from typing import List
import aiohttp
import khl
from khl import Bot, Message, Cert, MessageTypes, PrivateMessage, PublicMessage
from loguru import logger
from telebot import for... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/slack/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.376729 | # -*- coding: utf-8 -*-
# @Time : 2023/10/21 下午2:09
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
import time
from ssl import SSLContext
from typing import List
import aiohttp
from loguru import logger
from slack_bolt.adapter.socket_mode.async_handler import AsyncSocketModeHandler
from slac... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/kook/event.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.383170 | # -*- coding: utf-8 -*-
# @Time : 2023/10/19 下午6:30
# @Author : sudoskys
# @File : event.py
# @Software: PyCharm
from app.setting.discord import BotSetting
_upload_error_message_template = [
"I cant upload file {filename} to server {error}",
"we cant upload {filename}:( , because {error}...",
"Seems... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.394021 | # -*- coding: utf-8 -*-
# @Time : 2023/10/17 下午10:02
# @Author : sudoskys
# @File : schema.py
# @Software: PyCharm
from abc import abstractmethod, ABC
from typing import List
from llmkira.openapi.hook import run_hook, Trigger
from llmkira.task.schema import EventMessage, Sign
class Runner(ABC):
@staticmet... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/slack/event.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.486379 | # -*- coding: utf-8 -*-
# @Time : 2023/10/21 下午2:29
# @Author : sudoskys
# @File : event.py
# @Software: PyCharm
from pydantic import ConfigDict, BaseModel
def help_message():
return """
*Command*
!chat - chat with me in a serious way :(
@<myname> - Chat with me in a simple way :)
!task - chat with funct... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/slack/schema.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.640299 | # -*- coding: utf-8 -*-
# @Time : 2023/11/9 下午2:05
# @Author : sudoskys
# @File : schema.py
# @Software: PyCharm
from typing import List, Optional
from pydantic import ConfigDict, BaseModel, Field
class SlackFile(BaseModel):
id: Optional[str] = Field(None, description="id")
created: int = Field(None, ... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/telegram/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.744388 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:19
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from typing import Optional, Union, List
import telegramify_markdown
from loguru import logger
from telebot import formatting, util
from telebot import types
from telebot.async_telebot import As... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/telegram/event.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.763791 | # -*- coding: utf-8 -*-
# @Time : 2023/7/10 下午9:40
# @Author : sudoskys
# @File : event.py
# @Software: PyCharm
def help_message():
return """
# Command List
`/help` - show help message
`/chat` - just want to chat with me
`/task` - chat with function_enable
`/ask` - chat with function_disable
`/tool` - ch... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/sender/util_func.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.815397 | # -*- coding: utf-8 -*-
# @Time : 2023/10/17 下午10:02
# @Author : sudoskys
# @File : util_func.py
# @Software: PyCharm
import time
from typing import Tuple, Optional, Union
from urllib.parse import urlparse
import telegramify_markdown
from loguru import logger
from app.components.credential import Credential, P... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.849643 | # -*- coding: utf-8 -*-
# @Time : 2023/8/18 上午12:49
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from pydantic import ConfigDict, BaseModel
from .discord import BotSetting as DiscordSetting
from .kook import BotSetting as KookSetting
from .slack import BotSetting as SlackSetting
from .tele... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/database.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.887249 | from dotenv import load_dotenv
from httpx import AsyncClient
from loguru import logger
from pydantic import Field, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
from llmkira.sdk.utils import sync
global_httpx_client = AsyncClient(timeout=180)
class RabbitMQ(BaseSettings):
"""
... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/discord.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.906735 | # -*- coding: utf-8 -*-
# @Time : 2023/10/18 下午10:23
# @Author : sudoskys
# @File : discord.py
# @Software: PyCharm
from typing import Optional
from dotenv import load_dotenv
from loguru import logger
from pydantic import Field, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
cl... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/rabbitmq.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:07.978371 | # -*- coding: utf-8 -*-
# @Time : 2023/11/14 上午11:39
# @Author : sudoskys
# @File : rabbitmq.py
# @Software: PyCharm
from dotenv import load_dotenv
from loguru import logger
from pydantic import Field, PrivateAttr, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
from llmkira.sdk.u... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/slack.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.030352 | # -*- coding: utf-8 -*-
# @Time : 2023/10/21 下午2:14
# @Author : sudoskys
# @File : slack.py
# @Software: PyCharm
from typing import Optional
from dotenv import load_dotenv
from loguru import logger
from pydantic import Field, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/kook.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.045200 | # -*- coding: utf-8 -*-
# @Time : 2023/10/20 下午5:59
# @Author : sudoskys
# @File : kook.py
# @Software: PyCharm
from typing import Optional
from dotenv import load_dotenv
from loguru import logger
from pydantic import Field, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class ... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/setting/telegram.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.239716 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午8:22
# @Author : sudoskys
# @File : telegram.py
# @Software: PyCharm
from typing import Optional
from dotenv import load_dotenv
from loguru import logger
from pydantic import Field, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
cla... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | app/tutorial.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.274181 | # -*- coding: utf-8 -*-
# @Time : 2023/10/28 下午4:19
# @Author : sudoskys
# @File : tutorial.py
# @Software: PyCharm
import pathlib
from time import sleep
import elara
from rich.console import Console
elara_client = elara.exe(
path=pathlib.Path(__file__).parent / ".tutorial.db", commitdb=True
)
tutorial = ... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/schema_exp/openai_response.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.368432 | Data = {
'id': 'chatcmpl-8J2GoGKFhMHc9ZHqUO',
'object': 'chat.completion',
'created': 1691547350,
'model': 'gpt-3.5-turbo-0613',
'choices': [
{
'index': 0,
'message': {
'role': 'assistant',
'content': None,
'tool_calls':... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/test_script/bilibili.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.424921 | # -*- coding: utf-8 -*-
# @Time : 2023/8/22 下午2:15
# @Author : sudoskys
# @File : _bilibili.py
# @Software: PyCharm
import json
import inscriptis
from bilibili_api import search, sync, video_zone
async def test_f_search_by_order():
return await search.search_by_type("ウサギの現実は逃げる", search_type=search.Search... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/test_script/database/note_rabbit_connect.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.442797 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午10:09
# @Author : sudoskys
# @File : ra.py
# @Software: PyCharm
import threading
import pika
class SingletonClass(object):
"""单例模式用来少创建连接"""
# 加锁,防止并发较高时,同时创建对象,导致创建多个对象
_singleton_lock = threading.Lock()
def __init__(self, username='baibing', pas... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/test_script/database/note_rabbit_pika_usage.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.443686 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午7:28
# @Author : sudoskys
# @File : rabbit.py
# @Software: PyCharm
# !/usr/bin/env python
import atexit
import time
from pydantic import BaseModel
class Test(BaseModel):
name: str
age: int
import pika
# 创建凭证,使用rabbitmq用户密码登录
# 去邮局取邮件,必须得验证身份
credentials... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/test_script/database/note_rabbitmq_receiver.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.529798 | # -*- coding: utf-8 -*-
# @Time : 2023/8/17 下午9:05
# @Author : sudoskys
# @File : rabbit_rev.py
# @Software: PyCharm
import pika
from pydantic import BaseModel
# 建立与rabbitmq的连接
credentials = pika.PlainCredentials("admin", "admin")
connection = pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1', crede... |
LlmKira/Openaibot | https://github.com/LlmKira/Openaibot | null | null | null | null | 1,975 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/test_script/database/note_redis_lpush_usage.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:08.599387 | # -*- coding: utf-8 -*-
# @Time : 2023/10/11 下午3:48
# @Author : sudoskys
# @File : redis_lpush.py
# @Software: PyCharm
import time
from llmkira.sdk.cache import RedisRuntime
async def redis():
cache = RedisRuntime().get_redis()
await cache.lpush_data("test", int(time.time()))
await cache.lpush_dat... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/创建型模式-原型模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.060613 | #理解
#原型与工厂模式的区别应该是少一个与与产品平行的工厂类,通过克隆自己,可以创造多个对象
"""
创建型设计模式
"""
#例子
#有一个哺乳动物的原型,每个动物有名称,
#人有很多,所以有很多Object,我们通过clone得到人的对象,然后在附上不同属性
#猴子也有很多,我们也可以通过clone得到多个猴子
class Prototype(object):
typename='mammalian'
def __init__(self):
pass
def clone(self):
pass
class Person(Prototype):
def __init... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/descriptor.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.061590 | # wrong_lazy_properties.py
import random
import time
class LazyProperty:
def __init__(self, function):
self.function = function
self.name = function.__name__
def __get__(self, obj, type=None) -> object:
obj.__dict__[self.name] = self.function(obj)
return obj.__dict__[self.name]... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/创建型模式-单例模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.062671 | # -*- encoding=utf-8 -*-
print '----------------------方法1--------------------------'
# 方法1,实现__new__方法
# 并在将一个类的实例绑定到类变量_instance上,
# 如果cls._instance为None说明该类还没有实例化过,实例化该类,并返回
# 如果cls._instance不为None,直接返回cls._instance
class Singleton(object):
def __new__(cls, *args, **kw):
if not hasattr(cls, '_instance')... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/创建型模式-建造者模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.064215 | # 理解
# 个人理解builder模式的重点就是聚合,就像我们新建一个工程的时候有一些向导,
# 跟着这些向导,通过不同的选项,其中前面的选项可能影响后面的出现的向导,
# 最终得出不同的模版,也就是对象的构建与表示分离,也不知道我理解的对不对,要是不对希望大家指正
"""
创建型设计模式
"""
# 例子
# 我们就以创建一个函数(c函数和python函数)模版为例吧,也不知道合不合适
# product
class Product:
def __init__(self):
self.ReturnName = None
self.functionName = None
se... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/创建型模式-工厂模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.208860 | #-*-coding=utf-8-*-
#理解:
"""
创建型设计模式
"""
"""
"""
"""
工厂模式:实例化延迟到子类
缺点是使用类作为代价,且factory修改不封闭,每增加product就要修改
但可以使用配置文件,就可以封闭了
"""
class Product_opt:
def getResult(self):
pass
class Product_add(Product_opt):
def getResult(self):
return self.num1+self.num2
class Product_sub(Product_opt):
def get... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-代理proxy模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.849979 | # 理解
# 生活中的代理的例子很多很多,计算机方面代理的应用也很多,有多种多样的目的,这个UML图和Adapter模式有点像,不过侧重点完全不一样
# 例子
# 代理最简单的应用就是通过一个对象去控制另一个对象,当然代理可以做一些对被控制者的保护等等
# subject
class AbstractSubject:
def resquest(self):
pass
# Realsubject
class RealSubject(AbstractSubject):
def request(self):
print "i'm working"
# Pr... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/all_sort.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:11.993751 | # coding:utf-8
# 快排
def quick_sort(arr1):
if len(arr1) < 2:
return arr1
else:
pivot = arr1[0]
less = [i for i in arr1[1:] if i < pivot]
greater = [j for j in arr1[1:] if j >= pivot]
return quick_sort(less) + [pivot] + quick_sort(greater)
# 归并
def merge_sort(arr1):
if... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-享元模式flyweight.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.024846 | # 理解
# 运用共享技术,减少大量细粒度对象对存储的开销
# 例子
# 我们知道我们现在网上会注册很多帐号和密码,一些不重要的都是相同的,这样如果很多很多的话就会占用大量的空间
# Flyweight
class Flyweight:
def Operation(self):
pass
# ConcreateFlyweight
class password(Flyweight):
def __init__(self, pwd):
self.pwd = pwd
def Operation(self):
pass
# Flyw... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-适配器模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.058489 | # 理解
# 就是电源适配器的原理吧,将本来不兼容的接口类能够工作
# 这个是类实现方式
"""
结构型设计模式
"""
# 假如一个插座类输出脚是3脚的,而台灯需要的是两脚插座,现在就需要一个Adapter实现适配插座
# Adaptee
class socket(object):
def Trigle(self):
print 'power supply'
# target
class tableLamp(object):
def needTwo(self):
pass
# adapter
class Adapter(tableLamp,... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-桥接模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.087665 | #理解
#为了将抽象和实现都能独立的变化
#例子
#就是用面试宝典上的一个例子吧,将笔和画出的线条进行分离,例如,用蜡笔做大中小,红绿蓝三种线条就需要9只笔
#若是用毛笔,只需要3只毛笔,3种颜料即可,这样即使颜色增多也不会大量的增加笔类
#implementor
class Implementor(object):
def OperationImp(self):
pass
class ConcreteImplementorRed(Implementor):
def OperationImp(self):
print "red line"
class ConcreteImplement... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/创建型模式-抽象工厂.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.120820 | # 理解
# Abstract_Factory模式是Factory的扩展,
# Factory用于生产一类产品而抽象工厂用于生产多个产品系列
"""
创建型设计模式
"""
""" 例子:
# 两个工厂,一个生产狗玩具,一个生产猫玩具,而玩具共有两类一类机器玩具,一类毛绒玩具
"""
class Abstract_Factory:
def __init__(self, factory=None):
self.toy_factory = factory
class cat_Factory(Abstract_Factory):
# 当然这里可以象Factory_Method使用查表
def c... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-中介者模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.287836 | 理解
#中介模式可能看起来比较像代理模式,但是却有很大不同,Mediator强调行为,及对象的交互
#例子
#生活中有时候找房子或是找工作要通过中介
#Mediator
class Mediator:
def introCelleague(self,c1,c2):
self.colleague1=c1
self.colleague2=c2
#HouseMediator
class HouseMediator(Mediator):
def DoActionFrompTob(self):
print "mediator give b 80 yuan"
self.col... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-介绍模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.393179 | # 理解
# 职责链模式也是一个比较常见的模式,通过消息在处理模块的传递,将消息发送模块和各个处理模块解耦合
# 例子
# 这个模式的应用也是很多的,比如windows的消息机制,在产品保修时,如果当地的营销点,就会发回上一级的营销点,直到能够维修为止
# Handler
class Handler(object):
successor = None
def setSuccessor(self, suc):
self.successor = suc
class ConcreteHandle1(Handler):
def HandleRequest(self):
if se... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-命令模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.563449 | # 理解
# 模式的关键是将命令的封装
# 例子
# 将碰到句号自动分行和撤销的命令
class Command:
def __init__(self, rev):
self.rev = rev
def execute(self):
pass
def undo(self):
pass
class Concreate(Command):
def execute(self):
self.rev.str = self.rev.str.replace('.', '\n')
self.rev.printf()
de... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-备忘录模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.602022 | # 理解
# Memento模式的关键是不破坏封装
# Originator
class Originator:
def __init__(self, sta):
self.state = sta
def SetMemento(self, Mem):
self.state = Mem.getState()
def CreateMento(self):
return Memento(self.state)
class Memento:
def __init__(self, state):
self.SetState(state)
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-模板模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.651026 | # 理解
# 就是普通通过继承实现多态的方法,对于通用操作在父类中实现,不同操作的细节在子类中实现,父类只声明接口
# 注意的是要遵循DIP原则
# 例子
# 灯泡发光,不同的灯泡发不同的光
# AbstractClass
class AbstractClass:
def TemplementMethod(self):
self.operator1()
self.operator2()
def operator1(self):
pass
def operator2(self):
pass
class LedLight(AbstractC... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-组合模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.652748 | #理解
#具有层次结构,且使得部分和整体具有一致性
#例子
#一个经典的组合例子就是食品的分类
#Component
class food_Component(object):
def __init__(self):
self.food_object={}
self.i=0
def display_name(self):
pass
def Add(self,food):
pass
def remove(self,food):
pass
def getChild(self,pos):
pass
#Co... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-策略模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.687383 | # 理解
# 策略模式与模版模式相似,不同的是Strategy模式,将抽象接口封装到了另一个类
# Strategy
class Strategy:
def AlgrithmInterface(self):
pass
# ConcreteStrategy
class ConcreteStrategyA(Strategy):
def AlgrithmInterface(self):
print "eat food"
class ConcreteStrategyB(Strategy):
def AlgrithmInterface(self):
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-状态模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.725836 | # 理解
# 事物往往有多种状态,对于每一种状态,响应同一种输入的反应不同,最典型的是有限状态机
# 与策略模式不同的是State模式关注的是状态,将每一种状态封装,简化复杂的switch或驱动表对状态机的维护
# 例子
# 我们知道水有三种状态,冰,水,水汽,而且在加热或冷却的操作下会相互转化
class state:
def heat(self, con):
pass
def cool(self, con):
pass
class water(state):
def heat(self, con):
con.changeState(vapour())
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-外观模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.773916 | # 理解
# 减少各个子系统之间及与客户之间的依赖,为客户提供统一的接口
# 例子
# 假设同学毕业要去图书馆去审核借阅记录,去教务处办理离校手续,去生活部注销校园卡
# 现在提供一个学生办事处提供统一的外观
# library
class library:
def comeLibrary(self):
print "come lib"
# office
class office:
def comeOffice(self):
print "come office"
# LifeDepartment
class LifeDepartment:
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/结构型模式-装饰器模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.775174 | # 理解
# 动态的给一个对象添加额外的职责
# 例子
# 假如有一只会叫的dog,现在让它叫的时候会张嘴
# Component
class Animal(object):
def speak(self):
pass
# ConcreateComponent
class dog(Animal):
def speak(self):
print 'wangwang'
# Decorator
class Decorator(object):
Component = None
def speak(self):
self... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-职责链模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.849434 | # 理解
# 职责链模式也是一个比较常见的模式,通过消息在处理模块的传递,将消息发送模块和各个处理模块解耦合
# 例子
# 这个模式的应用也是很多的,比如windows的消息机制,在产品保修时,如果当地的营销点,就会发回上一级的营销点,直到能够维修为止
# Handler
class Handler(object):
successor = None
def setSuccessor(self, suc):
self.successor = suc
class ConcreteHandle1(Handler):
def HandleRequest(self):
if se... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-观察者模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:12.927015 | # 理解
# Observer模式是最多应用的模式之一
# 在很多的编程语言中,都实现了这种模式,并利用了这种模式
# 例子
# 订报的例子应该比较合适吧
#行为型设计模式
class publisher(object):
observers = list()
msg = None
def register(self, observer):
self.observers.append(observer)
def disregister(self, observer):
self.observers.remove(observer)
def Notify(s... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-访问者visior模式.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.137593 | # 理解
# 关键是双分派的理解
# 例子
# http://my.oschina.net/coolwater/blog/27676
# Element
class Problem:
def getProblem(self, s): # accept
print "一般问题",
s.solve(self)
class SpecialProblem(Problem):
def getProblem(self, s):
print "特殊问题",
s.solve(self)
# visitor
class Supporter:
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/行为型模式-解释器.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.223465 | # 理解
# python本身就是一种解释性的语言,通过python解释器解释问法,从而执行
# 例子
# 假设解析i = 1 ; i++ ; i++ ; i-- ; print k ;
# 分析
# Context
class Context:
out = 0
def __init__(self, str):
self.str = str
# Interpreter
class AbstractExpression:
def interpret(self):
pass
class AddExpression(AbstractExpression):
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/removeduplicate.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.262263 | class Solution:
def removeDuplicates(self, nums: [int]):
if not nums: return []
k = 1
for i in range(1, len(nums)):
if nums[i] != nums[i - 1]:
k += 1
return k
print(Solution().removeDuplicates([1,1,2,3,3,3,4,4,5,5])) |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/interface.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.283842 | # https://realpython.com/python-interface/#python-interface-overview
class InformalParserInterface:
def load_data_source(self, path: str, file_name: str) -> str:
"""Load in the file for extracting text."""
pass
def extract_text(self, full_file_name: str) -> dict:
"""Extract text from t... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/design_pattern/设计模式六大原则.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.284897 | #单一职责原则Single Responsibility Principle
"""定义:一个类或者一个接口,最好只负责一项职责。
问题由来:类T负责两个不同的职责P1和P2。由于职责P1需要发生改变而需要修改T类时,有可能导致原来运行正常的职责P2功能发生故障。
解决方法:遵循单一职责原则。分别建立两个类T1和T2,使类T1负责职责P1,类T2负责职责P2。这样,当修改类T1也不会影响职责P2;同理,当修改类T2时不会影响职责P1。
"""
#里氏替换原则Liskov Substitution Principle
"""定义2:所有引用基类的地方必须能透明地使用其子类的对象。
问题由来:有一功能P1,由类A完成。现需要将功... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/run_class.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.314698 |
def singleton(cls):
instances = {}
def wrapper(*args, **kwargs):
if 'cls' not in instances:
instances['cls'] = cls(*args, **kwargs)
return instances['cls']
return wrapper
@singleton
class TestSingle(object):
pass
class Singleton(object):
def __new__(cls, *args, **kw... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/run_file.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.328483 | # coding:utf-8
import time
import os
from mmap import mmap
def get_lines(fp):
with open(fp, "r+") as f:
for i in f:
yield i
def get_lines_by_mmap(fp):
with open(fp, "r+") as f:
m = mmap(f.fileno(), 0)
tmp = 0
for i, char in enumerate(m):
if char == b"... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/run_comp.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.347250 | # coding: utf-8
def two_sum(nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for i in nums:
if target - i in nums and i is not target-i:
return [nums.index(i), nums.index(target - i)]
def run_twosum():
nums_all = [3, 2, 7, 6, 11, 15]
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/run_legb.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.492168 | # coding: utf-8
def test_legb():
fun = [lambda x, i=i: x*i for i in range(4)]
for item in fun:
print(item(1))
def func():
fun_lambda_list = []
for i in range(4):
def lambda_(x):
print('Lambda函数中 i {} 命名空间为:{}:'.format(i, locals()))
return x*i
fun_lambda... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/solid_improve.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:13.510183 | class Const(object):
def __setattr__(self, key, value):
if key in self.__dict__:
raise Exception('Change invalid')
if not key.isupper():
raise Exception('Change invalid')
self.__dict__[key] = value
import sys
sys.modules[__name__] = Const()
|
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/waterjug.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:14.045719 | # coding:utf-8
class Solution:
def canMeasureWater(self, x: int, y: int, z: int) -> bool:
stack = [(0, 0)]
self.seen = set()
while stack:
remain_x, remain_y = stack.pop()
if remain_x == z or remain_y == z or remain_x + remain_y == z:
return True
... |
DasyDong/developer-roadmap | https://github.com/DasyDong/developer-roadmap | null | null | null | null | 1,974 | null | null | apache-2.0 | null | null | null | null | null | null | null | code/thread.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:14.229798 | import threading
import time
class MyThread(threading.Thread):
def run(self):
global num
time.sleep(5)
if mutex.acquire(1):
num +=1
msg = self.name + 'set num to ' +str(num)
print(msg)
mutex.release()
num = 0
mutex = threading.Lock()
def test... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/ceval/llama_evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.290326 | # This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval
import os
import re
from tqdm import tqdm
import random
import numpy as np
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import GenerationConfig
DEFAULT_SYSTEM_PROMPT = """You are a helpful as... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/cmmlu/categories.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.291604 | # This code is modified from CMMLU Project: https://github.com/haonan-li/CMMLU
name_en2zh = {
"agronomy": "农学",
"anatomy": "解剖学",
"ancient_chinese": "古汉语",
"arts": "艺术学",
"astronomy": "天文学",
"business_ethics": "商业伦理",
"chinese_civil_service_exam": "中国公务员考试",
"chinese_driving_rule": "中国驾驶... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/longbench/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.354396 | # The script is from https://github.com/THUDM/LongBench
import os
import json
import argparse
import numpy as np
from metrics import (
qa_f1_score,
rouge_zh_score,
qa_f1_zh_score,
rouge_score,
classification_score,
retrieval_score,
retrieval_zh_score,
count_score,
code_sim_score,
)
... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/ceval/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.354941 | # This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval
import os
import argparse
import pandas as pd
import torch
import json
from llama_evaluator import Llama_Evaluator
import time
choices = ["A", "B", "C", "D"]
def main(args, evaluator, take):
assert os.path.exists("subject_mapping.js... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/cmmlu/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.396369 | # This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval
import os
import argparse
import pandas as pd
import torch
import json
from llama_evaluator import Llama_Evaluator
from glob import glob
import time
from collections import defaultdict
from categories import name_en2zh, subcategories, catego... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/longbench/pred.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.561883 | # The script is modified from https://github.com/THUDM/LongBench/blob/main/pred.py
from datasets import load_dataset
import torch
import random
import numpy as np
import json
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import BitsAndBytesConfig
from tqdm import tqdm
import os
import a... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/inference/inference_hf.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.635723 | import argparse
import json, os
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import GenerationConfig
from transformers import BitsAndBytesConfig
DEFAULT_SYSTEM_PROMPT = """You are a helpful assistant. 你是一个乐于助人的助手。"""
system_format='<|start_header_id|>system<|end_header_i... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/longbench/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.707157 | # The script is from https://github.com/THUDM/LongBench
import re
import string
import jieba
from fuzzywuzzy import fuzz
import difflib
from collections import Counter
from rouge import Rouge
def normalize_answer(s):
"""Lower text and remove punctuation, articles and extra whitespace."""
def remove_articles... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/mmlu/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.944239 | # modified from https://github.com/baichuan-inc/Baichuan-7B/blob/main/evaluation/evaluate_mmlu.py
import argparse
import os
import torch
import numpy as np
import pandas as pd
from categories import subcategories, categories
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
choices = ["A"... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/oai_api_demo/openai_api_protocol.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:18.971714 | from typing import Optional, List, Dict, Any, Union, Literal
import time
import shortuuid
from pydantic import BaseModel, Field
class ChatCompletionRequest(BaseModel):
model: str = "llama-3-chinese"
messages: Union[str, List[Dict[str, str]]]
temperature: Optional[float] = 0.2
top_p: Optional[float] ... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/mmlu/categories.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.001235 | subcategories = {
"abstract_algebra": ["math"],
"anatomy": ["health"],
"astronomy": ["physics"],
"business_ethics": ["business"],
"clinical_knowledge": ["health"],
"college_biology": ["biology"],
"college_chemistry": ["chemistry"],
"college_computer_science": ["computer science"],
"c... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/oai_api_demo/openai_api_server.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.001972 | import argparse
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from threading import Thread
from sse_starlette.sse import EventSourceResponse
parser = argparse.ArgumentParser()
parser.add_argument('--base_model', default=None, type=str, required=True)
parser.add... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/training/build_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.045762 | import logging
import os
from typing import Union, List
import datasets
import torch
from datasets import load_dataset, concatenate_datasets
import transformers
IGNORE_INDEX = -100
logger = logging.getLogger('__name__')
DEFAULT_SYSTEM_PROMPT = """You are a helpful assistant. 你是一个乐于助人的助手。"""
system_format='<|start_h... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/training/run_clm_pt_with_peft.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.405060 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.