name
stringclasses
844 values
input_types
listlengths
0
100
output_type
stringlengths
1
419
code
stringlengths
34
233k
dependencies
listlengths
0
6
lib_used
listlengths
0
11
imports
listlengths
0
66
line_count
int64
3
199
full_code
stringlengths
39
1.01M
input_type_defs
listlengths
1
12
v0
[ "Iterable['DXFEntity']" ]
None
def v0(self, v1: Iterable['DXFEntity']) -> None: for v2 in v1: try: del self._boxes[self._get_key(v2)] except KeyError: pass
[]
[]
[]
6
# Copyright (c) 2021, Manfred Moitzi # License: MIT License from typing import TYPE_CHECKING, Iterable, Dict, Optional from ezdxf import disassemble from ezdxf.math import BoundingBox, Vec3 if TYPE_CHECKING: from ezdxf.eztypes import DXFEntity MAX_FLATTENING_DISTANCE = disassemble.Primitive.max_flattening_dista...
null
v0
[ "'DXFEntity'" ]
Optional[str]
def v0(self, v1: 'DXFEntity') -> Optional[str]: if v1.dxftype() == 'HATCH': return None v2 = v1.dxf.handle if v2 is None or v2 == '0': return str(v1.uuid) if self._use_uuid else None else: return v2
[]
[]
[]
8
# Copyright (c) 2021, Manfred Moitzi # License: MIT License from typing import TYPE_CHECKING, Iterable, Dict, Optional from ezdxf import disassemble from ezdxf.math import BoundingBox, Vec3 if TYPE_CHECKING: from ezdxf.eztypes import DXFEntity MAX_FLATTENING_DISTANCE = disassemble.Primitive.max_flattening_dista...
null
v1
[ "v0", "Tuple[v0, ...]", "Optional[str]" ]
Any
def v1(v2: v0, v3: Tuple[v0, ...], v4: Optional[str]=None): assert len(v3) > 0 return dataclasses.field(default=v2, repr=True, metadata=dict(is_parameter=True, description=v4, options=v3))
[]
[ "dataclasses" ]
[ "import dataclasses" ]
3
"""Base definition of a task in the shift happens benchmark. Fully defined tasks should subclass the :py:class:`Task` abstract base class, and implement all mixins based on the required model outputs to evaluate the task, also part of this module. Implementing a new task consists of the following steps: 1. Subclass ...
[ "v0 = TypeVar('T')" ]
v6
[ "list" ]
Any
def v6(v7: list): print('We will delete these files:') print(v0(v7, remove=True)) v8 = input('Are you sure you want to delete [y/N]: ') if v8.lower() == 'y': for v9 in v7: os.remove(v9) print('All files deleted!') elif v8.lower() not in {'', 'n'}: raise ValueError...
[ { "name": "v0", "input_types": [ "list", "bool" ], "output_type": "str", "code": "def v0(v1: list, v2: bool) -> str:\n v3 = colored('-', 'red') if v2 else colored('+', 'green')\n v4 = '\\n'.join((v3 + ' ' + n for v5 in v1))\n return v4", "dependencies": [] } ]
[ "os" ]
[ "import os", "from os.path import isfile, join, exists" ]
10
import argparse from fnmatch import fnmatch import os from os.path import isfile, join, exists import subprocess from termcolor import colored import sys from pyprojects.projectslib.py_utils import union parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("...
null
v0
[ "bool", "bool", "list", "Any" ]
list
def v0(v1: bool, v2: bool, v3: list, v4) -> list: v5 = ['aescrypt'] + (['-e'] if v1 else []) + (['-d'] if v2 else []) + (['-p', v4] if v4 else []) + v3 return v5
[]
[]
[]
3
import argparse from fnmatch import fnmatch import os from os.path import isfile, join, exists import subprocess from termcolor import colored import sys from pyprojects.projectslib.py_utils import union parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("...
null
v12
[ "bool", "bool", "list", "Any" ]
list
def v12(v13: bool, v14: bool, v15: list, v16='') -> list: assert v13 ^ v14 v17 = 'encrypt' if v13 else 'decrypt' print(f'We will {v17} these files:') print(v6(v15, remove=False)) v18 = input(f'Are you sure you want to {v17} [Y/n]: ') if v18.lower() in {'', 'y'}: print('DEBUGGING') ...
[ { "name": "v0", "input_types": [ "bool", "bool", "list", "Any" ], "output_type": "list", "code": "def v0(v1: bool, v2: bool, v3: list, v4) -> list:\n v5 = ['aescrypt'] + (['-e'] if v1 else []) + (['-d'] if v2 else []) + (['-p', v4] if v4 else []) + v3\n return v5", ...
[ "subprocess", "sys" ]
[ "import subprocess", "import sys" ]
19
import argparse from fnmatch import fnmatch import os from os.path import isfile, join, exists import subprocess from termcolor import colored import sys from pyprojects.projectslib.py_utils import union parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("...
null
v6
[ "list", "argparse.ArgumentParser" ]
Any
def v6(self, v7: list, v8: argparse.ArgumentParser): super().configure(v7, v8) v0(v8, 'dry_run') v3(v8, 'show_commands')
[ { "name": "v0", "input_types": [ "argparse.ArgumentParser", "str" ], "output_type": "Any", "code": "def v0(v1: argparse.ArgumentParser, v2: str):\n v1.add_argument('--dry-run', dest=v2, action='store_true', help='show operations performed by command without actually running them')...
[]
[]
4
import argparse import contextlib import functools import inspect import time ANSI_ESCAPE_CODE_RED = "\x1b[1;31m" ANSI_ESCAPE_CODE_YELLOW = "\x1b[1;33m" ANSI_ESCAPE_CODE_RESET = "\x1b[1;0m" class CommandFailedException(Exception): def __init__(self, message, hint): super().__init__(message) self...
null
v0
[ "np.array", "np.array", "int", "int" ]
typing.Tuple[np.array, np.array, np.array, np.array]
def v0(v1: np.array, v2: np.array, v3: int, v4: int) -> typing.Tuple[np.array, np.array, np.array, np.array]: if v4 is None: raise ValueError('Seed can not be None (to ensure test set equality)') np.random.seed(v4) v5 = np.arange(v1.shape[0]) np.random.shuffle(v5) v1 = v1[v5] v2 = v2[v5]...
[]
[ "numpy" ]
[ "import numpy as np" ]
9
import typing import logging import numpy as np import pandas as pd import scipy.stats import time import sklearn.metrics import func_timeout def format_learner(learner): learner_name = str(learner).replace("\n", " ").replace("\t", " ") for k in range(20): learner_name = learner_name.replace(" ", " ...
null
v0
[ "str" ]
Any
def v0(self, v1: str): self.put_trades(v1) self.put_close_trades(v1) self.put_open_positions(v1)
[]
[]
[]
4
from datetime import datetime, timedelta from loguru import logger import pandas as pd import requests from pydantic import BaseModel from pytz import timezone from finx_ib_reports.custom_flex_report import CustomFlexReport, parse_date_series # class ReportOutputAdapterShell(BaseModel): # class Config: # ...
null
v0
[ "str", "pd.DataFrame", "str" ]
None
def v0(self, v1: str, v2: pd.DataFrame, v3: str) -> None: v4 = self._gen_file_name(v1, v3) v2.to_csv(v4)
[]
[]
[]
3
from datetime import datetime, timedelta from loguru import logger import pandas as pd import requests from pydantic import BaseModel from pytz import timezone from finx_ib_reports.custom_flex_report import CustomFlexReport, parse_date_series # class ReportOutputAdapterShell(BaseModel): # class Config: # ...
null
v0
[ "str", "str", "typing.Optional[typing.Dict[str, typing.Any]]", "typing.Optional[typing.List[typing.Tuple[str, typing.Any]]]", "typing.Optional[typing.Dict[str, typing.Any]]", "typing.Optional[typing.Any]", "typing.Optional[typing.List[typing.Tuple[str, typing.Any]]]", "typing.Optional[typing.Dict[str,...
Any
def v0(self, v1: str, v2: str, v3: typing.Optional[typing.Dict[str, typing.Any]]=None, v4: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]]=None, v5: typing.Optional[typing.Dict[str, typing.Any]]=None, v6: typing.Optional[typing.Any]=None, v7: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]]=None,...
[]
[]
[]
4
""" OpenAPI definition No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v0 Contact: support@gooddata.com Generated by: https://openapi-generator.tech """ import json import atexit import ...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: v2 = self.current_question.answer if v1.lower() == v2.lower(): self.score += 1 return True else: return False
[]
[]
[]
7
import html class QuizBrain: def __init__(self, q_list): self.question_number = 0 self.score = 0 self.question_list = q_list self.current_question = None def still_has_questions(self): return self.question_number < len(self.question_list) def next_question(self):...
null
v0
[ "Union[None, str, List[str]]" ]
List[str]
def v0(v1: Union[None, str, List[str]]) -> List[str]: if isinstance(v1, str): return [v1] if isinstance(v1, list): return v1 return []
[]
[]
[]
6
# -*- coding: utf-8 -*- # Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
null
v0
[ "list", "list", "bool" ]
Any
def v0(self, v1: list, v2: list, v3: bool=True): v4 = self._redirect(v3) return subprocess.Popen(v1 + [self.wrap_cmd(v2)], stdin=subprocess.DEVNULL, stdout=v4, stderr=v4)
[]
[ "subprocess" ]
[ "import subprocess" ]
3
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
null
v0
[ "Any", "Any", "Any" ]
np.ndarray
def v0(v1, v2, v3=False) -> np.ndarray: v4: np.ndarray = np.matmul(v1[:, np.newaxis], v2[:, :, np.newaxis]) if not v3: v4 = v4.squeeze() return v4
[]
[ "numpy" ]
[ "import numpy as np" ]
5
"""operator""" import numpy as np def dot(a, b, keepdims=False) -> np.ndarray: """Dot product for a and b vectors """ res: np.ndarray = np.matmul(a[:, np.newaxis], b[:, :, np.newaxis]) if not keepdims: res = res.squeeze() return res def cross(a, b) -> np.ndarray: """Cross product fo...
null
v0
[ "Any", "Any" ]
np.ndarray
def v0(v1, v2) -> np.ndarray: v3: np.ndarray = np.cross(v1, v2) return v3
[]
[ "numpy" ]
[ "import numpy as np" ]
3
"""operator""" import numpy as np def dot(a, b, keepdims=False) -> np.ndarray: """Dot product for a and b vectors """ res: np.ndarray = np.matmul(a[:, np.newaxis], b[:, :, np.newaxis]) if not keepdims: res = res.squeeze() return res def cross(a, b) -> np.ndarray: """Cross product fo...
null
v7
[ "np.ndarray", "np.ndarray", "bool" ]
np.ndarray
def v7(v8: np.ndarray, v9: np.ndarray, v10: bool=False) -> np.ndarray: if not v10: v8 = v5(v8) v9 = v5(v9) v11 = np.arccos(v0(v8, v9)) return v11
[ { "name": "v0", "input_types": [ "Any", "Any", "Any" ], "output_type": "np.ndarray", "code": "def v0(v1, v2, v3=False) -> np.ndarray:\n v4: np.ndarray = np.matmul(v1[:, np.newaxis], v2[:, :, np.newaxis])\n if not v3:\n v4 = v4.squeeze()\n return v4", "depend...
[ "numpy" ]
[ "import numpy as np" ]
6
"""operator""" import numpy as np def dot(a, b, keepdims=False) -> np.ndarray: """Dot product for a and b vectors """ res: np.ndarray = np.matmul(a[:, np.newaxis], b[:, :, np.newaxis]) if not keepdims: res = res.squeeze() return res def cross(a, b) -> np.ndarray: """Cross product fo...
null
v0
[ "np.ndarray", "np.ndarray" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: v3 = -2 * np.matmul(v1, v2.T) v3 += np.sum(v1 ** 2, axis=1, keepdims=True) v3 += np.sum(v2 ** 2, axis=1, keepdims=True).T return v3
[]
[ "numpy" ]
[ "import numpy as np" ]
5
"""operator""" import numpy as np def dot(a, b, keepdims=False) -> np.ndarray: """Dot product for a and b vectors """ res: np.ndarray = np.matmul(a[:, np.newaxis], b[:, :, np.newaxis]) if not keepdims: res = res.squeeze() return res def cross(a, b) -> np.ndarray: """Cross product fo...
null
v0
[ "np.ndarray", "np.ndarray" ]
np.ndarray
def v0(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: v3 = v2.shape (v4, v5) = v1.shape v6 = v2.reshape(-1) v7 = v1[v6] v8 = v7.reshape(*v3, v5) return v8
[]
[]
[]
7
"""operator""" import numpy as np def dot(a, b, keepdims=False) -> np.ndarray: """Dot product for a and b vectors """ res: np.ndarray = np.matmul(a[:, np.newaxis], b[:, :, np.newaxis]) if not keepdims: res = res.squeeze() return res def cross(a, b) -> np.ndarray: """Cross product fo...
null
v0
[ "str", "Any" ]
Any
def v0(self, v1: str, v2): v3 = self.redis.pubsub() v3.subscribe(**{v1: v2}) v4 = v3.run_in_thread(sleep_time=2) return v4
[]
[]
[]
5
import json import os import redis from persistence.database.idatabase_handler import IMessageHandler from utilities import logger_config logger = logger_config.get_logger(__name__) class RedisHandler(IMessageHandler): def __init__(self, config): self.redis_pool = redis.ConnectionPool(host=config['host...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: v1 = v1.replace('\\', '/') if v1[-1] != '/': v1 += '/' return v1
[]
[]
[]
5
#!/usr/bin/env python3 # # Copyright 2018-2019 PSB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
null
v0
[ "Tensor", "Tensor", "Tensor" ]
Tuple[Tensor, Tensor]
def v0(self, v1: Tensor, v2: Tensor, v3: Tensor) -> Tuple[Tensor, Tensor]: (v4, v5, v6) = (v1.size(0), v1.size(2), v2.size(1)) if v3 is None: v3 = v2.new_zeros(v4, v6) v3 = self.location_conv(v3.unsqueeze(dim=1)) v3 = v3.transpose(1, 2) v7 = self.fc(torch.tanh(self.query_proj(v1) + self.valu...
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.nn.functional as F", "from torch import Tensor" ]
14
# Copyright (c) 2020, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
null
v0
[ "Tensor" ]
Tensor
def v0(self, v1: Tensor) -> Tensor: (v2, v3, v4, v5) = v1.size() v6 = v1.new_zeros(v2, v3, v4, 1) v7 = torch.cat([v6, v1], dim=-1) v7 = v7.view(v2, v3, v5 + 1, v4) v1 = v7[:, :, 1:].view_as(v1) return v1
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.nn.functional as F", "from torch import Tensor" ]
7
# Copyright (c) 2020, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
null
v0
[ "nn.Module", "float", "float", "float" ]
torch.optim.Optimizer
def v0(v1: nn.Module, v2: float=1e-05, v3: float=1e-08, v4: float=0.0) -> torch.optim.Optimizer: v5 = ['bias', 'LayerNorm.weight'] v6 = [{'params': [p for (v7, v8) in v1.named_parameters() if not any((nd in v7 for v9 in v5))], 'weight_decay': v4}, {'params': [v8 for (v7, v8) in v1.named_parameters() if any((v9 ...
[]
[ "transformers" ]
[ "from transformers import RobertaConfig, RobertaTokenizer, RobertaForSequenceClassification, AdamW" ]
5
import pandas as pd from torch.utils.data import TensorDataset, DataLoader import torch import torch.nn as nn import torch.nn.functional as F from transformers import RobertaConfig, RobertaTokenizer, RobertaForSequenceClassification, AdamW import numpy as np import shutil from tqdm import tqdm from configparser import ...
null
v0
[ "models.Model" ]
bool
def v0(v1: models.Model) -> bool: v2 = ['flow.Storage'] return hasattr(v1, 'permission_group') or v1._meta.label in v2
[]
[]
[]
3
""".. Ignore pydocstyle D400. ================= Permissions utils ================= .. autofunction:: copy_permissions """ from typing import List, Optional, Tuple, Union from django.contrib.auth import get_user_model from django.contrib.auth.models import AnonymousUser, Group, User from django.db import models, tr...
null
v0
[ "str" ]
dict
def v0(self, v1: str) -> dict: if v1 == '': raise ValueError('Key is empty') v1 = quote(v1, safe='') (v2, v3) = self._request('/items/{}'.format(v1), 'GET') return v3 or None
[]
[ "urllib" ]
[ "import urllib.error", "from urllib.parse import quote" ]
6
import http.client import os import socket import struct import typing import urllib.error from urllib.parse import quote try: import orjson as json except ImportError: import json class Util: class Trim: pass class Increment: def __init__(self, value=None): self.val = va...
null
v0
[ "torch.Tensor", "torch.Tensor" ]
Any
def v0(self, v1: torch.Tensor, v2: torch.Tensor): v3 = self.vae_down(v2) v3 = v3.view(-1, self.vae_fc1.in_features) v4 = self.vae_fc1(v3) v5 = torch.randn_like(v4) v5.requires_grad_(False) if self.vae_estimate_std: v6 = self.vae_fc2(v3) v6 = F.softplus(v6) v7 = 0.5 * torc...
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.nn.functional as F" ]
26
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
null
v0
[ "str" ]
Any
def v0(v1: str): if v1.lower() == 'keep': return (0, 128, 0) elif v1.lower() == 'erode': return (80, 127, 255) elif v1.lower() == 'safe': return (0, 255, 0) elif v1.lower() == 'delete': return (0, 0, 255) elif v1.lower() == 'enforce': return (255, 0, 255) ...
[]
[]
[]
21
import cv2 import math import numpy as np import ipso_phen.ipapi.base.ip_common as ipc def tag_to_color(tag: str): if tag.lower() == "keep": return 0, 128, 0 elif tag.lower() == "erode": return 80, 127, 255 elif tag.lower() == "safe": return 0, 255, 0 elif tag.lo...
null
v0
[ "list", "Any", "Any", "Any" ]
Any
def v0(v1: list, v2, v3=-1, v4=None): for v5 in v1: v2 = v5.draw_to(dst_img=v2, line_width=v3, color=v4) return v2
[]
[]
[]
4
import cv2 import math import numpy as np import ipso_phen.ipapi.base.ip_common as ipc def tag_to_color(tag: str): if tag.lower() == "keep": return 0, 128, 0 elif tag.lower() == "erode": return 80, 127, 255 elif tag.lower() == "safe": return 0, 255, 0 elif tag.lo...
null
v10
[ "list", "Any" ]
Any
def v10(v11: list, v12): v13 = v12.copy() if len(v13.shape) == 2 or (len(v13.shape) == 3 and v13.shape[2] == 1): v14 = np.zeros_like(v13) else: v14 = np.zeros_like(v13[:, :, 0]) v14 = v6(rois=v11, image=v14, color=255) return cv2.bitwise_and(v13, v13, mask=v14)
[ { "name": "v0", "input_types": [ "list", "Any", "Any", "Any" ], "output_type": "Any", "code": "def v0(v1: list, v2, v3=-1, v4=None):\n for v5 in v1:\n v2 = v5.draw_to(dst_img=v2, line_width=v3, color=v4)\n return v2", "dependencies": [] }, { "name...
[ "cv2", "numpy" ]
[ "import cv2", "import numpy as np" ]
8
import cv2 import math import numpy as np import ipso_phen.ipapi.base.ip_common as ipc def tag_to_color(tag: str): if tag.lower() == "keep": return 0, 128, 0 elif tag.lower() == "erode": return 80, 127, 255 elif tag.lower() == "safe": return 0, 255, 0 elif tag.lo...
null
v0
[ "list", "Any" ]
Any
def v0(v1: list, v2): for v3 in v1: v2 = v3.delete(src_image=v2) return v2
[]
[]
[]
4
import cv2 import math import numpy as np import ipso_phen.ipapi.base.ip_common as ipc def tag_to_color(tag: str): if tag.lower() == "keep": return 0, 128, 0 elif tag.lower() == "erode": return 80, 127, 255 elif tag.lower() == "safe": return 0, 255, 0 elif tag.lo...
null
v0
[ "Any", "bool" ]
Any
def v0(self, v1, v2: bool=False): if v2 is True: v3 = self.keep(v1) else: v3 = v1.copy() v4 = self.as_rect() if v4 is None: return None return v3[v4.top:v4.bottom, v4.left:v4.right].copy(order='C')
[]
[]
[]
9
import cv2 import math import numpy as np import ipso_phen.ipapi.base.ip_common as ipc def tag_to_color(tag: str): if tag.lower() == "keep": return 0, 128, 0 elif tag.lower() == "erode": return 80, 127, 255 elif tag.lower() == "safe": return 0, 255, 0 elif tag.lo...
null
v10
[]
dict
def v10(*v11) -> dict: v12 = {} v13 = set() for v14 in v11: v13 |= set(v14.keys()) for v15 in v13: v12[v15] = v4((v14[v15] for v14 in v11 if v15 in v14)) return v12
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "Any", "code": "def v0(v1):\n v2 = [i for v3 in v1 if not isinstance(v3, Dontsum)]\n return sum(v2)", "dependencies": [] }, { "name": "v4", "input_types": [ "Iterable[Tuple]" ], "output_type": "Tup...
[]
[]
8
from decimal import Decimal from typing import Any, Dict, Iterable, List, Tuple from django.db.models import Count, Sum from django.utils.translation import ugettext_lazy as _ from pretix.base.models import Event, Item, ItemCategory, Order, OrderPosition from pretix.base.models.event import SubEvent class DummyObje...
null
v0
[ "str" ]
str
def v0(v1: str) -> str: if not v1: raise SyntaxError('IMPORT must take in a filepath') with open(v1, 'r') as v2: return v2.read()
[]
[]
[]
5
import json import re import os import pypandoc from tqdm import tqdm from multiprocessing.pool import ThreadPool from os.path import dirname from examtool.api.utils import list_to_dict, IDFactory VERSION = 2 # increment when backward-incompatible changes are made def html_convert(x): return pypandoc.convert_...
null
v0
[]
None
def v0(self) -> None: v1 = 'sample-project' v2 = u'user@example.com deployed version 3eb5f44 of [sample-project](http://sample-project.herokuapp.com)\n``` quote\n * Example User: Test commit for Deploy Hook\n * Example User: Second test commit for Deploy Hook 2\n```' v2 = '\nuser@example.com deployed vers...
[]
[]
[]
5
# -*- coding: utf-8 -*- from zerver.lib.test_classes import WebhookTestCase class HerokuHookTests(WebhookTestCase): STREAM_NAME = 'heroku' URL_TEMPLATE = u"/api/v1/external/heroku?stream={stream}&api_key={api_key}" def test_deployment(self) -> None: expected_topic = "sample-project" expec...
null
v4
[ "list" ]
Any
def v4(v5: list): v6 = [] for v7 in v5: if not v0(v7, v6): v6.append(v7) return v6
[ { "name": "v0", "input_types": [ "Any", "Any" ], "output_type": "Any", "code": "def v0(v1, v2):\n for v3 in v2:\n if compare_objects(v3, v1):\n return True\n return False", "dependencies": [] } ]
[]
[]
6
from copy import deepcopy from .KeysHandler import split_key_and_delimiters_to_list, fuse_key_list, get_all_levels_keys, get_all_leaf_keys from .SchemaHandler import get_component_schema from compare_objects import compare_objects def obj_in_ls(ob, ls): for elem in ls: if compare_objects(elem, ob): ...
null
v0
[ "pytrellis.TileConfig", "str" ]
Optional[str]
def v0(v1: pytrellis.TileConfig, v2: str) -> Optional[str]: for v3 in v1.cenums: if v3.name == v2: return v3.value return None
[]
[]
[]
5
import os import re import sys from collections import defaultdict from dataclasses import dataclass, field from functools import lru_cache from typing import Callable, ClassVar, Dict, List, Optional, Set, Tuple, Type try: # optional import to get natural sorting of integers (i.e. 1, 5, 9, 10 instead of 1, 10, 5, ...
null
v38
[ "str", "str", "str" ]
None
def v38(v39: str, v40: str, v41: str) -> None: v0(v39, v40, v41) v42 = v32(v39, v40) print(f'Instances found in {v40}:', ', '.join((i.name for v43 in v42))) v44 = v23(v39) print(f'Instances found in project {v39}:') for (v45, v46) in v44.items(): print(f'{v45}:', ', '.join((v43.name for ...
[ { "name": "v0", "input_types": [ "str", "str", "str", "str", "str", "str" ], "output_type": "compute_v1.Instance", "code": "def v0(v1: str, v2: str, v3: str, v4: str='n1-standard-1', v5: str='projects/debian-cloud/global/images/family/debian-10', v6: str='glob...
[ "sys" ]
[ "import sys" ]
9
#!/usr/bin/env python # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
null
v0
[ "list" ]
None
def v0(self, v1: list) -> None: v2: T.Dict = self._cache.get_cache() for v3 in v2: if self._meson.policy_use_dist_inc_subprojects is False: v1.remove(v2[v3]) for v3 in v2: v1.extend([f'{v3}={v2[v3]}'])
[]
[]
[]
7
#!/usr/bin/env python3 # # author : Michael Brockus.   # contact: <mailto:michaelbrockus@gmail.com> # license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0 # # copyright 2020 The Meson-UI development team # from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from ..mesonuilib.coredata impo...
null
v0
[]
None
def v0(self) -> None: self._cache.configure('formats', self.combo_formats.currentText()) self._cache.configure('include-subprojects', self.combo_include_subprojects.currentText())
[]
[]
[]
3
#!/usr/bin/env python3 # # author : Michael Brockus.   # contact: <mailto:michaelbrockus@gmail.com> # license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0 # # copyright 2020 The Meson-UI development team # from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from ..mesonuilib.coredata impo...
null
v0
[ "List[List[int]]" ]
List[List[int]]
def v0(self, v1: List[List[int]]) -> List[List[int]]: if not v1: return [] v2 = len(v1) v3 = [] for v4 in v1[0]: v3.append([0, v4]) for v5 in range(1, v2 - 1): self.addNode(v5, v1[v5], v3) for v6 in range(len(v3) - 1, -1, -1): if v3[v6][-1] != v2 - 1: ...
[]
[]
[]
13
import unittest from typing import List class Solution: def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: if not graph: return [] num_nodes = len(graph) all_pathes = [] for edge in graph[0]: all_pathes.append([0, edge]) for...
null
v0
[ "int", "List[int]", "List[List[int]]" ]
None
def v0(self, v1: int, v2: List[int], v3: List[List[int]]) -> None: if not v2: return v4 = len(v2) for v5 in v3: if v5[-1] == v1: if v4 > 1: for v6 in range(1, v4): v7 = v5 + [v2[v6]] v3.append(v7) v5.append(v2[0]...
[]
[]
[]
11
import unittest from typing import List class Solution: def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: if not graph: return [] num_nodes = len(graph) all_pathes = [] for edge in graph[0]: all_pathes.append([0, edge]) for...
null
v0
[]
Dict[str, Any]
def v0(self) -> Dict[str, Any]: v1 = self._load_args v2 = self._save_args if 'properties' in v1: v3 = v1['properties'].copy() v3.pop('user', None) v3.pop('password', None) v1 = {**v1, 'properties': v3} if 'properties' in v2: v4 = v2['properties'].copy() v4...
[]
[]
[]
14
# Copyright 2020 QuantumBlack Visual Analytics Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # THE SOFTWARE IS PROVIDED "AS IS", WIT...
null
v0
[ "DAGCircuit" ]
DAGCircuit
def v0(self, v1: DAGCircuit) -> DAGCircuit: for v2 in v1.op_nodes(): if self._should_decompose(v2): if not v2.op.definition: continue v3 = v2.op.definition.data if len(v3) == 1 and len(v2.qargs) == len(v3[0][1]) == 1: if v2.op.definition.gl...
[]
[ "qiskit" ]
[ "from qiskit.transpiler.basepasses import TransformationPass", "from qiskit.dagcircuit.dagcircuit import DAGCircuit", "from qiskit.converters.circuit_to_dag import circuit_to_dag", "from qiskit.circuit.gate import Gate", "from qiskit.utils.deprecation import deprecate_arguments" ]
14
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: if v1[0] == 'v': return self.veth_to_sw_iface[v1] elif v1[0] == 's': return self.sw_iface_to_veth[v1]
[]
[]
[]
5
import os.path as osp import json from mininet.node import Controller class Config: def __init__(self, path=None): if not path: path = osp.join(osp.dirname(__file__), 'config.json') raw = json.load(open(path)) # hosts self.ips = [] self.macs = [] self.i...
null
v0
[ "str" ]
Dict[str, str]
async def v0(self, v1: str) -> Dict[str, str]: v2 = await self.client.get(self.fetch_ticker_url, params={'symbol': v1}) v3 = v2.json() return {'last': v3.get('price', '0')}
[]
[]
[]
4
""" Bitrue optimized price endpoint provider """ from typing import Dict from .base import FakeCCXT class Bitrue(FakeCCXT): """ Bitrue has a public endpoint for fetching a price of a symbol. """ fetch_ticker_url = "https://www.bitrue.com/api/v1/ticker/price" @property def id(self) -> str: ...
null
v0
[ "str" ]
str
def v0(self, v1: str) -> str: v1 = str(v1) if v1.startswith('/'): return v1[1:] if self._path is None or self._path == '/': return v1 return '%s/%s' % (self._path, v1)
[]
[]
[]
7
from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union from .jobs import ConsoleFunction from .lifecycles import * from .states import * class Context: """ Contexts serve as path-relevant snapshots of the kernel. These are the primary interaction between the modules and the kernel. The...
null
v0
[]
Generator['Context', None, None]
def v0(self) -> Generator['Context', None, None]: for v1 in list(self._kernel.contexts): if v1.startswith(self._path): yield (v1, self._kernel.contexts[v1])
[]
[]
[]
4
from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union from .jobs import ConsoleFunction from .lifecycles import * from .states import * class Context: """ Contexts serve as path-relevant snapshots of the kernel. These are the primary interaction between the modules and the kernel. The...
null
v0
[]
None
def v0(self) -> None: for v1 in list(self._kernel.contexts): if v1.startswith(self._path): del self._kernel.contexts[v1]
[]
[]
[]
4
from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union from .jobs import ConsoleFunction from .lifecycles import * from .states import * class Context: """ Contexts serve as path-relevant snapshots of the kernel. These are the primary interaction between the modules and the kernel. The...
null
v0
[ "Any", "Any", "Any" ]
Any
def v0(self, v1, v2, v3=None) -> Any: if hasattr(self, v2) and getattr(self, v2) is not None: return getattr(self, v2) if not v2.startswith('_'): v4 = self._kernel.read_persistent(v1, self.abs_path(v2), v3) else: v4 = v3 setattr(self, v2, v4) return v4
[]
[]
[]
9
import datetime import functools import inspect import os import re import threading import time from threading import Lock, Thread from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union from .svgelements import Color STATE_UNKNOWN = -1 STATE_INITIALIZE = 0 STATE_IDLE = 1 STATE_ACTIVE = 2 STATE_BUS...
null
v0
[ "str" ]
Union['Module', None]
def v0(self, v1: str) -> Union['Module', None]: try: return self.opened[v1] except KeyError: return None
[]
[]
[]
5
from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union from .jobs import ConsoleFunction from .lifecycles import * from .states import * class Context: """ Contexts serve as path-relevant snapshots of the kernel. These are the primary interaction between the modules and the kernel. The...
null
v2
[ "argparse.Namespace" ]
Any
def v2(v3: argparse.Namespace): v4 = v0(v3) v5 = io.imread(v3.INFILE) v4.fit(v5) v6 = v4.transform(v5) io.imsave(v3.OUTFILE, v6)
[ { "name": "v0", "input_types": [ "argparse.Namespace" ], "output_type": "Any", "code": "def v0(v1: argparse.Namespace):\n return Pyx(height=v1.height, width=v1.width, factor=v1.factor, upscale=v1.upscale, depth=v1.depth, palette=v1.palette, dither=v1.dither, sobel=v1.sobel, alpha=v1.alp...
[ "skimage" ]
[ "from skimage import io" ]
6
#!/usr/bin/env python3 import argparse import sys import re from pathlib import Path from typing import List, Optional, Set, Tuple, Union import numpy as np from skimage import io try: from . import Pyx, Pal, Vid except ImportError: try: from pyxelate import Pyx, Pal, Vid except ImportError: ...
null
v0
[ "argparse.ArgumentParser" ]
Any
def v0(v1: argparse.ArgumentParser): v1.add_argument('--sampler.name', type=str, default='batch_sampler', help='Name of the sampler') return v1
[]
[]
[]
3
# # For licensing see accompanying LICENSE file. # Copyright (C) 2020 Apple Inc. All Rights Reserved. # import os import importlib from typing import Optional from utils import logger import argparse from .base_sampler import BaseSamplerDDP, BaseSamplerDP SAMPLER_REGISTRY = {} def register_sampler(name): def ...
null
v0
[ "str" ]
Optional[entity.Entity]
def v0(self, v1: str) -> Optional[entity.Entity]: for v2 in self._platforms.values(): v3 = v2.entities.get(v1) if v3 is not None: return v3 return None
[]
[]
[]
6
"""Helpers for components that manage entities.""" import asyncio from datetime import timedelta from itertools import chain import logging from types import ModuleType from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union import voluptuous as vol from homeassistant import config as conf_util...
null
v0
[]
None
async def v0(self) -> None: v1 = [] for (v2, v3) in self._platforms.items(): if v2 == self.domain: v1.append(v3.async_reset()) else: v1.append(v3.async_destroy()) if v1: await asyncio.gather(*v1) self._platforms = {self.domain: self._platforms[self.domain]...
[]
[ "asyncio" ]
[ "import asyncio" ]
11
"""Helpers for components that manage entities.""" from __future__ import annotations import asyncio from datetime import timedelta from itertools import chain import logging from types import ModuleType from typing import Any, Callable, Iterable import voluptuous as vol from homeassistant import config as conf_util...
null
v0
[ "str" ]
None
async def v0(self, v1: str) -> None: v2 = None for v3 in self._platforms.values(): if v1 in v3.entities: v2 = v3 break if v2: await v2.async_remove_entity(v1)
[]
[]
[]
8
"""Helpers for components that manage entities.""" from __future__ import annotations import asyncio from datetime import timedelta from itertools import chain import logging from types import ModuleType from typing import Any, Callable, Iterable import voluptuous as vol from homeassistant import config as conf_util...
null
v0
[ "float" ]
float
def v0(v1: float) -> float: v2 = round(v1 / np.pi) if v2 % 2 == 0: return v1 - v2 * np.pi return v2 * np.pi - v1
[]
[ "numpy" ]
[ "import numpy as np" ]
5
# Copyright 2021 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
null
v7
[ "'cirq.FSimGate'" ]
Sequence[Tuple[float, float]]
def v7(v8: 'cirq.FSimGate') -> Sequence[Tuple[float, float]]: def v9(v10: Sequence[Tuple[float, float]]) -> Sequence[Tuple[float, float]]: return tuple(((a, b) for (v11, v12) in v10 if v11 < v12)) if isinstance(v8.theta, sympy.Expr) or isinstance(v8.phi, sympy.Expr): raise ValueError('Symbolic ...
[ { "name": "v0", "input_types": [ "float" ], "output_type": "float", "code": "def v0(v1: float) -> float:\n v2 = round(v1 / np.pi)\n if v2 % 2 == 0:\n return v1 - v2 * np.pi\n return v2 * np.pi - v1", "dependencies": [] }, { "name": "v3", "input_types": [ ...
[ "numpy", "sympy" ]
[ "import numpy as np", "import sympy" ]
21
# Copyright 2021 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
null
v0
[ "str", "str" ]
Any
def v0(self, v1: str, v2: str): if self._current_ref == v1: self.close_files_view() self.refresh_pkg_selection_view()
[]
[]
[]
4
import os from pathlib import Path from typing import TYPE_CHECKING, Callable, Optional import conan_app_launcher.app as app # using global module pattern from conan_app_launcher.app.logger import Logger from conan_app_launcher.core import (open_cmd_in_path, open_file, open_in_fil...
null
v0
[ "str" ]
int
def v0(self, v1: str) -> int: if not self.pkg_sel_model: return False for v2 in range(self.pkg_sel_model.root_item.child_count()): v3 = self.pkg_sel_model.root_item.child_items[v2] if v3.item_data[0] == v1: return v2 return -1
[]
[]
[]
8
import os from pathlib import Path from typing import TYPE_CHECKING, Callable, Optional import conan_app_launcher.app as app # using global module pattern from conan_app_launcher.app.logger import Logger from conan_app_launcher.core import (open_cmd_in_path, open_file, open_in_fil...
null
v0
[]
str
def v0(self) -> str: v1 = self._get_pkg_file_source_item() if not v1: if self.fs_model: return self.fs_model.rootPath() else: return '' return v1.model().fileInfo(v1).absoluteFilePath()
[]
[]
[]
8
import os from pathlib import Path from typing import TYPE_CHECKING, Callable, Optional import conan_app_launcher.app as app # using global module pattern from conan_app_launcher.app.logger import Logger from conan_app_launcher.core import (open_cmd_in_path, open_file, open_in_fil...
null
v0
[ "str", "list[str]" ]
Generator[str, None, None]
def v0(v1: str, v2: list[str]=None) -> Generator[str, None, None]: if v2 is None: v2 = [] else: v2 = [pathlib.Path(i) for v3 in v2] for v3 in v2: if not v3.exists(): raise ValueError(f'You excluded not existed directory [{v3.absolute()}]') v4 = pathlib.Pat...
[]
[ "pathlib" ]
[ "import pathlib" ]
24
from __future__ import annotations from typing import Generator import pathlib def walk_files_in_dir(path: str, excluded: list[str]=None) -> Generator[str, None, None]: if excluded is None: excluded = [] else: excluded = [pathlib.Path(i) for i in excluded] for i in excluded: if not i.exists(): raise V...
null
v55
[ "str" ]
None
def v55(v56: str='input.txt') -> None: v57 = v32(v56) v39(v57)
[ { "name": "v32", "input_types": [ "str" ], "output_type": "v0", "code": "def v32(v33: str) -> v0:\n with open(v33) as v34:\n v35 = [char for v36 in v34.read() if v36 in 'ABCD']\n v35 = ''.join((''.join(pair) for v37 in zip(v35[:4], v35[4:])))\n v38 = v0()\n v38.add_n...
[ "tqdm" ]
[ "from tqdm import tqdm" ]
3
from __future__ import annotations import dataclasses import functools import timeit from typing import Optional import fire from pipe import select from tqdm import tqdm COSTS = { "A": 1, "B": 10, "C": 100, "D": 1000, } @functools.cache def reachable_nodes(board: Board, node: Node) -> tuple[list[N...
[ "@dataclasses.dataclass\nclass v0:\n v1: dict[int, Node] = dataclasses.field(default_factory=dict)\n\n def v2(self, *v3: Node) -> None:\n for v4 in v3:\n self.add_node(v4)\n\n def v5(self, v6: Node) -> None:\n self.grid[v6.node_id] = v6\n\n def v7(self, v8: int) -> Node:\n ...
v0
[]
None
def v0(self, *v1: Recipe) -> None: for v2 in v1: self.add_recipe(v2)
[]
[]
[]
3
import argparse import logging from typing import Dict, Union, Any, List from .alkymi import compute_status_with_cache, Status from .logging import log from .recipe import Recipe class Lab: """ Class used to define a collection of alkymi recipes and expose them as a command line interface (CLI) This can...
null
v67
[]
list[tuple[v32, v32, int]]
def v67(self) -> list[tuple[v32, v32, int]]: v68 = [] for v69 in self.grid.values(): if v69.has_occupant and (not v69.completed): (v70, v71) = v58(self, v69) for (v72, v73) in zip(v70, v71): if v69.is_a_home and (not v72.is_a_home): v68.append(...
[ { "name": "v58", "input_types": [ "v0", "v32" ], "output_type": "tuple[list[v32], list[int]]", "code": "@functools.cache\ndef v58(v59: v0, v60: v32) -> tuple[list[v32], list[int]]:\n v61 = []\n v62 = []\n for (v63, v64) in zip(v60.neighbors(v59), v60.distances):\n if ...
[]
[]
13
from __future__ import annotations import dataclasses import functools import timeit from typing import Optional import fire from pipe import select from tqdm import tqdm COSTS = { "A": 1, "B": 10, "C": 100, "D": 1000, } @functools.cache def reachable_nodes(board: Board, node: Node) -> tuple[list[N...
[ "@dataclasses.dataclass\nclass v0:\n v1: dict[int, Node] = dataclasses.field(default_factory=dict)\n\n def v2(self, *v3: Node) -> None:\n for v4 in v3:\n self.add_node(v4)\n\n def v5(self, v6: Node) -> None:\n self.grid[v6.node_id] = v6\n\n def v7(self, v8: int) -> Node:\n ...
v26
[]
tuple[v0, str, int]
def v26(self) -> tuple[v0, str, int]: assert len(self.occupants) > 0 v27 = self.occupants[0] v28 = self.occupants[1:] return (dataclasses.replace(self, occupants=v28), v27, self.max_occupants - len(self.occupants))
[]
[ "dataclasses" ]
[ "import dataclasses" ]
5
from __future__ import annotations import dataclasses import functools import timeit from typing import Optional import fire from pipe import select from tqdm import tqdm COSTS = { "A": 1, "B": 10, "C": 100, "D": 1000, } @functools.cache def reachable_nodes(board: Board, node: Node) -> tuple[list[N...
[ "@dataclasses.dataclass(frozen=True)\nclass v0:\n v1: int\n v2: tuple[int, ...]\n v3: tuple[int, ...]\n v4: str = ''\n v5: str = ''\n v6: int = 1\n\n def v7(self, v8: Board) -> tuple[v0, ...]:\n return tuple((v8.get_node(v1) for v9 in self._neighbors))\n\n @property\n def v10(self)...
v26
[ "str" ]
tuple[v0, int]
def v26(self, v27: str) -> tuple[v0, int]: assert len(self.occupants) < self.max_occupants return (dataclasses.replace(self, occupants=v27 + self.occupants), self.max_occupants - len(self.occupants) - 1)
[]
[ "dataclasses" ]
[ "import dataclasses" ]
3
from __future__ import annotations import dataclasses import functools import timeit from typing import Optional import fire from pipe import select from tqdm import tqdm COSTS = { "A": 1, "B": 10, "C": 100, "D": 1000, } @functools.cache def reachable_nodes(board: Board, node: Node) -> tuple[list[N...
[ "@dataclasses.dataclass(frozen=True)\nclass v0:\n v1: int\n v2: tuple[int, ...]\n v3: tuple[int, ...]\n v4: str = ''\n v5: str = ''\n v6: int = 1\n\n def v7(self, v8: Board) -> tuple[v0, ...]:\n return tuple((v8.get_node(v1) for v9 in self._neighbors))\n\n @property\n def v10(self)...
v0
[ "str", "str" ]
Any
def v0(v1: str, v2: str): v3 = re.sub('\\W', '', v1) v4 = v3[0].lower() + v3[1:] return (v4, v2, v1)
[]
[ "re" ]
[ "import re" ]
4
import re def ms(text: str, code: str): # Make status s = re.sub(r'\W', '', text) key = s[0].lower() + s[1:] return key, code, text settingsTemplate = { 'teacherName': 'Dave Briccetti', # Change this 'missingSeatIndexes': [], 'chatEnabled': False, 'sharesEnabled': True, 'checksEnab...
null
v2
[ "Set[Type['BaseModel']]" ]
Dict[Type['BaseModel'], str]
def v2(v3: Set[Type['BaseModel']]) -> Dict[Type['BaseModel'], str]: v4 = {} v5: Set[str] = set() for v6 in v3: v7 = v6.__name__ v7 = re.sub('[^a-zA-Z0-9.\\-_]', '_', v7) if v7 in v5: v7 = v0(v6) v4[v7] = v6 elif v7 in v4: v5.add(v7) ...
[ { "name": "v0", "input_types": [ "Type['BaseModel']" ], "output_type": "str", "code": "def v0(v1: Type['BaseModel']) -> str:\n return f'{v1.__module__}__{v1.__name__}'.replace('.', '__')", "dependencies": [] } ]
[ "re" ]
[ "import re" ]
17
import re import warnings from datetime import date, datetime, time, timedelta from decimal import Decimal from enum import Enum from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network from pathlib import Path from types import FunctionType from typing import ( TYPE_CH...
null
v15
[ "Sequence[Type['BaseModel']]" ]
Set[Type['BaseModel']]
def v15(v16: Sequence[Type['BaseModel']]) -> Set[Type['BaseModel']]: v17: Set[Type['BaseModel']] = set() for v18 in v16: v17 |= v10(v18) return v17
[ { "name": "v0", "input_types": [ "ModelField", "Set[Type['BaseModel']]" ], "output_type": "Set[Type['BaseModel']]", "code": "def v0(v1: ModelField, v2: Set[Type['BaseModel']]) -> Set[Type['BaseModel']]:\n from .main import BaseModel\n v3: Set[Type[BaseModel]] = set()\n v4 = ...
[ "typing" ]
[ "from typing import TYPE_CHECKING, Any, Callable, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, cast", "from .typing import ForwardRef, Literal, is_callable_type, is_literal_type, is_new_type, literal_values, new_type_supertype" ]
5
import re import warnings from datetime import date, datetime, time, timedelta from decimal import Decimal from enum import Enum from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network from pathlib import Path from types import FunctionType from typing import ( TYPE_CH...
null
v0
[]
set
def v0(self) -> set: if hasattr(self, 'permissions') and self.permissions: if isinstance(self.permissions, set): return self.permissions elif isinstance(self.permissions, list): return set(self.permissions) else: return set(self.permissions.split(',')) ...
[]
[]
[]
9
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "t.Union[set, list, str]" ]
None
def v0(self, v1: t.Union[set, list, str]) -> None: if hasattr(self, 'permissions'): v2 = self.get_permissions() if isinstance(v1, set): v3 = v1 elif isinstance(v1, list): v3 = set(v1) else: v3 = {v1} self.permissions = ','.join(v2.differenc...
[]
[]
[]
12
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "t.Union[str, bytes]" ]
bool
def v0(self, v1: t.Union[str, bytes]) -> bool: v2 = 0 if len(v1) == 1 else 2 if hasattr(self, 'fs_token_uniquifier'): return v1[v2] == self.fs_token_uniquifier return v1[v2] == self.fs_uniquifier
[]
[]
[]
5
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "str" ]
bool
def v0(self, v1: str) -> bool: for v2 in self.roles: if v1 in v2.get_permissions(): return True return False
[]
[]
[]
5
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "t.Optional[t.Dict[str, t.Any]]" ]
t.Dict[str, t.Any]
def v0(self, v1: t.Optional[t.Dict[str, t.Any]]=None) -> t.Dict[str, t.Any]: if not v1: v1 = {} if hasattr(self, 'email'): v1.update({'email': self.email}) v1.update({'identity': self.calc_username()}) return v1
[]
[]
[]
7
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "t.Callable[[], 'ResponseValue']" ]
None
def v0(self, v1: t.Callable[[], 'ResponseValue']) -> None: warnings.warn("'unauthorized_handler' has been replaced with 'unauthz_handler' and 'unauthn_handler'", DeprecationWarning) self._unauthorized_callback = v1
[]
[ "warnings" ]
[ "import warnings" ]
3
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "str", "t.Callable[[], t.Dict[str, t.Any]]" ]
None
def v0(self, v1: str, v2: t.Callable[[], t.Dict[str, t.Any]]) -> None: v3 = self._context_processors.setdefault(v1, []) if v2 not in v3: v3.append(v2)
[]
[]
[]
4
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "str" ]
t.Dict[str, t.Any]
def v0(self, v1: str) -> t.Dict[str, t.Any]: v2: t.Dict[str, t.Any] = {} for v3 in ['global', v1]: for v4 in self._context_processors.setdefault(v3, []): v2.update(v4()) return v2
[]
[]
[]
6
""" flask_security.core ~~~~~~~~~~~~~~~~~~~ Flask-Security core module :copyright: (c) 2012 by Matt Wright. :copyright: (c) 2017 by CERN. :copyright: (c) 2017 by ETH Zurich, Swiss Data Science Center. :copyright: (c) 2019-2022 by J. Christopher Wagner (jwag). :license: MIT, see LICENSE...
null
v0
[ "Callable" ]
inspect.Signature
def v0(v1: Callable) -> inspect.Signature: if sys.version_info >= (3, 10): return inspect.signature(v1, eval_str=True) if inspect.isfunction(v1) or inspect.ismethod(v1): v2 = get_type_hints(v1) else: v2 = get_type_hints(v1.__call__) v3 = inspect.signature(v1) v4 = [] for ...
[]
[ "inspect", "sys", "typing" ]
[ "import inspect", "import sys", "from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union, cast, get_args, get_origin, get_type_hints, overload" ]
19
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
null
v0
[ "Optional[float]", "Optional[float]", "float" ]
Optional[float]
def v0(v1: Optional[float], v2: Optional[float], v3: float=1) -> Optional[float]: if v1 is not None: if v2 is not None: raise TypeError('Cannot combine lt and le or gt and le') return v1 elif v2 is not None: v4 = math.ldexp(1.0, -1024) return v2 + v4 * v3 else: ...
[]
[ "math" ]
[ "import math" ]
10
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
null
v9
[ "Callable[..., v0]" ]
v0
def v9(v10: Callable[..., v0], /, *v11: Any, **v12: Any) -> v0: v13: Any = object() v14 = v1(v10) v15 = {p.kind for v16 in v14.parameters.values()} v17 = {inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD} if v17.issubset(v15): raise TypeError('Cannot safely call a function wit...
[ { "name": "v1", "input_types": [ "Callable" ], "output_type": "inspect.Signature", "code": "def v1(v2: Callable) -> inspect.Signature:\n if sys.version_info >= (3, 10):\n return inspect.signature(v2, eval_str=True)\n if inspect.isfunction(v2) or inspect.ismethod(v2):\n ...
[ "inspect", "itertools", "sys", "typing" ]
[ "import inspect", "import itertools", "import sys", "from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union, cast, get_args, get_origin, get_type_hints, overload" ]
30
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
[ "v0 = TypeVar('T', bound=Any)" ]
v20
[ "Callable", "Any" ]
None
def v20(self, v21: Callable, v22: Any) -> None: (v23, v24) = v1(v21) if len(v24) != 1: raise TypeError('Converters must take precisely two arguments: the interaction and the argument') (v23, v25) = v24.popitem() v26 = v25.annotation if v25.default is not inspect.Parameter.empty and self.defa...
[ { "name": "v1", "input_types": [ "Callable" ], "output_type": "Tuple[Tuple[Optional[inspect.Parameter], ...], Dict[str, inspect.Parameter]]", "code": "def v1(v2: Callable) -> Tuple[Tuple[Optional[inspect.Parameter], ...], Dict[str, inspect.Parameter]]:\n v3 = lambda annot: issubclass_(a...
[ "inspect", "sys", "typing" ]
[ "import inspect", "import sys", "from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union, cast, get_origin, get_type_hints" ]
16
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
[ "v0 = TypeVar('TypeT', bound=Type[Any])" ]
v0
[ "inspect.Parameter" ]
None
def v0(self, v1: inspect.Parameter) -> None: self.name = self.name or v1.name self.param_name = v1.name
[]
[]
[]
3
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
null
v0
[ "disnake.utils._DocstringParam" ]
None
def v0(self, v1: disnake.utils._DocstringParam) -> None: if self.type == str and v1['type'] is not None: self.parse_annotation(v1['type']) self.description = self.description or v1['description'] self.name_localizations._upgrade(v1['localization_key_name']) self.description_localizations._upgrad...
[]
[]
[]
6
# The MIT License (MIT) # Copyright (c) 2021-present EQUENOS # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, mod...
null
v0
[ "str" ]
None
def v0(v1: str) -> None: if os.path.exists(v1): shutil.rmtree(v1, ignore_errors=True) os.mkdir(v1)
[]
[ "os", "shutil" ]
[ "import os", "import shutil" ]
4
import hashlib import os import shutil def get_all_files_in_dir(target_dir: str) -> list: filenames = [] for root, subdirs, files in os.walk(target_dir, topdown=True): for file in files: filenames.append(os.path.join(root, file)) return filenames def get_md5_of_file(filepath: str) ->...
null
v0
[ "str", "str", "str" ]
str
def v0(v1: str, v2: str, v3: str) -> str: v4 = 'https://ca.slack-edge.com/{}-{}-{}'.format(v2, v1, v3) return v4
[]
[]
[]
3
import os import ujson import hashlib import sys import argparse import shutil import subprocess import re import logging import random import requests from django.conf import settings from django.db import connection from django.utils.timezone import now as timezone_now from django.forms.models import model_to_dict f...
null
v0
[ "str", "str", "str" ]
Any
def v0(v1: str, v2: str, v3: str) -> Any: v4 = requests.get('%s?token=%s' % (v2, v1)) if v4.status_code == requests.codes.ok: if 'error' in v4.json(): raise Exception('Enter a valid token!') v5 = v4.json()[v3] return v5 else: raise Exception('Something went wrong....
[]
[ "requests" ]
[ "import requests" ]
9
import os import ujson import hashlib import sys import argparse import shutil import subprocess import re import logging import random import requests from django.conf import settings from django.db import connection from django.utils.timezone import now as timezone_now from django.forms.models import model_to_dict f...
null
v0
[ "tuple[int, int]", "float" ]
Any
def v0(self, v1: tuple[int, int], v2: float): v3 = self._screen.convert_abs_to_monitor(v1) self.pre_move() self.move(v3, force_move=True) self._cast_attack_pattern(v2)
[]
[]
[]
5
import keyboard from utils.custom_mouse import mouse from char import IChar,CharacterCapabilities from template_finder import TemplateFinder from ui import UiManager from pather import Pather from logger import Logger from screen import Screen from utils.misc import wait, cut_roi import time from pather import Pather, ...
null
v0
[]
bool
def v0(self) -> bool: v1 = self._char_config['atk_len_trav'] self._pather.traverse_nodes([228, 229], self, time_out=2.5, force_tp=True) self._cast_hammers(v1) self._move_and_attack((40, 20), v1) if self.can_teleport(): self._pather.traverse_nodes([226], self, time_out=2.5, force_tp=True) ...
[]
[]
[]
14
import keyboard from utils.custom_mouse import mouse from char import IChar from template_finder import TemplateFinder from ui import UiManager from pather import Pather from logger import Logger from screen import Screen from utils.misc import wait import time from pather import Pather, Location class Hammerdin(ICha...
null
v0
[ "Callable" ]
None
def v0(self, v1: Callable) -> None: try: v1() except Exception: self.report_exception()
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "str", "str", "str", "Optional[Callable[[], None]]", "Optional[Callable[[], bool]]", "Optional[str]", "Sequence[str]", "Optional[str]", "bool", "Optional[str]", "int", "Any", "Optional[str]", "Optional[str]", "Optional[str]", "bool", "bool", "Optional[tk.Menu]", "bool", "Any" ]
None
def v0(self, v1: str, v2: str, v3: str, v4: Optional[Callable[[], None]]=None, v5: Optional[Callable[[], bool]]=None, v6: Optional[str]=None, v7: Sequence[str]=[], v8: Optional[str]=None, v9: bool=False, v10: Optional[str]=None, v11: int=99, v12='end', v13: Optional[str]=None, v14: Optional[str]=None, v15: Optional[str...
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: for v1 in self._commands: self._publish_command(**v1)
[]
[]
[]
3
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "Union[int, float]" ]
int
def v0(self, v1: Union[int, float]) -> int: if isinstance(v1, (int, float)): v2 = int(self._scaling_factor * v1) if v2 == 0 and v1 > 0: return 1 else: return v2 else: raise NotImplementedError('Only numeric dimensions supported at the moment')
[]
[]
[]
9
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: v2 = [] v3 = {} v4 = v1 while True: (v5, v6, v7) = self._ui_themes[v4] v2.insert(0, v6) for v8 in v7: v3.setdefault(v8, v7[v8]) if v5 is not None: v4 = v5 else: break assert v4 in self._style.t...
[]
[]
[]
26
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: v1 = self.get_option('view.ui_theme') v2 = self.get_usable_ui_theme_names() if v1 in v2: self._apply_ui_theme(v1) elif 'Enhanced Clam' in v2: self._apply_ui_theme('Enhanced Clam') elif 'Windows' in v2: self._apply_ui_theme('Windows') self._apply_synt...
[]
[]
[]
10
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
bool
def v0(self) -> bool: v1 = self._style.theme_use() while True: if 'dark' in v1.lower(): return True try: (v1, v2, v2) = self._ui_themes[v1] except KeyError: return False if v1 is None: break return False
[]
[]
[]
12
# -*- coding: utf-8 -*- import os.path import platform import tkinter as tk import tkinter.font as tk_font import traceback from logging import getLogger from tkinter import messagebox, ttk import ast import collections import importlib import pkgutil import queue import re import shutil import socket import sys from...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: v1 = v1.strip() self.set_option('run.program_arguments', v1) if v1 == '': return v2 = self.get_option('run.past_program_arguments') if v1 in v2: v2.remove(v1) v2.insert(0, v1) v2 = v2[:10] self.set_option('run.past_program_arguments', v2) ...
[]
[]
[]
12
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[]
None
def v0(self) -> None: for v1 in self._view_records: if self._view_records[v1]['visibility_flag'].get(): try: self.show_view(v1, False) except Exception: self.report_exception('Problem showing ' + v1)
[]
[]
[]
7
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "str" ]
None
def v0(self, v1: str) -> None: if self.get_option('run.working_directory') != v1: self.set_option('run.working_directory', v1) if v1: self.event_generate('LocalWorkingDirectoryChanged', cwd=v1)
[]
[]
[]
5
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null
v0
[ "str", "bool" ]
Union[bool, tk.Widget]
def v0(self, v1: str, v2: bool=True) -> Union[bool, tk.Widget]: if v1 == 'MainFileBrowser': v1 = 'FilesView' v3 = self.get_view(v1) v4 = v3.home_widget.master if hasattr(v3, 'before_show') and v3.before_show() == False: return False if v3.hidden: v4.insert('auto', v3.home_wid...
[]
[]
[]
18
# -*- coding: utf-8 -*- import ast import collections import importlib from logging import getLogger import os.path import pkgutil import platform import queue import re import shutil import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback from threading import Thread from tkinter...
null