id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
145,372
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check if a class is an Optional. Args: cls: The class to check. Returns: Whether the class is an Optional.
145,373
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check if an attribute can be accessed on the cls and return its type. Supports pydantic models, unions, and annotated attributes on rx.Model. Args: cls: The class to check. name: The name of the attribute to check. Returns: The type of the attribute, if accessible, or None
145,374
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check if the given value is a dataframe. Args: value: The value to check. Returns: Whether the value is a dataframe.
145,375
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check if the given type is a valid prop type. Args: type_: The type to check. Returns: Whether the type is a valid prop type.
145,376
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check if this variable name correspond to a backend variable. Args: name: The name of the variable to check cls: The class of the variable to check Returns: bool: The result of the check
145,377
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check that a value type is found in a list of allowed types. Args: value_type: Type of value. allowed_types: Iterable of allowed types. Returns: If the type is found in the allowed types.
145,378
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Check that a prop value is in a list of allowed types. Does the check in a way that works regardless if it's a raw value or a state Var. Args: prop: The prop to check. allowed_types: The list of allowed types. Returns: If the prop type match one of the allowed_types.
145,379
from __future__ import annotations import contextlib import inspect import types from functools import wraps from typing import ( Any, Callable, Iterable, List, Literal, Optional, Type, Union, _GenericAlias, # type: ignore get_args, get_origin, get_type_hints, ) import s...
Decorator to check that the arguments passed to a function correspond to the correct function parameter if it (the parameter) is a literal type. Args: func: The function to validate. Returns: The wrapper function.
145,380
from __future__ import annotations import hashlib import json import os import platform import re import sys from pathlib import Path from urllib.parse import urljoin import psutil from reflex import constants from reflex.config import get_config from reflex.utils import console, path_ops from reflex.utils.watch import...
Whether the app is running in a testing environment. Returns: True if the app is running in under pytest.
145,381
from __future__ import annotations import glob import importlib import inspect import json import os import platform import random import re import stat import sys import tempfile import zipfile from datetime import datetime from fileinput import FileInput from pathlib import Path from types import ModuleType from typi...
Get the asynchronous redis client. Returns: The asynchronous redis client.
145,382
from __future__ import annotations import glob import importlib import inspect import json import os import platform import random import re import stat import sys import tempfile import zipfile from datetime import datetime from fileinput import FileInput from pathlib import Path from types import ModuleType from typi...
Get the production backend URL. Returns: The production backend URL.
145,383
from __future__ import annotations import glob import importlib import inspect import json import os import platform import random import re import stat import sys import tempfile import zipfile from datetime import datetime from fileinput import FileInput from pathlib import Path from types import ModuleType from typi...
Remove existing bun installation.
145,384
from __future__ import annotations import glob import importlib import inspect import json import os import platform import random import re import stat import sys import tempfile import zipfile from datetime import datetime from fileinput import FileInput from pathlib import Path from types import ModuleType from typi...
Decorator to cache the runs of a procedure on disk. Procedures should not have a return value. Args: cache_file: The file to store the cache payload in. payload_fn: Function that computes cache payload from function args Returns: The decorated function.
145,385
from __future__ import annotations import glob import importlib import inspect import json import os import platform import random import re import stat import sys import tempfile import zipfile from datetime import datetime from fileinput import FileInput from pathlib import Path from types import ModuleType from typi...
Installs the base and custom frontend packages. Args: packages: A list of package names to be installed. config: The config object. Example: >>> install_frontend_packages(["react", "react-dom"], get_config())
145,386
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a python type. Args: value: the type to serialize. Returns: The serialized type.
145,387
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a string. Args: value: The string to serialize. Returns: The serialized string.
145,388
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a primitive type. Args: value: The number/bool/None to serialize. Returns: The serialized number/bool/None.
145,389
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a Base instance. Args: value : The Base to serialize. Returns: The serialized Base.
145,390
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a list to a JSON string. Args: value: The list to serialize. Returns: The serialized list.
145,391
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a datetime to a JSON string. Args: dt: The datetime to serialize. Returns: The serialized datetime.
145,392
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a color. Args: color: The color to serialize. Returns: The serialized color.
145,393
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a pandas dataframe. Args: df: The dataframe to serialize. Returns: The serialized dataframe.
145,394
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a plotly figure. Args: figure: The figure to serialize. Returns: The serialized figure.
145,395
from __future__ import annotations import json import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union, get_type_hints from reflex.base import Base from reflex.constants.colors import Color, format_color fro...
Serialize a plotly figure. Args: image: The image to serialize. Returns: The serialized image.
145,396
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var The provided code...
Indent the given text by the given indent level. Args: text: The text to indent. indent_level: The indent level. Returns: The indented text.
145,397
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var The provided code...
Convert a string from snake case to title case. Args: text: The string to convert. Returns: The title case string.
145,398
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var def to_kebab_case(...
Format the given route. Args: route: The route to format. format_case: whether to format case to kebab case. Returns: The formatted route.
145,399
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var class Var: ""...
Format a match expression whose return type is a Var. Args: cond: The condition. match_cases: The list of cases to match. default: The default case. Returns: The formatted match expression
145,400
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var def format_prop( ...
Format the tag's props. Args: single_props: Props that are not key-value pairs. key_value_props: Props that are key-value pairs. Returns: The formatted props list.
145,401
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var def format_var(var...
Format an event chain as a javascript invocation. Args: event_chain: The event chain to queue on the frontend. event_arg: The browser-native event (only used to preventDefault). Returns: Compiled javascript code to queue the given event chain on the frontend. Raises: ValueError: When the given event chain is not a vali...
145,402
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var The provided code...
Format a state name, replacing dots with double underscore. This allows individual substates to be accessed independently as javascript vars without using dot notation. Args: state_name: The state name to format. Returns: The formatted state name.
145,403
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var class Var: ""...
Format a ref accessed by array. Args: refs : The ref array to access. idx : The index of the ref in the array. Returns: The formatted ref.
145,404
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var The provided code...
Take a route and return a list of tuple for use in breadcrumb. Args: route: The route to transform. Returns: list[tuple[str, str]]: the list of tuples for the breadcrumb.
145,405
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var The provided code...
Collapse keys with consecutive suffixes into a single list value. Separators dash and underscore are removed, unless this would overwrite an existing key. Args: form_dict: The dict to collapse. Returns: The collapsed dict.
145,406
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var ) class BaseVar(V...
Format a given column into the proper format. Args: col: The column. Raises: ValueError: invalid type provided for column. Returns: The formatted column.
145,407
from __future__ import annotations import inspect import json import os import re from typing import TYPE_CHECKING, Any, List, Union from reflex import constants from reflex.utils import exceptions, serializers, types from reflex.utils.serializers import serialize from reflex.vars import BaseVar, Var class Var: ""...
Format a given data into a renderable cell for data_editor. Args: cell: The data to format. Returns: The formatted cell.
145,408
from __future__ import annotations import json import os import re import shutil from pathlib import Path from reflex import constants def rm(path: str): """Remove a file or directory. Args: path: The path to the file or directory. """ if os.path.isdir(path): shutil.rmtree(path) elif...
Create a symbolic link. Args: src: The path to the file or directory. dest: The path to the destination. overwrite: Whether to overwrite the destination. Returns: Whether the link was successful.
145,409
from __future__ import annotations import json import os import subprocess import zipfile from pathlib import Path from rich.progress import MofNCompleteColumn, Progress, TimeElapsedColumn from reflex import constants from reflex.config import get_config from reflex.utils import console, path_ops, prerequisites, proces...
Set os environment variables. Args: kwargs: env key word args.
145,410
from __future__ import annotations from contextlib import contextmanager from typing import Generator, Iterator from selenium.webdriver.remote.webdriver import WebDriver from reflex.testing import AppHarness class AppHarness: """AppHarness executes a reflex app in-process for testing.""" app_name: str app...
Wait for driver url to change. Use as a contextmanager, and apply the navigation event inside the context block, polling will occur after the context block exits. Args: driver: WebDriver instance. timeout: Time to wait for url to change. Yields: None
145,415
import ast import contextlib import importlib import inspect import logging import re import subprocess import sys import textwrap import typing from inspect import getfullargspec from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace from typing import Any, C...
Walk all files in a path. This can be replaced with Path.walk() in python3.12. Args: path: The path to walk. Yields: The next file in the path.
145,416
import ast import contextlib import importlib import inspect import logging import re import subprocess import sys import textwrap import typing from inspect import getfullargspec from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace from typing import Any, C...
Get the list of changed files since the last run of the generator. Returns: The list of changed files, or None if all files should be regenerated.
145,417
import ast import contextlib import importlib import inspect import logging import re import subprocess import sys import textwrap import typing from inspect import getfullargspec from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace from typing import Any, C...
Generate the import statements for the stub file. Args: typing_imports: The typing imports to include. Returns: The list of import statements.
145,418
import ast import contextlib import importlib import inspect import logging import re import subprocess import sys import textwrap import typing from inspect import getfullargspec from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace from typing import Any, C...
Generate the __call__ function definition for a SimpleNamespace. Args: clz_name: The name of the SimpleNamespace class to generate the __call__ functiondef for. classes: Map name to actual class definition. type_hint_globals: The globals to use to resolving a type hint str. Returns: The create functiondef node for the ...
145,419
import ast import contextlib import importlib import inspect import logging import re import subprocess import sys import textwrap import typing from inspect import getfullargspec from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace from typing import Any, C...
Generate a pyi file for the main __init__.py.
145,421
The provided code snippet includes necessary dependencies for implementing the `pop_from_dict_by_set` function. Write a Python function `def pop_from_dict_by_set(dictionary: dict, valid_keys: set) -> dict` to solve the following problem: remove and create new dict with key value pairs of dictionary, where key is in v...
remove and create new dict with key value pairs of dictionary, where key is in valid_keys
145,422
The provided code snippet includes necessary dependencies for implementing the `check_kwargs_empty` function. Write a Python function `def check_kwargs_empty(kwargs_dict, raise_error=False) -> bool` to solve the following problem: returns True if kwargs are empty, False otherwise, raises error if not empty Here is t...
returns True if kwargs are empty, False otherwise, raises error if not empty
145,423
import customtkinter import tkinterDnD print(type(app), isinstance(app, tkinterDnD.Tk)) combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."]) combobox_1.pack(pady=10, padx=10) combobox_1.set("CTkComboBox") def button_callback(): print("Button click", combob...
null
145,424
import customtkinter import tkinterDnD progressbar_1 = customtkinter.CTkProgressBar(master=frame_1) progressbar_1.pack(pady=10, padx=10) def slider_callback(value): progressbar_1.set(value)
null
145,425
from PIL import Image, ImageOps import numpy as np import numpy.typing as npt import cv2 from pathlib import Path import logging from pkg_resources import resource_filename def resolve_ad_filepath(file_name: str, file_type: str) -> Path: """ Given input filename, attempts to find the file, first by relative to ...
Given path to input image file, opens it, flips it based on EXIF tags, if present, and returns image with proper orientation.
145,426
import numpy as np import numpy.typing as npt import logging def get_projection_matrix(buffer_w: int, buffer_h: int, type_: str = 'perspective') -> npt.NDArray[np.float32]: if type_ == 'perspective': fov = 35.0 near = 0.1 aspect = buffer_w / buffer_h top = near * np.tan(fov * np.p...
null
145,427
import numpy as np import numpy.typing as npt from collections import defaultdict import logging from typing import List, Dict, Set, Tuple import scipy.sparse.linalg as spla import scipy.sparse as sp The provided code snippet includes necessary dependencies for implementing the `plot_mesh` function. Write a Python fun...
Helper function to visualize mesh deformation outputs
145,428
import argparse import base64 from flask import Flask, render_template, request import json import os import sys import yaml global cfg_path global char_folder def load_cfg(path): with open(path, "r") as f: cfg_text = f.read() cfg_yaml = yaml.load(cfg_text, Loader=yaml.Loader) return cfg_yaml d...
null
145,429
import argparse import base64 from flask import Flask, render_template, request import json import os import sys import yaml def process(request): try: formdata = request.form.get('data') except Exception as e: return None, f"Error parsing data from request. No JSON data was found: {e}" try:...
null
145,430
from image_to_annotations import image_to_annotations from annotations_to_animation import annotations_to_animation from pathlib import Path import logging import sys from pkg_resources import resource_filename def image_to_annotations(img_fn: str, out_dir: str) -> None: """ Given the RGB image located at img_...
Given the image located at img_fn, create annotation files needed for animation. Then create animation from those animations and motion cfg and retarget cfg.
145,431
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,432
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,433
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,434
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,435
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,436
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,437
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,438
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
if thread is set to true, effecs of r are eliminated
145,439
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,440
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,441
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,442
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,443
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,444
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,445
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,446
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,447
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,448
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
This function checks if the given hwnd is not part of the *TextInputHost.exe process family. This function should be called as an individual thread
145,449
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,450
from ctypes import c_int, windll from functools import partial import json import time import datetime from versions import * import os import sys import winreg import locale from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * import platform import win32gui from external.blurwindow...
null
145,451
from ctypes import c_int, windll import io from types import FunctionType from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * def updateIfPossible(): print("🟡 updateIfPossible function has not been defined yet!")
null
145,452
from ctypes import c_int, windll import io from types import FunctionType from PySide6.QtGui import * from PySide6.QtCore import * from PySide6.QtWidgets import * def closeClocks(): print("🟡 closeClocks function has not been defined yet!")
null
145,453
import os languageReference = { "default": "System language", "ar" : "Arabic - عربي‎", "bg" : "Bulgarian - български", "bn" : "Bangla - বাংলা", "bs" : "Bosnian - Bosanski", "ca" : "Catalan - Català", "cs" : "Czech - Čeština", "da" : "Danish - Dansk", "de" : "G...
null
145,454
import os contributors = [ "marticliment", "panther7", "kirill-d-lappo", "Lilobast", "BoyceLig", "sinusinu", "Seeloewen", "VenusGirl", "noname-ctrl", "ShintakuNobuhiro", "xsm1997", "yrjarv", "wanderleihuttel", "mmis1000", "jameshamm", "jmlcoliveira", "viktak", "richeyphu", "jstmrb...
null
145,455
import ctypes ZwUpdateWnfStateData = ctypes.windll.ntdll.ZwUpdateWnfStateData dataBuffer = ctypes.create_string_buffer(4096) bufferSize = ctypes.c_ulong(ctypes.sizeof(dataBuffer)) def DoWrite(StateName, Data): StateName = ctypes.c_longlong(int(StateName, 16)) dataBuffer = ctypes.c_char_p(Data) bufferSize =...
null
145,456
import ctypes def DoRead(StateName) -> bytes: _, _, dataBuffer, bufferSize = ReadWnfData(int(StateName, 16)) return dataBuffer.raw[0:bufferSize] def isFocusAssistEnabled() -> bool: try: return not DoRead("0xd83063ea3bf1c75") == b'\x00\x00\x00\x00' except Exception as e: print(e) ...
null
145,457
import ctypes def DoRead(StateName) -> bytes: _, _, dataBuffer, bufferSize = ReadWnfData(int(StateName, 16)) return dataBuffer.raw[0:bufferSize] def getNotificationNumber() -> int: try: res = DoRead("0xd83063ea3bc1035")[0] assert type(res) == int, "Invalid value for notification number" ...
null
145,458
import sys import os def fileReplaceLinesWith(filename: str, list: dict[str, str], encoding="utf-8"): f = open(filename, "r+", encoding=encoding, errors="ignore") data = "" for line in f.readlines(): match = False for key, value in list.items(): if (line....
null
145,459
import argparse import json from time import sleep import tolgee_requests import translation_utils __args = __parser.parse_args() def create(strs: list[str]): count = len(strs) i = 1 for key in strs: print(f"[{i}/{count}] Key: {encode_str(key, strip=100)}") i += 1 if not __args.yes a...
null
145,460
def initialize(context): # 设定沪深300作为基准 set_benchmark('000300.XSHG') # 用真实价格交易 set_option('use_real_price', True) # 打开防未来函数 set_option("avoid_future_data", True) # 将滑点设置为0 set_slippage(FixedSlippage(0.001)) # 设置交易成本万分之三 set_order_cost(OrderCost(open_tax=0, close_tax=0, open_comm...
null
145,461
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math current_dt = time.strftime("%Y-%m-%d", time.localtime()) current_dt = datetime.strptime(current_dt, '%Y-%m-%d') previous_date = current_dt - timedelta(days = day) df = jq.get_fundamentals_continuo...
null
145,462
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math securities = jq.get_all_securities() stock_code = securities[securities['display_name'] == stock_name].index[0] return stock_code def get_stock_code(stock_name): securities = jq.get_all_securities...
null
145,463
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math current_dt = time.strftime("%Y-%m-%d", time.localtime()) current_dt = datetime.strptime(current_dt, '%Y-%m-%d') previous_date = current_dt - timedelta(days = day) current_dt = time.strftime("%...
null
145,464
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math stock_pool = [ '159915.XSHE', # 易方达创业板ETF '510300.XSHG', # 华泰柏瑞沪深300ETF '510500.XSHG', # 南方中证500ETF ] current_dt = time.strftime("%Y-%m-%d", time.localtime()) current_dt = datetime.strptime(cur...
null
145,465
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math from sendmail import mail current_dt = datetime.strptime(current_dt, '%Y-%m-%d') previous_date = current_dt - timedelta(days = day) print("#" * 30 + "候选" + "#" * 30) print('#' * 64) ("%...
null
145,466
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math from sendmail import mail def get_stock_code(stock_name): securities = jq.get_all_securities() stock_code = securities[securities['display_name'] == stock_name].index[0] return stock_code
null
145,467
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math from sendmail import mail current_dt = datetime.strptime(current_dt, '%Y-%m-%d') previous_date = current_dt - timedelta(days = day) data = jq.get_price(stock, end_date = previous_date, cou...
null
145,468
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math from sendmail import mail stock_pool = [ '159915.XSHE', # 易方达创业板ETF '510300.XSHG', # 华泰柏瑞沪深300ETF '510500.XSHG', # 南方中证500ETF ] current_dt = datetime.strptime(current_dt, '%Y-%m-%d') pr...
null
145,469
import jqdatasdk as jq from datetime import datetime, timedelta import time import numpy as np import math from sendmail import mail stock_pool = [ '159915.XSHE', # 易方达创业板ETF '510300.XSHG', # 华泰柏瑞沪深300ETF '510500.XSHG', # 南方中证500ETF ] current_dt = datetime.strptime(current_dt, '%Y-%m-%d') print(...
null
145,470
from beir import util, LoggingHandler from beir.datasets.data_loader import GenericDataLoader from beir.retrieval.evaluation import EvaluateRetrieval import pathlib, os, csv, random import sys import argparse import logging csv.field_size_limit(sys.maxsize) def tsv_reader(input_filepath): reader = csv.reader(open(...
null
145,471
import torch from colbert.modeling.colbert import ColBERT from colbert.modeling.tokenization import QueryTokenizer, DocTokenizer from colbert.utils.amp import MixedPrecisionManager from colbert.parameters import DEVICE def _stack_3D_tensors(groups): bsize = sum([x.size(0) for x in groups]) maxlen = max([x.size...
null
145,472
import torch def _split_into_batches(ids, mask, bsize): batches = [] for offset in range(0, ids.size(0), bsize): batches.append((ids[offset:offset+bsize], mask[offset:offset+bsize])) return batches def tensorize_triples(query_tokenizer, doc_tokenizer, queries, positives, negatives, bsize): asse...
null
145,473
import torch def _sort_by_length(ids, mask, bsize): if ids.size(0) <= bsize: return ids, mask, torch.arange(ids.size(0)) indices = mask.sum(-1).sort().indices reverse_indices = indices.sort().indices return ids[indices], mask[indices], reverse_indices
null
145,474
import os import random import time import torch import torch.nn as nn import numpy as np from transformers import AdamW, BertConfig from colbert.utils.runs import Run from colbert.utils.amp import MixedPrecisionManager from colbert.training.lazy_batcher import LazyBatcher from colbert.training.eager_batcher import Eag...
null
145,475
import os import torch from colbert.utils.runs import Run from colbert.utils.utils import print_message, save_checkpoint from colbert.parameters import SAVED_CHECKPOINTS def print_progress(scores): positive_avg, negative_avg = round(scores[:, 0].mean().item(), 2), round(scores[:, 1].mean().item(), 2) print("#>...
null
145,476
import os import torch from colbert.utils.runs import Run from colbert.utils.utils import print_message, save_checkpoint from colbert.parameters import SAVED_CHECKPOINTS def manage_checkpoints(args, colbert, optimizer, batch_idx): arguments = args.input_arguments.__dict__ path = os.path.join(Run.path, 'checkp...
null