id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
902 | from dataclasses import dataclass, field
import string
import random
from typing import List, Callable
SupportTickets = List[SupportTicket]
def fifo_ordering(list: SupportTickets) -> SupportTickets:
return list.copy() | null |
903 | from dataclasses import dataclass, field
import string
import random
from typing import List, Callable
SupportTickets = List[SupportTicket]
def filo_ordering(list: SupportTickets) -> SupportTickets:
list_copy = list.copy()
list_copy.reverse()
return list_copy | null |
904 | from dataclasses import dataclass, field
import string
import random
from typing import List, Callable
SupportTickets = List[SupportTicket]
def random_ordering(list: SupportTickets) -> SupportTickets:
list_copy = list.copy()
random.shuffle(list_copy)
return list_copy | null |
905 | from dataclasses import dataclass, field
import string
import random
from typing import List, Callable
SupportTickets = List[SupportTicket]
def blackhole_ordering(_: SupportTickets) -> SupportTickets:
return [] | null |
906 | import string
import random
from typing import List
from abc import ABC, abstractmethod
def generate_id(length=8):
# helper function for generating an id
return ''.join(random.choices(string.ascii_uppercase, k=length)) | null |
907 | import string
import random
from typing import List
def generate_id(length=8):
# helper function for generating an id
return ''.join(random.choices(string.ascii_uppercase, k=length)) | null |
908 | import tkinter as tk
import uuid
import string
import random
from abc import ABC, abstractmethod
def generate_uuid1():
return uuid.uuid1() | null |
909 | import tkinter as tk
import uuid
import string
import random
from abc import ABC, abstractmethod
def generate_uuid4():
return uuid.uuid4() | null |
910 | import tkinter as tk
import uuid
import string
import random
from abc import ABC, abstractmethod
def generate_simple_id():
return ''.join(random.choices(string.ascii_lowercase, k=30)) | null |
911 | from flask import Flask, jsonify, abort
def hello_world():
return 'Hello, World!' | null |
913 | import sqlite3
def blog_lst_to_json(item):
return {
'id': item[0],
'published': item[1],
'title': item[2],
'content': item[3],
'public': bool(item[4])
} | null |
914 | from flask import Flask, jsonify, abort
from db import fetch_blogs, fetch_blog, NotFoundError, NotAuthorizedError
def hello_world():
return 'Hello, World!' | null |
915 | from flask import Flask, jsonify, abort
from db import fetch_blogs, fetch_blog, NotFoundError, NotAuthorizedError
def fetch_blogs():
pass
def all_blogs():
return jsonify(fetch_blogs()) | null |
916 | from flask import Flask, jsonify, abort
from db import fetch_blogs, fetch_blog, NotFoundError, NotAuthorizedError
def fetch_blog(id: str):
class NotFoundError(Exception):
class NotAuthorizedError(Exception):
def get_blog(id):
try:
return jsonify(fetch_blog(id))
except NotFoundError:
abort(40... | null |
918 | from flask import Flask, jsonify, abort
from db import fetch_blogs, fetch_blog, NotFoundError, NotAuthorizedError
def fetch_blogs():
def all_blogs():
return jsonify(fetch_blogs()) | null |
920 | import logging
from functools import wraps
logger = create_logger()
def create_logger():
# create a logger object
logger = logging.getLogger('exc_logger')
logger.setLevel(logging.INFO)
# create a file to store all the
# logged exceptions
logfile = logging.FileHandler('exc_logger.log')
fmt = '%(asc... | null |
921 | import logging
from functools import wraps
if __name__ == '__main__':
divideByZero()
def exception(logger):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
issue = "exception in "+fu... | null |
922 | import logging
from functools import wraps
def divideByZero():
return 12/0 | null |
923 | import time
import math
from functools import wraps
The provided code snippet includes necessary dependencies for implementing the `retry` function. Write a Python function `def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None)` to solve the following problem:
Retry calling the decorated function using... | Retry calling the decorated function using an exponential backoff. http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/ original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry :param ExceptionToCheck: the exception to check. may be a tuple of exceptions to check :type ExceptionToChe... |
924 | import time
import math
from functools import wraps
def test_fail(text):
raise Exception("Fail") | null |
925 | import sqlite3
from returns.result import Result, safe
from returns.pipeline import flow
from returns.pointfree import bind
def fetch_blog_from_db(blog_id):
"""Fetches blog from SQLite3 database."""
with SQLite('application.db') as cur:
cur.execute(f"SELECT * FROM blogs where id=?", [blog_id])
r... | null |
928 | from flask import Flask, jsonify, abort
from db import fetch_blogs, fetch_blog, NotFoundError, NotAuthorizedError
def fetch_blog(id: str):
pass
class NotFoundError(Exception):
pass
class NotAuthorizedError(Exception):
pass
def get_blog(id):
try:
return jsonify(fetch_blog(id))
except NotF... | null |
932 | import sqlite3
class SQLite():
def __init__(self, file='application.db'):
self.file=file
def __enter__(self):
self.conn = sqlite3.connect(self.file)
return self.conn.cursor()
def __exit__(self, type, value, traceback):
print("Closing the connection")
self.conn.close()... | null |
933 | import sqlite3
class SQLite():
def __init__(self, file='application.db'):
self.file=file
def __enter__(self):
self.conn = sqlite3.connect(self.file)
return self.conn.cursor()
def __exit__(self, type, value, traceback):
print("Closing the connection")
self.conn.close()... | null |
934 | from pydantic import ConfigDict
from llmkira.extra.user import CostControl, UserCost
from llmkira.middleware.llm_provider import GetAuthDriver
from llmkira.sdk import resign_plugin_executor
from llmkira.sdk.endpoint import openai
from llmkira.sdk.func_calling import verify_openapi_version
from loguru import logger
fro... | null |
935 | from pydantic import field_validator, ConfigDict
import re
from llmkira.sdk import resign_plugin_executor
from llmkira.sdk.func_calling import verify_openapi_version
from llmkira.sdk.schema import File, Function
from io import BytesIO
from math import floor
from PIL import Image
from loguru import logger
from pydantic ... | null |
936 | from dotenv import load_dotenv
from loguru import logger
async def aps_start():
logger.success("Receiver Runtime:APS Timer start")
SCHEDULER.start()
class FunctionReceiver(object):
"""
receive message from any platform
"""
def __init__(self):
self.task = Task(queue=__receiver__)
... | null |
937 | import re
def replace_all(text, pattern, function):
poslist = [0]
strlist = []
originstr = []
poslist = find_all_index(text, pattern)
for i in range(1, len(poslist[:-1]), 2):
start, end = poslist[i:i + 2]
strlist.append(function(text[start:end]))
for i in range(0, len(poslist), 2... | null |
938 | import time
from typing import TYPE_CHECKING, Dict, Any
from typing import Tuple, List, Union, Optional
import hikari
import khl
import orjson
import shortuuid
from loguru import logger
from pydantic import model_validator, ConfigDict, Field, BaseModel
from telebot import types
from llmkira.schema import RawMessage
fro... | null |
939 | from . import resign_trigger, Trigger
The provided code snippet includes necessary dependencies for implementing the `on_chat_message` function. Write a Python function `async def on_chat_message(message: str, uid: str, **kwargs)` to solve the following problem:
:param message: RawMessage :return:
Here is the functio... | :param message: RawMessage :return: |
940 | from abc import abstractmethod, ABC
from typing import Any
def singleton(cls):
_instance = {}
def _singleton(*args, **kargs):
if cls not in _instance:
_instance[cls] = cls(*args, **kargs)
return _instance[cls]
return _singleton | null |
941 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
def dict2message(data... | null |
942 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
def __ensure_event_loo... | 同步执行异步函数,使用可参考 [同步执行异步代码](https://nemo2011.github.io/bilibili-api/#/sync-executor) Args: coroutine (Coroutine): 异步函数 Returns: 该异步函数的返回值 |
943 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
The provided code sni... | sha1加密算法 |
944 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
def generate_uid():
... | null |
945 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
async def aiohttp_dow... | null |
946 | import asyncio
import hashlib
import tempfile
from bisect import bisect_left
from typing import Coroutine, Dict, List, Optional
import aiohttp
import ffmpeg
import nest_asyncio
import shortuuid
from loguru import logger
from telebot import formatting
from telebot.formatting import escape_markdown
The provided code sni... | 在有序列表中二分查找前缀 :param wordlist: 有序列表 :param prefix: 前缀 |
947 | from pathlib import Path
from types import ModuleType
from typing import Optional, Set, Iterable, Union
from . import (
_managers,
_current_plugin_chain,
_module_name_to_plugin_name,
path_to_module_name, _find_manager_by_name, get_plugin,
)
from .model import PluginManager
from .schema import Plugin
def... | 导入文件夹下多个插件,以 `_` 开头的插件不会被导入! :param plugin_dir: 文件夹路径 :return: 插件集合 |
948 | from pathlib import Path
from types import ModuleType
from typing import Optional, Set, Iterable, Union
from . import (
_managers,
_current_plugin_chain,
_module_name_to_plugin_name,
path_to_module_name, _find_manager_by_name, get_plugin,
)
from .model import PluginManager
from .schema import Plugin
def... | 导入 Bot 内置插件。 :param name: 插件名称 :return: 插件 |
949 | from pathlib import Path
from types import ModuleType
from typing import Optional, Set, Iterable, Union
from . import (
_managers,
_current_plugin_chain,
_module_name_to_plugin_name,
path_to_module_name, _find_manager_by_name, get_plugin,
)
from .model import PluginManager
from .schema import Plugin
def... | 导入多个 Bot 内置插件。 :param plugins: 插件名称集合 |
950 | from pathlib import Path
from types import ModuleType
from typing import Optional, Set, Iterable, Union
from . import (
_managers,
_current_plugin_chain,
_module_name_to_plugin_name,
path_to_module_name, _find_manager_by_name, get_plugin,
)
from .model import PluginManager
from .schema import Plugin
def... | null |
951 | from pathlib import Path
from types import ModuleType
from typing import Optional, Set, Iterable, Union
from . import (
_managers,
_current_plugin_chain,
_module_name_to_plugin_name,
path_to_module_name, _find_manager_by_name, get_plugin,
)
from .model import PluginManager
from .schema import Plugin
def... | 获取一个插件的导出内容。 如果为 `load_plugins` 文件夹导入的插件,则为文件(夹)名。 :param name: 插件名称 即 {ref}`extra.plugin.model.Plugin.name`。 :exception RuntimeError: 插件无法加载 :return: 插件导出内容 |
952 | import re
The provided code snippet includes necessary dependencies for implementing the `escape_tag` function. Write a Python function `def escape_tag(s: str) -> str` to solve the following problem:
用于记录带颜色日志时转义 `<tag>` 类型特殊标签 参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color) 参数: s:... | 用于记录带颜色日志时转义 `<tag>` 类型特殊标签 参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color) 参数: s: 需要转义的字符串 |
953 | import asyncio
import atexit
import json
from typing import Any
import httpx
from loguru import logger
from .error import RateLimitError, ServiceUnavailableError, AuthenticationError, CheckError
def llm_error_handler(code, message: str):
if code == 429:
raise RateLimitError(message)
elif code == 404 and... | 请求 :param call_func: 错误回调函数 :param method: :param url: :param params: :param data: :param headers: :param json_body: :param proxy: :param timeout: :param kwargs: 参数 :return: |
954 | import asyncio
import atexit
import json
from typing import Any
import httpx
from loguru import logger
from .error import RateLimitError, ServiceUnavailableError, AuthenticationError, CheckError
__session_pool = {}
The provided code snippet includes necessary dependencies for implementing the `__clean` function. Write... | 程序退出清理操作。 |
955 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
from urllib.parse import urlparse
from redis import RedisCluster
from loguru import logger
def _redis_sentinel_client(redis_url: str, **kwargs: Any) -> RedisType:
"""helper method to parse an (un-official) redis+sentinel url
a... | Get a redis client from the connection url given. This helper accepts urls for Redis server (TCP with/without TLS or UnixSocket) as well as Redis Sentinel connections. Redis Cluster is not supported. Before creating a connection the existence of the database driver is checked an and ValueError raised otherwise To use, ... |
956 | import json
from typing import TYPE_CHECKING
from typing import Union, List, Type
import tiktoken
from loguru import logger
from pydantic import BaseModel
def _pydantic_type(_message):
if isinstance(_message, BaseModel):
return _message.model_dump()
return _message | null |
957 | import json
from typing import TYPE_CHECKING
from typing import Union, List, Type
import tiktoken
from loguru import logger
from pydantic import BaseModel
class BaseTokenizer(object):
def num_tokens_from_messages(
self, messages: List[Union[dict, BaseModel, Type[BaseModel]]], model: str
) -> int:
... | null |
958 | import hashlib
import os
from typing import Optional
from typing import TYPE_CHECKING
from pydantic import field_validator, Field
from pydantic_settings import BaseSettings, SettingsConfigDict
from ..error import ValidationError
The provided code snippet includes necessary dependencies for implementing the `sha1_encry... | sha1加密算法 |
959 | import base64
import hashlib
import pickle
import time
from abc import abstractmethod, ABC
from io import BytesIO
from typing import Literal, Optional, List, Type, Union
from typing import TYPE_CHECKING
import aiohttp
import shortuuid
from docstring_parser import parse
from loguru import logger
from pydantic import mod... | null |
960 | import base64
import hashlib
import pickle
import time
from abc import abstractmethod, ABC
from io import BytesIO
from typing import Literal, Optional, List, Type, Union
from typing import TYPE_CHECKING
import aiohttp
import shortuuid
from docstring_parser import parse
from loguru import logger
from pydantic import mod... | 创建单任务模板 |
961 | import base64
import hashlib
import pickle
import time
from abc import abstractmethod, ABC
from io import BytesIO
from typing import Literal, Optional, List, Type, Union
from typing import TYPE_CHECKING
import aiohttp
import shortuuid
from docstring_parser import parse
from loguru import logger
from pydantic import mod... | 将 dict 实例化,用错误hook覆盖 |
962 | import base64
import hashlib
import pickle
import time
from abc import abstractmethod, ABC
from io import BytesIO
from typing import Literal, Optional, List, Type, Union
from typing import TYPE_CHECKING
import aiohttp
import shortuuid
from docstring_parser import parse
from loguru import logger
from pydantic import mod... | 标准化转换,供请求使用 |
963 | import base64
import hashlib
import pickle
import time
from abc import abstractmethod, ABC
from io import BytesIO
from typing import Literal, Optional, List, Type, Union
from typing import TYPE_CHECKING
import aiohttp
import shortuuid
from docstring_parser import parse
from loguru import logger
from pydantic import mod... | null |
964 | import cjieba
The provided code snippet includes necessary dependencies for implementing the `cut_words_weights` function. Write a Python function `def cut_words_weights(content)` to solve the following problem:
根据jieba分词,提取关键词及其权重 :param content: :return:
Here is the function:
def cut_words_weights(content):
""... | 根据jieba分词,提取关键词及其权重 :param content: :return: |
965 | import cjieba
The provided code snippet includes necessary dependencies for implementing the `hash_keyword_add_weight` function. Write a Python function `def hash_keyword_add_weight(keyword_weight, len_hash=64)` to solve the following problem:
对关键词进行hash, 然后加权 :param keyword_weight: :param len_hash: :return:
Here is ... | 对关键词进行hash, 然后加权 :param keyword_weight: :param len_hash: :return: |
966 | import cjieba
The provided code snippet includes necessary dependencies for implementing the `cal_hamming_distance` function. Write a Python function `def cal_hamming_distance(hash_file1, hash_file2)` to solve the following problem:
计算两篇文章的海明距离 :param hash_file1: :param hash_file2: :return:
Here is the function:
def... | 计算两篇文章的海明距离 :param hash_file1: :param hash_file2: :return: |
967 |
def singleton(cls):
_instance = {}
def _singleton(*args, **kargs):
if cls not in _instance:
_instance[cls] = cls(*args, **kargs)
return _instance[cls]
return _singleton | null |
968 | import cjieba
from ..solo import singleton
from ..summarization import STOPWORDS
The provided code snippet includes necessary dependencies for implementing the `load_stopwords` function. Write a Python function `def load_stopwords(stopwords_path)` to solve the following problem:
加载停用词词典 :param stopwords_path: :return:... | 加载停用词词典 :param stopwords_path: :return: |
969 | import cjieba
from ..solo import singleton
from ..summarization import STOPWORDS
def split_doc(doc):
separators = ['。', '!', '!', '?', '?']
for sep in separators:
doc = doc.replace(sep, sep + '##')
sentences = doc.split('##')
return sentences[:-1] | null |
970 | import cjieba
from ..solo import singleton
from ..summarization import STOPWORDS
def calculate_sentence_score(sentence, stopwords):
# jieba_ret = jieba.analyse.extract_tags(sentence, topK=100, withWeight=True) # , allowPOS=('ns', 'n', 'vn', 'v'))
jieba_ret = cjieba.extract(sentence, top_k=100, with_weight=Tru... | null |
971 | import cjieba
import numpy as np
from nltk.cluster.util import cosine_distance
from ..solo import singleton
from ..summarization import STOPWORDS as STOPWORDS_PATH
def load_stopwords(file_path):
with open(file_path, encoding='utf-8') as f:
return [line.strip() for line in f] | null |
972 | import cjieba
import numpy as np
from nltk.cluster.util import cosine_distance
from ..solo import singleton
from ..summarization import STOPWORDS as STOPWORDS_PATH
MIN_SEQ_LEN = 0
def split_doc(doc, stopwords=None):
if not stopwords:
stopwords = []
sentences = []
cut_sentences = []
origin_sent... | null |
973 | import cjieba
import numpy as np
from nltk.cluster.util import cosine_distance
from ..solo import singleton
from ..summarization import STOPWORDS as STOPWORDS_PATH
def sentence_similarity(sent1, sent2):
"""
计算两个句子之间的相似性
:param sent1:
:param sent2:
:return:
"""
all_words = list(set(sent1 + se... | 构建相似矩阵 :param sentences: :return: |
974 | import cjieba
import numpy as np
from nltk.cluster.util import cosine_distance
from ..solo import singleton
from ..summarization import STOPWORDS as STOPWORDS_PATH
def pagerank(A, eps=0.0001, d=0.85):
P = np.ones(len(A)) / len(A)
while True:
new_P = np.ones(len(A)) * (1 - d) / len(A) + d * A.T.dot(P)
... | null |
975 | import logging
import os
from typing import Dict, Union
import fasttext
import requests
def get_or_load_model(low_memory=False):
if low_memory:
model = models.get("low_mem", None)
if not model:
check_model("lid.176.ftz")
model_path = download_model("lid.176.ftz")
... | null |
976 | import time
from typing import TYPE_CHECKING, Literal, Type, Optional
from typing import Union, List
import nest_asyncio
from pydantic import field_validator, ConfigDict, Field, BaseModel
from .sdk.endpoint.tokenizer import get_tokenizer
from .sdk.schema import File, generate_uid, UserMessage, Message
def singleton(cl... | null |
977 | random
class MappingDefault(dict):
def __missing__(self, key):
return key
def get_request_error_message(error: str):
_txt: str = random.choice(REQUEST_ERROR_MESSAGE_TEMPLATE)
return _txt.format_map(MappingDefault(error=error)) | null |
978 | random
class MappingDefault(dict):
def __missing__(self, key):
return key
def get_upload_error_message(filename: str, error: str):
_txt: str = random.choice(REQUEST_ERROR_MESSAGE_TEMPLATE)
return _txt.format_map(MappingDefault(filename=filename, error=error)) | null |
979 | from typing import Literal, List, Union
from pydantic import BaseModel, Field, field_validator
SENDER = {}
RECEIVER = {}
def router_set(role: Literal["sender", "receiver"], name: str):
if role == "sender":
SENDER[name] = name
elif role == "receiver":
RECEIVER[name] = name
else:
rais... | null |
980 | import pathlib
from time import sleep
import elara
from rich.console import Console
elara_client = elara.exe(path=pathlib.Path(__file__).parent / "elara.db", commitdb=True)
tutorial = [
{
"cn": "接下来进行一些说明,如果您不想看到这些说明,请使用 --no-tutorial 参数运行入口文件。",
"en": "Next, some instructions will be given. "
... | null |
981 | from llmkira.setting.discord import BotSetting
BotSetting = DiscordBot()
def help_message():
return """
`{prefix}chat` - Chat with me :)
`{prefix}task` - Ask me do things with `func_enable`
**Slash Command**
`/help` - **You just did it :)**
`/tool` - Check all useful tools
`/clear` -... | null |
982 | from typing import Tuple, Optional
from urllib.parse import urlparse
from loguru import logger
from ..middleware.chain_box import Chain, AuthReloader
from ..task import Task
The provided code snippet includes necessary dependencies for implementing the `parse_command` function. Write a Python function `def parse_comma... | :param command like `/chat something` :return command_head,command_body |
983 | from typing import Tuple, Optional
from urllib.parse import urlparse
from loguru import logger
from ..middleware.chain_box import Chain, AuthReloader
from ..task import Task
The provided code snippet includes necessary dependencies for implementing the `is_valid_url` function. Write a Python function `def is_valid_url... | :param url url :return bool |
984 | from typing import Tuple, Optional
from urllib.parse import urlparse
from loguru import logger
from ..middleware.chain_box import Chain, AuthReloader
from ..task import Task
The provided code snippet includes necessary dependencies for implementing the `is_command` function. Write a Python function `def is_command( ... | :param text: message text :param command: command :param at_bot_username: check /command@bot_username :param check_empty: check /command -> False :return: bool |
985 | from typing import Tuple, Optional
from urllib.parse import urlparse
from loguru import logger
from ..middleware.chain_box import Chain, AuthReloader
from ..task import Task
def is_empty_command(text: str) -> bool:
assert text, "Command Input Must Be Str"
if not text.startswith("/"):
return False
i... | null |
986 | from typing import Tuple, Optional
from urllib.parse import urlparse
from loguru import logger
from ..middleware.chain_box import Chain, AuthReloader
from ..task import Task
class AuthReloader(object):
"""
重放任务
"""
def __init__(self, uid: str = None):
self.uid = uid
def _prefix(cls, uuid:... | :param uuid: verify id :param platform: message channel :param user_id: raw user id :raise LookupError Not Found :return None |
987 | from dotenv import load_dotenv
from loguru import logger
class StartSetting(BaseModel):
def from_subdir(cls):
global_cache_runtime: RedisRuntime = RedisRuntime()
global_mongodb_runtime: MongodbRuntime = MongodbRuntime()
class TelegramBotRunner(Runner):
def __init__(self):
async def is_user_admin(self,... | null |
988 | from llmkira.setting.discord import BotSetting
BotSetting = DiscordBot()
def help_message():
return """
`{prefix}chat` - Chat with me :)
`{prefix}task` - Ask me do things with `func_enable`
**Slash Command**
`/help` - **You just did it :)**
`/tool` - Check all useful tools
`/clear` -... | null |
989 | 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 function_enable
!ask - chat with function_disable
!auth - Auth a task
*Slash Command*
`/help` - Help message
`/tool` - Tool l... | null |
990 |
def help_message():
return """
/help - HELP YOURSELF
/chat - Chat with me :)
/task - Function enable
/ask - Chat with func_disable, 禁止函数
/tool - 工具列表
/clear - 删除自己的记录
/auth - POWER
Private Chat Only:
/bind - RSS
/unbind - RSS
/set_endpoint - <apikey>#<endpoint>
/cl... | null |
991 | import socket
import feedparser
from inscriptis import get_text
from loguru import logger
from pydantic import BaseModel
from telebot import formatting
from telebot.formatting import escape_markdown
from ..schema import Runner
from ...sdk.cache import global_cache_runtime
from ...task import Task, TaskHeader
from ...mi... | null |
992 | import os
import subprocess
import time
from setuptools import find_packages, setup
The provided code snippet includes necessary dependencies for implementing the `readme` function. Write a Python function `def readme()` to solve the following problem:
Get readme. Returns: str, readme content string.
Here is the func... | Get readme. Returns: str, readme content string. |
993 | import os
import subprocess
import time
from setuptools import find_packages, setup
SHORT_VERSION = '{}.{}.{}{}'.format(MAJOR, MINOR, PATCH, SUFFIX)
VERSION_FILE = 'pyretri/version.py'
def get_hash():
"""Get hash value.
Returns:
str, hash value.
"""
if os.path.exists('.git'):
sha = get_g... | Write version.py. |
994 | import os
import subprocess
import time
from setuptools import find_packages, setup
VERSION_FILE = 'pyretri/version.py'
The provided code snippet includes necessary dependencies for implementing the `get_version` function. Write a Python function `def get_version()` to solve the following problem:
Get version. Returns... | Get version. Returns: str, version string. |
995 | import os
import subprocess
import time
from setuptools import find_packages, setup
The provided code snippet includes necessary dependencies for implementing the `parse_requirements` function. Write a Python function `def parse_requirements(fname='requirements.txt', with_version=True)` to solve the following problem:... | Parse the package dependencies listed in a requirements file but strips specific versioning information. Args: fname (str): path to requirements file with_version (bool, default=False): if True include version specs Returns: List[str]: list of requirements items CommandLine: python -c "import setup; print(setup.parse_r... |
996 | import os
import argparse
import importlib
from pyretri.config import get_defaults_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
def load_datasets():
data_json_dir = "/home/songrenjie/projects/RetrievalToolBox/new... | null |
997 | import os
import argparse
import importlib
from pyretri.config import get_defaults_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep ... | null |
998 | import json
import importlib
import os
import argparse
from utils.misc import check_result_exist, get_dir, get_default_result_dict
from pyretri.config import get_defaults_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def load_datasets():
dataset... | null |
999 | import json
import importlib
import os
import argparse
from utils.misc import check_result_exist, get_dir, get_default_result_dict
from pyretri.config import get_defaults_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def parse_args():
parser = a... | null |
1,000 | import json
import importlib
import os
import argparse
from utils.misc import check_result_exist, get_dir, get_default_result_dict
from pyretri.config import get_defaults_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def load_datasets():
dataset... | null |
1,001 | import json
import importlib
import os
import argparse
from utils.misc import check_result_exist, get_dir, get_default_result_dict
from pyretri.config import get_defaults_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def get_evaluate(fea_dir, evalua... | null |
1,002 | import json
import importlib
import os
import argparse
from utils.misc import check_result_exist, get_dir, get_default_result_dict
from pyretri.config import get_defaults_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
vgg_fea = ["pool5_PWA"]
res_fea =... | null |
1,004 | import os
import torch
import argparse
import importlib
from pyretri.config import get_defaults_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
from pyretri.models.backbone import ft_net
def load_datasets():
data_js... | null |
1,005 | import os
import torch
import argparse
import importlib
from pyretri.config import get_defaults_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
from pyretri.models.backbone import ft_net
def parse_args():
parser = a... | null |
1,007 | import os
import argparse
import importlib
from pyretri.config import get_defaults_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep ... | null |
1,008 | import os
import argparse
import json
import codecs
from utils.misc import save_to_csv, filter_by_keywords
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep learning-based image retrieval')
parser.add_argument('opts', default=None, nargs=argparse.REMAINDER)
parser.add_argu... | null |
1,009 | import os
import argparse
import json
import codecs
from utils.misc import save_to_csv, filter_by_keywords
def show_results(results):
for i in range(len(results)):
print(results[i]) | null |
1,010 | import os
from typing import Dict, List
import csv
The provided code snippet includes necessary dependencies for implementing the `check_result_exist` function. Write a Python function `def check_result_exist(now_res: Dict, exist_results: List) -> bool` to solve the following problem:
Check if the config exists. Args:... | Check if the config exists. Args: now_res (Dict): configuration to be checked. exist_results (List): a list of existing configurations. Returns: bool: if the config exists. |
1,011 | import os
from typing import Dict, List
import csv
The provided code snippet includes necessary dependencies for implementing the `get_dir` function. Write a Python function `def get_dir(root_path: str, dir: str, dataset: Dict) -> (str, str, str)` to solve the following problem:
Get the feature directory path of galle... | Get the feature directory path of gallery set, query set and feature set for training PCA/SVD. Args: root_path (str): the root path of all extracted features. dir (str): the path of one single extracted feature directory. dataset (Dict): a dict containing the information of gallery set, query set and training set. Retu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.