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"
] | List['FmtStr'] | def v0(self, v1: bool=False) -> List['FmtStr']:
v2 = self.split('\n')
return [line + '\n' for v3 in v2] if v1 else v2 if v2[-1] else v2[:-1] | [] | [] | [] | 3 | r"""Colored strings that behave mostly like strings
>>> s = fmtstr("Hey there!", 'red')
>>> s
red('Hey there!')
>>> s[4:7]
red('the')
>>> red_on_blue = fmtstr('hello', 'red', 'on_blue')
>>> blue_on_red = fmtstr('there', fg='blue', bg='red')
>>> green = fmtstr('!', 'green')
>>> full = red_on_blue + ' ' + blue_on_red + ... | null |
v168 | [
"int",
"Optional[str]"
] | 'FmtStr' | def v168(self, v169: int, v170: Optional[str]=None) -> 'FmtStr':
if v170 is not None:
return v158(self.s.ljust(v169, v170), **self.shared_atts)
v171 = ' ' * (v169 - len(self.s))
v172 = self.shared_atts
if 'bg' in v172:
return self + v158(v171, bg=v172['bg']) if v171 else self
else:
... | [
{
"name": "v158",
"input_types": [
"Union[str, v0]"
],
"output_type": "v0",
"code": "def v158(v159: Union[str, v0], *v160: Any, **v161: Any) -> v0:\n v162 = parse_args(v160, v161)\n if isinstance(v159, v0):\n pass\n elif isinstance(v159, (bytes, str)):\n v159 = v0.fr... | [
"typing"
] | [
"from typing import Iterator, Tuple, List, Union, Optional, Any, Mapping, cast, MutableMapping, no_type_check, Type, Callable, Iterable"
] | 10 | r"""Colored strings that behave mostly like strings
>>> s = fmtstr("Hey there!", 'red')
>>> s
red('Hey there!')
>>> s[4:7]
red('the')
>>> red_on_blue = fmtstr('hello', 'red', 'on_blue')
>>> blue_on_red = fmtstr('there', fg='blue', bg='red')
>>> green = fmtstr('!', 'green')
>>> full = red_on_blue + ' ' + blue_on_red + ... | [
"class v0:\n\n def __init__(self, *v1: Chunk) -> None:\n self.chunks = list(v1)\n self._unicode: Optional[str] = None\n self._len: Optional[int] = None\n self._s: Optional[str] = None\n self._width: Optional[int] = None\n\n @classmethod\n def v2(cls, v3: str) -> 'FmtStr':... |
v0 | [
"str"
] | aiosqlite.Cursor | async def v0(self, v1: str, *v2) -> aiosqlite.Cursor:
v3 = await self.db.execute(v1, v2)
await self.db.commit()
return v3 | [] | [] | [] | 4 | import os
from datetime import datetime, timedelta
import aiosqlite
import disnake
from aiosqlite import connect
from disnake.ext import commands
from dotenv import load_dotenv
from exencolorlogs import Logger
from utils.constants import *
class Bot(commands.Bot):
def __init__(self):
super().__init__(
... | null |
v0 | [
"int"
] | int | None | async def v0(self, v1: int) -> int | None:
v2 = await self.execute('SELECT pg_id FROM ids WHERE id = ?', v1)
try:
return (await v2.fetchone())[0]
except (KeyError, ValueError):
return None | [] | [] | [] | 6 | import os
from datetime import datetime, timedelta
import aiosqlite
import disnake
from aiosqlite import connect
from disnake.ext import commands
from dotenv import load_dotenv
from exencolorlogs import Logger
from utils.constants import *
class Bot(commands.Bot):
def __init__(self):
super().__init__(
... | null |
v0 | [
"int"
] | disnake.Member | None | async def v0(self, v1: int) -> disnake.Member | None:
v2 = await self.execute('SELECT id FROM ids WHERE pg_id = ?', v1)
v3 = await v2.fetchone()
if len(v3) == 0:
return None
return await self.server.get_or_fetch_member(v3[0]) | [] | [] | [] | 6 | import os
from datetime import datetime, timedelta
import aiosqlite
import disnake
from aiosqlite import connect
from disnake.ext import commands
from dotenv import load_dotenv
from exencolorlogs import Logger
from utils.constants import *
class Bot(commands.Bot):
def __init__(self):
super().__init__(
... | null |
v0 | [
"str"
] | str | def v0(self, v1: str) -> str:
v2 = []
for v3 in v1:
if v3 != ']':
v2.append(v3)
else:
v4 = ''
while v2[-1] != '[':
v4 += v2.pop()
v2.pop()
v5 = ''
while v2 and v2[-1].isdigit():
v5 += v2.pop()... | [] | [] | [] | 18 | class Solution:
def decodeString(self, s: str) -> str:
"abc3[cd]xyz"
stack = []
for i in s:
if i != "]":
stack.append(i)
else:
temp = ""
while (stack[-1] != "["):
temp += stack.pop()
s... | null |
v0 | [
"List[str]",
"Any",
"int"
] | Any | def v0(v1: List[str], v2=None, v3: int=-1):
v1 = (word for v4 in v1 if v4[0] == 'Ġ' and len([char for v5 in v4[1:] if v5.isalpha()]) >= 2)
if v2 and v3 > 0:
v1 = sorted(v1, key=lambda word: v2[v4[1:]], reverse=True)[:v3]
return v1 | [] | [] | [] | 5 | import argparse
import os
import json
from collections import Counter
from typing import Dict, List
import numpy as np
import random
import torch
from transformers import PreTrainedTokenizer, RobertaTokenizer
from pet.tasks import PROCESSORS, load_examples, TRAIN_SET
from pet.utils import InputExample, eq_div
from pe... | null |
v0 | [
"int"
] | Dict[str, List[str]] | def v0(self, v1: int) -> Dict[str, List[str]]:
if v1 <= 0:
return {label: self.word2idx.keys() for v2 in self.labels}
v3 = {v2: Counter() for v2 in self.labels}
for v2 in self.labels:
for v4 in self.probs_list:
for (v5, v6) in self.word2idx.items():
v7 = np.sum(np... | [] | [
"collections",
"numpy"
] | [
"from collections import Counter",
"import numpy as np"
] | 10 | import argparse
import os
import json
from collections import Counter
from typing import Dict, List
import numpy as np
import random
import torch
from transformers import PreTrainedTokenizer, RobertaTokenizer
from pet.tasks import PROCESSORS, load_examples, TRAIN_SET
from pet.utils import InputExample, eq_div
from pe... | null |
v0 | [
"Dict[str, List[str]]",
"bool",
"int",
"str"
] | Dict[str, List[str]] | def v0(self, v1: Dict[str, List[str]], v2: bool=True, v3: int=10, v4: str='llr') -> Dict[str, List[str]]:
v5 = {label: Counter() for v6 in self.labels}
for v6 in self.labels:
for v7 in self.probs_list:
for v8 in v1[v6]:
v9 = self.word2idx[v8]
if v4 == 'llr':
... | [] | [
"collections"
] | [
"from collections import Counter"
] | 13 | import argparse
import os
import json
from collections import Counter
from typing import Dict, List
import numpy as np
import random
import torch
from transformers import PreTrainedTokenizer, RobertaTokenizer
from pet.tasks import PROCESSORS, load_examples, TRAIN_SET
from pet.utils import InputExample, eq_div
from pe... | null |
v0 | [
"int",
"int",
"bool",
"str"
] | Any | def v0(self, v1: int=10, v2: int=1000, v3: bool=True, v4: str='llr'):
if v4 == 'random':
return {label: random.sample(self.word2idx.keys(), v1) for v5 in self.labels}
v6 = self._get_candidates(num_candidates=v2)
return self._get_top_words(candidates=v6, normalize=v3, words_per_label=v1, score_fct=v4... | [] | [
"random"
] | [
"import random"
] | 5 | import argparse
import os
import json
from collections import Counter
from typing import Dict, List
import numpy as np
import random
import torch
from transformers import PreTrainedTokenizer, RobertaTokenizer
from pet.tasks import PROCESSORS, load_examples, TRAIN_SET
from pet.utils import InputExample, eq_div
from pe... | null |
v0 | [
"int"
] | 'StreamExecutionEnvironment' | def v0(self, v1: int) -> 'StreamExecutionEnvironment':
self._j_stream_execution_environment = self._j_stream_execution_environment.setMaxParallelism(v1)
return self | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [] | 'StreamExecutionEnvironment' | def v0(self) -> 'StreamExecutionEnvironment':
self._j_stream_execution_environment = self._j_stream_execution_environment.disableOperatorChaining()
return self | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [
"bool"
] | 'StreamExecutionEnvironment' | def v0(self, v1: bool) -> 'StreamExecutionEnvironment':
self._j_stream_execution_environment = self._j_stream_execution_environment.enableChangelogStateBackend(v1)
return self | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [] | Optional[bool] | def v0(self) -> Optional[bool]:
v1 = self._j_stream_execution_environment.isChangelogStateBackendEnabled()
return v1.getAsBoolean() | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [
"str"
] | 'StreamExecutionEnvironment' | def v0(self, v1: str) -> 'StreamExecutionEnvironment':
self._j_stream_execution_environment.setDefaultSavepointDirectory(v1)
return self | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [] | Optional[str] | def v0(self) -> Optional[str]:
v1 = self._j_stream_execution_environment.getDefaultSavepointDirectory()
if v1 is None:
return None
else:
return v1.toString() | [] | [] | [] | 6 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [] | str | def v0(self) -> str:
v1 = self._generate_stream_graph(False)
return v1.getStreamingPlanAsJSON() | [] | [] | [] | 3 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | null |
v0 | [] | None | def v0(self) -> None:
self.menubar.append(self.__make_menu_file())
self.menubar.append(self.__make_menu_edit())
self.menubar.append(self.__make_menu_tools())
self.menubar.show_all() | [] | [] | [] | 5 | # -*- coding: utf-8 -*-
#
# ramstk.views.gtk3.desktop.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 - 2020 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK GTK3 basebook."""
# Standard Library Imports
import locale
from typing import List, TypeVar
# Third Party Imp... | null |
v3 | [] | None | def v3(self) -> None:
self.connect('delete_event', v0)
self.connect('window_state_event', self._on_window_state_event)
self.connect('button_press_event', self._on_button_press) | [
{
"name": "v0",
"input_types": [
"Gtk.Widget",
"Gdk.Event"
],
"output_type": "None",
"code": "def v0(v1: Gtk.Widget, v2: Gdk.Event=None) -> None:\n Gtk.main_quit()",
"dependencies": []
}
] | [] | [] | 4 | # -*- coding: utf-8 -*-
#
# ramstk.views.gtk3.desktop.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 - 2020 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK GTK3 basebook."""
# Standard Library Imports
import locale
from typing import List, TypeVar
# Third Party Imp... | null |
v0 | [
"object",
"Gdk.EventButton"
] | None | def v0(self, v1: object, v2: Gdk.EventButton) -> None:
if v2.button == 1:
self.present() | [] | [] | [] | 3 | # -*- coding: utf-8 -*-
#
# ramstk.views.gtk3.desktop.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 - 2020 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK GTK3 basebook."""
# Standard Library Imports
import locale
from typing import List, TypeVar
# Third Party Imp... | null |
v0 | [
"str"
] | List[str] | def v0(v1: str) -> List[str]:
v1 = v1.replace('http://', '')
v1 = v1.replace('https://', '')
v1 = v1.replace(',', ' ')
v1 = v1.replace('\n', ' ')
v1 = v1.replace('\t', ' ')
v1 = v1.split(' ')
v1 = [re.sub(':[^\\s]*', '', u) for v2 in v1]
v1 = [re.sub('/[^\\s]*', '', v2) for v2 in v1]
... | [] | [
"re"
] | [
"import re"
] | 13 | import logging
import re
from typing import Any, Dict, List, Tuple
import tldextract
from actstream import action
from constance import config
from django.db.models import Count, Prefetch
from django.utils import timezone
from websecmap.organizations.models import Url
from websecmap.scanners.models import Endpoint
fro... | null |
v0 | [
"bytes",
"Optional[int]",
"bool"
] | bytes | def v0(self, v1: bytes, v2: Optional[int]=None, v3: bool=False) -> bytes:
v4 = b''
while v4[-len(v1):] != v1:
v4 += self.recv(1, timeout=v2)
if v3:
v4 = v4[:-len(v1)]
return v4 | [] | [] | [] | 7 | from abc import abstractmethod
from typing import Optional, Protocol
class Tube(Protocol):
@abstractmethod
def recv(self, numb: int = 4096, timeout: Optional[int] = None) -> bytes:
raise NotImplementedError
@abstractmethod
def send(self, data: bytes, timeout: Optional[int] = None) -> None:
... | null |
v0 | [
"bytes",
"bytes",
"Optional[int]"
] | None | def v0(self, v1: bytes, v2: bytes, v3: Optional[int]=None) -> None:
self.recvuntil(v1, timeout=v3)
self.send(v2, timeout=v3) | [] | [] | [] | 3 | from abc import abstractmethod
from typing import Optional, Protocol
class Tube(Protocol):
@abstractmethod
def recv(self, numb: int = 4096, timeout: Optional[int] = None) -> bytes:
raise NotImplementedError
@abstractmethod
def send(self, data: bytes, timeout: Optional[int] = None) -> None:
... | null |
v0 | [
"bytes",
"bytes",
"bytes",
"Optional[int]"
] | None | def v0(self, v1: bytes, v2: bytes, v3: bytes=b'\n', v4: Optional[int]=None) -> None:
self.recvuntil(v1, timeout=v4)
self.sendline(v2, newline=v3, timeout=v4) | [] | [] | [] | 3 | from abc import abstractmethod
from typing import Optional, Protocol
class Tube(Protocol):
@abstractmethod
def recv(self, numb: int = 4096, timeout: Optional[int] = None) -> bytes:
raise NotImplementedError
@abstractmethod
def send(self, data: bytes, timeout: Optional[int] = None) -> None:
... | null |
v0 | [
"np.ndarray"
] | float | def v0(v1: np.ndarray) -> float:
assert len(v1.shape) == 2 and v1.shape[0] == v1.shape[1]
v2 = 0
for v3 in range(len(v1)):
v2 += v1[v3, v3]
v4 = np.sum(v1)
if v4 == 0:
return 1
else:
return v2 / v4 | [] | [
"numpy"
] | [
"import numpy as np"
] | 10 | import argparse
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
import torch.optim
from torch.utils.data import DataLoader
from model.model import MAXNet
from util.log import Log
@torch.no_grad()
def eval(model: MAXNet,
test_loader: DataLoader,
epoch,
device,
... | null |
v0 | [
"'pl.Trainer'"
] | None | def v0(self, v1: 'pl.Trainer') -> None:
if self._check_on_train_epoch_end is None:
self._check_on_train_epoch_end = v1.val_check_interval == 1.0 and v1.check_val_every_n_epoch == 1 | [] | [] | [] | 3 | # Copyright The PyTorch Lightning team.
#
# 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 i... | null |
v0 | [
"'pl.Trainer'",
"'pl.LightningModule'",
"Dict[str, Any]"
] | None | def v0(self, v1: 'pl.Trainer', v2: 'pl.LightningModule', v3: Dict[str, Any]) -> None:
self.wait_count = v3['wait_count']
self.stopped_epoch = v3['stopped_epoch']
self.best_score = v3['best_score']
self.patience = v3['patience'] | [] | [] | [] | 5 | # Copyright The PyTorch Lightning team.
#
# 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 i... | null |
v0 | [
"'pl.Trainer'",
"'pl.LightningModule'"
] | None | def v0(self, v1: 'pl.Trainer', v2: 'pl.LightningModule') -> None:
if not self._check_on_train_epoch_end or self._should_skip_check(v1):
return
self._run_early_stopping_check(v1) | [] | [] | [] | 4 | # Copyright The PyTorch Lightning team.
#
# 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 i... | null |
v0 | [
"'pl.Trainer'"
] | None | def v0(self, v1: 'pl.Trainer') -> None:
v2 = v1.callback_metrics
if v1.fast_dev_run or not self._validate_condition_metric(v2):
return
v3 = v2.get(self.monitor)
v1.dev_debugger.track_early_stopping_history(self, v3)
(v4, v5) = self._evaluate_stopping_criteria(v3)
v4 = v1.training_type_pl... | [] | [] | [] | 13 | # Copyright The PyTorch Lightning team.
#
# 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 i... | null |
v0 | [
"torch.Tensor"
] | Tuple[bool, Optional[str]] | def v0(self, v1: torch.Tensor) -> Tuple[bool, Optional[str]]:
v2 = False
v3 = None
if self.check_finite and (not torch.isfinite(v1)):
v2 = True
v3 = f'Monitored metric {self.monitor} = {v1} is not finite. Previous best value was {self.best_score:.3f}. Signaling Trainer to stop.'
elif sel... | [] | [
"torch"
] | [
"import torch",
"from torch import Tensor",
"from torch.nn import Module",
"from torch.optim.optimizer import Optimizer"
] | 27 | # 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 writing, software
# distributed under th... | null |
v0 | [
"torch.Tensor"
] | str | def v0(self, v1: torch.Tensor) -> str:
if torch.isfinite(self.best_score):
v2 = f'Metric {self.monitor} improved by {abs(self.best_score - v1):.3f} >= min_delta = {abs(self.min_delta)}. New best score: {v1:.3f}'
else:
v2 = f'Metric {self.monitor} improved. New best score: {v1:.3f}'
return v2 | [] | [
"torch"
] | [
"import torch"
] | 6 | # Copyright The PyTorch Lightning team.
#
# 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 i... | null |
v32 | [
"str",
"argparse._SubParsersAction"
] | argparse.ArgumentParser | def v32(self, v33: str, v34: argparse._SubParsersAction) -> argparse.ArgumentParser:
v35 = 'Train the specified model on the specified dataset.'
v36 = v34.add_parser(v33, description=v35, help='Train a model.')
v36.add_argument('param_path', type=str, help='path to parameter file describing the model to be ... | [
{
"name": "v0",
"input_types": [
"Params",
"str",
"bool",
"bool",
"bool",
"str",
"str"
],
"output_type": "Model",
"code": "def v0(v1: Params, v2: str, v3: bool=False, v4: bool=False, v5: bool=False, v6: str=None, v7: str=None) -> Model:\n create_seria... | [
"logging",
"os"
] | [
"import logging",
"import os"
] | 13 | """
The ``train`` subcommand can be used to train a model.
It requires a configuration file and a directory in
which to write the results.
.. code-block:: bash
$ allennlp train --help
usage: allennlp train [-h] -s SERIALIZATION_DIR [-r] [-f] [-o OVERRIDES]
[--file-friendly-logging]
... | null |
v0 | [] | str | def v0() -> str:
v1: Dict[str, str] = {}
with open('lakehouse/version.py') as v2:
exec(v2.read(), v1)
return v1['__version__'] | [] | [] | [] | 5 | from typing import Dict
from setuptools import find_packages, setup # type: ignore
def get_version() -> str:
version: Dict[str, str] = {}
with open("lakehouse/version.py") as fp:
exec(fp.read(), version) # pylint: disable=W0122
return version["__version__"]
if __name__ == "__main__":
set... | null |
v0 | [] | None | def v0(self) -> None:
self.hidraw_device.destroy()
del self.hidraw_device
self.ev_device.ungrab()
self.ev_device.close()
del self.ev_device
print('Compatibility Device ', self.device_path, ' finalised') | [] | [] | [] | 7 | import asyncio
from typing import List
from evdev import InputDevice, categorize, ecodes
from hidtools.uhid import UHIDDevice
CONSUMER_KEYS_EVENT_TO_USAGE_FLAG_MAPPING = {
ecodes.KEY_NEXTSONG : 0x01, # Usage (Scan Next Track)
ecodes.KEY_PREVIOUSSONG : 0x02, # Usage (Scan Previous Track)
ecodes.KEY_STOP : ... | null |
v0 | [] | Dict[str, Any] | def v0(self, **v1) -> Dict[str, Any]:
v1['predictions'] = self.get_prediction_dict()
v1['method_times'] = self.scan._method_times.extend(self._method_times)
return v1 | [] | [] | [] | 4 | import cv2
import json
import numpy as np
import os
from abc import ABC
from typing import Any, Dict
from document_reader.cv_wrapper import display, find_transform_and_mask, get_keypoints_and_descriptors, get_matching_points, resize, reverse_transformation
from document_reader.py_wrapper import coalesce, store_time
... | null |
v0 | [
"int",
"list",
"list",
"Any"
] | Any | def v0(v1: int, v2: list, v3: list, v4):
v3 = [int(i) for v5 in v3]
v2 = [int(v5) for v5 in v2]
v6 = len(v3) + 1
v7 = v1 + 1
v3 = [0] + v3[:]
v2 = [0] + v2[:]
v8 = [[0 for v5 in range(v7)] for v9 in range(v6)]
for v5 in range(1, v6):
for v9 in range(1, v7):
if v9 - v2... | [] | [] | [] | 30 | from coinmarketcap import Market
from tkinter import *
from tkinter import font as tkfont
import pandas as pd
from tkinter import ttk
from PIL import Image, ImageTk
test = []
#############################################FRONTEND#############################################################################... | null |
v0 | [
"torch.Tensor",
"torch.Tensor"
] | float | def v0(v1: torch.Tensor, v2: torch.Tensor) -> float:
assert len(v1) == len(v2), 'Predictions and labels must have the same length.'
assert len(v2.shape) == 1, 'Labels must be a column vector.'
return 1.0 - float((v1.argmax(1) == v2.to(torch.long)).sum()) / v1.shape[0] | [] | [
"torch"
] | [
"import torch",
"from torch import nn"
] | 4 | """
This example shows how to interact with the Determined PyTorch interface to build a
multi prediction MNIST network.
The `MultiMNistTrial` class contains methods for building the model, building the
optimizer, and defining the forward pass for training and validation.
"""
from typing import Any, Dict, Tuple, cast
... | null |
v0 | [
"List[int]",
"List[int]",
"Sequence[Union[Sequence[int], int]]",
"Sequence[Union[Sequence[int], int]]",
"nn.Module",
"Optional[Sequence[Union[Sequence[int], int]]]"
] | Any | def v0(self, v1: List[int], v2: List[int], v3: Sequence[Union[Sequence[int], int]], v4: Sequence[Union[Sequence[int], int]], v5: nn.Module, v6: Optional[Sequence[Union[Sequence[int], int]]]=None):
v7 = []
if v6 is not None:
for (v8, v9, v10, v11, v12) in zip(v1, v2, v3, v4, v6):
v13 = {'spat... | [] | [
"torch"
] | [
"import torch",
"import torch.nn as nn",
"from torch.nn.functional import interpolate"
] | 13 | # 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",
"str",
"str"
] | Any | def v0(v1: str, v2: str, v3: str):
with tarfile.open(f'{v1}.tar.gz', 'w:gz') as v4:
v4.add(v1, arcname=os.path.basename(v1))
print(f'client type is {v2}')
v5 = os.system(f'rsync -av {v1}.tar.gz {v3}')
if os.path.exists(f'{v1}.tar.gz'):
os.remove(f'{v1}.tar.gz')
if os.path.exists(f'{v... | [] | [
"os",
"shutil",
"tarfile"
] | [
"import os",
"import shutil",
"import tarfile"
] | 10 | import gc
import os
import ssl
import sys
import time
import trio
import uuid
import ftfy
import math
import ujson
import shutil
import random
import hashlib
import tarfile
import requests
import numpy as np
import pandas as pd
import gcld3
from glob import glob
from uuid import uuid1
from io import BytesIO
from reque... | null |
v0 | [
"Image"
] | Any | def v0(v1: Image):
(v2, v3) = v1.size
v4 = min(v2, v3) / 224
v5 = int(round(v2 / v4, 0))
v6 = int(round(v3 / v4, 0))
v1 = v1.resize((v5, v6), resample=Image.BICUBIC)
if v5 > 224 or v6 > 224:
v7 = (v5 - 224) / 2
v8 = (v6 - 224) / 2
v9 = (v5 + 224) / 2
v10 = (v6 + 2... | [] | [
"PIL"
] | [
"from PIL import Image, ImageFile, UnidentifiedImageError"
] | 13 | # use this if you have a spare computer with multiple CPUs and a very good internet link
# command line: python3 worker-multicpu.py N nickname
# where N = max number of CPU to use
# nickname is you nickname for the leaderboard
import gc
import os
import re
import ssl
import sys
import time
import trio
import uuid
impo... | null |
v0 | [] | None | def v0(self) -> None:
try:
os.remove('.localstorage')
except OSError:
pass | [] | [
"os"
] | [
"import os"
] | 5 | import os
from unittest import TestCase, mock
from src.configurations import LocalStorageSimpleConfigRepository, EnvFullConfigRepository, SimpleConfig, get_config, FullConfig, create_simple_config
from src.lyrics.exceptions import ConfigError
class TestEnvFullConfigRepository(TestCase):
@mock.patch('src.configu... | null |
v2 | [
"str"
] | None | def v2(self, v3: str) -> None:
for v4 in ['json', 'tif', 'jpeg', 'png', 'float', 'int', 'string']:
v0(os.path.join(self.job_path, v3 + '.' + v4)) | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "None",
"code": "def v0(v1: str) -> None:\n try:\n os.remove(v1)\n except:\n pass",
"dependencies": []
}
] | [
"os"
] | [
"import os"
] | 3 | import logging
import os
import shutil
from pesto.ws.service.job_list import JobListService
log = logging.getLogger(__name__)
class JobDeleteService:
def __init__(self, url_root: str, job_id: str):
self.job_id = job_id
self.job_path = os.path.join(JobListService.PESTO_WORKSPACE, self.job_id)
... | null |
v13 | [
"Union[str, PurePath]"
] | bool | def v13(v14: Union[str, PurePath]) -> bool:
assert isinstance(v14, (str, PurePath)), f'{v14!r} is not a valid filename'
v2(v14)
with io.open(v14, mode='rb') as v15:
for v16 in iter(lambda : v15.read(1024), bytes()):
if b'\x00' in v16:
return True
return False | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "str",
"code": "def v0(v1: str) -> str:\n if len(v1) > 255:\n return '\\\\\\\\?\\\\' + v1\n return v1",
"dependencies": []
},
{
"name": "v2",
"input_types": [
"str",
"str"
],
"output_t... | [
"io",
"os",
"pathlib"
] | [
"import os",
"import io",
"from pathlib import PurePath"
] | 8 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v8 | [
"str",
"str"
] | None | def v8(v9: str, v10: str='file') -> None:
try:
v11 = os.path.exists(v9)
except TypeError:
v12 = 'cannot find %s=%r\n' % (v10, v9)
raise TypeError(v12)
if not v11:
v12 = 'cannot find %s=%r\n%s' % (v10, v9, v2(v9))
raise FileNotFoundError(v12) | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "str",
"code": "def v0(v1: str) -> str:\n if len(v1) > 255:\n return '\\\\\\\\?\\\\' + v1\n return v1",
"dependencies": []
},
{
"name": "v2",
"input_types": [
"str"
],
"output_type": "str",
... | [
"os"
] | [
"import os"
] | 9 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v2 | [
"str"
] | str | def v2(v3: str) -> str:
if len(v3) > 255:
v3 = os.path.abspath(v0(v3))
v4 = os.path.dirname(v3)
v5 = [v3]
while v3 != v4:
(v3, v4) = (v4, os.path.dirname(v4))
v5.append(v3)
v6 = {True: 'passed', False: 'failed'}
return '\n'.join(['%s: %s' % (v6... | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "str",
"code": "def v0(v1: str) -> str:\n if len(v1) > 255:\n return '\\\\\\\\?\\\\' + v1\n return v1",
"dependencies": []
}
] | [
"os"
] | [
"import os"
] | 18 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
if len(v1) > 255:
return '\\\\?\\' + v1
return v1 | [] | [] | [] | 4 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v18 | [
"Any",
"str",
"Optional[List[str]]",
"bool"
] | str | def v18(v19: Any, v20: str='public', v21: Optional[List[str]]=None, v22: bool=False) -> str:
v23 = '%s:\n' % v19.__class__.__name__
v24 = v13(v19, mode=v20, keys_to_skip=v21, filter_properties=v22)
for v25 in sorted(v24):
v26 = getattr(v19, v25)
v23 += ' %-6s : %r\n' % (v25, v26)
return... | [
{
"name": "v0",
"input_types": [
"Any",
"Any",
"Any",
"Any",
"bool"
],
"output_type": "Any",
"code": "def v0(v1, v2, v3, v4, v5: bool=False):\n v3 = [] if v3 is None else v3\n v6 = {'public': lambda k: not k.startswith('_') and k not in v3, 'private': lambda k... | [] | [] | 7 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v0 | [
"str",
"str"
] | List[int] | def v0(v1: str, v2: str) -> List[int]:
v3 = v2.split('-')[0].split('+')[0]
if 'rc' not in v1:
v3 = v3.split('rc')[0]
try:
return [int(val) for v4 in v3.split('.')]
except ValueError:
raise SyntaxError('cannot determine version for %s %s' % (v1, v3)) | [] | [] | [] | 8 | """
defines:
- deprecated(old_name, new_name, deprecated_version, levels=None)
- print_bad_path(path)
- object_attributes(obj, mode='public', keys_to_skip=None)
- object_methods(obj, mode='public', keys_to_skip=None)
"""
# -*- coding: utf-8 -*-
from types import MethodType, FunctionType
import os
import io
import s... | null |
v0 | [
"list",
"int"
] | Any | def v0(v1: list, v2: int):
if v2 <= 0:
raise ValueError('chunk_size must not be 0 or negative')
v3 = 0
while v3 < len(v1):
if v3 + v2 >= len(v1):
yield v1[v3:]
v3 = len(v1)
else:
yield v1[v3:v3 + v2]
v3 += v2 | [] | [] | [] | 11 | """Cardinality constraint encoders
This module provides at-most-k constraint encoders. An at-most-k constraint encoding for a set L of literals
is satisfied if and only if no more than k elements in L have the value assignment 'true'.
"""
from cscl.interfaces import CNFLiteralFactory
import itertools
def subsets_of... | null |
v0 | [
"onp.array",
"tuple"
] | Any | def v0(v1: onp.array, v2: tuple):
v3 = tuple(reversed(v2))
v4 = []
for v5 in range(len(v3)):
v4.append(v1 % v3[v5])
v1 = v1 // v3[v5]
v4 = onp.array(tuple(reversed(v4))).T
return v4 | [] | [
"numpy"
] | [
"import numpy as onp"
] | 8 | from scipy.special import gamma, loggamma
import numpy as onp
from functools import reduce
def _get_hashed_number(numbers_in_range_of_size: onp.array, shape: tuple):
reversed_bucket = tuple(reversed(shape))
res = []
for rt in range(len(reversed_bucket)):
res.append(numbers_in_range_of_size % reve... | null |
v6 | [
"onp.array"
] | Any | def v6(v7: onp.array):
v8 = v7.size
v9 = onp.array(list(range(v8)))
v10 = v0(v9, v7.shape)
v11 = onp.empty(v7.shape, dtype=onp.longdouble)
for v12 in v10:
v11[tuple(v12)] = onp.sum(v7[tuple(v12)])
return v11 | [
{
"name": "v0",
"input_types": [
"onp.array",
"tuple"
],
"output_type": "Any",
"code": "def v0(v1: onp.array, v2: tuple):\n v3 = tuple(reversed(v2))\n v4 = []\n for v5 in range(len(v3)):\n v4.append(v1 % v3[v5])\n v1 = v1 // v3[v5]\n v4 = onp.array(tuple(rev... | [
"numpy"
] | [
"import numpy as onp"
] | 8 | from scipy.special import gamma, loggamma
import numpy as onp
from functools import reduce
def _get_hashed_number(numbers_in_range_of_size: onp.array, shape: tuple):
reversed_bucket = tuple(reversed(shape))
res = []
for rt in range(len(reversed_bucket)):
res.append(numbers_in_range_of_size % reve... | null |
v0 | [
"onp.array"
] | Any | def v0(v1: onp.array):
v2 = onp.max(v1, axis=0)
v3 = onp.argmax(v1, axis=0)
v4 = onp.max(v2, axis=0)
v5 = onp.argmax(v2, axis=0)
v6 = onp.argmax(v4, axis=0)
v7 = (v3[v5[v6], v6], v5[v6], v6)
return v7 | [] | [
"numpy"
] | [
"import numpy as onp"
] | 8 | from scipy.special import gamma, loggamma
import numpy as onp
from functools import reduce
def _get_hashed_number(numbers_in_range_of_size: onp.array, shape: tuple):
reversed_bucket = tuple(reversed(shape))
res = []
for rt in range(len(reversed_bucket)):
res.append(numbers_in_range_of_size % reve... | null |
v0 | [
"onp.array"
] | Any | def v0(v1: onp.array):
v2 = onp.min(v1, axis=0)
v3 = onp.argmin(v1, axis=0)
v4 = onp.argmax(v2, axis=0)
v5 = (v3[v4], v4)
return v5 | [] | [
"numpy"
] | [
"import numpy as onp"
] | 6 | from scipy.special import gamma, loggamma
import numpy as onp
from functools import reduce
def _get_hashed_number(numbers_in_range_of_size: onp.array, shape: tuple):
reversed_bucket = tuple(reversed(shape))
res = []
for rt in range(len(reversed_bucket)):
res.append(numbers_in_range_of_size % reve... | null |
v0 | [
"Any",
"tuple"
] | Any | def v0(v1, v2: tuple):
assert len(v1.shape) == len(v2), f'matrix.shape: {v1.shape}, times: {v2}'
v3 = tuple([v1.shape[i] * v2[i] for v4 in range(len(v2))])
v5 = []
for v6 in v1.shape:
v5.append(v6)
v5.append(1)
v5 = tuple(v5)
v7 = []
for v4 in range(len(v2)):
v7.appen... | [] | [
"numpy"
] | [
"import numpy as onp"
] | 14 | from scipy.special import gamma, loggamma
import numpy as onp
from functools import reduce
def _get_hashed_number(numbers_in_range_of_size: onp.array, shape: tuple):
reversed_bucket = tuple(reversed(shape))
res = []
for rt in range(len(reversed_bucket)):
res.append(numbers_in_range_of_size % reve... | null |
v0 | [
"Any"
] | List[str] | def v0(v1=False) -> List[str]:
v2 = []
v3 = 'scanner/core/constants/vectors.txt'
v4 = 'scanner/core/constants/fast_vectors.txt'
with open(v4 if v1 else v3, 'r', encoding='utf-8') as v5:
for v6 in v5.readlines():
v2.append(v6.replace('\n', ''))
return v2 | [] | [] | [] | 8 | from typing import Dict, List
import urllib
import crayons
def get_payloads_from_vectors(fast=False) -> List[str]:
payloads = []
vectorsPath = 'scanner/core/constants/vectors.txt'
fastVectorsPath = 'scanner/core/constants/fast_vectors.txt'
with open(fastVectorsPath if fast else vectorsPath, 'r', enco... | null |
v0 | [
"str"
] | dict | def v0(v1: str) -> dict:
v2 = urllib.parse.urlparse(v1)
v3 = v2.query
v4 = dict(urllib.parse.parse_qsl(v3))
return v4 | [] | [
"urllib"
] | [
"import urllib"
] | 5 | from typing import Dict, List
import urllib
import crayons
def get_payloads_from_vectors(fast=False) -> List[str]:
payloads = []
vectorsPath = 'scanner/core/constants/vectors.txt'
fastVectorsPath = 'scanner/core/constants/fast_vectors.txt'
with open(fastVectorsPath if fast else vectorsPath, 'r', enco... | null |
v0 | [
"Any",
"Any"
] | str | def v0(v1, v2) -> str:
v3 = urllib.parse.urlencode(v2)
v4 = v1 + '?' + v3
return v4 | [] | [
"urllib"
] | [
"import urllib"
] | 4 | from typing import Dict, List
import urllib
import crayons
def get_payloads_from_vectors(fast=False) -> List[str]:
payloads = []
vectorsPath = 'scanner/core/constants/vectors.txt'
fastVectorsPath = 'scanner/core/constants/fast_vectors.txt'
with open(fastVectorsPath if fast else vectorsPath, 'r', enco... | null |
v0 | [
"str"
] | List[Dict] | def v0(v1: str) -> List[Dict]:
v2 = []
v3 = v1.split(',')
for v4 in v3:
v5 = v4.split(':')
v6 = {'name': v5[0], 'value': v5[1], 'path': v5[2]}
v2.append(v6)
return v2 | [] | [] | [] | 8 | from typing import Dict, List
import urllib
import crayons
def get_payloads_from_vectors(fast=False) -> List[str]:
payloads = []
vectorsPath = 'scanner/core/constants/vectors.txt'
fastVectorsPath = 'scanner/core/constants/fast_vectors.txt'
with open(fastVectorsPath if fast else vectorsPath, 'r', enco... | null |
v0 | [
"'Model'"
] | None | def v0(v1: 'Model', *v2: 'Model') -> None:
for v3 in v2:
v1._attach_child_model(v3) | [] | [] | [] | 3 | from inspect import signature
from functools import wraps
from typing import (
Any,
Union,
Callable,
Optional,
TypeVar,
Tuple,
Dict,
List,
Iterator,
overload,
)
from contextlib import contextmanager
from weakref import WeakValueDictionary
__all__ = ["Model", "Control", "view", ... | null |
v0 | [
"Any"
] | bool | def v0(v1) -> bool:
v2 = {'submit', 'reset', 'button', 'file', 'image'}
if v1.tag_name == 'input' and v1.get_attribute('type') in v2:
return False
else:
return True | [] | [] | [] | 6 | from typing import Dict, List
import urllib
import crayons
def get_payloads_from_vectors(fast=False) -> List[str]:
payloads = []
vectorsPath = 'scanner/core/constants/vectors.txt'
fastVectorsPath = 'scanner/core/constants/fast_vectors.txt'
with open(fastVectorsPath if fast else vectorsPath, 'r', enco... | null |
v0 | [
"str"
] | bool | def v0(v1: str) -> bool:
try:
socket.inet_aton(v1)
return True
except socket.error:
try:
socket.inet_aton(socket.gethostbyname(v1))
return True
except:
return False | [] | [
"socket"
] | [
"import socket"
] | 10 | import requests
import argparse
import socket
def check_if_is_ip(ip: str) -> bool:
try:
socket.inet_aton(ip)
return True
except socket.error:
try:
socket.inet_aton(socket.gethostbyname(ip))
return True
except:
return False
def get_host_name(i... | null |
v0 | [
"List[str]",
"List[str]",
"int"
] | int | def v0(v1: List[str], v2: List[str], v3: int) -> int:
for v4 in v1:
if 'description' in v4:
for v5 in v2:
if v5 in v4.split():
return v4.split().index(v5)
return v3 | [] | [] | [] | 7 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
import sys
import mypy
from typing import List
import seaborn as sns
import argparse
def floatable(st: str) -> bool:
"""
Allows filtering column contents by numeric-ness.
"""
try:
f... | null |
v2 | [
"List[str]",
"bool",
"str",
"float",
"float"
] | None | def v2(v3: List[str], v4: bool, v5: str, v6: float, v7: float) -> None:
print('In simrna mode')
v8 = []
v9 = []
v10 = []
v11 = 1
v12 = 0
for v13 in v3:
with open(v13) as v14:
v10.append([line for v15 in v14])
(v16, v17) = ([], [])
for v18 in v10:
v8 = [flo... | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "bool",
"code": "def v0(v1: str) -> bool:\n try:\n float(v1)\n return True\n except:\n return False",
"dependencies": []
}
] | [
"matplotlib",
"numpy"
] | [
"import numpy as np",
"import matplotlib.pyplot as plt"
] | 32 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
import sys
import mypy
from typing import List
import seaborn as sns
import argparse
def floatable(st: str) -> bool:
"""
Allows filtering column contents by numeric-ness.
"""
try:
f... | null |
v12 | [
"List[str]",
"bool",
"str"
] | None | def v12(v13: List[str], v14: bool, v15: str) -> None:
v16 = []
v17 = []
v18 = []
for v19 in v13:
with open(v19) as v20:
v18.append([line for v21 in v20 if v21[0:5] == 'SCORE'])
(v22, v23) = ([], [])
for v24 in v18:
if scoreidx == -1 or len(v18) > 1:
v25 = ... | [
{
"name": "v0",
"input_types": [
"List[str]",
"List[str]",
"int"
],
"output_type": "int",
"code": "def v0(v1: List[str], v2: List[str], v3: int) -> int:\n for v4 in v1:\n if 'description' in v4:\n for v5 in v2:\n if v5 in v4.split():\n ... | [
"matplotlib",
"numpy"
] | [
"import numpy as np",
"import matplotlib.pyplot as plt"
] | 32 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
import sys
import mypy
from typing import List
import seaborn as sns
import argparse
def floatable(st: str) -> bool:
"""
Allows filtering column contents by numeric-ness.
"""
try:
f... | null |
v14 | [
"List[str]",
"int",
"int",
"bool",
"str",
"float",
"float"
] | None | def v14(v15: List[str], v16: int, v17: int, v18: bool, v19: str, v20: float, v21: float) -> None:
v22 = []
v23 = []
v24 = []
for v25 in v15:
with open(v25) as v26:
v24.append([line for v27 in v26 if v27[0:5] == 'SCORE'])
(v28, v29) = ([], [])
for v30 in v24:
if v16 ==... | [
{
"name": "v0",
"input_types": [
"List[str]",
"List[str]",
"int"
],
"output_type": "int",
"code": "def v0(v1: List[str], v2: List[str], v3: int) -> int:\n for v4 in v1:\n if 'description' in v4:\n for v5 in v2:\n if v5 in v4.split():\n ... | [
"matplotlib",
"numpy"
] | [
"import numpy as np",
"import matplotlib.pyplot as plt"
] | 33 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
import sys
import mypy
from typing import List
import seaborn as sns
import argparse
def floatable(st: str) -> bool:
"""
Allows filtering column contents by numeric-ness.
"""
try:
f... | null |
v0 | [
"str",
"Sequence[str]"
] | bool | def v0(v1: str, v2: Sequence[str]) -> bool:
v3 = re.search('(https?://[^\\s\\\'"]+)', v1)
if not v3:
return False
v4 = urlparse(v3.group(1))
if not v4:
return False
for v5 in v2:
if v4.path == v5:
return True
return False | [] | [
"re",
"urllib"
] | [
"import re",
"from urllib.parse import urlparse"
] | 11 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# type: ignore
'''Utils for Selenium tests.'''
import contextlib
import inspect
import json
import logging
import os
import functools
import re
import sys
import traceback
from urllib.parse import urlparse
from typing import Iterator, List, NamedTuple, Text, Sequence
fr... | null |
v0 | [
"str",
"Sequence[str]"
] | bool | def v0(v1: str, v2: Sequence[str]) -> bool:
v3 = re.search('(\\\'(?:[^\\\']|\\\\\\\')*\\\'|"(?:[^"]|\\\\")*")', v1)
if v3:
v4 = v3.group(1)[1:-1]
for v5 in v2:
if v4 == v5:
return True
return False
for v5 in v2:
if v5 in v1:
return True... | [] | [
"re"
] | [
"import re"
] | 12 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# type: ignore
'''Utils for Selenium tests.'''
import contextlib
import inspect
import json
import logging
import os
import functools
import re
import sys
import traceback
from urllib.parse import urlparse
from typing import Iterator, List, NamedTuple, Text, Sequence
fr... | null |
v0 | [
"Any",
"str"
] | None | def v0(v1, *, v2: str) -> None:
v1.wait.until(EC.element_to_be_clickable((By.XPATH, '//a[contains(@href, "#runs")]'))).click()
v1.wait.until(EC.element_to_be_clickable((By.XPATH, '//table[contains(concat(" ", normalize-space(@class), " "), " runs ")]/tbody/tr/td/div[contains(concat(" ", normalize-space(@class),... | [] | [
"selenium"
] | [
"from selenium.webdriver.common.by import By",
"from selenium.webdriver.support import expected_conditions as EC",
"from selenium.webdriver.support.select import Select"
] | 8 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# type: ignore
'''Utils for Selenium tests.'''
import contextlib
import inspect
import json
import logging
import os
import functools
import re
import sys
import traceback
from urllib.parse import urlparse
from typing import Iterator, List, NamedTuple, Text, Sequence
fr... | null |
v0 | [] | Iterator[Tuple[str, str]] | def v0(self, *v1, **v2) -> Iterator[Tuple[str, str]]:
v3: str = v1[0]
v4 = os.path.join(v3, 'collection.tsv')
with open(v4, 'r') as v5:
for v6 in v5:
(v7, v8) = v6.split('\t', 1)
yield (v7, v8) | [] | [
"os"
] | [
"import os"
] | 7 | # Copyright 2019 The Forte 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 required by applicable ... | null |
v0 | [
"Any"
] | dict | def v0(v1) -> dict:
v2 = {}
for v3 in v1:
if v2.get(v3) is None:
v2[v3] = 1
else:
v2[v3] = v2[v3] + 1
return v2 | [] | [] | [] | 8 | # qubit number=2
# total number=14
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | null |
v0 | [
"str"
] | Any | def v0(v1: str):
v2 = v1.lower()
v3 = v2.split(' ')
v3 = [word for v4 in v3 if v4 not in string.punctuation]
v2 = ' '.join(v3)
return v2 | [] | [
"string"
] | [
"import string"
] | 6 | import string
def clean_headline(headline: str):
cleaned = headline.lower()
words = cleaned.split(" ")
words = [word for word in words if word not in string.punctuation]
cleaned = ' '.join(words)
return cleaned
def tokenize_headlines(headline:str):
tokens = headline.split(" ")
return to... | null |
v0 | [
"str"
] | Any | def v0(v1: str):
v2 = v1.split(' ', 2)
v2.reverse()
return v2 | [] | [] | [] | 4 | #!/usr/bin/env python3
import urllib.parse
import urllib.request
import argparse
import itertools
import typing
import json
import collections
import re
import os
from bs4 import BeautifulSoup
re_cdata = re.compile(r'<!\[CDATA\[(.*?)\]\]>')
def download_url(link: str, status: str) -> str:
status_text = '' if l... | null |
v0 | [
"List[Tensor]",
"List[Tensor]",
"int"
] | Tensor | def v0(self, v1: List[Tensor], v2: List[Tensor], v3: int=10) -> Tensor:
(v4, v5, v6, v7) = v1[0].shape
v8 = []
for v5 in range(v3):
v9 = torch.zeros(v4, self.in_channels, v6, v7).to(v1[0].device)
(v1[0], v2[0]) = self.forecast[0](v9, v1[0], v2[0])
for v10 in range(1, self.layers):
... | [] | [
"torch"
] | [
"import torch",
"from torch import nn, Tensor"
] | 13 | from typing import List, Tuple
from ConvLSTMCell import ConvLSTMCell
import torch
from torch import nn, Tensor
__all__ = ["ConvLSTM"]
class ConvLSTM(nn.Module):
def __init__(self, in_channels: int = 1, hidden_channels_list=None, size: Tuple[int, int] = (100, 100),
kernel_size_list=None, forget_... | null |
v0 | [
"Any"
] | Optional[str] | def v0(v1) -> Optional[str]:
if len(self.build_order) > v1 + 1:
return self.build_order[v1 + 1]
return None | [] | [] | [] | 4 | from sc2 import Race, Attribute
from sc2.constants import *
from sc2.player import Bot, Computer
from sc2.position import Point2, Point3
from sc2.unit import Unit
from sc2.units import Units
from protoss_common import ProtossCommon
from typing import Union, Optional
from time import sleep, time, strftime, localtime
imp... | null |
v0 | [
"torch.Tensor",
"torch.Tensor",
"Any"
] | Any | def v0(v1: torch.Tensor, v2: torch.Tensor, v3=None):
assert len(v2.shape) == 1, 'Only one dimensional partitions supported'
assert v1.shape[0] == v2.shape[0], 'Partitions requires the same size as data'
if v3 is None:
v3 = max(torch.unique(v2))
return [v1[v2 == index] for v4 in range(v3)] | [] | [
"torch"
] | [
"import torch",
"import torch.nn as nn",
"import torch.nn.functional as F"
] | 6 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# CifModel implemented by RYM
import logging
from argparse import Namespace
import contextlib
import copy
import math
import numpy as np
impo... | null |
v0 | [
"Callable",
"Callable"
] | Any | def v0(self, v1: Callable, v2: Callable):
self.transform = v1
self.target_transform = v2 | [] | [] | [] | 3 | from typing import MutableMapping, Callable
from ..configs import ImporterConfig
from fancy import config as cfg
from torch.utils.data import DataLoader, Dataset
class DatasetConfig(ImporterConfig):
param: dict = cfg.Option(default={}, type=cfg.process.flag_container)
batch_size: int = cfg.Option(default=1,... | null |
v0 | [
"str",
"Any",
"int"
] | None | def v0(v1: str, v2, v3: int=4) -> None:
with io.open(v1, 'r') as v4:
v5 = json.loads(v4.read())
print(json.dumps(v2(v5), indent=v3)) | [] | [
"io",
"json"
] | [
"import io",
"import json"
] | 4 | import io
import json
from argparse import ArgumentParser
from common_osint_model import *
def convshodan() -> None:
"""
Converts a JSON file with shodan data to the common data model
"""
args = parse_args()
if args.flatten:
convert(args.filepath, from_shodan_flattened, args.indent)
e... | null |
v0 | [
"List[int]",
"int"
] | int | def v0(self, v1: List[int], v2: int) -> int:
(v3, v4) = (0, len(v1) - 1)
while v3 <= v4:
v5 = v3 + (v4 - v3) // 2
if v1[v5] == v2:
return v5
if v1[v5] > v2:
if v1[v3] <= v1[v5]:
if v1[v3] > v2:
v3 = v5 + 1
else:
... | [] | [] | [] | 22 | #!/usr/bin/env python
"""
CREATED AT: 2021/9/8
Des:
https://leetcode.com/problems/search-in-rotated-sorted-array
https://leetcode.com/explore/interview/card/top-interview-questions-medium/110/sorting-and-searching/804/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Medium
"""
from typing import List
class ... | null |
v5 | [
"Union[str, List[str]]",
"Callable[[str, Optional[str]], Dict[str, Any]]"
] | Iterator[Dict[str, Any]] | def v5(v6: Union[str, List[str]], v7: Callable[[str, Optional[str]], Dict[str, Any]]=None) -> Iterator[Dict[str, Any]]:
if isinstance(v6, str):
v6 = [v6]
if v7 is None:
v7 = v0
v8 = -1
for v9 in v6:
with open(expanduser(v9), 'r') as v10:
for v11 in v10:
... | [
{
"name": "v0",
"input_types": [
"str",
"str"
],
"output_type": "Dict[str, Any]",
"code": "def v0(v1: str, v2: str) -> Dict[str, Any]:\n v3 = json.loads(v1)\n if 'audio_filename' in v3:\n v3['audio_file'] = v3.pop('audio_filename')\n elif 'audio_filepath' in v3:\n ... | [
"json",
"os"
] | [
"import json",
"from os.path import expanduser"
] | 13 | # Copyright (c) 2019 NVIDIA Corporation
import json
from os.path import expanduser
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
class ManifestBase:
def __init__(self, *args, **kwargs):
raise ValueError(
"This class is deprecated, look at https://github.com/NVIDIA/NeM... | null |
v0 | [
"str",
"str"
] | Dict[str, Any] | def v0(v1: str, v2: str) -> Dict[str, Any]:
v3 = json.loads(v1)
if 'audio_filename' in v3:
v3['audio_file'] = v3.pop('audio_filename')
elif 'audio_filepath' in v3:
v3['audio_file'] = v3.pop('audio_filepath')
else:
raise ValueError(f'Manifest file {v2} has invalid json line struct... | [] | [
"json",
"os",
"pathlib"
] | [
"import json",
"from os.path import expanduser",
"from pathlib import Path"
] | 26 | # Copyright (c) 2020, NVIDIA CORPORATION. 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 appli... | null |
v0 | [
"np.ndarray",
"str",
"str"
] | None | def v0(self, v1: np.ndarray, v2: str, v3: str) -> None:
v4 = self.img_producer.topic_path(self.project, v3)
v5 = self.encode_message(v2, v1)
self.img_producer.publish(v4, v5) | [] | [] | [] | 4 | import json
import numpy as np
from google.cloud import pubsub_v1
import utils
from producers.base_producer import BaseProducer
CONFIG = utils.get_config()
class GCPImageProducer(BaseProducer):
"""GCP Pub/Sub Producer class which can send and decode images"""
def __init__(self, project: str = CONFIG["Goog... | null |
v0 | [
"str",
"str"
] | None | def v0(self, v1: str, v2: str) -> None:
v3 = self.img_producer.topic_path(self.project, v2)
v4 = {'Message': v1}
v5 = json.dumps(v4).encode('utf-8')
self.img_producer.publish(v3, v5) | [] | [
"json"
] | [
"import json"
] | 5 | import json
import numpy as np
from google.cloud import pubsub_v1
import utils
from producers.base_producer import BaseProducer
CONFIG = utils.get_config()
class GCPImageProducer(BaseProducer):
"""GCP Pub/Sub Producer class which can send and decode images"""
def __init__(self, project: str = CONFIG["Goog... | null |
v0 | [
"Any",
"float",
"pygame.Rect",
"Any"
] | pygame.Surface | def v0(self, v1, v2: float, v3: pygame.Rect, v4=None) -> pygame.Surface:
v5 = v3.w / v3.h
v6 = ((math.floor(v1[0] - v2 * v5), math.floor(v1[1] - v2)), (math.ceil(v1[0] + v2 * v5), math.ceil(v1[1] + v2)))
raise NotImplementedError | [] | [
"math"
] | [
"import math, random"
] | 4 | "https://lua-api.factorio.com/latest/"
# Imports
# Base
import math, random
# Installed
import pygame
# Classes
## Coordinates
class CoordinatePairKey:
def __init__(self, x:int, y:int):
"When hashed, results in a 32-bit integer. X and Y values must be in range(-(2**16), 2**16)"
... | null |
v5 | [
"v0",
"Any"
] | Any | def v5(self, v6: v0, v7):
v8 = self.getChunkKey(v7)
v9 = v7[0] % 32
v10 = v7[1] % 32
if v8 not in self.chunks.keys():
self.generateChunk(v8, True)
self.getChunk(v8, True)[v9][v10] = v6 | [] | [] | [] | 7 | "https://lua-api.factorio.com/latest/"
# Imports
# Base
import math, random
# Installed
import pygame
# Classes
## Coordinates
class CoordinatePairKey:
def __init__(self, x:int, y:int):
"When hashed, results in a 32-bit integer. X and Y values must be in range(-(2**16), 2**16)"
... | [
"class v0:\n\n def __init__(self, v1: TilePrototype, v2, v3, v4=0):\n self.PROTOTYPE = v1\n self.POSITION = v2\n self.SURFACE = v3\n if v4:\n assert self.PROTOTYPE.mineableProperties\n else:\n assert not self.PROTOTYPE.mineableProperties\n self.mine... |
v5 | [
"Any"
] | v0 | def v5(self, v6) -> v0:
(v7, v8) = divmod(v6[0], 32)
(v9, v10) = divmod(v6[1], 32)
return self.getChunk((v7, v9))[v8][v10] | [] | [] | [] | 4 | "https://lua-api.factorio.com/latest/"
# Imports
# Base
import math, random
# Installed
import pygame
# Classes
## Coordinates
class CoordinatePairKey:
def __init__(self, x:int, y:int):
"When hashed, results in a 32-bit integer. X and Y values must be in range(-(2**16), 2**16)"
... | [
"class v0:\n\n def __init__(self, v1: TilePrototype, v2, v3, v4=0):\n self.PROTOTYPE = v1\n self.POSITION = v2\n self.SURFACE = v3\n if v4:\n assert self.PROTOTYPE.mineableProperties\n else:\n assert not self.PROTOTYPE.mineableProperties\n self.mine... |
v7 | [
"str",
"str"
] | None | def v7(v8: str, v9: str) -> None:
v10 = os.path.abspath(v9)
v11 = os.path.basename(v10)
v12 = os.path.dirname(v10)
def v13(v14: str, v15: List[str]) -> List[str]:
v16: List[str] = []
if v14 == v8:
v16 += ['.tox', '.nox']
if os.path.abspath(v14) == v12:
v1... | [
{
"name": "v0",
"input_types": [
"str",
"str"
],
"output_type": "None",
"code": "def v0(v1: str, v2: str) -> None:\n try:\n copy2_fixed(v1, v2)\n except shutil.SpecialFileError as e:\n logger.warning(\"Ignoring special file error '%s' encountered copying %s to %s.... | [
"os",
"shutil"
] | [
"import os",
"import shutil"
] | 13 | """Prepares a distribution for installation
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging
import mimetypes
import os
import shutil
from typing import Dict, Iterable, List, Optional
from pip._vendor.packaging.utils import canonicalize_name
fro... | null |
v3 | [
"str"
] | str | def v3(v4: str) -> str:
v5 = v0(v4).find('h1').text
return v5 | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "bs4",
"code": "def v0(v1: str) -> bs4:\n v2 = BeautifulSoup(v1, 'html.parser')\n return v2",
"dependencies": []
}
] | [] | [] | 3 | """Retrieving data for a recipe."""
from typing import Dict, List, Union
import bs4
import httpx
from bs4 import BeautifulSoup
def get_html(url: str) -> Union[str, bool]:
"""We get raw materials for the soup."""
with httpx.Client(timeout=10.0) as client:
try:
result = client.get(url)
... | null |
v3 | [
"str"
] | List[Dict[str, float]] | def v3(v4: str) -> List[Dict[str, float]]:
v5 = v0(v4).find('ul', class_='ingredients-lst').findAll('li')
v6 = []
for v7 in v5:
v8 = v7.find(class_='name').text
v9 = v7.find(class_='value').text
v10 = v7.find(class_='type').text
v6.append({'item': v8, 'qty': v9, 'units': v10}... | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "bs4",
"code": "def v0(v1: str) -> bs4:\n v2 = BeautifulSoup(v1, 'html.parser')\n return v2",
"dependencies": []
}
] | [] | [] | 9 | """Retrieving data for a recipe."""
from typing import Dict, List, Union
import bs4
import httpx
from bs4 import BeautifulSoup
def get_html(url: str) -> Union[str, bool]:
"""We get raw materials for the soup."""
with httpx.Client(timeout=10.0) as client:
try:
result = client.get(url)
... | null |
v0 | [
"str",
"Dict"
] | Dict[str, List] | def v0(v1: str, v2: Dict) -> Dict[str, List]:
with open(v1, 'r', encoding='utf8') as v3:
v4 = load(v3, encoding='utf-8')
v5 = False
for v6 in v2:
if v6 not in v4:
v5 = True
v4[v6] = v2[v6]
else:
for v7 in v2[v6]:
if v7 not in v4[v6]... | [] | [
"json"
] | [
"from json import load, dump"
] | 17 | from json import load, dump
from typing import Dict, List
from bs4 import BeautifulSoup
from requests import get
def scrape() -> Dict[str, List]:
page = get('http://kaomoji.ru/en', headers = {
"accept": "text/html",
"accept-language": "en-GB,en-US;q=1",
"cache-control": "max-age... | null |
v0 | [
"List[int]"
] | List[int] | def v0(self, v1: List[int]) -> List[int]:
if not v1:
return []
v2 = [0] * len(v1)
for v3 in range(len(v1)):
v4 = v1[v3]
for v5 in range(len(v1)):
if v3 != v5 and v1[v5] < v4:
v2[v3] += 1
return v2 | [] | [] | [] | 10 | """
Leetcode #1365
"""
from typing import List
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
if not nums:
return []
res = [0] * len(nums)
for i in range(len(nums)):
tmp = nums[i]
for j in range(len(nums)):
... | null |
v0 | [
"List[int]"
] | List[int] | def v0(self, v1: List[int]) -> List[int]:
if not v1:
return []
v2 = sorted(v1)
v3 = len(v1)
v4 = {}
for v5 in range(v3):
if v4.get(v2[v5]) is None:
v4[v2[v5]] = v5
v6 = [0] * v3
for v5 in range(v3):
v6[v5] = v4.get(v1[v5])
return v6 | [] | [] | [] | 13 | """
Leetcode #1365
"""
from typing import List
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
if not nums:
return []
res = [0] * len(nums)
for i in range(len(nums)):
tmp = nums[i]
for j in range(len(nums)):
... | null |
v12 | [
"dict"
] | Any | def v12(v13: dict):
v14 = []
for v15 in v13:
v16 = v8(v15)
v17 = v0(v15)
v18 = v4(v15)
v14.append({'Event ID': v15.get('ID'), 'Event Tags': v16, 'Event Galaxies': v17, 'Event Objects': v18, 'Publish Timestamp': v15.get('PublishTimestamp'), 'Event Info': v15.get('Info'), 'Event Or... | [
{
"name": "v0",
"input_types": [
"Any"
],
"output_type": "Any",
"code": "def v0(v1):\n v2 = v1.get('Galaxy', [])\n if v2:\n return [galaxy.get('Name') for v3 in v1.get('Galaxy')]",
"dependencies": []
},
{
"name": "v4",
"input_types": [
"Any"
],
"o... | [] | [] | 8 | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | null |
v26 | [
"dict"
] | Any | def v26(v27: dict):
v28 = ['text', 'last_seen', 'first_seen']
v29 = v27.get('event_id')
v30 = v27.get('url')
v31 = urlparse(v30)
v32 = [{'url': v30}]
v32.extend({'scheme': v31.scheme}) if v31.scheme else None
v32.append({'resource_path': v31.path}) if v31.path else None
v32.append({'quer... | [
{
"name": "v0",
"input_types": [
"str",
"MISPObject"
],
"output_type": "Any",
"code": "def v0(v1: str, v2: MISPObject):\n v3 = PYMISP.add_object(v1, misp_object=v2)\n if 'errors' in v3:\n raise DemistoException(f'Error in `{demisto.command()}` command: {v3}')\n for v4... | [
"urllib"
] | [
"from urllib.parse import urlparse"
] | 16 | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | null |
v0 | [
"str"
] | Any | def v0(v1: str):
v2 = Path(v1.replace('.', '/').replace('homeassistant', 'tests'))
if not v2.exists():
return False
if not v2.is_dir():
return True
v3 = [f.name for v4 in v2.glob('*')]
return v3 != ['__pycache__'] | [] | [
"pathlib"
] | [
"from pathlib import Path"
] | 8 | #!/usr/bin/env python3
"""Generate an updated requirements_all.txt."""
import difflib
import importlib
import os
from pathlib import Path
import pkgutil
import re
import sys
from script.hassfest.model import Integration
from homeassistant.util.yaml.loader import load_yaml
COMMENT_REQUIREMENTS = (
"Adafruit_BBIO"... | null |
v46 | [
"xr.DataArray",
"str",
"int",
"float",
"int",
"Union[str, Callable]",
"Optional[bool]"
] | Any | def v46(v47: xr.DataArray, v48: str='time', v49: int=1, v50: float=0.5, v51: int=2, v52: Union[str, Callable]='tricube', v53: Optional[bool]=None):
v54 = v47[v48]
v54 = ((v54 - v54[0]) / (v54[-1] - v54[0])).astype(float)
v55 = {'tricube': v43, 'gaussian': v5}.get(v52, v52)
v56 = {0: v0, 1: v8}[v49]
... | [
{
"name": "v0",
"input_types": [
"Any",
"Any",
"Any",
"Any"
],
"output_type": "Any",
"code": "@numba.njit\ndef v0(v1, v2, v3, v4):\n return (v4 * v3).sum() / v4.sum()",
"dependencies": []
},
{
"name": "v5",
"input_types": [
"Any"
],
"outpu... | [
"numpy",
"warnings",
"xarray"
] | [
"from warnings import warn",
"import numpy as np",
"import xarray as xr"
] | 16 | """LOESS smoothing module."""
from typing import Callable, Optional, Union
from warnings import warn
import numba
import numpy as np
import xarray as xr
@numba.njit
def _gaussian_weighting(x): # pragma: no cover
"""
Kernel function for loess with a gaussian shape.
The span f covers 95% of the gaussian.... | null |
v10 | [
"Callable",
"str",
"str"
] | Union[v0, bool] | def v10(v11: Callable, v12: str, v13: str) -> Union[v0, bool]:
v14 = v11(v12)
if not v14:
return False
if not v7(v13, v14.password):
return False
return v14 | [
{
"name": "v7",
"input_types": [
"Any",
"Any"
],
"output_type": "bool",
"code": "def v7(v8, v9) -> bool:\n return pwd_context.verify(v8, v9)",
"dependencies": []
}
] | [] | [] | 7 | from datetime import datetime, timedelta
from typing import Callable, List, Optional, Union
from fastapi import Depends, HTTPException, Request, status
from fastapi.security import OAuth2PasswordBearer
from jose import JWTError, jwt
from passlib.context import CryptContext
from pydantic import BaseModel
from sqlmodel ... | [
"class v0(SQLModel, table=True):\n v1: Optional[int] = Field(default=None, primary_key=True)\n v2: str = Field(sa_column_kwargs={'unique': True})\n v3: HashedPassword\n v4: bool = False\n v5: bool = False\n v6: List['Content'] = Relationship(back_populates='user')"
] |
v0 | [
"str",
"str",
"list"
] | Any | def v0(self: any, v1: str, v2: str, v3: list):
v4 = []
for v5 in range(0, len(v3)):
if v5 < len(v3) / 2:
v4.append(v1 + v3[v5])
else:
v4.append(v2 + v3[v5])
return v4 | [] | [] | [] | 8 | import urllib3
import bs4
import re
class TibcoDaemonServiceInfo:
def __init__(self:any, hostname: str, listeningInterfaces: str, services_info):
self._hostname = hostname
self._ipinterfaces = listeningInterfaces
self._services_info = services_info
pass
@property
def h... | null |
v0 | [
"bs4.BeautifulSoup",
"int"
] | Any | def v0(self: any, v1: bs4.BeautifulSoup, v2: int):
v3 = v1.find_all('table')
v4 = [item.text for v5 in v3[4].find_all('td')][0].split(':')
v6 = [h.nextSibling for v7 in v3[4].find_all('td')[1].find_all('br')]
v6.insert(0, str(v2))
v8 = zip(v4, v6)
return dict(v8) | [] | [] | [] | 7 | import urllib3
import bs4
import re
class TibcoDaemonServiceInfo:
def __init__(self:any, hostname: str, listeningInterfaces: str, services_info):
self._hostname = hostname
self._ipinterfaces = listeningInterfaces
self._services_info = services_info
pass
@property
def h... | null |
v0 | [
"bs4.BeautifulSoup"
] | Any | def v0(self: any, v1: bs4.BeautifulSoup):
v2 = v1.find(text='Inbound Rates (per second)').parent
v3 = v2.findParent('table').find_all('tr')
v4 = [item.text for v5 in v3[1].find_all('b')]
v4 = self._prefix_halfitem_with('in_', 'out_', v4)
v6 = [v5.text for v5 in v3[2].find_all('font')]
v7 = zip(v... | [] | [] | [] | 8 | import urllib3
import bs4
import re
class TibcoDaemonServiceInfo:
def __init__(self:any, hostname: str, listeningInterfaces: str, services_info):
self._hostname = hostname
self._ipinterfaces = listeningInterfaces
self._services_info = services_info
pass
@property
def h... | null |
v0 | [
"str",
"bs4.BeautifulSoup"
] | Any | def v0(self: any, v1: str, v2: bs4.BeautifulSoup):
v3 = v2.find(text=v1).parent
v4 = v3.findParent('table').find_all('tr')
v5 = [item.text for v6 in v4[1].find_all('b')]
v7 = [v6.text for v6 in v4[2].find_all('font')]
v8 = zip(v5, v7)
return dict(v8) | [] | [] | [] | 7 | import urllib3
import bs4
import re
class TibcoDaemonServiceInfo:
def __init__(self:any, hostname: str, listeningInterfaces: str, services_info):
self._hostname = hostname
self._ipinterfaces = listeningInterfaces
self._services_info = services_info
pass
@property
def h... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.