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
[]
bool
def v0(self) -> bool: if self.attributes_address == -1: self._unsaved_changes = False return True v1: bool = True v2 = bytearray() v3 = len(self.attributes) v4 = [0, 2, 4, 6] for v5 in range(64): v6 = 0 v7 = v5 % 8 << 2 v8 = v5 >> 3 << 2 v9 = v7 % ...
[]
[]
[]
21
__author__ = "Fox Cunning" from tkinter import Canvas from typing import List from PIL import Image, ImageTk import colour from appJar import appjar from debug import log from helpers import Point2D from palette_editor import PaletteEditor from rom import ROM from undo_redo import UndoRedo class CutsceneEditor: ...
null
v2
[ "str" ]
None
def v2(self, v3: str) -> None: v4 = self.nametable[:960] v5 = len(self.attributes) v6 = [0, 2, 4, 6] for v7 in range(64): v8 = 0 v9 = v7 % 8 << 2 v10 = v7 >> 3 << 2 v11 = v9 % 32 + (v10 << 5) v12 = [v11, v11 + 2, v11 + 64, v11 + 66] for v13 in range(4): ...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Any", "code": "def v0(self, v1: str):\n log(2, f'{self.__class__.__name__}', v1)", "dependencies": [] } ]
[]
[]
21
__author__ = "Fox Cunning" from tkinter import Canvas from typing import List from PIL import Image, ImageTk import colour from appJar import appjar from debug import log from helpers import Point2D from palette_editor import PaletteEditor from rom import ROM from undo_redo import UndoRedo class CutsceneEditor: ...
null
v2
[ "str" ]
None
def v2(self, v3: str) -> None: try: v4 = open(v3, 'rb') v5 = v4.read() v4.close() self.nametable = bytearray(v5[:960]) self.attributes.clear() v6 = 960 self.attributes = bytearray(v6) v5 = v5[960:] for v7 in range(64): v8 = v5[v7] &...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "Any", "code": "def v0(self, v1: str):\n log(2, f'{self.__class__.__name__}', v1)", "dependencies": [] } ]
[]
[]
30
__author__ = "Fox Cunning" from tkinter import Canvas from typing import List from PIL import Image, ImageTk import colour from appJar import appjar from debug import log from helpers import Point2D from palette_editor import PaletteEditor from rom import ROM from undo_redo import UndoRedo class CutsceneEditor: ...
null
v0
[ "int", "int", "int" ]
str
def v0(v1: int, v2: int=420, v3: int=420) -> str: v4 = requests.get(f'https://www.roblox.com/headshot-thumbnail/image?userId={v1}&width={v2}&height={v3}&format=png') return v4.url
[]
[ "requests" ]
[ "import requests, random, webbrowser" ]
3
import requests, random, webbrowser from time import time from typing import Union import Utils #Variables RawCookie = None UserID = None Username = None Robux = None Thumbnail = None isBuildersclub = None isPremium = None canChangeUsername = None isAdmin = None isEmailOnFile = None isEmailVerified = None isPhoneFeatu...
null
v0
[ "str", "str", "bytes" ]
Any
def v0(self, v1: str, v2: str, v3: bytes): assert v1 != v2 v4 = self.keyname_rows[v1].pop(v3) v5 = self.folders[v1].takeRow(v4) self.folders[v2].appendRow(v5) v6 = self.keyname_rows[v2] v6[v3] = len(v6)
[]
[]
[]
7
from typing import TYPE_CHECKING, Sequence import PyQt5.QtGui as QtGui import PyQt5.QtWidgets as QtWidgets import PyQt5.QtCore as QtCore from PyQt5.QtWidgets import QLabel, QLineEdit from electrum_plcu import util from electrum_plcu.i18n import _ from electrum_plcu.util import bh2u, format_time from electrum_plcu.lnu...
null
v0
[]
Iterator[str]
def v0(self) -> Iterator[str]: for v1 in self.env.found_docs: if v1 not in self.env.all_docs: yield v1 continue v2 = os.path.join(self.outdir, v1 + self.format) try: v3 = os.path.getmtime(v2) except Exception: v3 = 0 try: ...
[]
[ "os" ]
[ "import sys, os" ]
16
# -*- coding: utf-8 -*- #=============================================================================== # # Sphinx XWiki Builder # # by Eron Hennessey <eron@abstrys.com> # # Based on the syntax described here: # # * http://rendering.xwiki.org/xwiki/bin/view/XWiki/XWikiSyntax?syntax=2.1 # #=============================...
null
v0
[ "str", "str", "str" ]
Any
def v0(self, v1: str, v2: str, v3: str='and'): v4 = self[v1] if not v4: v5 = '' else: v5 = ' ' + v3 + ' (' + v4 + ')' self[v1] = v2 + v5
[]
[]
[]
7
import re, _io from pathlib import Path, PurePath from functools import partial import struct import bs4 import typing from .utils import * from .KSAST import * from .enum import * from .number import * from .pathTracer import Registry, extractUFWBIdFromRef expressionSplittingRx=re.compile("([^\\w\\.]+)") def subSt...
null
v0
[ "str", "typing.Optional[str]" ]
Any
def v0(v1: str, v2: typing.Optional[str]): global _server_url v3 = v1 global _server_directory v4 = v2
[]
[]
[]
5
#!/usr/bin/env python3 import os.path import requests import logging import typing import dataclasses import time import json import shutil @dataclasses.dataclass class PrankWebResponse: status: int body: typing.Dict logger = logging.getLogger("prankweb") logger.setLevel(logging.DEBUG) _server_url = None ...
null
v0
[]
None
def v0(self) -> None: v1 = self.ec2_mock.describe_instances.return_value['Reservations'] v2 = v1[0]['Instances'][0] v3 = (v2['InstanceId'], v2['PrivateIpAddress'], v2['PublicIpAddress'], 22, v2['State']['Name']) v4 = self.adapter.create_instances(num_cpu=2, num_ram=2, timeout=1) assert len(v4) == 1 ...
[]
[]
[]
8
# Copyright 2020 Adap GmbH. 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 law or ag...
null
v0
[]
None
def v0(self) -> None: v1 = '1' v2 = {'TerminatingInstances': [{'CurrentState': {'Name': 'shutting-down'}}]} self.ec2_mock.terminate_instances.return_value = v2 self.adapter.terminate_instances([v1])
[]
[]
[]
5
# Copyright 2020 Adap GmbH. 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 law or ag...
null
v0
[]
None
def v0(self) -> None: v1 = self.adapter.create_instances(num_cpu=2, num_ram=2, num_instance=1, timeout=10) v1 = self.adapter.list_instances() assert len(v1) == 1 self.adapter.terminate_instances([v1[0][0]])
[]
[]
[]
5
# Copyright 2020 Adap GmbH. 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 law or ag...
null
v0
[ "str", "int" ]
str
def v0(self, v1: str, v2: int) -> str: v3 = 0 for (v4, v5) in enumerate(v1): if v5.isdigit(): v3 *= int(v5) else: v3 += 1 if v3 >= v2: break for v6 in range(v4, -1, -1): v2 %= v3 if v2 == 0 and v1[v6].isalpha(): return v...
[]
[]
[]
17
class Solution: def decodeAtIndex(self, S: str, K: int) -> str: n = 0 for i, c in enumerate(S): if c.isdigit(): n *= int(c) else: n += 1 if n >= K: break for j in range(i, -1, -1): K %= n ...
null
v0
[ "Any", "str" ]
None
def v0(v1, v2: str) -> None: with open(v2, 'wb') as v3: pickle.dump(v1, v3, pickle.HIGHEST_PROTOCOL)
[]
[ "pickle" ]
[ "import pickle" ]
3
import pickle import pickle5 from typing import List, Union import os import json import yaml import re import ast import numpy as np import collections def convert(obj): """Conversion helper instead of JSON encoder for handling booleans.""" if isinstance(obj, bool): return int(obj) if isinstance(...
null
v0
[ "str" ]
Any
def v0(v1: str): with open(v1, 'rb') as v2: v3 = pk.load(v2) v2.close() return v3
[]
[ "pickle" ]
[ "import pickle as pk" ]
5
''' test config module ''' import os import pickle as pk import pandas as pd ''' NBUG ''' from nbug import * class test_configuration(object): def __init__(self, TEST_ID:str, OUT_DIR:str, OUT_DATA:str, CONF_DIR:str, SIM_DUR:float, ...
null
v0
[ "str" ]
Tuple[int, int]
def v0(v1: str) -> Tuple[int, int]: with open(v1) as v2: return (int(v2.readline().strip().split()[-1]), int(v2.readline().strip().split()[-1]))
[]
[]
[]
3
""" Advent of Code 2015 - Day 22 https://adventofcode.com/2015/day/22 """ import copy import dataclasses import heapq import pathlib from typing import Dict, List, Tuple __mypath = pathlib.Path(__file__).resolve().parent FULL_INPUT_FILE = __mypath / 'input.full.txt' TEST_INPUT_FILE = __mypath / 'input.test.txt' DEFA...
null
v0
[ "str", "str" ]
Any
def v0(v1: str, v2: str): if v2 is sys.stdout: print(v1) else: with open(v2, 'w') as v3: print(v1, file=v3)
[]
[ "sys" ]
[ "import sys" ]
6
# Why does this file exist, and why not put this in `__main__`? # # You might be tempted to import things from `__main__` later, # but that will cause problems: the code will get executed twice: # # - When you run `python -m griffe` python will execute # `__main__.py` as a script. That means there won't be any # `g...
null
v0
[ "Path" ]
bool
def v0(self, v1: Path) -> bool: v2 = v1 / 'model.tf' if self.model is not None: return True elif not v2.exists() or not v2.is_dir(): return False else: self.model = v0(v2) return True
[]
[ "tensorflow" ]
[ "from tensorflow import string, data, config", "from tensorflow.keras import Model, Input", "from tensorflow.keras.activations import sigmoid", "from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping", "from tensorflow.keras.layers import Bidirectional, LSTM, Dense, Subtract, Dropout, GlobalA...
9
# pylint: disable=no-name-in-module from pathlib import Path from typing import List, Tuple, Optional from nlpaug.augmenter.word import WordAugmenter, SynonymAug from nltk.downloader import Downloader from numpy import ndarray, array from tensorflow import string, data, config from tensorflow.keras import Model, Input...
null
v0
[ "torch.Tensor", "int", "int" ]
Any
def v0(v1: torch.Tensor, v2: int, v3: int): v4 = v1.new_zeros(v1.shape) v4[:, 1:] = v1[:, :-1].clone() v4[:, 0] = v3 if v2 is None: raise ValueError('self.model.config.pad_token_id has to be defined.') v4.masked_fill_(v4 == -100, v2) return v4
[]
[]
[]
8
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. 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/L...
null
v0
[ "torch.Size", "torch.dtype", "int" ]
Any
def v0(v1: torch.Size, v2: torch.dtype, v3: int=0): (v4, v5) = v1 v6 = torch.full((v5, v5), torch.tensor(torch.finfo(v2).min)) v7 = torch.arange(v6.size(-1)) v6.masked_fill_(v7 < (v7 + 1).view(v6.size(-1), 1), 0) v6 = v6.to(v2) if v3 > 0: v6 = torch.cat([torch.zeros(v5, v3, dtype=v2), v6...
[]
[ "torch" ]
[ "import torch", "import torch.utils.checkpoint", "from torch import nn", "from torch.nn import CrossEntropyLoss" ]
9
# coding=utf-8 # Copyright 2021 The Marian Team Authors and The HuggingFace Inc. team. 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/licen...
null
v0
[ "torch.Tensor", "torch.dtype", "Optional[int]" ]
Any
def v0(v1: torch.Tensor, v2: torch.dtype, v3: Optional[int]=None): (v4, v5) = v1.size() v3 = v3 if v3 is not None else v5 v6 = v1[:, None, None, :].expand(v4, 1, v3, v5).to(v2) v7 = 1.0 - v6 v8 = v7.masked_fill(v7.bool(), torch.finfo(v2).min) v8 = v8 * v7 return v8
[]
[ "torch" ]
[ "import torch", "import torch.nn.functional as F", "import torch.utils.checkpoint", "from torch import nn", "from torch.nn import CrossEntropyLoss" ]
8
# coding=utf-8 # Copyright 2021 Iz Beltagy, Matthew E. Peters, Arman Cohan and The HuggingFace Inc. team. 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://w...
null
v0
[ "int" ]
nn.Embedding
def v0(self, v1: int) -> nn.Embedding: v2 = super().resize_token_embeddings(v1) self._resize_final_logits_bias(v1) return v2
[]
[]
[]
4
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. 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/L...
null
v0
[ "int" ]
None
def v0(self, v1: int) -> None: v2 = self.final_logits_bias.shape[-1] if v1 <= v2: v3 = self.final_logits_bias[:, :v1] else: v4 = torch.zeros((1, v1 - v2), device=self.final_logits_bias.device) v3 = torch.cat([self.final_logits_bias, v4], dim=1) self.register_buffer('final_logits_...
[]
[ "torch" ]
[ "import torch", "import torch.utils.checkpoint", "from torch import nn", "from torch.nn import CrossEntropyLoss" ]
8
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. 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/L...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('base_config', metavar='base_config', help='Path to base config.') v1.add_argument('--viddir', dest='viddir', help='Directory containing videos.') v1.add_argument('--crop-height', dest='crop_height', type=ast.literal_eval, help=...
[]
[ "ast" ]
[ "import ast" ]
20
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( # com_predict, # com_train, dannce_predict, dannce_train, social_dannce_train, ) from dannce.config import check_config, infer_params, build_params from dannce import ( _param_defaults_dannce, _param_default...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--exp', dest='exp', type=ast.literal_eval, help='List of experiment dictionaries for network training. See examples in io.yaml.') v1.add_argument('--loss', dest='loss', help='Loss function to use during training. See losses.py.') ...
[]
[ "ast" ]
[ "import ast" ]
17
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( # com_predict, # com_train, dannce_predict, dannce_train, social_dannce_train, ) from dannce.config import check_config, infer_params, build_params from dannce import ( _param_defaults_dannce, _param_default...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--max-num-samples', dest='max_num_samples', type=int, help='Maximum number of samples to predict during COM or DANNCE prediction.') v1.add_argument('--start-batch', dest='start_batch', type=int, help='Starting batch number during d...
[]
[]
[]
5
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( com_predict, com_train, dannce_predict, dannce_train, build_params, ) from dannce.engine.processing import check_config, infer_params from dannce import ( _param_defaults_dannce, _param_defaults_shared, ...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--net-type', dest='net_type', help='Net types can be:\nAVG: more precise spatial average DANNCE, can be harder to train\nMAX: DANNCE where joint locations are at the maximum of the 3D output distribution\n') v1.add_argument('--com-...
[]
[ "ast" ]
[ "import ast" ]
25
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( # com_predict, # com_train, dannce_predict, dannce_train, social_dannce_train, ) from dannce.config import check_config, infer_params, build_params from dannce import ( _param_defaults_dannce, _param_default...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--dannce-train-dir', dest='dannce_train_dir', help='Training directory for dannce network.') v1.add_argument('--rotate', dest='rotate', type=ast.literal_eval, help='If True, use rotation augmentation for dannce training.') v1.a...
[]
[ "ast" ]
[ "import ast" ]
24
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( # com_predict, # com_train, dannce_predict, dannce_train, social_dannce_train, ) from dannce.config import check_config, infer_params, build_params from dannce import ( _param_defaults_dannce, _param_default...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--dannce-predict-dir', dest='dannce_predict_dir', help='Prediction directory for dannce network.') v1.add_argument('--dannce-predict-model', dest='dannce_predict_model', help='Path to model to use for dannce prediction.') v1.ad...
[]
[ "ast" ]
[ "import ast" ]
8
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( com_predict, com_train, dannce_predict, dannce_train, build_params, ) from dannce.engine.processing import check_config, infer_params from dannce import ( _param_defaults_dannce, _param_defaults_shared, ...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--com-train-dir', dest='com_train_dir', help='Training directory for COM network.') v1.add_argument('--com-finetune-weights', dest='com_finetune_weights', help='Initial weights to use for COM finetuning.') v1.add_argument('--au...
[]
[ "ast" ]
[ "import ast" ]
11
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( com_predict, com_train, dannce_predict, dannce_train, build_params, ) from dannce.engine.processing import check_config, infer_params from dannce import ( _param_defaults_dannce, _param_defaults_shared, ...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--com-predict-dir', dest='com_predict_dir', help='Prediction directory for COM network.') v1.add_argument('--com-predict-weights', dest='com_predict_weights', help='Path to .hdf5 weights to use for COM prediction.') return v1
[]
[]
[]
4
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( com_predict, com_train, dannce_predict, dannce_train, build_params, ) from dannce.engine.processing import check_config, infer_params from dannce import ( _param_defaults_dannce, _param_defaults_shared, ...
null
v0
[ "argparse.ArgumentParser" ]
argparse.ArgumentParser
def v0(v1: argparse.ArgumentParser) -> argparse.ArgumentParser: v1.add_argument('--dsmode', dest='dsmode', help='Downsampling mode. Can be dsm (local average) or nn (nearest_neighbor).') v1.add_argument('--downfac', dest='downfac', type=int, help='Downfactoring rate of images.') v1.add_argument('--debug', d...
[]
[ "ast" ]
[ "import ast" ]
5
"""Entrypoints for dannce training and prediction.""" from dannce.interface import ( com_predict, com_train, dannce_predict, dannce_train, build_params, ) from dannce.engine.processing import check_config, infer_params from dannce import ( _param_defaults_dannce, _param_defaults_shared, ...
null
v0
[ "int", "str", "str" ]
Any
def v0(self, v1: int, v2: str=None, v3: str=None): print(f'[line{v1}] Error. {v2}: {v3}') self.had_error = True
[]
[]
[]
3
from pylox.token import Token, TokenType class ErrorHandler(object): def __init__(self): self.had_error = False def error(self, line: int, where: str = None, message: str = None): print(f"[line{line}] Error. {where}: {message}") self.had_error = True def parse_error(self, token: Token, message: str)...
null
v0
[ "str" ]
int
def v0(self, v1: str) -> int: v2 = [0] for v3 in v1: if v3 == '(': v2.append(0) elif v3 == ')': v4 = v2.pop() if v4 == 0: v5 = 1 else: v5 = 2 * v4 v2[-1] += v5 return v2[-1]
[]
[]
[]
13
class Solution: def scoreOfParentheses(self, S: str) -> int: stack = [0] for par in S: if par == "(": stack.append(0) else: last = stack.pop() if last == 0: score = 1 else: ...
null
v0
[ "Any", "Any" ]
str
def v0(self, v1, v2=None) -> str: v3 = self.get_method_version_cache() if not v1: raise ValueError('Must provide a method to lookup') if not v2: v2 = 'release' if v1 not in v3 or v2 not in v3[v1]: v4 = v1.split('.')[0] v5 = self.get_catalog().get_module_version({'module_n...
[]
[]
[]
11
import copy from collections import defaultdict from typing import Dict from lib.installed_clients.CatalogClient import Catalog class CatalogCache: """ Per call catalog cache used to speed up catalog lookups Caches the "Method Version" and the "Job Resource Requirements" There's no cache invalidatio...
null
v0
[ "Any", "Any" ]
dict
def v0(self, v1, v2) -> dict: v3 = self.get_job_resources_cache() if v1 not in v3 or v2 not in v3[v1]: v3[v1][v2] = self.get_catalog().list_client_group_configs({'module_name': v1, 'function_name': v2}) return copy.deepcopy(v3[v1][v2])
[]
[ "copy" ]
[ "import copy" ]
5
import copy from collections import defaultdict from typing import Dict from lib.installed_clients.CatalogClient import Catalog class CatalogCache: """ Per call catalog cache used to speed up catalog lookups Caches the "Method Version" and the "Job Resource Requirements" There's no cache invalidatio...
null
v1
[]
v0
def v1(self) -> v0: v2 = super().task() v2.label_smoothing_prob = 0.1 return v2
[]
[]
[]
4
# Lint as: python3 # Copyright 2021 The TensorFlow Authors. 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 ...
[ "v0 = py_utils.InstantiableParams" ]
v0
[ "torch.Tensor", "torch.Tensor" ]
Any
def v0(self, v1: torch.Tensor, v2: torch.Tensor=None): if v2 is None: assert v1.shape[-1] == self.input_size else: assert v1.shape[-1] + v2.shape[-1] == self.input_size if v2 is None: v3 = v1[..., :self.obs_dim] v4 = v1[..., self.obs_dim:] else: v3 = v1 v4...
[]
[]
[]
12
import torch import numpy as np from typing import Tuple from self_supervised.policy.skill_policy import SkillTanhGaussianPolicy, MakeDeterministic import self_supervised.utils.typed_dicts as td import rlkit.torch.pytorch_util as ptu class SkillTanhGaussianPolicyRevised(SkillTanhGaussianPolicy): def get_acti...
null
v0
[ "torch.Tensor", "Any", "Any", "Any", "Any" ]
Any
def v0(self, v1: torch.Tensor, v2=None, v3=True, v4=False, v5=False): (v6, v7) = self.recover_obs_skillvec(obs=v1, skill_vec=v2) v8 = super().forward(obs=v6, skill_vec=v7, reparameterize=v3, return_log_prob=v4, deterministic=v5) return (v8.action, v8.mean, v8.log_std, v8.log_prob, v8.entropy, v8.std, v8.mea...
[]
[]
[]
4
import torch import numpy as np from typing import Tuple from self_supervised.policy.skill_policy import SkillTanhGaussianPolicy, MakeDeterministic import self_supervised.utils.typed_dicts as td import rlkit.torch.pytorch_util as ptu class SkillTanhGaussianPolicyRevised(SkillTanhGaussianPolicy): def get_acti...
null
v2
[ "v0" ]
v1
def v2(v3: v0) -> v1: if not isinstance(v3, dict): raise TypeError(f'batch_dict requires batch of type dict, got {type(v3)}') return v3
[]
[]
[]
4
# Copyright 2021 MosaicML. All Rights Reserved. """Reference for common types used throughout the composer library. Attributes: Batch (BatchPair | BatchDict | torch.Tensor): Union type covering the most common representations of batches. A batch of data can be represented in several formats, depending on ...
[ "v0 = Union[BatchPair, BatchDict, torch.Tensor]", "v1 = Dict[str, torch.Tensor]" ]
v2
[ "v0" ]
v1
def v2(v3: v0) -> v1: if not isinstance(v3, (tuple, list)): raise TypeError(f'batch_pair required batch to be a tuple or list, got {type(v3)}') if not len(v3) == 2: raise TypeError(f'batch has length {len(v3)}, expected length 2') return v3
[]
[]
[]
6
# Copyright 2021 MosaicML. All Rights Reserved. """Reference for common types used throughout the composer library. Attributes: Batch (BatchPair | BatchDict | torch.Tensor): Union type covering the most common representations of batches. A batch of data can be represented in several formats, depending on ...
[ "v0 = Union[BatchPair, BatchDict, torch.Tensor]", "v1 = Sequence[Union[torch.Tensor, Sequence[torch.Tensor]]]" ]
v0
[ "str" ]
typing.Optional[str]
def v0(self, v1: str, **v2) -> typing.Optional[str]: v3 = self._redis.get(self.prefixize(v1)) if isinstance(v3, bytes): return v3.decode() return None
[]
[]
[]
5
import typing import redis from sitri.providers.base import ConfigProvider class RedisConfigProvider(ConfigProvider): """Config provider for redis storage.""" provider_code = "redis" _prefix = "redis" def __init__(self, prefix: str, redis_connector: typing.Callable[[], redis.Redis]): """ ...
null
v0
[]
typing.List[str]
def v0(self, **v1) -> typing.List[str]: v2 = [] for v3 in self._redis.keys(): if self._prefix in v3.decode(): v2.append(self.unprefixize(v3.decode())) return v2
[]
[]
[]
6
import typing import redis from sitri.providers.base import ConfigProvider class RedisConfigProvider(ConfigProvider): """Config provider for redis storage.""" provider_code = "redis" _prefix = "redis" def __init__(self, prefix: str, redis_connector: typing.Callable[[], redis.Redis]): """ ...
null
v0
[ "discord.Member" ]
Any
async def v0(self, v1: discord.Member): if (v2 := v1.guild.get_channel(self.cog.queue[v1.guild.id][v1.id][2].extras['data']['channel_id'])): await v2.send(f'{v1.mention}, 合言葉を送信してください。')
[]
[]
[]
3
# RT Captcha - Word from typing import TYPE_CHECKING import discord if TYPE_CHECKING: from .__init__ import Captcha class WordCaptcha: def __init__(self, cog: "Captcha"): self.cog = cog async def on_message(self, message: discord.Message): if message.channel.id == self.cog.queue[messag...
null
v0
[]
None
def v0(self) -> None: v1 = u'#11: Test ticket subject ☃' v2 = '\nRequester ☃ Bob <requester-bob@example.com> created [ticket #11](http://test1234zzz.freshdesk.com/helpdesk/tickets/11):\n\n``` quote\nTest ticket description ☃.\n```\n\n* **Type**: Incident\n* **Priority**: High\n* **Status**: Pending\n'.strip() ...
[]
[]
[]
4
# -*- coding: utf-8 -*- from mock import MagicMock, patch from zerver.lib.test_classes import WebhookTestCase class FreshdeskHookTests(WebhookTestCase): STREAM_NAME = 'freshdesk' URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}" def test_ticket_creation(self) -> None: """ Mess...
null
v0
[]
None
def v0(self) -> None: v1 = u'#11: Test ticket subject ☃' v2 = '\nRequester Bob <requester-bob@example.com> updated [ticket #11](http://test1234zzz.freshdesk.com/helpdesk/tickets/11):\n\n* **Status**: Resolved -> Waiting on Customer\n'.strip() self.api_stream_message(self.TEST_USER_EMAIL, 'status_changed', v...
[]
[]
[]
4
# -*- coding: utf-8 -*- from mock import MagicMock, patch from zerver.lib.test_classes import WebhookTestCase class FreshdeskHookTests(WebhookTestCase): STREAM_NAME = 'freshdesk' URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}" def test_ticket_creation(self) -> None: """ Mess...
null
v0
[]
None
def v0(self) -> None: self.url = self.build_webhook_url() v1 = self.get_body('status_changed_fixture_with_missing_key') v2 = {'HTTP_AUTHORIZATION': self.encode_credentials(self.TEST_USER_EMAIL), 'content_type': 'application/x-www-form-urlencoded'} v3 = self.client_post(self.url, v1, **v2) self.asser...
[]
[]
[]
6
# -*- coding: utf-8 -*- from mock import MagicMock, patch from zerver.lib.test_classes import WebhookTestCase class FreshdeskHookTests(WebhookTestCase): STREAM_NAME = 'freshdesk' URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}" def test_ticket_creation(self) -> None: """ Mess...
null
v0
[]
None
def v0(self) -> None: v1 = u'#11: Test ticket subject' v2 = '\nRequester Bob <requester-bob@example.com> updated [ticket #11](http://test1234zzz.freshdesk.com/helpdesk/tickets/11):\n\n* **Priority**: High -> Low\n'.strip() self.api_stream_message(self.test_user, 'priority_changed', v1, v2, content_type='app...
[]
[]
[]
4
# -*- coding: utf-8 -*- from mock import MagicMock, patch from zerver.lib.test_classes import WebhookTestCase class FreshdeskHookTests(WebhookTestCase): STREAM_NAME = 'freshdesk' URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}" def test_ticket_creation(self) -> None: """ Mess...
null
v0
[]
None
def v0(self) -> None: v1 = u'#12: Not enough ☃ guinea pigs' v2 = '\nRequester ☃ Bob <requester-bob@example.com> created [ticket #12](http://test1234zzz.freshdesk.com/helpdesk/tickets/12):\n\n``` quote\nThere are too many cat pictures on the internet ☃. We need more guinea pigs.\nExhibit 1:\n\n \n\n[guinea_pig....
[]
[]
[]
4
# -*- coding: utf-8 -*- from mock import MagicMock, patch from zerver.lib.test_classes import WebhookTestCase class FreshdeskHookTests(WebhookTestCase): STREAM_NAME = 'freshdesk' URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}" def test_ticket_creation(self) -> None: """ Mess...
null
v21
[ "str", "v1", "bool", "List[str]" ]
None
def v21(v22: str, v23: v1=None, v24: bool=False, v25: List[str]=[]) -> None: v8(v22, v23, v25) v2(v22, v23) if v24: v14(v22)
[ { "name": "v2", "input_types": [ "str", "v1", "v0" ], "output_type": "None", "code": "def v2(v3: str, v4: v1=None, v5: v0=None) -> None:\n if v4 in ['make', None]:\n v6 = ['make']\n elif v4 == 'ninja':\n v6 = ['ninja']\n if v5 is None:\n v5 = setti...
[ "os", "subprocess", "sys" ]
[ "import os", "import subprocess", "import sys" ]
5
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os from . import settings from . import toolchain from .settings import PROJECT_ROOT import logging import subprocess import sys from typing import Union, List, Optional OptionalInt = Optional[int] OptionalStr = Union[str, None] logger ...
[ "v0 = Optional[int]", "v1 = Union[str, None]" ]
v0
[ "str", "list", "dict", "dict", "dict", "list" ]
Any
def v0(self, v1: str, v2: list=[], v3: dict={}, v4: dict={}, v5: dict={}, v6: list=[]): v7 = len(self.components) v8 = self.__create_widget(v7, v1) if v2 != []: self.edit_widget_test(v8, v1, v2, v3, v4, v5, v6) return v8
[]
[]
[]
6
import requests import yaml import os import logging import pandas as pd from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from IPython.display import Image, display, HTML _LOG_FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] - %(asctime)s --> %(message)s" g_logger = logging.getLogg...
null
v0
[ "str" ]
Any
def v0(self, v1: str): with open(v1, 'wb') as v2: v2.write(self.__get_card_img())
[]
[]
[]
3
import requests import yaml import os import logging import pandas as pd from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from typing import TYPE_CHECKING from IPython.display import Image, display, HTML if TYPE_CHECKING: from askdata.askdata_client import Askdata _LOG_FORMAT = "[%(fi...
null
v0
[ "pd.DataFrame", "list" ]
Any
def v0(self, v1: pd.DataFrame, v2: list=[]): v3 = len(self.components) v4 = self.add_component('data', v3) self.edit_data(v4, v1) if v2 != []: for v5 in range(len(v2)): self.edit_data_entity(v4, v5, v2[v5]) return v4
[]
[]
[]
8
import requests import yaml import os import logging import pandas as pd from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from typing import TYPE_CHECKING from IPython.display import Image, display, HTML if TYPE_CHECKING: from askdata.askdata_client import Askdata _LOG_FORMAT = "[%(fi...
null
v0
[ "float", "float", "float", "float", "float", "float" ]
dict
def v0(v1: float, v2: float, v3: float, v4: float, v5: float, v6: float) -> dict: v7 = randint(0, 1000000) v8 = {'id': 'g_region_%i' % v7, 'module': 'g.region', 'inputs': [{'param': 'n', 'value': str(v3)}, {'param': 's', 'value': str(v4)}, {'param': 'e', 'value': str(v2)}, {'param': 'w', 'value': str(v1)}, {'pa...
[]
[ "random" ]
[ "from random import randint" ]
4
# -*- coding: utf-8 -*- import json from random import randint from pprint import pprint from openeo_grass_gis_driver.process_schemas import Parameter, ProcessDescription, ReturnValue from .base import analyse_process_graph, PROCESS_DICT, PROCESS_DESCRIPTION_DICT __license__ = "Apache License, Version 2.0" __author__ ...
null
v12
[ "List[str]" ]
List[str]
def v12(v13: List[str]) -> List[str]: v13 = [f for v14 in v13 if os.path.isfile(v14)] v15 = [v14 for v14 in v13 if v14.endswith('.par2')] if not v15: logging.debug('No par2 files found to process, running renamer') else: for v16 in v15: logging.debug('Deobfuscate par2: handli...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "List[str]", "code": "def v0(v1: str) -> List[str]:\n if not is_parfile(v1):\n logging.info('Par2 file %s was not really a par2 file')\n return []\n v2 = {}\n parse_par2_file(v1, v2)\n v3 = os.path.dirname(v...
[ "hashlib", "logging", "os" ]
[ "import hashlib", "import logging", "import os" ]
16
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
null
v0
[ "str" ]
bool
def v0(v1: str) -> bool: (v2, v3) = os.path.split(v1) (v4, v5) = os.path.splitext(v3) logging.debug('Checking: %s', v4) if re.findall('^[a-f0-9]{32}$', v4): logging.debug('Obfuscated: 32 hex digit') return True if re.findall('^[a-f0-9.]{40,}$', v4): logging.debug('Obfuscated:...
[]
[ "logging", "os", "re" ]
[ "import logging", "import os", "import re" ]
31
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
null
v2
[ "int", "int" ]
str
def v2(v3: int, v4: int=1) -> str: if not isinstance(v3, int): raise TypeError('{} instead of int'.format(v3)) v5 = pow(256, v4) if v3 < -(v5 // 2) or v3 >= v5: raise OverflowError('cannot convert int {} to hex ({} bytes)'.format(v3, v4)) if v3 < 0: v3 = v5 + v3 v6 = hex(v3)[...
[ { "name": "v0", "input_types": [ "str" ], "output_type": "str", "code": "def v0(v1: str) -> str:\n return bh2u(bfh(v1)[::-1])", "dependencies": [] } ]
[]
[]
11
# -*- coding: utf-8 -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # 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 wit...
null
v7
[ "int" ]
str
def v7(v8: int) -> str: assert v8 >= 0, v8 if v8 < 253: return v0(v8) elif v8 <= 65535: return 'fd' + v0(v8, 2) elif v8 <= 4294967295: return 'fe' + v0(v8, 4) else: return 'ff' + v0(v8, 8)
[ { "name": "v0", "input_types": [ "int", "int" ], "output_type": "str", "code": "def v0(v1: int, v2: int=1) -> str:\n if not isinstance(v1, int):\n raise TypeError('{} instead of int'.format(v1))\n v3 = pow(256, v2)\n if v1 < -(v3 // 2) or v1 >= v3:\n raise Over...
[]
[]
10
# -*- coding: utf-8 -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # 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 wit...
null
v7
[ "int" ]
str
def v7(v8: int) -> str: if v8 < 160: return v0(v8) elif v8 <= 255: return '4c' + v0(v8) elif v8 <= 65535: return '4d' + v0(v8, 2) else: return '4e' + v0(v8, 4)
[ { "name": "v0", "input_types": [ "int", "int" ], "output_type": "str", "code": "def v0(v1: int, v2: int=1) -> str:\n assert isinstance(v1, int)\n v3 = pow(256, v2)\n if v1 < -v3 / 2 or v1 >= v3:\n raise OverflowError('cannot convert int {} to hex ({} bytes)'.format(v1...
[]
[]
9
# -*- coding: utf-8 -*- """ __author__ = 'CodeFace' """ import hashlib import hmac from eth_abi import encode_abi from eth_utils import function_abi_to_4byte_selector from .util import bfh, bh2u, assert_bytes, to_bytes, inv_dict, print_error, QtumException from .util import unpack_uint16_from, unpack_uint32_from, unpa...
null
v17
[ "v0" ]
List[str]
def v17(v18: v0) -> List[str]: v19 = [f'-{v18.name}'] v20 = [] if v18.value: v20.append(v18.value) if v18.id_value is not None: v20.append(f'id={v18.id_value}') for (v21, v22) in v18.attributes.items(): if v21 == 'id': continue if v22 is None: ...
[]
[]
[]
17
from dataclasses import dataclass, field, replace from typing import Union, Mapping, Optional, List ArgumentValue = Union[int, str, None] @dataclass(frozen=True) class Argument: name: str value: ArgumentValue = None attributes: Mapping[str, ArgumentValue] = field(default_factory=dict) def __post_ini...
[ "@dataclass(frozen=True)\nclass v0:\n v1: str\n v2: ArgumentValue = None\n v3: Mapping[str, ArgumentValue] = field(default_factory=dict)\n\n def v4(self):\n if 'id' in self.attributes:\n if self.id_value is None:\n raise Exception('ID must not be None')\n if n...
v1
[ "Mapping[str, v0]" ]
'Argument'
def v1(self, v2: Mapping[str, v0]) -> 'Argument': if self.id_value is not None and self.id_value != v2.get('id', None): raise Exception('Cannot change value of ID') v3 = dict(self.attributes) v3.update(v2) return replace(self, attributes=v3)
[]
[ "dataclasses" ]
[ "from dataclasses import dataclass, field, replace" ]
6
from dataclasses import dataclass, field, replace from typing import Union, Mapping, Optional, List ArgumentValue = Union[int, str, None] @dataclass(frozen=True) class Argument: name: str value: ArgumentValue = None attributes: Mapping[str, ArgumentValue] = field(default_factory=dict) def __post_ini...
[ "v0 = Union[int, str, None]" ]
v0
[ "List[str]" ]
Any
def v0(self, v1: List[str]): if 'id' in v1: raise Exception('Cannot remove assigned id') v2 = dict(self.attributes) for v3 in v1: del v2[v3] return replace(self, attributes=v2)
[]
[ "dataclasses" ]
[ "from dataclasses import dataclass, field, replace" ]
7
from dataclasses import dataclass, field, replace from typing import Union, Mapping, Optional, List ArgumentValue = Union[int, str, None] @dataclass(frozen=True) class Argument: name: str value: ArgumentValue = None attributes: Mapping[str, ArgumentValue] = field(default_factory=dict) def __post_ini...
null
v0
[ "Any" ]
float
def v0(v1: Any) -> float: assert isinstance(v1, float) return v1
[]
[]
[]
3
from dataclasses import dataclass from typing import Optional, Any def from_str(x: Any) -> str: assert isinstance(x, str) return x def from_int(x: Any) -> int: assert isinstance(x, int) and not isinstance(x, bool) return x def from_none(x: Any) -> Any: assert x is None return x def from_...
null
v0
[ "Any" ]
Any
def v0(v1: Any) -> Any: assert v1 is None return v1
[]
[]
[]
3
# To use this code, make sure you # # import json # # and then, to convert JSON from a string, do # # result = channels_kick_response_from_dict(json.loads(json_string)) from dataclasses import dataclass from typing import Optional, Any, TypeVar, Type, cast T = TypeVar("T") def from_bool(x: Any) -> bool: ...
null
v0
[ "Any" ]
str
def v0(v1: Any) -> str: if v1 is None: return None assert isinstance(v1, str) return v1
[]
[]
[]
5
import re import datetime from dateutil import parser as dateutil_parser from typing import Any, Callable, List, Literal, Optional, TypeVar, Union # api.tweet.profile # User profile payload # # generator version 1 T = TypeVar('T') def from_str(x: Any) -> str: if x is None: return None assert isinstance(x, ...
null
v1
[ "Type[v0]", "Any" ]
dict
def v1(v2: Type[v0], v3: Any) -> dict: assert isinstance(v3, v2) return cast(Any, v3).to_dict()
[]
[ "typing" ]
[ "from typing import Optional, Any, TypeVar, Type, cast" ]
3
# To use this code, make sure you # # import json # # and then, to convert JSON from a string, do # # result = channels_kick_response_from_dict(json.loads(json_string)) from dataclasses import dataclass from typing import Optional, Any, TypeVar, Type, cast T = TypeVar("T") def from_bool(x: Any) -> bool: ...
[ "v0 = TypeVar('T')" ]
v10
[]
dict
def v10(self) -> dict: v11: dict = {} v11['ok'] = v6([v0, v2], self.ok) v11['already_closed'] = v6([v0, v2], self.already_closed) v11['no_op'] = v6([v0, v2], self.no_op) v11['error'] = v6([v4, v2], self.error) v11['needed'] = v6([v4, v2], self.needed) v11['provided'] = v6([v4, v2], self.prov...
[ { "name": "v0", "input_types": [ "Any" ], "output_type": "bool", "code": "def v0(v1: Any) -> bool:\n assert isinstance(v1, bool)\n return v1", "dependencies": [] }, { "name": "v2", "input_types": [ "Any" ], "output_type": "Any", "code": "def v2(v3: A...
[]
[]
9
# To use this code, make sure you # # import json # # and then, to convert JSON from a string, do # # result = conversations_close_response_from_dict(json.loads(json_string)) from dataclasses import dataclass from typing import Optional, Any, TypeVar, Type, cast T = TypeVar("T") def from_bool(x: Any) -> bo...
null
v0
[ "amicus.Project" ]
amicus.Project
def v0(self, v1: amicus.Project) -> amicus.Project: self.contents = self.contents(**self.parameters) v2 = v1.data v2.x_train = self.contents.fit(v2.x_train) v2.x_train = self.contents.transform(v2.x_train) if v2.x_test is not None: v2.x_test = self.contents.transform(v2.x_test) if v2.x_v...
[]
[]
[]
11
""" simplify.analyst.scale Corey Rayburn Yung <coreyrayburnyung@gmail.com> Copyright 2021, Corey Rayburn Yung License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0) Contents: """ from __future__ import annotations import dataclasses from typing import (Any, Callable, ClassVar, Dict, Hashable, Iterable, Li...
null
v0
[ "dict" ]
None
def v0(self, v1: dict) -> None: v2 = self.buttons[-1] v2.append(v1)
[]
[]
[]
3
import json import typing from enum import Enum from vkwave.bots.core.types.json_types import JSONEncoder from vkwave.bots.utils.keyboards._types import Button from vkwave.bots.utils.keyboards._vkpayaction import ( VKPayAction, VKPayActionTransferToUser, VKPayActionTransferToGroup, VKPayActionPayToUse...
null
v0
[ "typing.Dict[str, str]" ]
None
def v0(self, v1: typing.Dict[str, str]) -> None: for v2 in self.buttons: for v3 in v2: if v1 == v3.get('action').get('payload'): v4 = self.buttons.index(v2) v5 = v2.index(v3) del self.buttons[v4][v5]
[]
[]
[]
7
import json import typing from enum import Enum from vkwave.bots.core.types.json_types import JSONEncoder from vkwave.bots.utils.keyboards._types import Button from vkwave.bots.utils.keyboards._vkpayaction import ( VKPayAction, VKPayActionTransferToUser, VKPayActionTransferToGroup, VKPayActionPayToUse...
null
v0
[]
None
def v0(self) -> None: for v1 in self.__accounts: v0(v1.text())
[]
[]
[]
3
""" Account class will contain informations about clients accounts cridentials , exams..etc """ import ujson as json from typing import (Any, Dict, List) from operator import attrgetter import logging logger = logging.getLogger(__name__) class Account: def __init__(self, **kwargs):...
null
v5
[ "int" ]
v0
def v5(self, v6: int) -> v0: if v6 < 0 or v6 >= self.count(): raise Exception(f'get_item invalid index: {v6}') return self.__accounts[v6]
[]
[]
[]
4
""" Account class will contain informations about clients accounts cridentials , exams..etc """ import ujson as json from typing import (Any, Dict, List) from operator import attrgetter import logging logger = logging.getLogger(__name__) class Account: def __init__(self, **kwargs):...
[ "class v0:\n\n def __init__(self, **v1):\n \"\"\"\n Account constructor method\n @kwargs\n :email -> str\n :password -> str\n :motivation -> int (1, 3, 4, 5) default 1\n 1 etude en france\n 3 immigration au canada\n 4 naturalization\n ...
v0
[ "Any", "dict", "Any" ]
Any
def v0(v1, v2: dict, v3): if v2 is None: return (v1, v3) v4 = v2.get('nbond', 0) v5 = v2.get('ntriplet', 0) v6 = v2.get('bond_mask', None) v7 = v2.get('triplet_mask', None) v8 = None v9 = None v10 = None v11 = None v12 = None v13 = None if 'map' in v2: v14...
[]
[ "numpy" ]
[ "import numpy as np" ]
44
import numpy as np from flare.kernels import sc, mc_simple, mc_sephyps """ This module includes interface functions between kernels and gp/gp_algebra str_to_kernel_set is used in GaussianProcess class to search for a kernel function based on a string name. from_mask_to_args converts the hyperparameter vector and th...
null
v0
[]
argparse.Namespace
def v0() -> argparse.Namespace: v1 = argparse.ArgumentParser(description='Pytorch RL rl_algorithms') v1.add_argument('--seed', type=int, default=777, help='random seed for reproducibility') v1.add_argument('--algo', type=str, default='ddpg', help='choose an algorithm') v1.add_argument('--cfg-path', type...
[]
[ "argparse" ]
[ "import argparse" ]
17
# -*- coding: utf-8 -*- """Train or test algorithms on Reacher-v2 of Mujoco. - Author: Kyunghwan Kim - Contact: kh.kim@medipixel.io """ import argparse import datetime import gym from rl_algorithms import build_agent import rl_algorithms.common.env.utils as env_utils import rl_algorithms.common.helper_functions as ...
null
v0
[]
int
def v0(self) -> int: v1 = glob.glob(f'{self.paths.records}/*.{self.extension}') return len(v1)
[]
[ "glob" ]
[ "import glob" ]
3
import os import glob from typing import Text, List, Set, Dict, Tuple from collections import defaultdict from datetime import datetime from threading import RLock import yaml from appyratus.env import Environment from appyratus.files import BaseFile, Yaml from appyratus.schema.fields import UuidString from appyratu...
null
v0
[ "Any", "Any" ]
Dict
def v0(self, v1, v2=None) -> Dict: v3 = self.fetch_many([v1], fields=v2) v4 = v3.get(v1) if v3 else {} return v4
[]
[]
[]
4
import os import glob from typing import Text, List, Set, Dict, Tuple from collections import defaultdict from datetime import datetime from threading import RLock import yaml from appyratus.env import Environment from appyratus.files import BaseFile, Yaml from appyratus.schema.fields import UuidString from appyratu...
null
v0
[ "Any" ]
None
def v0(self, v1) -> None: self._cache_store.delete(v1) v2 = self.mkpath(v1) os.remove(v2)
[]
[ "os" ]
[ "import os" ]
4
import os import glob from typing import Text, List, Set, Dict, Tuple from collections import defaultdict from datetime import datetime from threading import RLock import yaml from appyratus.env import Environment from appyratus.files import BaseFile, Yaml from appyratus.schema.fields import UuidString from appyratu...
null
v0
[ "List" ]
None
def v0(self, v1: List) -> None: for v2 in v1: self.delete(v2)
[]
[]
[]
3
import os import glob from typing import Text, List, Set, Dict, Tuple from collections import defaultdict from datetime import datetime from threading import RLock import yaml from appyratus.env import Environment from appyratus.files import BaseFile, Yaml from appyratus.schema.fields import UuidString from appyratu...
null
v0
[ "Text" ]
Text
def v0(self, v1: Text) -> Text: v1 = self.ftype.format_file_name(v1) return os.path.join(self.paths.records, v1)
[]
[ "os" ]
[ "import os" ]
3
import os import glob from typing import Text, List, Set, Dict, Tuple from collections import defaultdict from datetime import datetime from threading import RLock import yaml from appyratus.env import Environment from appyratus.files import BaseFile, Yaml from appyratus.schema.fields import UuidString from appyratu...
null
v1
[ "v0", "v0", "v0" ]
v0
def v1(v2: v0, v3: v0, v4: v0) -> v0: if v3 > v4: (v4, v3) = (v3, v4) if v2 < v3: return v3 elif v2 > v4: return v4 else: return v2
[]
[]
[]
9
from __future__ import annotations from typing import Any, NamedTuple, TypeVar T = TypeVar("T", int, float) def clamp(value: T, minimum: T, maximum: T) -> T: """Clamps a value between two other values. Args: value (T): A value minimum (T): Minimum value maximum (T): maximum value ...
[ "v0 = TypeVar('T', int, float)" ]
v0
[ "int", "int" ]
bool
def v0(self, v1: int, v2: int) -> bool: (v3, v4, v5, v6) = self return v3 + v5 > v1 >= v3 and v4 + v6 > v2 >= v4
[]
[]
[]
3
from __future__ import annotations from typing import Any, NamedTuple, TypeVar T = TypeVar("T", int, float) def clamp(value: T, minimum: T, maximum: T) -> T: """Clamps a value between two other values. Args: value (T): A value minimum (T): Minimum value maximum (T): maximum value ...
null
v0
[ "tuple[int, int]" ]
bool
def v0(self, v1: tuple[int, int]) -> bool: (v2, v3, v4, v5) = self.corners try: (v6, v7) = v1 except Exception: raise TypeError(f'a tuple of two integers is required, not {v1!r}') return v4 > v6 >= v2 and v5 > v7 >= v3
[]
[]
[]
7
from __future__ import annotations from typing import Any, NamedTuple, TypeVar T = TypeVar("T", int, float) def clamp(value: T, minimum: T, maximum: T) -> T: """Clamps a value between two other values. Args: value (T): A value minimum (T): Minimum value maximum (T): maximum value ...
null
v138
[ "v0" ]
bool
def v138(self, v139: v0) -> bool: (v140, v141, v142, v143) = self.corners (v144, v145, v146, v147) = v139.corners return (v142 > v144 >= v140 or v142 > v146 > v140 or (v144 < v140 and v146 >= v142)) and (v143 > v145 >= v141 or v143 > v147 > v141 or (v145 < v141 and v147 >= v143))
[]
[]
[]
4
from __future__ import annotations from typing import Any, NamedTuple, TypeVar T = TypeVar("T", int, float) def clamp(value: T, minimum: T, maximum: T) -> T: """Clamps a value between two other values. Args: value (T): A value minimum (T): Minimum value maximum (T): maximum value ...
[ "class v0(NamedTuple):\n v1: int = 0\n v2: int = 0\n v3: int = 0\n v4: int = 0\n\n @classmethod\n def v5(cls, v6: int, v7: int, v8: int, v9: int) -> v0:\n \"\"\"Construct a Region form the top left and bottom right corners.\n\n Args:\n x1 (int): Top left x\n y1 ...
v138
[ "v0" ]
bool
def v138(self, v139: v0) -> bool: (v140, v141, v142, v143) = self.corners (v144, v145, v146, v147) = v139.corners return (v142 >= v144 >= v140 and v143 >= v145 >= v141) and (v142 >= v146 >= v140 and v143 >= v147 >= v141)
[]
[]
[]
4
from __future__ import annotations from typing import Any, NamedTuple, TypeVar T = TypeVar("T", int, float) def clamp(value: T, minimum: T, maximum: T) -> T: """Clamps a value between two other values. Args: value (T): A value minimum (T): Minimum value maximum (T): maximum value ...
[ "class v0(NamedTuple):\n v1: int = 0\n v2: int = 0\n v3: int = 0\n v4: int = 0\n\n @classmethod\n def v5(cls, v6: int, v7: int, v8: int, v9: int) -> v0:\n \"\"\"Construct a Region form the top left and bottom right corners.\n\n Args:\n x1 (int): Top left x\n y1 ...
v1
[ "tp.PandasIndexingFunc" ]
v0
def v1(self, v2: tp.PandasIndexingFunc, **v3) -> v0: (v4, v5, v6, v7) = self.wrapper.indexing_func_meta(v2, column_only_select=True, **v3) (v8, v9) = self.col_mapper._col_idxs_meta(v7) v10 = self.values[v8] v11 = self.id_arr[v8] if self.idx_arr is not None: v12 = self.idx_arr[v8] else: ...
[]
[]
[]
10
"""Base class for working with mapped arrays. This class takes the mapped array and the corresponding column and (optionally) index arrays, and offers features to directly process the mapped array without converting it to pandas; for example, to compute various statistics by column, such as standard deviation. ## Red...
[ "v0 = tp.Tuple[ArrayWrapper, tp.Array1d, tp.Array1d, tp.Array1d, tp.Optional[tp.Array1d], tp.MaybeArray, tp.Array1d]" ]
v1
[ "tp.PandasIndexingFunc" ]
v0
def v1(self: v0, v2: tp.PandasIndexingFunc, **v3) -> v0: (v4, v5, v6, v7, v8, v9, v9) = self.indexing_func_meta(v2, **v3) return self.replace(wrapper=v4, mapped_arr=v5, col_arr=v6, id_arr=v7, idx_arr=v8)
[]
[]
[]
3
# Copyright (c) 2021 Oleg Polakow. All rights reserved. # This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details) """Base class for working with mapped arrays. This class takes the mapped array and the corresponding column and (optionally) index arrays, and offers features to d...
[ "v0 = tp.TypeVar('MappedArrayT', bound='MappedArray')" ]
v1
[ "bool", "tp.Optional[tp.Array1d]", "tp.GroupByLike" ]
v0
def v1(self: v0, v2: bool=False, v3: tp.Optional[tp.Array1d]=None, v4: tp.GroupByLike=None, **v5) -> v0: if v3 is None: v3 = self.idx_arr if self.is_sorted(incl_id=v2): return self.replace(idx_arr=v3, **v5).regroup(v4) if v2: v6 = np.lexsort((self.id_arr, self.col_arr)) else: ...
[]
[ "numpy" ]
[ "import numpy as np" ]
10
# Copyright (c) 2021 Oleg Polakow. All rights reserved. # This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details) """Base class for working with mapped arrays. This class takes the mapped array and the corresponding column and (optionally) index arrays, and offers features to d...
[ "v0 = tp.TypeVar('MappedArrayT', bound='MappedArray')" ]
v1
[ "tp.Array1d", "tp.Optional[tp.Array1d]", "tp.GroupByLike" ]
v0
def v1(self: v0, v2: tp.Array1d, v3: tp.Optional[tp.Array1d]=None, v4: tp.GroupByLike=None, **v5) -> v0: if v3 is None: v3 = self.idx_arr return self.copy(mapped_arr=self.values[v2], col_arr=self.col_arr[v2], id_arr=self.id_arr[v2], idx_arr=v3[v2] if v3 is not None else None, **v5).regroup(v4)
[]
[]
[]
4
"""Base class for working with mapped arrays. This class takes the mapped array and the corresponding column and (optionally) index arrays, and offers features to directly process the mapped array without converting it to pandas; for example, to compute various statistics by column, such as standard deviation. ## Red...
[ "v0 = tp.TypeVar('MappedArrayT', bound='MappedArray')" ]
v0
[ "str", "IO[Any]" ]
None
def v0(self, v1: str, v2: IO[Any]) -> None: v3 = self._get_client() v3.download_fileobj(self._bucket_name, v1, v2)
[]
[]
[]
3
import logging import os import re import tempfile import threading from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, Optional, Union from tqdm import tqdm from minato.filesystems.filesystem import FileSystem try: import boto3 except ModuleNotFoundError: bot...
null
v0
[ "IO[Any]", "str" ]
None
def v0(self, v1: IO[Any], v2: str) -> None: v3 = self._get_client() v3.upload_fileobj(v1, self._bucket_name, v2)
[]
[]
[]
3
import logging import os import re import tempfile import threading from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, Optional, Union from tqdm import tqdm from minato.filesystems.filesystem import FileSystem try: import boto3 except ModuleNotFoundError: bot...
null
v0
[]
bool
def v0(self) -> bool: v1 = self._get_resource() v2 = v1.Bucket(self._bucket_name) v3 = list(v2.objects.filter(Prefix=self._key)) return len(v3) > 0
[]
[]
[]
5
import logging import os import re import tempfile import threading from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, Optional, Union from tqdm import tqdm from minato.filesystems.filesystem import FileSystem try: import boto3 except ModuleNotFoundError: bot...
null
v0
[]
None
def v0(self) -> None: if not self.exists(): raise FileNotFoundError(self._url.raw) v1 = self._get_resource() v2 = v1.Bucket(self._bucket_name) v2.objects.filter(Prefix=self._key).delete()
[]
[]
[]
6
import logging import os import re import tempfile import threading from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, Optional, Union from tqdm import tqdm from minato.filesystems.filesystem import FileSystem try: import boto3 except ModuleNotFoundError: bot...
null
v0
[]
Optional[str]
def v0(self) -> Optional[str]: if not self.exists(): raise FileNotFoundError(self._url.raw) v1 = self._get_resource() v2 = v1.Bucket(self._bucket_name) v3 = list(v2.objects.filter(Prefix=self._key)) v4 = [str(obj.e_tag).strip('"') for v5 in v3 if v5.e_tag] return '.'.join(sorted(v4)) if ...
[]
[]
[]
8
import logging import os import re import tempfile import threading from contextlib import contextmanager from pathlib import Path from typing import IO, Any, Iterator, Optional, Union from tqdm import tqdm from minato.filesystems.filesystem import FileSystem try: import boto3 except ModuleNotFoundError: bot...
null
v0
[]
None
def v0(self) -> None: v1 = {'account_id': self._account_id, 'url': self._url} v2 = self._monzo_auth.make_request(path='/webhooks', method='POST', data=v1) self._webhook_id = v2['data']['webhook']['id']
[]
[]
[]
4
"""Class to manage webhooks.""" from __future__ import annotations from typing import List from monzo.authentication import Authentication from monzo.endpoints.monzo import Monzo class Webhook(Monzo): """ Class to manage webhooks. Class provides methods create, fetch and delete webhooks. """ _...
null
v0
[ "float" ]
None
def v0(self, v1: float=0.1) -> None: self.ws1.weight.data.uniform_(-v1, v1) self.ws2.weight.data.uniform_(-v1, v1)
[]
[]
[]
3
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch import torch.nn as nn import torch.onnx.operators from pytext.config import ConfigBase from pytext.models.module import Module from pytext.utils.usage import log_class_usage class SelfAttention(Module): clas...
null
v0
[ "torch.Tensor", "torch.Tensor" ]
torch.Tensor
def v0(self, v1: torch.Tensor, v2: torch.Tensor) -> torch.Tensor: if torch._C._get_tracing_state(): assert v1.shape[0] == 1 return v1[:, -1, :] (v3, v4, v5) = v1.shape v6 = v2.unsqueeze(1).expand(v3, v5).unsqueeze(1) return v1.gather(1, v6 - 1).squeeze(1)
[]
[ "torch" ]
[ "import torch", "import torch.nn as nn", "import torch.onnx.operators" ]
7
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch import torch.nn as nn import torch.onnx.operators from pytext.config import ConfigBase from pytext.models.module import Module from pytext.utils.usage import log_class_usage class SelfAttention(Module): clas...
null
v8
[ "str", "str", "v0", "v0" ]
None
def v8(v9: str, v10: str, v11: v0, v12: v0) -> None: if v10 is not None: v13 = '{} {}'.format(v9, v10) else: v13 = v9 logging.error('Your %s version %s is not recent enough. Please upgrade it to at least %s', v13, v11, v12)
[]
[ "logging" ]
[ "import logging" ]
6
# Copyright (c) 2021, Arm Limited and affiliates. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ...
[ "@functools.total_ordering\nclass v0:\n\n def __init__(self, *v1):\n self.ver = tuple(v1)\n\n def v2(self) -> str:\n \"\"\"Convert version tuple into a dot-delimited version string.\"\"\"\n return '.'.join((str(v) for v3 in self.ver))\n\n def v4(self, v5):\n if not isinstance(v5...
v14
[ "config.Config", "config.Toolchain", "str", "v0", "v0" ]
bool
def v14(v15: config.Config, v16: config.Toolchain, v17: str, v18: v0, v19: v0) -> bool: if v18 < v19: v8(v16.kind.pretty_name, v16.c_compiler, v18, v19) return False if v15.verbose: logging.info('Using %s toolchain: %s version %s', v17, v16.kind.pretty_name, v18) return True
[ { "name": "v8", "input_types": [ "str", "str", "v0", "v0" ], "output_type": "None", "code": "def v8(v9: str, v10: str, v11: v0, v12: v0) -> None:\n if v10 is not None:\n v13 = '{} {}'.format(v9, v10)\n else:\n v13 = v9\n logging.error('Your %s versi...
[ "logging" ]
[ "import logging" ]
7
# Copyright (c) 2021, Arm Limited and affiliates. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ...
[ "@functools.total_ordering\nclass v0:\n\n def __init__(self, *v1):\n self.ver = tuple(v1)\n\n def v2(self) -> str:\n \"\"\"Convert version tuple into a dot-delimited version string.\"\"\"\n return '.'.join((str(v) for v3 in self.ver))\n\n def v4(self, v5):\n if not isinstance(v5...
v0
[ "str", "str" ]
bool
def v0(v1: str, v2: str=None) -> bool: if shutil.which(v1) is None: if v2 is None: v2 = v1 print('{} not found.'.format(v2)) return False return True
[]
[ "shutil" ]
[ "import shutil" ]
7
# Copyright (c) 2021, Arm Limited and affiliates. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ...
null
v0
[]
bool
def v0(self) -> bool: v1 = self._client.read_command() if not v1: return False self._client.process_commands(v1) return True
[]
[]
[]
6
from bson.objectid import ObjectId from pyfastocloud.fastocloud_client import FastoCloudClient, Fields, Commands from pyfastocloud.client_handler import IClientHandler from pyfastocloud.json_rpc import Request, Response from pyfastocloud.client_constants import ClientStatus import pyfastocloud.socket.gevent as gsocket...
null
v0
[]
int
def v0(self) -> int: v1 = self.current_ledger_id self.current_ledger_id += 1 return v1
[]
[]
[]
4
import json import os import random from typing import Any, Callable, Dict, List, Optional from data_faker.utils import assets_exist_at_time from rotkehlchen.assets.asset import Asset from rotkehlchen.exchanges.data_structures import Trade, trade_pair_from_assets from rotkehlchen.fval import FVal from rotkehlchen.kra...
null