id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
179,835
import codecs import os import re import typing as t import winreg from dataclasses import dataclass from module.device.platform.utils import cached_property, iter_folder from module.device.platform.emulator_base import EmulatorBase, EmulatorInstanceBase, EmulatorManagerBase class RegValue: name: str value: str...
List all values in a reg key
179,836
import codecs import os import re import typing as t import winreg from dataclasses import dataclass from module.device.platform.utils import cached_property, iter_folder from module.device.platform.emulator_base import EmulatorBase, EmulatorInstanceBase, EmulatorManagerBase def abspath(path): return os.path.abspa...
null
179,837
import os import re import typing as t from dataclasses import dataclass from module.device.platform.utils import cached_property, iter_folder def abspath(path): return os.path.abspath(path).replace('\\', '/')
null
179,838
import os import re import typing as t from dataclasses import dataclass from module.device.platform.utils import cached_property, iter_folder The provided code snippet includes necessary dependencies for implementing the `get_serial_pair` function. Write a Python function `def get_serial_pair(serial)` to solve the fo...
Args: serial (str): Returns: str, str: `127.0.0.1:5555+{X}` and `emulator-5554+{X}`, 0 <= X <= 32
179,839
import ctypes import re import subprocess import psutil from deploy.Windows.utils import DataProcessInfo from module.base.decorator import run_once from module.base.timer import Timer from module.device.connection import AdbDeviceWithStatus from module.device.platform.platform_base import PlatformBase from module.devic...
null
179,840
import ctypes import re import subprocess import psutil from deploy.Windows.utils import DataProcessInfo from module.base.decorator import run_once from module.base.timer import Timer from module.device.connection import AdbDeviceWithStatus from module.device.platform.platform_base import PlatformBase from module.devic...
null
179,841
import ctypes import re import subprocess import psutil from deploy.Windows.utils import DataProcessInfo from module.base.decorator import run_once from module.base.timer import Timer from module.device.connection import AdbDeviceWithStatus from module.device.platform.platform_base import PlatformBase from module.devic...
null
179,842
import ctypes import re import subprocess import psutil from deploy.Windows.utils import DataProcessInfo from module.base.decorator import run_once from module.base.timer import Timer from module.device.connection import AdbDeviceWithStatus from module.device.platform.platform_base import PlatformBase from module.devic...
Returns the window title as a string.
179,843
import ctypes import re import subprocess import psutil from deploy.Windows.utils import DataProcessInfo from module.base.decorator import run_once from module.base.timer import Timer from module.device.connection import AdbDeviceWithStatus from module.device.platform.platform_base import PlatformBase from module.devic...
null
179,844
import collections import itertools import sys from module.base.timer import Timer from module.device.app_control import AppControl from module.device.control import Control from module.device.screenshot import Screenshot from module.exception import ( EmulatorNotRunningError, GameNotRunningError, GameStuck...
INFO 21:07:31.554 │ Function calls: <string> L1 <module> spawn.py L116 spawn_main() spawn.py L129 _main() process.py L314 _bootstrap() process.py L108 run() process_manager.py L149 run_process() alas.py L285 loop() alas.py L69 run() src.py L55 rogue() rogue.py L36 run() rogue.py L18 rogue_once() entry.py L335 rogue_wor...
179,850
import random import re import socket import time import typing as t import uiautomator2 as u2 from adbutils import AdbTimeout from lxml import etree from module.base.decorator import cached_property from module.logger import logger The provided code snippet includes necessary dependencies for implementing the `remove...
Remove suffix of a string or bytes like `string.removesuffix(suffix)`, which is on Python3.9+ Args: s (str, bytes): suffix (str, bytes): Returns: str, bytes:
179,854
import re from functools import wraps import cv2 import numpy as np import time from adbutils.errors import AdbError from lxml import etree from module.base.decorator import Config from module.device.connection import Connection from module.device.method.utils import (RETRY_TRIES, retry_sleep, remove_prefix, handle_adb...
null
179,862
import typing as t from functools import wraps import cv2 import numpy as np import requests from adbutils.errors import AdbError from module.base.decorator import Config, cached_property, del_cached_property from module.base.timer import Timer from module.device.method.uiautomator_2 import Uiautomator2, ProcessInfo fr...
null
179,863
import ipaddress import logging import platform import re import socket import subprocess import time from functools import wraps import uiautomator2 as u2 from adbutils import AdbClient, AdbDevice, AdbTimeout, ForwardItem, ReverseItem from adbutils.errors import AdbError import module.config.server as server_ from mod...
null
179,864
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,865
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,866
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,867
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,868
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,869
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,870
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,876
import datetime import logging import os import sys from typing import Callable, List from rich.console import Console, ConsoleOptions, ConsoleRenderable, NewLine from rich.highlighter import NullHighlighter, RegexHighlighter from rich.logging import RichHandler from rich.rule import Rule from rich.style import Style f...
null
179,878
The provided code snippet includes necessary dependencies for implementing the `handle_sensitive_image` function. Write a Python function `def handle_sensitive_image(image)` to solve the following problem: Args: image: Returns: np.ndarray: Here is the function: def handle_sensitive_image(image): """ Args: ...
Args: image: Returns: np.ndarray:
179,879
def handle_sensitive_logs(logs): return logs
null
179,880
from module.logger import logger logger = logging.getLogger('alas') logger.setLevel(logging.DEBUG if logger_debug else logging.INFO) logger.addHandler(console_hdlr) logger.error = error_convert(logger.error) logger.hr = hr logger.attr = attr logger.attr_align = attr_align logger.set_file_logger...
null
179,881
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def str_presenter(dumper, data): if len(data.splitlines()) > 1: # check for mult...
null
179,882
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def filepath_args(filename='args', mod_name='alas'): return f'./module/config/arg...
null
179,883
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def filepath_argument(filename): return f'./module/config/argument/{filename}.yam...
null
179,884
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def filepath_config(filename, mod_name='alas'): if mod_name == 'alas': re...
null
179,885
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def filepath_code(): return './module/config/config_generated.py'
null
179,886
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `alas_...
Returns: list[str]: Name of all Alas instances, except `template`.
179,887
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `alas_...
Returns: list[str]: Name of all Alas instances, except `template`.
179,888
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `deep_...
Pop value from dictionary safely, imitating deep_get().
179,889
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `deep_...
Set default value into dictionary safely, imitating deep_get(). Value is set only when the dict doesn't contain such keys.
179,890
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `parse...
Convert a string to float, int, datetime, if possible. Args: value (str): data (dict): Returns:
179,891
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `data_...
| Condition | Type | | ------------------------------------ | -------- | | `value` is bool | checkbox | | Arg has `options` | select | | Arg has `stored` | select | | `Filter` is in name (in data['arg']) | textarea | | Rest of the args | input | Args: data (dict): kwargs: Any additional properties Returns: str:
179,892
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `data_...
Args: data (dict): Returns: str: <func>.<group>.<arg>
179,893
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `path_...
Convert dictionary keys in .yaml files to argument names in config. Args: path (str): Such as `Scheduler.ServerUpdate` Returns: str: Such as `Scheduler_ServerUpdate`
179,894
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `dict_...
Args: dictionary: Such as `{'path': 'Scheduler.ServerUpdate', 'value': True}` allow_none (bool): Returns: str: Such as `path='Scheduler.ServerUpdate', value=True`
179,895
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def random_normal_distribution_int(a, b, n=3): """ A non-numpy implementation ...
Ensure to be time. Args: second (int, float, tuple): time, such as 10, (10, 30), '10, 30' n (int): The amount of numbers in simulation. Default to 5. precision (int): Decimals. Returns: float:
179,896
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def get_os_next_reset(): """ Get the first day of next month. Returns: ...
Returns: int: number of days before next opsi reset
179,897
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def get_server_last_update(daily_trigger): """ Args: daily_trigger (li...
Args: daily_trigger (list[str], str): [ "00:00", "12:00", "18:00",] Returns: datetime.datetime
179,898
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def get_server_next_update(daily_trigger): """ Args: daily_trigger (li...
Args: daily_trigger (list[str], str): [ "00:00", "12:00", "18:00",] Returns: datetime.datetime
179,899
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `neare...
Get the neatest future time. Return the last one if two things will finish within `interval`. Args: future (list[datetime.datetime]): interval (int): Seconds Returns: datetime.datetime:
179,900
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def server_time_offset() -> timedelta: """ To convert local time to server tim...
Get nearest weekday date starting from current date Args: target (int): target weekday to calculate Returns: datetime.datetime
179,901
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write def server_time_offset() -> timedelta: """ To convert local time to server tim...
Returns: int: The server's current day of the week
179,902
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write The provided code snippet includes necessary dependencies for implementing the `to_li...
Args: text (str): Such as `1, 2, 3` length (int): If there's only one digit, return a list expanded to given length, i.e. text='3', length=5, returns `[3, 3, 3, 3, 3]` Returns: list[int]:
179,903
import json import os import random import string from datetime import datetime, timedelta, timezone import yaml from filelock import FileLock import module.config.server as server_ from module.config.atomicwrites import atomic_write if __name__ == '__main__': get_os_reset_remain() The provided code snippet includ...
Convert any types or any objects to a string。 Remove <> to prevent them from being parsed as HTML tags. Args: typ: Returns: str: Such as `int`, 'datetime.datetime'.
179,904
import re import typing as t from copy import deepcopy from cached_property import cached_property from deploy.Windows.utils import DEPLOY_TEMPLATE, poor_yaml_read, poor_yaml_write from module.base.timer import timer from module.config.convert import * from module.config.server import VALID_SERVER from module.config.ut...
null
179,905
import re import typing as t from copy import deepcopy from cached_property import cached_property from deploy.Windows.utils import DEPLOY_TEMPLATE, poor_yaml_read, poor_yaml_write from module.base.timer import timer from module.config.convert import * from module.config.server import VALID_SERVER from module.config.ut...
null
179,906
def convert_daily(value): if value == "Calyx_Crimson_Hunt": value = "Calyx_Crimson_The_Hunt" return value
null
179,907
def convert_20_dungeon(value): if value == 'Calyx_Golden_Memories': return 'Calyx_Golden_Memories_Jarilo_VI' if value == 'Calyx_Golden_Aether': return 'Calyx_Golden_Aether_Jarilo_VI' if value == 'Calyx_Golden_Treasures': return 'Calyx_Golden_Treasures_Jarilo_VI' if value == 'Ca...
null
179,908
from datetime import datetime from functools import cached_property as functools_cached_property from module.base.decorator import cached_property from module.config.utils import DEFAULT_TIME, deep_get, get_server_last_monday_update, get_server_last_update from module.exception import ScriptError def now(): return...
null
179,909
from datetime import datetime from functools import cached_property as functools_cached_property from module.base.decorator import cached_property from module.config.utils import DEFAULT_TIME, deep_get, get_server_last_monday_update, get_server_last_update from module.exception import ScriptError The provided code sni...
Args: cls: Class or object Yields: str, obj: Attribute name, attribute value
179,910
import copy import datetime import operator import threading import pywebio from module.base.decorator import cached_property, del_cached_property from module.base.filter import Filter from module.config.config_generated import GeneratedConfig from module.config.config_manual import ManualConfig, OutputConfig from modu...
Args: name (str): Returns: Function:
179,911
lang = 'cn' def release_resources(next_task=''): # Release all OCR models # det models take 400MB if not next_task: from module.ocr.models import OCR_MODEL OCR_MODEL.resource_release() # Release assets cache # module.ui has about 80 assets and takes about 3MB # Alas has about 8...
Change language and this will affect globally, including assets and language specific methods. Args: lang_: package name or server.
179,912
VALID_SERVER = { 'CN-Official': 'com.miHoYo.hkrpg', 'CN-Bilibili': 'com.miHoYo.hkrpg.bilibili', 'OVERSEA-America': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-Asia': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-Europe': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-TWHKMO': 'com.HoYoverse.hkrpgoversea', } The pr...
Convert package/server to server. To unknown packages, consider they are a CN channel servers.
179,913
VALID_SERVER = { 'CN-Official': 'com.miHoYo.hkrpg', 'CN-Bilibili': 'com.miHoYo.hkrpg.bilibili', 'OVERSEA-America': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-Asia': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-Europe': 'com.HoYoverse.hkrpgoversea', 'OVERSEA-TWHKMO': 'com.HoYoverse.hkrpgoversea', } The pr...
Convert package/server to package.
179,926
import datetime import operator import re import sys import threading import time import traceback from queue import Queue from typing import Callable, Generator, List import pywebio from module.config.utils import deep_iter from module.logger import logger from module.webui.setting import State from pywebio.input impo...
null
179,930
import argparse import queue import threading import time from datetime import datetime from functools import partial from typing import Dict, List, Optional from pywebio import config as webconfig from pywebio.output import ( Output, clear, close_popup, popup, put_button, put_buttons, put_c...
null
179,931
from filelock import FileLock from deploy.Windows.config import DeployConfig as _DeployConfig from deploy.Windows.utils import * def poor_yaml_read_with_lock(file): if not os.path.exists(file): return {} with FileLock(f"{file}.lock"): return poor_yaml_read(file)
null
179,932
from filelock import FileLock from deploy.Windows.config import DeployConfig as _DeployConfig from deploy.Windows.utils import * def poor_yaml_write_with_lock(data, file, template_file=DEPLOY_TEMPLATE): folder = os.path.dirname(file) if not os.path.exists(folder): os.mkdir(folder) with FileLock(f"...
null
179,933
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,934
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,935
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,936
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,937
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,938
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,939
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,940
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,941
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,942
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,943
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,944
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
Args: type_: Type defined in _widget_type_to_func and argument.yaml Returns: str: Html element name
179,945
import copy import json import random import string from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Union from pywebio.exceptions import SessionException from pywebio.io_ctrl import Output from pywebio.output import * from pywebio.session import eval_js, local, run_js from rich.console...
null
179,946
from pywebio.input import (actions, checkbox, input, input_group, input_update, select) from pywebio.output import put_buttons, put_markdown from pywebio.session import defer_call, hold, run_js, set_env import module.webui.lang as lang from module.config.utils import (LANGUAGES, deep_get, dee...
Translate Alas
179,947
from module.config.config import AzurLaneConfig def start_ocr_server_process(*args, **kwargs): pass
null
179,948
from module.config.config import AzurLaneConfig def stop_ocr_server_process(*args, **kwargs): pass
null
179,949
from module.config.config import AzurLaneConfig class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher): stop_event: threading.Event = None bound = {} # Class property is_hoarding_task = True def __setattr__(self, key, value): if key in self.bound: pa...
null
179,950
from module.config.config import AzurLaneConfig The provided code snippet includes necessary dependencies for implementing the `get_config_mod` function. Write a Python function `def get_config_mod(config_name)` to solve the following problem: Args: config_name (str): Here is the function: def get_config_mod(config_...
Args: config_name (str):
179,951
from module.config.config import AzurLaneConfig def mod_instance(): return []
null
179,952
from module.config.config import AzurLaneConfig def init_discord_rpc(): pass
null
179,953
from module.config.config import AzurLaneConfig def close_discord_rpc(): pass
null
179,954
import time from typing import Dict from module.config.utils import * from module.webui.fake import list_mod from module.webui.setting import State LANG = "zh-CN" class State: """ Shared settings """ _init = False _clearup = False restart_event: threading.Event = None manager: SyncManager...
null
179,955
import time from typing import Dict from module.config.utils import * from module.webui.fake import list_mod from module.webui.setting import State def t(s, *args, **kwargs): """ Get translation. other args, kwargs pass to .format() """ if TRANSLATE_MODE: return s return _t(s, LANG).form...
Convert "2023-08-29 12:30:53" to "3 Minutes Ago"
179,956
import json import shlex import threading import time from subprocess import PIPE, Popen from typing import TYPE_CHECKING from module.logger import logger from module.config.utils import random_id from module.webui.setting import State _ssh_thread: threading.Thread = None def start_remote_access_service_(**kwargs): ...
null
179,958
import re from module.base.decorator import cached_property def get_assets_from_file(file): assets = set() regex = re.compile(r"file='(.*?)'") with open(file, 'r', encoding='utf-8') as f: for row in f.readlines(): result = regex.search(row) if result: assets....
null
179,964
import module.config.server as server from module.base.decorator import cached_property, del_cached_property from module.base.resource import Resource from module.base.utils import * from module.exception import ScriptError The provided code snippet includes necessary dependencies for implementing the `match_template`...
Args: image (np.ndarray): Screenshot template (np.ndarray): area (tuple): Crop area of image. offset (int, tuple): Detection area offset. similarity (float): 0-1. Similarity. Lower than this value will return float(0). Returns: bool:
179,969
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `area2corner` function. Write a Python function `def area2corner(area)` to solve the following problem: Args: area: (x1, y1, x2, y2) Returns: np.ndarray: [upper-left,...
Args: area: (x1, y1, x2, y2) Returns: np.ndarray: [upper-left, upper-right, bottom-left, bottom-right]
179,970
import numpy as np from scipy import optimize from .utils import area_pad def corner2area(corner): """ Args: corner: [upper-left, upper-right, bottom-left, bottom-right] Returns: np.ndarray: (x1, y1, x2, y2) """ x, y = np.array(corner).T return np.rint([np.min(x), np.min(y), np.m...
Convert corners of a trapezoid to area. Args: corner: ((x0, y0), (x1, y1), (x2, y2), (x3, y3)) pad (int): Positive value for inscribed area. Negative value and 0 for circumscribed area. Returns: tuple[int]: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y).
179,971
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `points_to_area_generator` function. Write a Python function `def points_to_area_generator(points, shape)` to solve the following problem: Args: points (np.ndarray): ...
Args: points (np.ndarray): N x 2 array. shape (tuple): (x, y). Yields: tuple, np.ndarray: (x, y), [upper-left, upper-right, bottom-left, bottom-right]
179,972
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `get_map_inner` function. Write a Python function `def get_map_inner(points)` to solve the following problem: Args: points (np.ndarray): N x 2 array. Yields: np.ndarr...
Args: points (np.ndarray): N x 2 array. Yields: np.ndarray: (x, y).
179,973
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `separate_edges` function. Write a Python function `def separate_edges(edges, inner)` to solve the following problem: Args: edges: A iterate object which contains flo...
Args: edges: A iterate object which contains float ot integer. inner (float, int): A inner point to separate edges. Returns: float, float: Lower edge and upper edge. if not found, return None
179,974
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `perspective_transform` function. Write a Python function `def perspective_transform(points, data)` to solve the following problem: Args: points: A 2D array with shap...
Args: points: A 2D array with shape (n, 2) data: Perspective data, a 2D array with shape (3, 3), see https://web.archive.org/web/20150222120106/xenia.media.mit.edu/~cwren/interpolator/ Returns: np.ndarray: 2D array with shape (n, 2)
179,975
import numpy as np from scipy import optimize from .utils import area_pad The provided code snippet includes necessary dependencies for implementing the `fit_points` function. Write a Python function `def fit_points(points, mod, encourage=1)` to solve the following problem: Get a closet point in a group of points with...
Get a closet point in a group of points with common difference. Will ignore points in the distance. Args: points: Points on image, a 2D array with shape (n, 2) mod: Common difference of points, (x, y). encourage (int, float): Describe how close to fit a group of points, in pixel. Smaller means closer to local minimum, ...
179,981
import re import cv2 import numpy as np from PIL import Image The provided code snippet includes necessary dependencies for implementing the `area_center` function. Write a Python function `def area_center(area)` to solve the following problem: Get the center of an area Args: area: (upper_left_x, upper_left_y, bottom_...
Get the center of an area Args: area: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y) Returns: tuple: (x, y)
179,986
import re import cv2 import numpy as np from PIL import Image REGEX_NODE = re.compile(r'(-?[A-Za-z]+)(-?\d+)') def name2col(col_str): """ Convert a cell reference in A1 notation to a zero indexed row and column. Args: col_str: A1 style string. Returns: row, col: Zero indexed cell row and...
See location2node() Args: node (str): Example: 'E3' Returns: tuple[int]: Example: (4, 2)
179,992
import re import cv2 import numpy as np from PIL import Image The provided code snippet includes necessary dependencies for implementing the `rgb2gray` function. Write a Python function `def rgb2gray(image)` to solve the following problem: Args: image (np.ndarray): Shape (height, width, channel) Returns: np.ndarray: S...
Args: image (np.ndarray): Shape (height, width, channel) Returns: np.ndarray: Shape (height, width)
180,008
from typing import Optional import numpy as np from module.base.decorator import cached_property from module.base.timer import Timer from module.logger import logger from tasks.character.switch import CharacterSwitch from tasks.map.keywords import MapPlane from tasks.map.keywords.plane import ( Herta_MasterControlZ...
null
180,009
from module.base.decorator import cached_property from module.base.timer import Timer from module.exception import RequestHumanTakeover from module.logger import logger from tasks.rogue.assets.assets_rogue_path import * from tasks.rogue.assets.assets_rogue_ui import ROGUE_LAUNCH from tasks.rogue.blessing.ui import Rogu...
Inner offset an area. Args: area: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y). pad (tuple): Returns: tuple: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y).