id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
19,978
import torch from mmcv.parallel import MMDataParallel, MMDistributedDataParallel def is_npu_available(): """Returns a bool indicating if NPU is currently available.""" return hasattr(torch, 'npu') and torch.npu.is_available() The provided code snippet includes necessary dependencies for implementing the `get_d...
Returns an available device, cpu, cuda or npu.
19,979
import logging from mmcv.utils import get_logger The provided code snippet includes necessary dependencies for implementing the `get_root_logger` function. Write a Python function `def get_root_logger(log_file=None, log_level=logging.INFO)` to solve the following problem: Get root logger. Args: log_file (str): File pa...
Get root logger. Args: log_file (str): File path of log. Defaults to None. log_level (int): The level of logger. Defaults to logging.INFO. Returns: :obj:`logging.Logger`: The obtained logger
19,980
import argparse import copy import os import os.path as osp import time import warnings import mmcv import torch import torch.distributed as dist from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist from mmdet.apis import set_random_seed from mmtrack import __version__ from mmtrack.apis ...
null
19,981
from argparse import ArgumentParser, Namespace from pathlib import Path from tempfile import TemporaryDirectory import mmcv The provided code snippet includes necessary dependencies for implementing the `mmtrack2torchserve` function. Write a Python function `def mmtrack2torchserve( config_file: str, checkpoint...
Converts mmtracking model (config + checkpoint) to TorchServe `.mar`. Args: config_file (str): In MMTracking config format. The contents vary for each task repository. checkpoint_file (str): In MMTracking checkpoint format. The contents vary for each task repository. output_folder (str): Folder where `{model_name}.mar`...
19,982
from argparse import ArgumentParser, Namespace from pathlib import Path from tempfile import TemporaryDirectory import mmcv def parse_args(): parser = ArgumentParser( description='Convert mmtrack models to TorchServe `.mar` format.') parser.add_argument('config', type=str, help='config file path') ...
null
19,983
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='UAV123 dataset to COCO Video format') parser.add_argument( '-i', '--input', help='root directory...
null
19,984
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_uav123` function. Write a Python function `def convert_uav123(uav123, ann_dir, save_dir)` to solve the following ...
Convert trackingnet dataset to COCO style. Args: uav123 (dict): The converted COCO style annotations. ann_dir (str): The path of trackingnet test dataset save_dir (str): The path to save `uav123`.
19,985
import argparse import glob import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='GOT10k dataset to COCO Video format') parser.add_argument( '-i', '--input', help='ro...
null
19,986
import argparse import glob import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_got10k` function. Write a Python function `def convert_got10k(ann_dir, save_dir, split='test')` to so...
Convert got10k dataset to COCO style. Args: ann_dir (str): The path of got10k dataset save_dir (str): The path to save `got10k`. split (str): the split ('train', 'val' or 'test') of dataset.
19,987
import argparse import glob import os import os.path as osp import time import numpy as np def parse_args(): parser = argparse.ArgumentParser( description='Generate the information of GOT10k dataset') parser.add_argument( '-i', '--input', help='root directory of GOT10k dataset',...
null
19,988
import argparse import glob import os import os.path as osp import time import numpy as np The provided code snippet includes necessary dependencies for implementing the `gen_data_infos` function. Write a Python function `def gen_data_infos(data_root, save_dir, split='train')` to solve the following problem: Generate ...
Generate dataset information. Args: data_root (str): The path of dataset. save_dir (str): The path to save the information of dataset. split (str): the split ('train' or 'test') of dataset.
19,989
import argparse import glob import os import os.path as osp import time def parse_args(): parser = argparse.ArgumentParser( description='Generate the information of TrackingNet dataset') parser.add_argument( '-i', '--input', help='root directory of TrackingNet dataset', ) ...
null
19,990
import argparse import glob import os import os.path as osp import time The provided code snippet includes necessary dependencies for implementing the `gen_data_infos` function. Write a Python function `def gen_data_infos(data_root, save_dir, split='train', chunks=['all'])` to solve the following problem: Generate dat...
Generate dataset information. args: data_root (str): The path of dataset. save_dir (str): The path to save the information of dataset. split (str): the split ('train' or 'test') of dataset. chunks (list): the chunks of train set of TrackingNet.
19,991
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='TrackingNet test dataset to COCO Video format') parser.add_argument( '-i', '--input', help='root...
null
19,992
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_trackingnet` function. Write a Python function `def convert_trackingnet(ann_dir, save_dir, split='test')` to solv...
Convert trackingnet dataset to COCO style. Args: ann_dir (str): The path of trackingnet test dataset save_dir (str): The path to save `trackingnet`. split (str): the split ('train' or 'test') of dataset.
19,993
import argparse import glob import os import os.path as osp import re from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='OTB100 dataset to COCO Video format') parser.add_argument( '-i', '--input', ...
null
19,994
import argparse import glob import os import os.path as osp import re from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_otb100` function. Write a Python function `def convert_otb100(otb, ann_dir, save_dir)` to s...
Convert OTB100 dataset to COCO style. Args: otb (dict): The converted COCO style annotations. ann_dir (str): The path of OTB100 dataset save_dir (str): The path to save `OTB100`.
19,995
import argparse import multiprocessing import os import os.path as osp import re import socket from urllib import error, request from tqdm import tqdm def download_url(url_savedir_tuple): url = url_savedir_tuple[0] saved_dir = url_savedir_tuple[1] video_zip = osp.basename(url) if not osp.isdir(saved_di...
null
19,996
import argparse import multiprocessing import os import os.path as osp import re import socket from urllib import error, request from tqdm import tqdm def parse_url(homepage, href=None): html = request.urlopen(homepage + 'datasets.html').read().decode('utf-8') if BeautifulSoup is not None: soup = Beaut...
null
19,997
import argparse import os.path as osp from collections import defaultdict import mmcv from tao.toolkit.tao import Tao from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='Make annotation files for TAO') parser.add_argument('-i', '--input', help='path of TAO json file')...
null
19,998
import argparse import os.path as osp from collections import defaultdict import mmcv from tao.toolkit.tao import Tao from tqdm import tqdm def get_classes(tao_path, filter_classes=True): train = mmcv.load(osp.join(tao_path, 'train.json')) train_classes = list(set([_['category_id'] for _ in train['annotations...
null
19,999
import argparse import os.path as osp from collections import defaultdict import mmcv from tao.toolkit.tao import Tao from tqdm import tqdm def convert_tao(file, classes): tao = Tao(file) raw = mmcv.load(file) out = defaultdict(list) out['tracks'] = raw['tracks'].copy() out['info'] = raw['info'].c...
null
20,000
import argparse import os import os.path as osp from collections import defaultdict import mmcv import numpy as np from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='Convert MOT label and detections to COCO-VID format.') parser.add_argument('-i', '--input', help='pat...
null
20,001
import argparse import os import os.path as osp from collections import defaultdict import mmcv import numpy as np from tqdm import tqdm USELESS = [3, 4, 5, 6, 9, 10, 11] IGNORES = [2, 7, 8, 12, 13] def parse_gts(gts, is_mot15): outputs = defaultdict(list) for gt in gts: gt = gt.strip().split(',') ...
null
20,002
import argparse import os import os.path as osp from collections import defaultdict import mmcv import numpy as np from tqdm import tqdm def parse_dets(dets): outputs = defaultdict(list) for det in dets: det = det.strip().split(',') frame_id, ins_id = map(int, det[:2]) assert ins_id == ...
null
20,003
import argparse import json import os import os.path as osp from collections import defaultdict import mmcv from PIL import Image from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='CrowdHuman to COCO Video format') parser.add_argument( '-i', '--input'...
null
20,004
import argparse import json import os import os.path as osp from collections import defaultdict import mmcv from PIL import Image from tqdm import tqdm def load_odgt(filename): with open(filename, 'r') as f: lines = f.readlines() data_infos = [json.loads(line.strip('\n')) for line in lines] return d...
Convert CrowdHuman dataset in COCO style. Args: ann_dir (str): The path of CrowdHuman dataset. save_dir (str): The path to save annotation files. mode (str): Convert train dataset or validation dataset. Options are 'train', 'val'. Default: 'train'.
20,005
import argparse import os import os.path as osp import random import mmcv import numpy as np from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='Convert MOT dataset into ReID dataset.') parser.add_argument('-i', '--input', help='path of MOT data') parser.add_argum...
null
20,006
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='Convert DanceTrack label and detections to \ COCO-VID format.') parser.add_argument('-i', '--input', help='path ...
null
20,007
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm USELESS = [3, 4, 5, 6, 9, 10, 11] IGNORES = [2, 7, 8, 12, 13] def parse_gts(gts): outputs = defaultdict(list) for gt in gts: gt = gt.strip().split(',') frame_id, ins_id = map(in...
null
20,008
import argparse import glob import os import os.path as osp import xml.etree.ElementTree as ET from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='ImageNet DET to COCO Video format') parser.add_argument( '-i', ...
null
20,009
import argparse import glob import os import os.path as osp import xml.etree.ElementTree as ET from collections import defaultdict import mmcv from tqdm import tqdm CLASSES = ('airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', ...
Convert ImageNet DET dataset in COCO style. Args: DET (dict): The converted COCO style annotations. ann_dir (str): The path of ImageNet DET dataset save_dir (str): The path to save `DET`.
20,010
import argparse import os import os.path as osp import xml.etree.ElementTree as ET from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='ImageNet VID to COCO Video format') parser.add_argument( '-i', '--inp...
null
20,011
import argparse import os import os.path as osp import xml.etree.ElementTree as ET from collections import defaultdict import mmcv from tqdm import tqdm CLASSES = ('airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'h...
Convert ImageNet VID dataset in COCO style. Args: VID (dict): The converted COCO style annotations. ann_dir (str): The path of ImageNet VID dataset. save_dir (str): The path to save `VID`. mode (str): Convert train dataset or validation dataset. Options are 'train', 'val'. Default: 'train'.
20,012
import argparse import copy import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='YouTube-VIS to COCO Video format') parser.add_argument( '-i', '--input', help='root ...
null
20,013
import argparse import copy import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_vis` function. Write a Python function `def convert_vis(ann_dir, save_dir, dataset_version, mode='tra...
Convert YouTube-VIS dataset in COCO style. Args: ann_dir (str): The path of YouTube-VIS dataset. save_dir (str): The path to save `VIS`. dataset_version (str): The version of dataset. Options are '2019', '2021'. mode (str): Convert train dataset or validation dataset or test dataset. Options are 'train', 'valid', 'test...
20,014
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='LaSOT test dataset to COCO Video format') parser.add_argument( '-i', '--input', help='root direc...
null
20,015
import argparse import os import os.path as osp from collections import defaultdict import mmcv from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `convert_lasot` function. Write a Python function `def convert_lasot(ann_dir, save_dir, split='test')` to solve the follow...
Convert lasot dataset to COCO style. Args: ann_dir (str): The path of lasot dataset save_dir (str): The path to save `lasot`. split (str): the split ('train' or 'test') of dataset.
20,016
import argparse import glob import os import os.path as osp import time import numpy as np def parse_args(): parser = argparse.ArgumentParser( description='Generate the information of LaSOT dataset') parser.add_argument( '-i', '--input', help='root directory of LaSOT dataset', ...
null
20,017
import argparse import glob import os import os.path as osp import time import numpy as np The provided code snippet includes necessary dependencies for implementing the `gen_data_infos` function. Write a Python function `def gen_data_infos(data_root, save_dir, split='train')` to solve the following problem: Generate ...
Generate dataset information. Args: data_root (str): The path of dataset. save_dir (str): The path to save the information of dataset. split (str): the split ('train' or 'test') of dataset.
20,018
import argparse import glob import os import os.path as osp import time def parse_args(): parser = argparse.ArgumentParser( description='Generate the information of VOT dataset') parser.add_argument( '-i', '--input', help='root directory of VOT dataset', ) parser.add_arg...
null
20,019
import argparse import glob import os import os.path as osp import time The provided code snippet includes necessary dependencies for implementing the `gen_data_infos` function. Write a Python function `def gen_data_infos(data_root, save_dir, dataset_type='vot2018')` to solve the following problem: Generate dataset in...
Generate dataset information. Args: data_root (str): The path of dataset. save_dir (str): The path to save the information of dataset.
20,020
import argparse import os import os.path as osp import socket import zipfile from urllib import error, request from tqdm import tqdm VOT_DATASETS = dict( vot2018='http://data.votchallenge.net/vot2018/main/description.json', vot2018_lt= # noqa: E251 'http://data.votchallenge.net/vot2018/longterm/description...
null
20,021
import argparse import os import os.path as osp from collections import defaultdict import cv2 import mmcv import numpy as np from tqdm import tqdm def parse_args(): parser = argparse.ArgumentParser( description='VOT dataset to COCO Video format') parser.add_argument( '-i', '--input', ...
null
20,022
import argparse import os import os.path as osp from collections import defaultdict import cv2 import mmcv import numpy as np from tqdm import tqdm def parse_attribute(video_path, attr_name, img_num): """Parse attribute of each video in VOT. Args: video_path (str): The path of video. attr_name (...
Convert vot dataset to COCO style. Args: ann_dir (str): The path of vot dataset save_dir (str): The path to save `vot`. dataset_type (str): The type of vot challenge.
20,023
import argparse import os import numpy as np import torch from mmcv import Config, DictAction, get_logger, print_log from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist, load_checkpoint, wrap_fp1...
null
20,024
import argparse import os import os.path as osp import mmcv import motmetrics as mm import numpy as np from mmcv import Config from mmcv.utils import print_log from mmtrack.core.utils import imshow_mot_errors from mmtrack.datasets import build_dataset def parse_args(): parser = argparse.ArgumentParser( des...
null
20,025
import argparse import os import os.path as osp import mmcv import motmetrics as mm import numpy as np from mmcv import Config from mmcv.utils import print_log from mmtrack.core.utils import imshow_mot_errors from mmtrack.datasets import build_dataset The provided code snippet includes necessary dependencies for imple...
Evaluate the results of the video. Args: resfiles (dict): A dict containing the directory of the MOT results. dataset (Dataset): MOT dataset of the video to be evaluated. video_name (str): Name of the video to be evaluated. Returns: tuple: (acc, res, gt), acc contains the results of MOT metrics, res is the results of i...
20,026
import argparse import os import os.path as osp import mmcv def parse_args(): parser = argparse.ArgumentParser( description='Make dummy results for MOT Challenge.') parser.add_argument('json_file', help='Input JSON file.') parser.add_argument('out_folder', help='Output folder.') args = parser.p...
null
20,027
import argparse import os from itertools import product import mmcv import torch from dotty_dict import dotty from mmcv import Config, DictAction, get_logger, print_log from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist...
null
20,028
import argparse import os from itertools import product import mmcv import torch from dotty_dict import dotty from mmcv import Config, DictAction, get_logger, print_log from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist...
null
20,029
import argparse import glob import os.path as osp import subprocess import torch def parse_args(): parser = argparse.ArgumentParser( description='Process a checkpoint to be published') parser.add_argument('in_file', help='input checkpoint filename') parser.add_argument('out_file', help='output chec...
null
20,030
import argparse import glob import os.path as osp import subprocess import torch def process_checkpoint(in_file, out_file): exp_dir = osp.dirname(in_file) log_json_path = list(sorted(glob.glob(osp.join(exp_dir, '*.log.json'))))[-1] model_time = osp.split(l...
null
20,031
import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import seaborn as sns def cal_train_time(log_dicts, args): for i, log_dict in enumerate(log_dicts): print(f'{"-" * 5}Analyze train time of {args.json_logs[i]}{"-" * 5}') all_times = []...
null
20,032
import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import seaborn as sns def plot_curve(log_dicts, args): if args.backend is not None: plt.switch_backend(args.backend) sns.set_style(args.style) # if legend is None, use {filename}_{key}...
null
20,033
import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import seaborn as sns def add_plot_parser(subparsers): parser_plt = subparsers.add_parser( 'plot_curve', help='parser for plotting curves') parser_plt.add_argument( 'json_logs', ...
null
20,034
import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import seaborn as sns def load_json_logs(json_logs): # load and convert json_logs to log_dict, key is epoch, value is a sub dict # keys of sub dict is different metrics, e.g. memory, bbox_mAP ...
null
20,035
import argparse import time import torch from mmcv import Config from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel from mmcv.runner import load_checkpoint, wrap_fp16_model from mmdet.datasets import replace_ImageToTensor from mmtrack.datasets import build_dataloader, build_dataset from mmtrack....
null
20,036
import argparse from mmcv import Config, DictAction def parse_args(): parser = argparse.ArgumentParser(description='Print the whole config') parser.add_argument('config', help='config file path') parser.add_argument( '--options', nargs='+', action=DictAction, help='arguments in dict') args = pa...
null
20,037
import os from setuptools import setup, find_packages import versioneer def read_file(fname): with open(fname, 'r') as f: return f.read()
null
20,046
import logging import os import sys from gooey import Gooey, GooeyParser from ffsubsync.constants import ( RELEASE_URL, WEBSITE, DEV_WEBSITE, DESCRIPTION, LONG_DESCRIPTION, PROJECT_NAME, PROJECT_LICENSE, COPYRIGHT_YEAR, SUBSYNC_RESOURCES_ENV_MAGIC, ) from ffsubsync.ffsubsync import r...
null
20,047
import errno import os import re import subprocess import sys HANDLERS = {} The provided code snippet includes necessary dependencies for implementing the `register_vcs_handler` function. Write a Python function `def register_vcs_handler(vcs, method)` to solve the following problem: Decorator to mark a method as the h...
Decorator to mark a method as the handler for a particular VCS.
20,048
import errno import os import re import subprocess import sys The provided code snippet includes necessary dependencies for implementing the `run_command` function. Write a Python function `def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None)` to solve the following pro...
Call the given command(s).
20,050
import errno import os import re import subprocess import sys def get_keywords(): """Get the keywords needed to look up the version information.""" # these strings will be replaced by git during git-archive. # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a l...
Get version information or return default if unable to do so.
20,051
import logging import math logger = logging.getLogger(__name__) invphi = (math.sqrt(5) - 1) / 2 invphi2 = (3 - math.sqrt(5)) / 2 The provided code snippet includes necessary dependencies for implementing the `gss` function. Write a Python function `def gss(f, a, b, tol=1e-4)` to solve the following problem: Golden-se...
Golden-section search. Given a function f with a single local minimum in the interval [a,b], gss returns a subset interval [c,d] that contains the minimum with d-c <= tol. Example: >>> f = lambda x: (x-2)**2 >>> a = 1 >>> b = 5 >>> tol = 1e-5 >>> (c,d) = gss(f, a, b, tol) >>> print(c, d) 1.9999959837979107 2.0000050911...
20,052
from collections import defaultdict from itertools import islice from typing import Any, Callable, Optional from typing_extensions import Protocol class Pipeline: def __init__(self, steps, verbose=False): self.steps = steps self.verbose = verbose self._validate_steps() def _validate_step...
Construct a Pipeline from the given estimators. This is a shorthand for the Pipeline constructor; it does not require, and does not permit, naming the estimators. Instead, their names will be set to the lowercase of their types automatically. Parameters ---------- *steps : list of estimators. verbose : bool, default=Fa...
20,053
from collections import defaultdict from itertools import islice from typing import Any, Callable, Optional from typing_extensions import Protocol def _transform_one(transformer, X, y, weight, **fit_params): res = transformer.transform(X) # if we have a weight for this transformer, multiply output if weigh...
null
20,054
from collections import defaultdict from itertools import islice from typing import Any, Callable, Optional from typing_extensions import Protocol The provided code snippet includes necessary dependencies for implementing the `_fit_transform_one` function. Write a Python function `def _fit_transform_one(transformer, X...
Fits ``transformer`` to ``X`` and ``y``. The transformed result is returned with the fitted transformer. If ``weight`` is not ``None``, the result will be multiplied by ``weight``.
20,055
from datetime import timedelta import logging from typing import Any, cast, List, Optional import pysubs2 from ffsubsync.sklearn_shim import TransformerMixin import srt from ffsubsync.constants import ( DEFAULT_ENCODING, DEFAULT_MAX_SUBTITLE_SECONDS, DEFAULT_START_SECONDS, ) from ffsubsync.file_utils import...
null
20,056
import logging import os import platform import subprocess from ffsubsync.constants import SUBSYNC_RESOURCES_ENV_MAGIC def subprocess_args(include_stdout=True): # The following is true only on Windows. if hasattr(subprocess, "STARTUPINFO"): # On Windows, subprocess calls will pop up a command window by...
null
20,057
import argparse from datetime import datetime import logging import os import shutil import subprocess import sys from typing import cast, Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np from ffsubsync.aligners import FFTAligner, MaxScoreAligner from ffsubsync.constants import ( DEFAULT_APPLY_O...
null
20,058
import argparse from datetime import datetime import logging import os import shutil import subprocess import sys from typing import cast, Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np from ffsubsync.aligners import FFTAligner, MaxScoreAligner from ffsubsync.constants import ( DEFAULT_APPLY_O...
null
20,059
import os from contextlib import contextmanager import logging import io import subprocess import sys from datetime import timedelta from typing import cast, Callable, Dict, List, Optional, Union import ffmpeg import numpy as np import tqdm from ffsubsync.constants import ( DEFAULT_ENCODING, DEFAULT_MAX_SUBTITL...
null
20,060
import os from contextlib import contextmanager import logging import io import subprocess import sys from datetime import timedelta from typing import cast, Callable, Dict, List, Optional, Union import ffmpeg import numpy as np import tqdm from ffsubsync.constants import ( DEFAULT_ENCODING, DEFAULT_MAX_SUBTITL...
null
20,061
import os from contextlib import contextmanager import logging import io import subprocess import sys from datetime import timedelta from typing import cast, Callable, Dict, List, Optional, Union import ffmpeg import numpy as np import tqdm from ffsubsync.constants import ( DEFAULT_ENCODING, DEFAULT_MAX_SUBTITL...
null
20,062
import os from contextlib import contextmanager import logging import io import subprocess import sys from datetime import timedelta from typing import cast, Callable, Dict, List, Optional, Union import ffmpeg import numpy as np import tqdm from ffsubsync.constants import ( DEFAULT_ENCODING, DEFAULT_MAX_SUBTITL...
null
20,063
import bpy from .declarations import Macros, Operators, WorkSpaceTools from .stateful_operator.utilities.keymap import tool_invoke_kmi addon_keymaps = [] class Operators(str, Enum): AddAngle = "view3d.slvs_add_angle" AddArc2D = "view3d.slvs_add_arc2d" AddCircle2D = "view3d.slvs_add_circle2d" AddCoincid...
null
20,064
import bpy from .declarations import Macros, Operators, WorkSpaceTools from .stateful_operator.utilities.keymap import tool_invoke_kmi addon_keymaps = [] def unregister(): wm = bpy.context.window_manager kc = wm.keyconfigs.addon if kc: for km, kmi in addon_keymaps: km.keymap_items.remov...
null
20,065
import logging import bpy import gpu from bpy.types import Context, Operator from bpy.utils import register_class, unregister_class from . import global_data from .utilities.preferences import use_experimental from .declarations import Operators def draw_selection_buffer(context: Context): def ensure_selection_texture...
null
20,066
import logging import bpy import gpu from bpy.types import Context, Operator from bpy.utils import register_class, unregister_class from . import global_data from .utilities.preferences import use_experimental from .declarations import Operators def update_elements(context: Context, force: bool = False): """ TO...
null
20,067
import logging import bpy import gpu from bpy.types import Context, Operator from bpy.utils import register_class, unregister_class from . import global_data from .utilities.preferences import use_experimental from .declarations import Operators class View3D_OT_slvs_register_draw_cb(Operator): bl_idname = Operators...
null
20,068
import logging import bpy import gpu from bpy.types import Context, Operator from bpy.utils import register_class, unregister_class from . import global_data from .utilities.preferences import use_experimental from .declarations import Operators class View3D_OT_slvs_register_draw_cb(Operator): bl_idname = Operators...
null
20,069
from pathlib import Path from functools import cache import gpu import bpy import bpy.utils.previews from gpu_extras.batch import batch_for_shader from bpy.app import background from .declarations import Operators from .shaders import Shaders def get_folder_path(): return Path(__file__).parent / "resources" / "icon...
null
20,070
from pathlib import Path from functools import cache import gpu import bpy import bpy.utils.previews from gpu_extras.batch import batch_for_shader from bpy.app import background from .declarations import Operators from .shaders import Shaders icons = {} def unload_preview_icons(): global preview_icons if not pr...
null
20,071
from pathlib import Path from functools import cache import gpu import bpy import bpy.utils.previews from gpu_extras.batch import batch_for_shader from bpy.app import background from .declarations import Operators from .shaders import Shaders preview_icons = None def get_constraint_icon(operator: str): if not prev...
null
20,072
from pathlib import Path from functools import cache import gpu import bpy import bpy.utils.previews from gpu_extras.batch import batch_for_shader from bpy.app import background from .declarations import Operators from .shaders import Shaders icons = {} def _get_shader(): return Shaders.uniform_color_image_2d() def...
null
20,073
from bpy.types import Context, UILayout from .. import declarations from . import VIEW3D_PT_sketcher_base from .. import declarations def sketch_selector( context: Context, layout: UILayout, ): row = layout.row(align=True) row.scale_y = 1.8 active_sketch = context.scene.sketcher.active_sketch ...
null
20,074
from bpy.types import Context, UILayout from .. import declarations from .. import types from . import VIEW3D_PT_sketcher_base from .. import declarations The provided code snippet includes necessary dependencies for implementing the `draw_constraint_listitem` function. Write a Python function `def draw_constraint_li...
Creates a single row inside the ``layout`` describing the ``constraint``.
20,075
from bpy.types import Menu from ..declarations import Operators, Menus from typing import Iterable def _get_value_icon(collection: Iterable, property: str, default: bool) -> bool: values = [getattr(item, property) for item in collection] if all(values): return False, "CHECKBOX_HLT" if not any(value...
null
20,076
import gpu from bpy.types import Gizmo, GizmoGroup from .. import global_data from ..declarations import Gizmos, GizmoGroups from ..draw_handler import ensure_selection_texture from ..utilities.index import rgb_to_index from .utilities import context_mode_check def _spiral(N, M): x,y = 0,0 dx, dy = 0, -1 ...
Returns a list of coordinates to check starting from given position spiraling out
20,077
import math import blf import gpu from bpy.types import Gizmo, GizmoGroup from mathutils import Vector, Matrix from .. import icon_manager, units from ..declarations import Gizmos, GizmoGroups, Operators from ..utilities.preferences import get_prefs from ..utilities.view import get_2d_coords from .base import Constrain...
null
20,078
import math from enum import Enum, auto from mathutils import Matrix from ..model.types import GenericConstraint from ..utilities.constants import QUARTER_TURN from ..utilities.preferences import get_prefs def get_constraint_color_type(constraint: GenericConstraint): def get_color(color_type: Color, highlit: bool): de...
null
20,079
import math from enum import Enum, auto from mathutils import Matrix from ..model.types import GenericConstraint from ..utilities.constants import QUARTER_TURN from ..utilities.preferences import get_prefs QUARTER_TURN = tau / 4 def draw_arrow_shape(target, shoulder, width, is_3d=False): v = shoulder - target ...
null
20,080
import math from enum import Enum, auto from mathutils import Matrix from ..model.types import GenericConstraint from ..utilities.constants import QUARTER_TURN from ..utilities.preferences import get_prefs def get_prefs(): return bpy.context.preferences.addons[get_name()].preferences def get_arrow_size(dist, scal...
null
20,081
import math from enum import Enum, auto from mathutils import Matrix from ..model.types import GenericConstraint from ..utilities.constants import QUARTER_TURN from ..utilities.preferences import get_prefs def get_prefs(): return bpy.context.preferences.addons[get_name()].preferences def get_overshoot(scale, dir)...
null
20,082
import math from enum import Enum, auto from mathutils import Matrix from ..model.types import GenericConstraint from ..utilities.constants import QUARTER_TURN from ..utilities.preferences import get_prefs def context_mode_check(context, widget_group): tools = context.workspace.tools mode = context.mode fo...
null
20,083
import bpy import logging logger = logging.getLogger(__name__) def update_pointers(scene, index_old, index_new): """Replaces all references to an entity index with its new index""" logger.debug("Update references {} -> {}".format(index_old, index_new)) # NOTE: this should go through all entity pointers and...
Updates type index of entities keeping local index as is
20,084
import logging from typing import List from bpy.types import Scene from ..model.types import SlvsGenericEntity The provided code snippet includes necessary dependencies for implementing the `point_entity_mapping` function. Write a Python function `def point_entity_mapping(scene)` to solve the following problem: Get a ...
Get a entities per point mapping
20,085
import logging from typing import List from bpy.types import Scene from ..model.types import SlvsGenericEntity def shares_point(seg_1, seg_2): points = seg_1.connection_points() for p in seg_2.connection_points(): if p in points: return True return False
null
20,086
from mathutils import Vector from math import sin, cos from .constants import FULL_TURN def pol2cart(radius: float, angle: float) -> Vector: x = radius * cos(angle) y = radius * sin(angle) return Vector((x, y))
null