id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
17,201 | from __future__ import print_function
import base64
import os
import sys
def show_help():
print("Usage: imgcat filename ...")
print(" or: cat filename | python imgcat.py -")
exit() | null |
17,202 | from __future__ import print_function
import base64
import os
import sys
def _read_binary_stdin():
# see https://stackoverflow.com/a/38939320/474819 for other platform notes
PY3 = sys.version_info >= (3, 0)
if PY3:
source = sys.stdin.buffer
else:
# Python 2 on Windows opens sys.stdin in... | null |
17,203 | from __future__ import print_function
import heapq
import itertools
import math
from collections import deque
from functools import wraps
The provided code snippet includes necessary dependencies for implementing the `require_axis` function. Write a Python function `def require_axis(f)` to solve the following problem:... | Check if the object of the function has axis and sel_axis members |
17,204 | from __future__ import print_function
import heapq
import itertools
import math
from collections import deque
from functools import wraps
def level_order(tree, include_all=False):
""" Returns an iterator over the tree in level-order
If include_all is set to True, empty parts of the tree are filled
with dumm... | Prints the tree to stdout |
17,205 | import functools
from io import StringIO
from PIL import Image
from . import kdtree
def convert(filename,
is_unicode=False,
is_truecolor=False,
is_256color=True,
is_16color=False,
is_8color=False,
width=80,
palette="default"):
"""
... | Convert an image, and output to file. Arguments: infile -- The name of the input file to load. Example: '/home/user/image.png' outfile -- The name of the output file that the string will be written into. Keyword Arguments: is_unicode -- Whether to use unicode in generating output (default False, ASCII will be used) is_... |
17,206 | __credits__ = ["Micah Elliott", "Kevin Lange", "Takumi Sueda", "Torry Crass"]
__license__ = "WTFPL http://sam.zoy.org/wtfpl/"
__version__ = "0.2"
__maintainer__ = "Torry Crass"
__email__ = "tc.github@outlook.com"
__status__ = "Development"
import sys
import os.path
def print_help():
print("")
print(75 * "=")
... | null |
17,207 | import sys
import os.path
def _create_incs_lut():
incs = [(0x00, 0x5f), (0x5f, 0x87), (0x87, 0xaf), (0xaf, 0xd7),
(0xd7, 0xff)]
res = []
for part in range(256):
for s, b in incs:
if s <= part <= b:
if abs(s - part) < abs(b - part):
res.app... | null |
17,208 | import sys
import os.path
RGB2SHORT_DICT = dict(CLUT)
def lut(part):
def rgb2short_fast(r, g, b):
return RGB2SHORT_DICT['%s%s%s' % (lut(r), lut(g), lut(b))] | null |
17,209 | import importlib
import importlib.util
import logging
import numpy as np
import os
import random
import sys
from datetime import datetime
import torch
The provided code snippet includes necessary dependencies for implementing the `seed_all_rng` function. Write a Python function `def seed_all_rng(seed=None)` to solve t... | Set the random seed for the RNG in torch, numpy and python. Args: seed (int): if None, will use a strong random seed. |
17,210 | import importlib
import importlib.util
import logging
import numpy as np
import os
import random
import sys
from datetime import datetime
import torch
The provided code snippet includes necessary dependencies for implementing the `_configure_libraries` function. Write a Python function `def _configure_libraries()` to ... | Configurations for some libraries. |
17,211 | import importlib
import importlib.util
import logging
import numpy as np
import os
import random
import sys
from datetime import datetime
import torch
DOC_BUILDING = os.getenv("_DOC_BUILDING", False)
The provided code snippet includes necessary dependencies for implementing the `fixup_module_metadata` function. Write ... | Fix the __qualname__ of module members to be their exported api name, so when they are referenced in docs, sphinx can find them. Reference: https://github.com/python-trio/trio/blob/6754c74eacfad9cc5c92d5c24727a2f3b620624e/trio/_util.py#L216-L241 |
17,212 | import itertools
import functools
import dataclasses
import torch
def unflatten_tensors(tensors, start=0):
obj_type = tensors[start].item()
if obj_type == 0:
return unflatten_none(tensors, start + 1)
elif obj_type == 1:
return unflatten_tensor(tensors, start + 1)
elif obj_type == 2:
... | null |
17,213 | import contextlib
import torch
def compute_precision(*, allow_tf32):
old_allow_tf32_matmul = torch.backends.cuda.matmul.allow_tf32
try:
torch.backends.cuda.matmul.allow_tf32 = allow_tf32
with torch.backends.cudnn.flags(enabled=None,
benchmark=None,
... | null |
17,214 | import contextlib
import torch
def compute_precision(*, allow_tf32):
old_allow_tf32_matmul = torch.backends.cuda.matmul.allow_tf32
try:
torch.backends.cuda.matmul.allow_tf32 = allow_tf32
with torch.backends.cudnn.flags(enabled=None,
benchmark=None,
... | null |
17,215 | MODEL = 'runwayml/stable-diffusion-v1-5'
VARIANT = None
CUSTOM_PIPELINE = None
SCHEDULER = 'LCMScheduler'
LORA = 'latent-consistency/lcm-lora-sdv1-5'
CONTROLNET = None
STEPS = 4
PROMPT = 'best quality, realistic, unreal engine, 4K, a beautiful girl'
NEGATIVE_PROMPT = None
SEED = None
WARMUPS = 3
BATCH = 1
HEIGHT = None... | null |
17,216 | import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
def load_model(pip... | null |
17,217 | import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
class CompilationC... | null |
17,218 | import argparse
import logging
import math
import os
import random
import shutil
from pathlib import Path
import datasets
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
import transformers
from accelerate import Accelerator
from accelerate.logging import get_logger
from ac... | null |
17,219 | import argparse
import logging
import math
import os
import random
import shutil
from pathlib import Path
import datasets
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
import transformers
from accelerate import Accelerator
from accelerate.logging import get_logger
from ac... | null |
17,220 | MODEL = 'runwayml/stable-diffusion-v1-5'
VARIANT = None
CUSTOM_PIPELINE = None
SCHEDULER = 'EulerAncestralDiscreteScheduler'
LORA = None
CONTROLNET = None
STEPS = 30
PROMPT = 'best quality, realistic, unreal engine, 4K, a beautiful girl'
NEGATIVE_PROMPT = None
SEED = None
WARMUPS = 3
BATCH = 1
HEIGHT = None
WIDTH = Non... | null |
17,223 | MODEL = 'SimianLuo/LCM_Dreamshaper_v7'
VARIANT = None
CUSTOM_PIPELINE = 'latent_consistency_txt2img'
SCHEDULER = 'EulerAncestralDiscreteScheduler'
LORA = None
CONTROLNET = None
STEPS = 4
PROMPT = 'best quality, realistic, unreal engine, 4K, a beautiful girl'
NEGATIVE_PROMPT = None
SEED = None
WARMUPS = 3
BATCH = 1
HEIG... | null |
17,226 | REPO = None
FACE_ANALYSIS_ROOT = None
MODEL = 'wangqixun/YamerMIX_v8'
VARIANT = None
CUSTOM_PIPELINE = None
SCHEDULER = 'EulerAncestralDiscreteScheduler'
LORA = None
CONTROLNET = 'InstantX/InstantID'
STEPS = 30
PROMPT = 'film noir style, ink sketch|vector, male man, highly detailed, sharp focus, ultra sharpness, monoch... | null |
17,227 | import sys
import os
import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
import numpy as np
import cv2
from huggingface_hub import snapshot_download
from diffusers.utils import load_image
from insightface.app import FaceAnalysis
from sfast.compilers.di... | null |
17,228 | import sys
import os
import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
import numpy as np
import cv2
from huggingface_hub import snapshot_download
from diffusers.utils import load_image
from insightface.app import FaceAnalysis
from sfast.compilers.di... | null |
17,229 | MODEL = 'stabilityai/stable-video-diffusion-img2vid-xt'
VARIANT = None
CUSTOM_PIPELINE = None
SCHEDULER = None
LORA = None
CONTROLNET = None
STEPS = 25
SEED = None
WARMUPS = 1
FRAMES = None
BATCH = 1
HEIGHT = 576
WIDTH = 1024
FPS = 7
DECODE_CHUNK_SIZE = 4
INPUT_IMAGE = 'https://huggingface.co/datasets/huggingface/docum... | null |
17,230 | import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
from diffusers.utils import load_image, export_to_video
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
d... | null |
17,231 | import importlib
import inspect
import argparse
import time
import json
import torch
from PIL import (Image, ImageDraw)
from diffusers.utils import load_image, export_to_video
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
c... | null |
17,232 | import torch
from diffusers import AutoPipelineForText2Image, EulerDiscreteScheduler, ControlNetModel
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
import numpy as np
import cv2
from PI... | null |
17,233 | import torch
from diffusers import AutoPipelineForText2Image, EulerDiscreteScheduler, ControlNetModel
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
import numpy as np
import cv2
from PI... | null |
17,234 | import torch
from diffusers import AutoPipelineForText2Image, EulerDiscreteScheduler, ControlNetModel
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
import numpy as np
import cv2
from PI... | null |
17,235 | import torch
from diffusers import AutoPipelineForText2Image, EulerDiscreteScheduler, ControlNetModel
from diffusers.utils import load_image
from sfast.compilers.diffusion_pipeline_compiler import (compile,
CompilationConfig)
import numpy as np
import cv2
from PI... | null |
17,236 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_onprem(f):
f = f.replace("_", "-")
return f.lower() | null |
17,237 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_aws(f):
f = f.replace("_", "-")
f = f.replace("@4x", "")
f = f.replace("@5x", "")
f = f.replace("2.0", "2-0")
f = f.replace("-light-bg4x", "")
f = f.replace("-light-bg", "")
for p in cfg.FILE_... | null |
17,238 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_azure(f):
f = f.replace("_", "-")
f = f.replace("(", "").replace(")", "")
f = "-".join(f.split())
for p in cfg.FILE_PREFIXES["azure"]:
if f.startswith(p):
f = f[len(p) :]
b... | null |
17,239 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_gcp(f):
f = f.replace("_", "-")
f = "-".join(f.split())
for p in cfg.FILE_PREFIXES["gcp"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,240 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_ibm(f):
f = f.replace("_", "-")
f = "-".join(f.split())
for p in cfg.FILE_PREFIXES["ibm"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,241 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_firebase(f):
f = f.replace("_", "-")
f = "-".join(f.split())
for p in cfg.FILE_PREFIXES["firebase"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,242 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_k8s(f):
f = f.replace("-256", "")
for p in cfg.FILE_PREFIXES["k8s"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,243 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_digitalocean(f):
f = f.replace("-32", "")
for p in cfg.FILE_PREFIXES["digitalocean"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,244 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_alibabacloud(f):
for p in cfg.FILE_PREFIXES["alibabacloud"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,245 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_oci(f):
f = f.replace(" ", "-")
f = f.replace("_", "-")
for p in cfg.FILE_PREFIXES["oci"]:
if f.startswith(p):
f = f[len(p) :]
break
return f.lower() | null |
17,246 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_programming(f):
return f.lower() | null |
17,247 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_generic(f):
return f.lower() | null |
17,248 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_saas(f):
return f.lower() | null |
17,249 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_elastic(f):
return f.lower() | null |
17,250 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_outscale(f):
return f.lower() | null |
17,251 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
def cleaner_openstack(f):
return f.lower() | null |
17,252 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
cleaners = {
"onprem": cleaner_onprem,
"aws": cleaner_aws,
"azure": cleaner_azure,
"digitalocean": cleaner_digitalocean,
"gcp": cleaner_gcp,
"ibm": cleaner_ibm,
"firebase": cleaner_firebase,
"k8s": cle... | Refine the resources files names. |
17,253 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
The provided code snippet includes necessary dependencies for implementing the `round_png` function. Write a Python function `def round_png(pvd: str) -> None` to solve the following problem:
Round the images.
Here is the function:
... | Round the images. |
17,254 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
The provided code snippet includes necessary dependencies for implementing the `svg2png` function. Write a Python function `def svg2png(pvd: str) -> None` to solve the following problem:
Convert the svg into png
Here is the functio... | Convert the svg into png |
17,255 | import os
import subprocess
import sys
import config as cfg
from . import resource_dir
The provided code snippet includes necessary dependencies for implementing the `svg2png2` function. Write a Python function `def svg2png2(pvd: str) -> None` to solve the following problem:
Convert the svg into png using image magick... | Convert the svg into png using image magick |
17,256 | import os
import sys
from typing import Iterable
from jinja2 import Environment, FileSystemLoader, Template, exceptions
import config as cfg
from . import app_root_dir, doc_root_dir, resource_dir, template_dir, base_dir
def gen_classes(pvd: str, typ: str, paths: Iterable[str]) -> str:
"""Generate all service node c... | Generates a service node classes. |
17,257 | from collections import defaultdict
from pathlib import Path
from uuid import uuid4
import sys
import re
from typing import List
import peewee
from datetime import datetime
from sqlite3 import Cursor
database = peewee.SqliteDatabase(None)
lass Database(object):
def __init__(self, sqlite_file: Path) -> None:
de... | null |
17,258 | import re
import json
from typing import List
from uuid import uuid4
section = [
"案情回顾",
"法官解读",
"基本案情",
"申请人请求",
"原告诉讼请求",
"裁判结果",
"处理结果",
"案例分析",
"典型意义",
"裁判要点",
"简要案情",
"法院裁判",
"裁判要旨",
"适用解析",
"司法解释相关法条",
]
def isSection(line) -> bool:
line = line.stri... | null |
17,259 | import re
import json
from typing import List
from uuid import uuid4
nums}、)|(?:^案例{zh_nums}))"
def isTitle(line) -> str:
if re.match(title_matcher, line):
return re.sub(title_matcher, "", line).strip()
return None | null |
17,260 | import logging
import re
from typing import List, Tuple
from docx.document import Document as _Document
from docx import Document
from docx.oxml.table import CT_Tbl
from docx.oxml.text.paragraph import CT_P
from docx.oxml import CT_SectPr
from docx.table import Table, _Cell, _Row
from docx.text.paragraph import Paragra... | null |
17,261 | import logging
import os
import re
import sys
from hashlib import md5
from pathlib import Path
from time import time
from typing import Any, List
from common import LINE_RE
from manager import CacheManager, RequestManager
from parsers import ContentParser, HTMLParser, Parser, WordParser
def find(f, arr: List[Any]) -> ... | null |
17,262 | import logging
import os
import re
import sys
from hashlib import md5
from pathlib import Path
from time import time
from typing import Any, List
from common import LINE_RE
from manager import CacheManager, RequestManager
from parsers import ContentParser, HTMLParser, Parser, WordParser
LINE_RE = INDENT_RE + [f"^第{NUM... | null |
17,263 | from pathlib import Path
from parsers import WordParser, ContentParser
from manager import CacheManager
word_parser = WordParser()
content_parser = ContentParser()
cache = CacheManager()
def parse(doc_file: Path):
print(doc_file)
title, desc, content = word_parser.parse_document(doc_file, doc_file.stem)
f... | null |
17,264 |
cfg = Config(VERSION_PATH, EXAMPLE_PATH, CONFIG_PATH) ... | null |
17,265 |
class Daily:
def start():
if cfg.daily_enable:
Daily.run()
# 优先历战余响
if Date.is_next_mon_x_am(cfg.echo_of_war_timestamp, cfg.refresh_hour):
if cfg.echo_of_war_enable:
Echoofwar.start()
else:
log.info("历战余响未开启")
els... | null |
17,266 |
class Daily:
def start():
if cfg.daily_enable:
Daily.run()
# 优先历战余响
if Date.is_next_mon_x_am(cfg.echo_of_war_timestamp, cfg.refresh_hour):
if cfg.echo_of_war_enable:
Echoofwar.start()
else:
log.info("历战余响未开启")
els... | null |
17,267 |
class Fight:
def update():
from module.update.update_handler import UpdateHandler
from tasks.base.fastest_mirror import FastestMirror
if cfg.fight_operation_mode == "exe":
import requests
import json
response = requests.get(FastestMirror.get_github_api_... | null |
17,268 |
class Fight:
def update():
from module.update.update_handler import UpdateHandler
from tasks.base.fastest_mirror import FastestMirror
if cfg.fight_operation_mode == "exe":
import requests
import json
response = requests.get(FastestMirror.get_github_api_... | null |
17,269 |
class Fight:
def update():
def check_path():
def check_requirements():
def before_start():
def start():
def gui():
def reset_config():
class Universe:
def update():
def check_path():
def check_requirements():
def before_start():
def start(get_reward=False, ... | null |
17,270 |
notif = Notification("三月七小助手|・ω・)", log):
def run_notify_action():
notif.notify("这是一条测试消息", "./assets/app/images/March7th.jpg")
input("按回车键关闭窗口. . .")
sys.exit(0) | null |
17,271 |
The provided code snippet includes necessary dependencies for implementing the `exit_handler` function. Write a Python function `def exit_handler()` to solve the following problem:
注册程序退出时的处理函数,用于清理OCR资源.
Here is the function:
def exit_handler():
"""注册程序退出时的处理函数,用于清理OCR资源."""
ocr.exit_ocr() | 注册程序退出时的处理函数,用于清理OCR资源. |
17,272 | import os
import socket t subprocess import loads as jsonLoads, dumps as jsonDumps
from sys import platform as sysPlatform se64 import b64encode lass PPOCR_pipe:
"""调用OCR(管道模式)"""
class PPOCR_socket(PPOCR_pipe):
"""调用OCR(套接字模式)"""
None, ipcMode: str = "pipe"):
"""获取识别器API对象。\n
`exePath`: 识别器`PaddleO... | 获取识别器API对象。\n `exePath`: 识别器`PaddleOCR_json.exe`的路径。\n `argument`: 启动参数,字典`{"键":值}`。参数说明见 https://github.com/hiroi-sora/PaddleOCR-json\n `ipcMode`: 进程通信模式,可选值为套接字模式`socket` 或 管道模式`pipe`。用法上完全一致。 |
17,273 | import concurrent.futures
import json
import os
import shutil
import subprocess
import sys
import time
from packaging.version import parse
from tqdm import tqdm
import requests
import psutil
from urllib.request import urlopen
from urllib.error import URLError
from utils.color import red, green
from module.logger.logger... | 检查临时目录并运行更新程序。 |
17,274 | from utils.command import subprocess_with_stdout
import subprocess
import sys
import os
def is_windows_terminal_available():
"""
检查 Windows Terminal (wt.exe) 是否可用。
"""
return subprocess_with_stdout(["where", "wt.exe"]) is not None
def execute_command_in_new_environment(command, use_windows_terminal=Fals... | 根据当前环境,启动任务。 |
17,275 | from tqdm import tqdm
import urllib.request
import subprocess
import os
def download_with_progress(download_url, save_path):
aria2_path = os.path.abspath("./assets/binary/aria2c.exe")
if os.path.exists(aria2_path):
command = [aria2_path, "--max-connection-per-server=16", f"--dir={os.path.dirname(save... | null |
17,276 | import sys
import os.path
import pkgutil
import shutil
import tempfile
import argparse
import importlib
from base64 import b85decode
def determine_pip_install_arguments():
def monkeypatch_for_cert(tmpdir):
def main():
def bootstrap(tmpdir):
monkeypatch_for_cert(tmpdir)
# Execute the included pip and use it to... | null |
17,277 | import sys
from enum import Enum
from PyQt5.QtCore import QLocale
from qfluentwidgets import (qconfig, QConfig, ConfigItem, OptionsConfigItem, BoolValidator,
OptionsValidator, RangeConfigItem, RangeValidator,
FolderListValidator, EnumSerializer, FolderValidator, C... | null |
17,278 | from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import QThread, pyqtSignal
from ..card.messagebox_custom import MessageBoxAnnouncement
from module.config import cfg
from io import BytesIO
from enum import Enum
import requests
import qrcode
def download_image(image_url):
response = requests.get(image_url)... | null |
17,279 | from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import QThread, pyqtSignal
from ..card.messagebox_custom import MessageBoxAnnouncement
from module.config import cfg
from io import BytesIO
from enum import Enum
import requests
import qrcode
def generate_qr_code(url):
qr = qrcode.QRCode(
version=1,... | null |
17,280 | from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import QThread, pyqtSignal
from ..card.messagebox_custom import MessageBoxAnnouncement
from module.config import cfg
from io import BytesIO
from enum import Enum
import requests
import qrcode
class AnnouncementStatus(Enum):
class AnnouncementThread(QThread):
... | null |
17,281 | from PyQt5.QtCore import Qt, QThread, pyqtSignal
from qfluentwidgets import InfoBar, InfoBarPosition, StateToolTip
from urllib.parse import urlencode, urlparse, parse_qs
from win32api import CopyFile
from datetime import datetime
from pathlib import Path
from enum import Enum
import markdown
import requests
import temp... | null |
17,282 | from PyQt5.QtCore import Qt
from qfluentwidgets import InfoBar, InfoBarPosition
from ..card.messagebox_custom import MessageBoxDisclaimer
from module.config import cfg
import markdown
import base64
import time
import sys
import os
lass MessageBoxDisclaimer(MessageBoxHtml):
def __init__(self, title: str, content: s... | null |
17,283 | from PyQt5.QtCore import Qt, QThread, pyqtSignal
from qfluentwidgets import InfoBar, InfoBarPosition
from ..card.messagebox_custom import MessageBoxUpdate
from tasks.base.fastest_mirror import FastestMirror
from module.config import cfg
from packaging.version import parse
from enum import Enum
import subprocess
import ... | 检查更新,并根据更新状态显示不同的信息或执行更新操作。 |
17,284 | import subprocess
def subprocess_with_timeout(command, timeout, working_directory=None, env=None):
process = None
try:
process = subprocess.Popen(command, cwd=working_directory, env=env)
process.communicate(timeout=timeout)
if process.returncode == 0:
return True
except ... | null |
17,285 | from typing import Literal
import winreg
import os
The provided code snippet includes necessary dependencies for implementing the `get_game_auto_hdr` function. Write a Python function `def get_game_auto_hdr(game_path: str) -> Literal["enable", "disable", "unset"]` to solve the following problem:
Get the Auto HDR setti... | Get the Auto HDR setting for a specific game via Windows Registry. Parameters: - game_path: The file path to the game executable, ensuring Windows path conventions. Returns: - A Literal indicating the status of Auto HDR for the game: "enable", "disable", or "unset". |
17,286 | from typing import Literal
import winreg
import os
The provided code snippet includes necessary dependencies for implementing the `set_game_auto_hdr` function. Write a Python function `def set_game_auto_hdr(game_path: str, status: Literal["enable", "disable", "unset"] = "unset")` to solve the following problem:
Set, u... | Set, update, or unset the Auto HDR setting for a specific game via Windows Registry, without affecting other settings. Ensures the game path is an absolute path and raises exceptions on errors instead of printing. Parameters: - game_path: The file path to the game executable, ensuring Windows path conventions. - status... |
17,287 | from typing import Tuple, Optional
import winreg
import json
registry_key_path = r"SOFTWARE\miHoYo\崩坏:星穹铁道"
resolution_value_name = "GraphicsSettings_PCResolution_h431323223"
def read_registry_value(key, sub_key, value_name):
"""
Read the content of the specified registry value.
Parameters:
- key: The h... | Return the game resolution from the registry value. This function does not take any parameters. Returns: - If the registry value exists and data is valid, it returns a tuple (width, height, isFullScreen) representing the game resolution. - If the registry value does not exist or data is invalid, it returns None or rais... |
17,288 | from typing import Tuple, Optional
import winreg
import json
registry_key_path = r"SOFTWARE\miHoYo\崩坏:星穹铁道"
resolution_value_name = "GraphicsSettings_PCResolution_h431323223"
def write_registry_value(key, sub_key, value_name, data, mode) -> None:
"""
Write a registry value to the specified registry key.
Par... | Set the resolution of the game and whether it should run in fullscreen mode. Parameters: - width: The width of the game window. - height: The height of the game window. - is_fullscreen: Whether the game should run in fullscreen mode. |
17,289 | from typing import Tuple, Optional
import winreg
import json
registry_key_path = r"SOFTWARE\miHoYo\崩坏:星穹铁道"
graphics_value_name = "GraphicsSettings_Model_h2986158309"
def read_registry_value(key, sub_key, value_name):
"""
Read the content of the specified registry value.
Parameters:
- key: The handle of... | Return the game FPS settings from the registry value. This function does not take any parameters. |
17,290 | from typing import Tuple, Optional
import winreg
import json
registry_key_path = r"SOFTWARE\miHoYo\崩坏:星穹铁道"
graphics_value_name = "GraphicsSettings_Model_h2986158309"
def read_registry_value(key, sub_key, value_name):
"""
Read the content of the specified registry value.
Parameters:
- key: The handle of... | Set the FPS of the game. Parameters: - fps |
17,291 |
The provided code snippet includes necessary dependencies for implementing the `black` function. Write a Python function `def black(text)` to solve the following problem:
将文本颜色设置为黑色
Here is the function:
def black(text):
"""将文本颜色设置为黑色"""
return f"\033[30m{text}\033[0m" | 将文本颜色设置为黑色 |
17,292 |
The provided code snippet includes necessary dependencies for implementing the `grey` function. Write a Python function `def grey(text)` to solve the following problem:
将文本颜色设置为灰色
Here is the function:
def grey(text):
"""将文本颜色设置为灰色"""
return f"\033[90m{text}\033[0m" | 将文本颜色设置为灰色 |
17,293 |
The provided code snippet includes necessary dependencies for implementing the `red` function. Write a Python function `def red(text)` to solve the following problem:
将文本颜色设置为红色
Here is the function:
def red(text):
"""将文本颜色设置为红色"""
return f"\033[91m{text}\033[0m" | 将文本颜色设置为红色 |
17,294 |
The provided code snippet includes necessary dependencies for implementing the `green` function. Write a Python function `def green(text)` to solve the following problem:
将文本颜色设置为绿色
Here is the function:
def green(text):
"""将文本颜色设置为绿色"""
return f"\033[92m{text}\033[0m" | 将文本颜色设置为绿色 |
17,295 |
The provided code snippet includes necessary dependencies for implementing the `yellow` function. Write a Python function `def yellow(text)` to solve the following problem:
将文本颜色设置为黄色
Here is the function:
def yellow(text):
"""将文本颜色设置为黄色"""
return f"\033[93m{text}\033[0m" | 将文本颜色设置为黄色 |
17,296 |
The provided code snippet includes necessary dependencies for implementing the `blue` function. Write a Python function `def blue(text)` to solve the following problem:
将文本颜色设置为蓝色
Here is the function:
def blue(text):
"""将文本颜色设置为蓝色"""
return f"\033[94m{text}\033[0m" | 将文本颜色设置为蓝色 |
17,297 |
The provided code snippet includes necessary dependencies for implementing the `purple` function. Write a Python function `def purple(text)` to solve the following problem:
将文本颜色设置为紫色
Here is the function:
def purple(text):
"""将文本颜色设置为紫色"""
return f"\033[95m{text}\033[0m" | 将文本颜色设置为紫色 |
17,298 |
The provided code snippet includes necessary dependencies for implementing the `cyan` function. Write a Python function `def cyan(text)` to solve the following problem:
将文本颜色设置为青色
Here is the function:
def cyan(text):
"""将文本颜色设置为青色"""
return f"\033[96m{text}\033[0m" | 将文本颜色设置为青色 |
17,299 |
The provided code snippet includes necessary dependencies for implementing the `white` function. Write a Python function `def white(text)` to solve the following problem:
将文本颜色设置为白色
Here is the function:
def white(text):
"""将文本颜色设置为白色"""
return f"\033[97m{text}\033[0m" | 将文本颜色设置为白色 |
17,300 |
The provided code snippet includes necessary dependencies for implementing the `default` function. Write a Python function `def default(text)` to solve the following problem:
将文本颜色设置回默认颜色
Here is the function:
def default(text):
"""将文本颜色设置回默认颜色"""
return f"\033[39m{text}\033[0m" | 将文本颜色设置回默认颜色 |
17,301 | from fastapi import UploadFile
from functools import partial
from hashlib import sha256
from uuid import UUID
import aiofiles
import json
import re
from config import (
logger
)
_snake_1 = partial(re.compile(r'(.)((?<![^A-Za-z])[A-Z][a-z]+)').sub, r'\1_\2')
_snake_2 = partial(re.compile(r'([a-z0-9])([A-Z])').sub, r... | null |
17,302 | import random
import openai
import json
from langchain.docstore.document import Document as LangChainDocument
from langchain.embeddings.openai import OpenAIEmbeddings
from fastapi import HTTPException
from uuid import UUID, uuid4
from langchain.text_splitter import (
CharacterTextSplitter,
MarkdownTextSplitter
... | null |
17,303 | from fastapi import (
FastAPI,
File,
Depends,
HTTPException,
UploadFile
)
from fastapi.openapi.utils import get_openapi
from fastapi.staticfiles import StaticFiles
from sqlmodel import Session, select
from typing import (
List,
Optional,
Union,
Any
)
from datetime import datetime
imp... | null |
17,304 | from fastapi import (
FastAPI,
File,
Depends,
HTTPException,
UploadFile
)
from fastapi.openapi.utils import get_openapi
from fastapi.staticfiles import StaticFiles
from sqlmodel import Session, select
from typing import (
List,
Optional,
Union,
Any
)
from datetime import datetime
imp... | ## Get all active organizations Returns: List[OrganizationRead]: List of organizations |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.