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 | [
"str"
] | None | async def v0(self, v1: str) -> None:
if v1 not in self._hvac_mode_to_deconz:
raise ValueError(f'Unsupported HVAC mode {v1}')
v2 = {'mode': self._hvac_mode_to_deconz[v1]}
if len(self._hvac_mode_to_deconz) == 2:
v2 = {'on': self._hvac_mode_to_deconz[v1]}
await self._device.async_set_config... | [] | [] | [] | 7 | """Support for deCONZ climate devices."""
from typing import Optional
from pydeconz.sensor import Thermostat
from homeassistant.components.climate import DOMAIN, ClimateEntity
from homeassistant.components.climate.const import (
FAN_AUTO,
FAN_HIGH,
FAN_LOW,
FAN_MEDIUM,
FAN_OFF,
FAN_ON,
HVA... | null |
v0 | [
"list",
"int",
"float"
] | Any | def v0(v1: list, v2: int, v3: float=par.pad_token):
v4 = [v3 for v5 in range(v2 - len(v1))]
return v1 + v4 | [] | [] | [] | 3 | import os
import numpy as np
# from deprecated.sequence import EventSeq, ControlSeq
import tensorflow as tf
import transformers.params as par
def find_files_by_extensions(root, exts=[]):
def _has_ext(name):
if not exts:
return True
name = name.lower()
for ext in exts:
... | null |
v0 | [
"int",
"list",
"float"
] | Any | def v0(v1: int, v2: list, v3: float=par.pad_token):
v4 = max(v1 - len(v2), 0)
v5 = [v3] * v4
return v2 + v5 | [] | [] | [] | 4 | import os
import numpy as np
# from deprecated.sequence import EventSeq, ControlSeq
import tensorflow as tf
import transformers.params as par
def find_files_by_extensions(root, exts=[]):
def _has_ext(name):
if not exts:
return True
name = name.lower()
for ext in exts:
... | null |
v0 | [
"torch.Tensor",
"Any"
] | Any | def v0(v1: torch.Tensor, v2):
v3 = torch.ones((v1.size(0), 1), dtype=v1.dtype) * v2
v4 = torch.ones((v1.size(0), 1), dtype=v1.dtype) * v2
return torch.cat([v3, v1, v4], -1) | [] | [
"torch"
] | [
"import torch",
"import torch.nn.functional as F"
] | 4 | import os
import numpy as np
from sequence import EventSeq, ControlSeq
import torch
import torch.nn.functional as F
import torchvision
# from custom.config import config
def find_files_by_extensions(root, exts=[]):
def _has_ext(name):
if not exts:
return True
name = name.lower()
... | null |
v0 | [
"str",
"str"
] | float | def v0(v1: str, v2: str='DEFLATE') -> float:
v3 = bytes(v1, encoding='utf-8')
if v2 == 'DEFLATE':
v4 = zlib.compress(v3)
else:
raise NotImplementedError('Other methods not supported yet')
v5 = len(v4) / len(v3)
return 1 - v5 | [] | [
"zlib"
] | [
"import zlib"
] | 8 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v0 | [
"str"
] | Iterator[str] | def v0(v1: str) -> Iterator[str]:
v2 = iter(v1)
v3 = []
for v4 in v2:
if v4 in ' -,\n()"':
yield ''.join(v3)
v3 = []
else:
v3.append(v4) | [] | [] | [] | 9 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v0 | [
"Iterable[str]"
] | Dict[str, str] | def v0(v1: Iterable[str]) -> Dict[str, str]:
v2 = {}
for v3 in v1:
v3 = v3.lower()
v2[v3] = v2.get(v3, 0) + 1
v4 = dict(sorted(v2.items(), key=itemgetter(1), reverse=True))
return v4 | [] | [
"operator"
] | [
"from operator import itemgetter"
] | 7 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v0 | [
"Iterable[str]"
] | pd.DataFrame | def v0(v1: Iterable[str]) -> pd.DataFrame:
v2 = {}
for v3 in v1:
v3 = v3.lower()
v2[v3] = v2.get(v3, 0) + 1
v4 = sorted(v2.items(), key=itemgetter(1), reverse=True)
v5 = []
for (v6, (v7, v8)) in zip(range(1, len(v2) + 1), v4):
v5.append({'freq': v8, 'rank': v6, 'word': v7})
... | [] | [
"operator",
"pandas"
] | [
"from operator import itemgetter",
"import pandas as pd"
] | 11 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v4 | [
"int"
] | Any | def v4(v5: int):
def v6(v7, v8):
return 1 / v7 ** v8 / sum((1 / n ** v8 for v9 in range(1, v5 + 1))) * v5
return v6 | [
{
"name": "v0",
"input_types": [
"Any",
"Any"
],
"output_type": "Any",
"code": "def v0(v1, v2):\n return 1 / v1 ** v2 / sum((1 / n ** v2 for v3 in range(1, N + 1))) * N",
"dependencies": []
}
] | [] | [] | 5 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v10 | [
"pd.DataFrame"
] | (float, float) | def v10(v11: pd.DataFrame) -> (float, float):
v12 = sum(v11.get('freq'))
v13 = v4(v12)
(v14, v15) = curve_fit(v13, v11.get('rank'), v11.get('freq'))
return (v14[0], v15) | [
{
"name": "v0",
"input_types": [
"Any",
"Any"
],
"output_type": "Any",
"code": "def v0(v1, v2):\n return 1 / v1 ** v2 / sum((1 / n ** v2 for v3 in range(1, N + 1))) * N",
"dependencies": []
},
{
"name": "v4",
"input_types": [
"int"
],
"output_type": "... | [
"scipy"
] | [
"from scipy.optimize import curve_fit"
] | 5 | import zlib
from typing import List, Iterator, Dict, Iterable
from operator import itemgetter
import pandas as pd
from scipy.optimize import curve_fit
from utils.misc import depreciated
def calculate_repetition(text: str, method: str = 'DEFLATE') -> float:
b_str = bytes(text, encoding='utf-8')
if method == ... | null |
v1 | [
"str",
"v0",
"v0"
] | Any | def v1(v2: str, v3: v0, v4: v0):
v5 = {line: changes for (v6, v7) in v3}
v8 = {v6: v7 for (v6, v7) in v4}
v9: Set[int] = set([v6 for (v6, v10) in v3] + [v6 for (v6, v10) in v4])
for v11 in sorted(v9):
v12 = v5.get(v11, set())
v13 = v8.get(v11, set())
if v12 == v13:
co... | [] | [] | [] | 15 | #!/usr/bin/env python3
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import re
import sys
from typing import List, Tuple, Set, DefaultDict, Dict, Callable, Optional
from collecti... | [
"v0 = List[LineChanges]"
] |
v16 | [
"v1",
"v1"
] | Any | def v16(v17: v1, v18: v1):
v19 = set(list(v17.keys()) + list(v18.keys()))
for v20 in sorted(v19):
v2(v20, v17.get(v20, []), v18.get(v20, [])) | [
{
"name": "v2",
"input_types": [
"str",
"v0",
"v0"
],
"output_type": "Any",
"code": "def v2(v3: str, v4: v0, v5: v0):\n v6 = {line: changes for (v7, v8) in v4}\n v9 = {v7: v8 for (v7, v8) in v5}\n v10: Set[int] = set([v7 for (v7, v11) in v4] + [v7 for (v7, v11) in v5])... | [] | [] | 4 | #!/usr/bin/env python3
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import re
import sys
from typing import List, Tuple, Set, DefaultDict, Dict, Callable, Optional
from collecti... | [
"v0 = List[LineChanges]",
"v1 = Dict[str, v0]"
] |
v0 | [
"str",
"str"
] | requests.Response | def v0(self, v1: str, v2: str, **v3: Any) -> requests.Response:
v2 = urljoin(self.url_base, v2)
return super().request(v1, v2, **v3) | [] | [
"urllib"
] | [
"from urllib.parse import urljoin"
] | 3 | import datetime
from typing import Any, Dict, Optional, Union
from urllib.parse import urljoin
import requests
from .settings import TIIMA_API_KEY, TIIMA_COMPANY_ID, TIIMA_PASSWORD, TIIMA_USERNAME
class TiimaSession(requests.Session):
def __init__(self, company_id: str, api_key: str,) -> None:
super()._... | null |
v0 | [] | int | def v0(self) -> int:
if self.greynoise_id is not None:
return self.greynoise_id
v1 = self.helper.api.stix_domain_object.get_by_stix_id_or_name(name=self.greynoise_ent_name)
if not v1:
self.helper.log_info(f'Create {self.greynoise_ent_name}')
self.greynoise_id = self.helper.api.identi... | [] | [] | [] | 12 | import os
from time import sleep
import pycountry
import requests
import yaml
from dateutil.parser import parse
from pycti import OpenCTIConnectorHelper, get_config_variable
from stix2 import TLP_WHITE
class GreyNoiseConnector:
def __init__(self):
config_file_path = os.path.dirname(os.path.abspath(__file... | null |
v0 | [
"int",
"Any",
"Any"
] | Any | def v0(self, v1: int, v2, v3):
v2 = v2.to(v3)
v4 = self.model.forward(**v2)
v5 = v4.loss
return v5 | [] | [] | [] | 5 | import sys
from dataclasses import dataclass
import matplotlib.pyplot as plt
import torch
from torch.optim import Adam
from torch.optim.lr_scheduler import OneCycleLR
from torch.utils.data import DataLoader
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification,
)
import pymarlin as ml
f... | null |
v0 | [
"int",
"Any",
"Any"
] | Any | def v0(self, v1: int, v2, v3):
v2 = v2.to(v3)
v4 = self.model.forward(**v2)
v5 = v4.loss
v6 = v4.logits
return (v5, v6, v2.labels) | [] | [] | [] | 6 | import sys
from dataclasses import dataclass
import matplotlib.pyplot as plt
import torch
from torch.optim import Adam
from torch.optim.lr_scheduler import OneCycleLR
from torch.utils.data import DataLoader
from transformers import (
AutoTokenizer,
AutoModelForSequenceClassification,
)
import pymarlin as ml
f... | null |
v0 | [
"int",
"int"
] | Any | def v0(self, v1: int, v2: int):
v3 = torch.optim.Adam(self.model.parameters(), self.args.max_lr)
v4 = OneCycleLR(v3, max_lr=self.args.max_lr, steps_per_epoch=v1, epochs=v2, anneal_strategy='linear')
self.schedulers = v4
return ([v3], [v4]) | [] | [
"torch"
] | [
"import torch",
"from torch.utils.data import DataLoader",
"from torch.optim.lr_scheduler import OneCycleLR"
] | 5 | from typing import List, Dict
import torch
from pymarlin.core import trainer_backend, module_interface, trainer
from torch.utils.data import DataLoader
# too long import
from pymarlin.utils.stats import global_stats
from pymarlin.utils.config_parser.custom_arg_parser import CustomArgParser
from pymarlin.utils.distribu... | null |
v0 | [
"Any"
] | object | def v0(v1) -> object:
logging.info('submit_registration')
v2 = 'http://10.0.2.2:5001/register'
v3 = {'Content-Type': 'application/json'}
v4 = requests.post(v2, data=v1, headers=v3)
if v4.status_code != 202:
return 'Error ' + str(v4.status_code) + ' :- ' + v4.text
else:
return 'su... | [] | [
"logging",
"requests"
] | [
"import logging",
"import requests"
] | 9 | from flask import request, Response, render_template
import logging
from application import app
import jsonpickle
import json
import requests
@app.route('/', methods=["GET"])
def index():
return render_template('index.html')
@app.route('/start_registration', methods=['GET'])
def start_registration():
loggin... | null |
v0 | [
"Path"
] | Any | def v0(v1: Path):
with Image.open(v1) as v2:
(v3, v4) = v2.size
v5 = v3 // 10
v6 = v4 // 10
v7 = v1.parent
for v8 in range(0, 10):
for v9 in range(0, 10):
v10 = v8 * v5
v11 = v9 * v6
v12 = (v10, v11, v10 + v5, v11 + ... | [] | [
"PIL"
] | [
"from PIL import Image"
] | 13 | from PIL import Image
from pathlib import Path
def crop(file: Path):
with Image.open(file) as im:
w, h = im.size
tw = w // 10
th = h // 10
p = file.parent
for x in range(0, 10):
for y in range(0, 10):
tx = x * tw
ty = y * th
... | null |
v0 | [
"Path"
] | Any | def v0(v1: Path):
with Image.new('RGBA', (1600, 1440)) as v2:
for v3 in range(0, 10):
for v4 in range(0, 10):
with Image.open(v1 / f'tile_{v3}_{v4}.png') as v5:
v6 = v3 * 160
v7 = v4 * 144
v2.paste(v5, (v6, v7))
... | [] | [
"PIL"
] | [
"from PIL import Image"
] | 9 | from PIL import Image
from pathlib import Path
def crop(file: Path):
with Image.open(file) as im:
w, h = im.size
tw = w // 10
th = h // 10
p = file.parent
for x in range(0, 10):
for y in range(0, 10):
tx = x * tw
ty = y * th
... | null |
v0 | [
"Tensor"
] | Tensor | def v0(self, v1: Tensor) -> Tensor:
v2 = v1[..., -1]
v3 = super()._untransform(v1)
v3[..., -1] = v2
return v3 | [] | [] | [] | 5 | from __future__ import annotations
from typing import Optional
import torch
from torch import Tensor
from botorch.models.transforms.input import Normalize
class CostAwareNormalize(Normalize):
"""
Wrapper for botorch normalize that ignores the last input value (which should be
cost)
"""
def __in... | null |
v0 | [
"float",
"str"
] | str | def v0(v1: float, v2: str) -> str:
if v1 > 1:
return str(v1) + ' ' + v2 + 's'
if v1 > 0:
return str(v1) + ' ' + v2
if v1 == 0:
return ''
else:
return 'ERROR' | [] | [] | [] | 9 | """
Convert a second-time to a year-day-hour-minute-second time
Python 3.7.4
Hu Xiangyou Oct 3, 2019
"""
def f(num:float,unit:str)->str:
if num>1:
return str(num)+" "+unit+"s"
if num>0:
return str(num)+" "+unit
if num==0:
return ""
else:
return "ERROR"
def main(seconds:float=0.00)->str:
m,s=divmod(second... | null |
v3 | [
"float"
] | str | def v3(v4: float=0.0) -> str:
(v5, v6) = divmod(v4, 60)
(v7, v5) = divmod(v5, 60)
(v8, v7) = divmod(v7, 24)
(v9, v8) = divmod(v8, 365)
v9 = int(v9)
v8 = int(v8)
v7 = int(v7)
v5 = int(v5)
v6 = round(v6, 2)
return ' '.join((i for v10 in (v0(v9, 'year'), v0(v8, 'day'), v0(v7, 'hour'... | [
{
"name": "v0",
"input_types": [
"float",
"str"
],
"output_type": "str",
"code": "def v0(v1: float, v2: str) -> str:\n if v1 > 1:\n return str(v1) + ' ' + v2 + 's'\n if v1 > 0:\n return str(v1) + ' ' + v2\n if v1 == 0:\n return ''\n else:\n ret... | [] | [] | 11 | """
Convert a second-time to a year-day-hour-minute-second time
Python 3.7.4
Hu Xiangyou Oct 3, 2019
"""
def f(num:float,unit:str)->str:
if num>1:
return str(num)+" "+unit+"s"
if num>0:
return str(num)+" "+unit
if num==0:
return ""
else:
return "ERROR"
def main(seconds:float=0.00)->str:
m,s=divmod(second... | null |
v0 | [
"List[Tuple]"
] | plotly.graph_objects.Figure | def v0(v1: List[Tuple]) -> plotly.graph_objects.Figure:
if len(v1) == 0:
v2 = ('Analysis of Text', 'Analysis of Labels', 'Document Lengths', '', '', '', '', 'Word Frequency', '', '', '', '', 'Common Nouns', '', '', '', 'Common Adjectives', '', '', '', 'Common Verbs')
elif len(v1) == 1:
v2 = ('An... | [] | [
"plotly"
] | [
"import plotly",
"import plotly.figure_factory as ff",
"import plotly.graph_objs as go",
"from plotly.subplots import make_subplots"
] | 13 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v29 | [
"plotly.graph_objs.Figure",
"List",
"List",
"dict",
"dict",
"dict"
] | None | def v29(v30: plotly.graph_objs.Figure, v31: List, v32: List, v33: dict, v34: dict, v35: dict) -> None:
def v36(v37: List, v38: str) -> dict:
"""Create a trace from data.
Args:
data (list): List of numbers
color (list[str])
Returns:
data_dist (dict): Repr... | [
{
"name": "v0",
"input_types": [
"List",
"str"
],
"output_type": "dict",
"code": "def v0(v1: List, v2: str) -> dict:\n v3 = ff.create_distplot([v1], group_labels=['distplot'], colors=[v2])['data']\n for v4 in v3:\n v4.pop('xaxis', None)\n v4.pop('yaxis', None)\n ... | [
"plotly"
] | [
"import plotly",
"import plotly.figure_factory as ff",
"import plotly.graph_objs as go",
"from plotly.subplots import make_subplots"
] | 48 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v10 | [
"plotly.graph_objs.Figure",
"pandas.DataFrame",
"str"
] | None | def v10(v11: plotly.graph_objs.Figure, v12: pandas.DataFrame, v13: str) -> None:
if len(v13) == 1:
v14 = v0(v12, label_col=v13[0][0], label_type=v13[0][1])
v11.append_trace(v14, 2, 2)
v11.update_yaxes(title_text='Count', row=2, col=2)
elif len(v13) == 2:
v14 = v0(v12, label_col=v... | [
{
"name": "v0",
"input_types": [
"pandas.DataFrame",
"str",
"str"
],
"output_type": "plotly.graph_objects.Histogram",
"code": "def v0(v1: pandas.DataFrame, v2: str, v3: str) -> plotly.graph_objects.Histogram:\n if v3 == 'categorical':\n v4 = v1[v2].unique().tolist()\n... | [
"plotly"
] | [
"import plotly",
"import plotly.figure_factory as ff",
"import plotly.graph_objs as go",
"from plotly.subplots import make_subplots"
] | 35 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v0 | [
"pandas.DataFrame",
"str",
"str"
] | plotly.graph_objects.Histogram | def v0(v1: pandas.DataFrame, v2: str, v3: str) -> plotly.graph_objects.Histogram:
if v3 == 'categorical':
v4 = v1[v2].unique().tolist()
v5 = v1[v2].value_counts()
v6 = []
v7 = []
for v8 in v4:
v6.append(v8)
v7.append(v5[v8])
v9 = go.Bar(x=v6, y... | [] | [
"plotly"
] | [
"import plotly",
"import plotly.figure_factory as ff",
"import plotly.graph_objs as go",
"from plotly.subplots import make_subplots"
] | 15 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v0 | [
"List",
"str"
] | dict | def v0(v1: List, v2: str) -> dict:
v3 = ff.create_distplot([v1], group_labels=['distplot'], colors=[v2])['data']
for v4 in v3:
v4.pop('xaxis', None)
v4.pop('yaxis', None)
return v3 | [] | [
"plotly"
] | [
"import plotly",
"import plotly.figure_factory as ff",
"import plotly.graph_objs as go",
"from plotly.subplots import make_subplots"
] | 6 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v0 | [
"dict",
"List[str]"
] | None | def v0(v1: dict, v2: List[str]) -> None:
for v3 in v2:
if v3 in v1:
v1[v3] += 1
else:
v1[v3] = 1 | [] | [] | [] | 6 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v0 | [
"List[Tuple[str, str]]",
"str"
] | List | def v0(v1: List[Tuple[str, str]], v2: str) -> List:
v3 = []
for v4 in v1:
if v4[1].startswith(v2):
v3.append(v4[0])
return v3 | [] | [] | [] | 6 | import string
from typing import List, Tuple
import nltk
import os
import plotly
import pandas
import plotly.figure_factory as ff
import plotly.graph_objs as go
from wordcloud import WordCloud, get_single_color_func
from snlp import logger
from tqdm import tqdm
from nltk.corpus import stopwords
from plotly.subplots im... | null |
v0 | [] | List[float] | def v0(self) -> List[float]:
try:
v1 = float(self.value >= self.limit)
return [1.0, v1]
except (TypeError, ValueError):
return [0.0, 0.0] | [] | [] | [] | 6 | import logging
from typing import Any, Dict, List, Text, Optional
from rasa.shared.core.slots import Slot
logger = logging.getLogger(__name__)
class LimitSlot(Slot):
"""
A slot for featurizing an amount as greater than or equal to vs. less than a given value.
Example of configuration in the domain.yml ... | null |
v0 | [] | Dict[Text, Any] | def v0(self) -> Dict[Text, Any]:
v1 = super().persistence_info()
v1['max_value'] = self.max_value
v1['min_value'] = self.min_value
return v1 | [] | [] | [] | 5 | # -*- coding: utf-8 -*-
"""
@Author : Xu
@Software: PyCharm
@File : slots.py
@Time : 2021/4/1 5:05 下午
@Desc : 槽位的处理逻辑
"""
import logging
from typing import Any, Dict, List, Optional, Text, Type
import wechatter.shared.dm.dm_config
from wechatter.shared.exceptions import WechatterExcept... | null |
v0 | [] | None | def v0(self) -> None:
self._hiddens = None
self.batch_idx = 0
self.batch_outputs = [[] for v1 in range(len(self.trainer.optimizers))] | [] | [] | [] | 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 | [
"Any"
] | List[Any] | def v0(self, v1: Any) -> List[Any]:
v2 = self.trainer.lightning_module.truncated_bptt_steps
if v2 == 0:
return [v1]
v3 = self.trainer.lightning_module
with self.trainer.profiler.profile('tbptt_split_batch'):
v4 = v3.tbptt_split_batch(v1, v2)
return v4 | [] | [] | [] | 8 | # 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 | [
"Tensor",
"Optional[torch.optim.Optimizer]",
"Optional[int]"
] | Tensor | def v0(self, v1: Tensor, v2: Optional[torch.optim.Optimizer], v3: Optional[int]=None, *v4: Any, **v5: Any) -> Tensor:
self.trainer.accelerator.backward(v1, v2, v3, *v4, **v5)
return v1 | [] | [] | [] | 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 | [
"torch.Tensor"
] | None | def v0(self, v1: torch.Tensor) -> None:
if self.trainer.lightning_module.automatic_optimization:
self.accumulated_loss.append(v1)
v2 = self.accumulated_loss.mean()
if v2 is not None:
self.running_loss.append(self.accumulated_loss.mean() * self.trainer.accumulate_grad_batches)
self.accumu... | [] | [] | [] | 7 | # 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 | [
"Optional[int]"
] | List[Tuple[int, Optimizer]] | def v0(self, v1: Optional[int]=None) -> List[Tuple[int, Optimizer]]:
if not self.trainer.optimizer_frequencies:
return list(enumerate(self.trainer.optimizers))
v1 = self.total_batch_idx if v1 is None else v1
v2 = self.optimizer_freq_cumsum[-1]
v3 = v1 % v2
v4 = int(np.argmax(self.optimizer_f... | [] | [
"numpy"
] | [
"import numpy as np"
] | 8 | # 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 | [
"str",
"Any"
] | Any | def v0(self, v1: str, v2: Any=None) -> Any:
v3 = self._execute(v1, v2)
v4 = v3.fetchone()
self.connection.commit()
self.connection.close()
return v4 | [] | [] | [] | 6 | import sqlite3
from sqlite3 import Connection, Cursor
from typing import Any, Dict, List
class SQLiteWrapper:
def __init__(self, db_file: str):
self.db_file = db_file
self.connection: Connection = sqlite3.Connection(self.db_file)
self.connection.close()
def open_connection(self) -> No... | null |
v0 | [
"str",
"Any"
] | bool | def v0(self, v1: str, v2=None) -> bool:
v3 = self.get_param(v1, default_val=v2)
if v3 is None:
return False
setattr(self, v1, v3)
return True | [] | [] | [] | 6 | ###############################################################################
# Copyright (c) 2017-2020 Koren Lev (Cisco Systems), #
# Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others #
# #
... | null |
v0 | [
"dict"
] | Any | def v0(self, v1: dict):
if not v1:
raise Exception(f'Cell template context is not provided for config dumper {self.__class__}')
v2 = self._get_config_content(cell_template_context=v1)
if not v2:
return
with self._config_file_path.open(mode='w') as v3:
v3.write(v2) | [] | [] | [] | 8 | """
OpenVINO DL Workbench
Classes for config file dumpers in generated Jupyter notebook
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.a... | null |
v52 | [
"v0[Callable[[v45], v44]]"
] | v0[v44] | def v52(self: v0[v45], v53: v0[Callable[[v45], v44]]) -> v0[v44]:
def v54(v55: Callable[[v45], v44]) -> v0[v44]:
def v56(v57: v45) -> Any:
try:
return v55(v57)
except TypeError:
return partial(v55, v57)
return self.map(v56)
return v53.bin... | [
{
"name": "v46",
"input_types": [
"Callable[[v43], v44]"
],
"output_type": "v0[v44]",
"code": "def v46(v47: Callable[[v43], v44]) -> v0[v44]:\n\n def v48(v49: v43) -> Any:\n try:\n return v47(v49)\n except TypeError:\n return partial(v47, v49)\n re... | [
"functools"
] | [
"from functools import partial"
] | 11 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeSource], abc.ABC):\n v1: TypeSource\n v2: Exception\n v3: bool\n\n def v4(self: v0[TypeSource], v5: Callable[[TypeSource], TypeResult]) -> v0[TypeResult]:\n \"\"\"Calls function to the Success value if not an Failure, otherwise leaving the Failure value untouched.\n T... |
v51 | [
"v0[v43]"
] | v0[v44] | def v51(self: v0[Callable[[v43], v44]], v52: v0[v43]) -> v0[v44]:
def v53(v54: Callable[[v43], v44]) -> v0[v44]:
def v55(v56: v43) -> Any:
try:
return v54(v56)
except TypeError:
return partial(v54, v56)
return v52.map(v55)
return self.bin... | [
{
"name": "v45",
"input_types": [
"Callable[[v43], v44]"
],
"output_type": "v0[v44]",
"code": "def v45(v46: Callable[[v43], v44]) -> v0[v44]:\n\n def v47(v48: v43) -> Any:\n try:\n return v46(v48)\n except TypeError:\n return partial(v46, v48)\n re... | [
"functools"
] | [
"from functools import partial"
] | 11 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeSource], abc.ABC):\n v1: TypeSource\n v2: Exception\n v3: bool\n\n def v4(self: v0[TypeSource], v5: Callable[[TypeSource], TypeResult]) -> v0[TypeResult]:\n \"\"\"Calls function to the Success value if not an Failure, otherwise leaving the Failure value untouched.\n T... |
v44 | [] | v43 | def v44(self: v0[v43]) -> v43:
if self._is_failure:
raise self._failure_value
return self._success_value | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeSource], abc.ABC):\n v1: TypeSource\n v2: Exception\n v3: bool\n\n def v4(self: v0[TypeSource], v5: Callable[[TypeSource], TypeResult]) -> v0[TypeResult]:\n \"\"\"Calls function to the Success value if not an Failure, otherwise leaving the Failure value untouched.\n T... |
v44 | [
"v43"
] | v43 | def v44(self: v0[v43], v45: v43) -> v43:
if self._is_failure:
return v45
return self._success_value | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeSource], abc.ABC):\n v1: TypeSource\n v2: Exception\n v3: bool\n\n def v4(self: v0[TypeSource], v5: Callable[[TypeSource], TypeResult]) -> v0[TypeResult]:\n \"\"\"Calls function to the Success value if not an Failure, otherwise leaving the Failure value untouched.\n T... |
v45 | [
"Callable[[Exception], v43]",
"Callable[[v44], v43]"
] | v43 | def v45(self: v0[v44], v46: Callable[[Exception], v43], v47: Callable[[v44], v43]) -> v43:
if self._is_failure:
return v46(self._failure_value)
return v47(self._success_value) | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeSource], abc.ABC):\n v1: TypeSource\n v2: Exception\n v3: bool\n\n def v4(self: v0[TypeSource], v5: Callable[[TypeSource], TypeResult]) -> v0[TypeResult]:\n \"\"\"Calls function to the Success value if not an Failure, otherwise leaving the Failure value untouched.\n T... |
v44 | [
"v42"
] | v42 | def v44(self: v0[v42, v43], v45: v42) -> v42:
if self._is_left:
return self._left_value
return v45 | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"class v0(Generic[TypeLeft, TypeRight], abc.ABC):\n v1: TypeLeft\n v2: TypeRight\n v3: bool\n\n def v4(self: v0[TypeLeft, TypeRight], v5: Callable[[TypeRight], TypeResult]) -> v0[TypeLeft, TypeResult]:\n \"\"\"Calls function to the a wrapped Right value if not Left, otherwise leaving the Left val... |
v1 | [
"v0"
] | v0 | def v1(self, v2: v0) -> v0:
if self._is_err:
return self._err_value
return v2 | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | [
"v0 = TypeVar('TypeErr')"
] |
v0 | [
"Exception"
] | Exception | def v0(self, v1: Exception) -> Exception:
if self._is_failure:
return self._failure_value
return v1 | [] | [] | [] | 4 | from __future__ import annotations
import abc
from functools import partial
from typing import Callable, Any, Generic, TypeVar
TypeLeft = TypeVar("TypeLeft")
TypeRight = TypeVar("TypeRight")
TypeResult = TypeVar("TypeResult")
TypePure = TypeVar("TypePure")
class Either(Generic[TypeLeft, TypeRight], abc.ABC):
""... | null |
v0 | [] | ArgumentParser | def v0() -> ArgumentParser:
v1 = ArgumentParser(description='', epilog='')
v1.add_argument('--lr', type=float, required=True, help='Learning rate')
v1.add_argument('--epochs', type=int, metavar='N', required=True, help='Number of epochs')
v1.add_argument('--batch-size', type=int, metavar='N', default=1,... | [] | [
"argparse",
"pathlib"
] | [
"import pathlib",
"from argparse import ArgumentParser"
] | 11 | import numpy as np
import os
import pathlib
import torch
import torch.nn.functional as F
from PIL import Image
from argparse import ArgumentParser
from datetime import datetime
def make_output_dir_name(args):
"""Constructs a unique name for a directory in ./output using
current time and script arguments"""
... | null |
v0 | [
"int"
] | Any | def v0(self, v1: int):
v2 = np.rot90(self.board, k=v1)
(v3, v4) = self._slide_left_and_merge(v2)
if np.array_equal(np.rot90(v4, k=4 - v1), self.board):
for v5 in range(50):
v1 = random.choice([0, 1, 2, 3])
v2 = np.rot90(self.board, k=v1)
(v3, v4) = self._slide_lef... | [] | [
"numpy",
"random"
] | [
"import numpy as np",
"import random"
] | 14 | import numpy as np
import gym
import gym.spaces as spaces
from gym.utils import seeding
import random
class Base2048Env(gym.Env):
metadata = {
'render.modes': ['human'],
}
##
# NOTE: Don't modify these numbers as
# they define the number of
# anti-clockwise rotations before
# applying the left act... | null |
v0 | [
"Exception"
] | list | def v0(self, v1: Exception) -> list:
if v1.status_code == 400:
self.reset()
return [] | [] | [] | [] | 4 | from datetime import datetime
from telstra_pn.models.tpn_model import TPNModel, TPNListModel
from telstra_pn.codes import status, renewal, latency
from telstra_pn.exceptions import TPNRefreshInconsistency
# P2PLink is a medium change rate resource
class P2PLinks(TPNListModel):
def __init__(self, session):
... | null |
v0 | [
"datetime",
"datetime"
] | Any | def v0(self, v1: datetime, v2: datetime):
v3 = v1.strftime('%Y-%m-%d-%H:%M:%S')
v4 = v2.strftime('%Y-%m-%d-%H:%M:%S')
v5 = self.session.api_session.call_api(path=f'/1.0.0/inventory/links-stats/flow/{self.id}/{v3}/{v4}')
if self.debug:
print(f'P2PLink.get_stats.response: {v5}')
return v5 | [] | [] | [] | 7 | from datetime import datetime
from telstra_pn.models.tpn_model import TPNModel, TPNListModel
from telstra_pn.codes import status, renewal, latency
from telstra_pn.exceptions import TPNRefreshInconsistency
# P2PLink is a medium change rate resource
class P2PLinks(TPNListModel):
def __init__(self, session):
... | null |
v0 | [
"str"
] | bool | def v0(v1: str) -> bool:
v2 = re.compile('[a-zA-Z]')
for v3 in v1:
if v2.match(v3):
return True
return False | [] | [
"re"
] | [
"import re"
] | 6 | import json
from typing import List
from tqdm import tqdm
import re
from config import Config
# Indic library
import sys
from indicnlp import common
INDIC_NLP_LIB_HOME=r"indic_nlp_library"
INDIC_NLP_RESOURCES=r"indic_nlp_resources"
sys.path.append(r'{}\src'.format(INDIC_NLP_LIB_HOME))
common.set_resources_path(INDIC_... | null |
v0 | [
"Any",
"Path"
] | Any | def v0(v1, v2: Path):
if not torch.cuda.is_available():
v3 = torch.load(v2, map_location='cpu')
else:
v3 = torch.load(v2)
v1.load_state_dict(v3['model_state_dict'])
v1.eval()
return v1 | [] | [
"torch"
] | [
"import torch",
"import torch.optim as optim",
"import torch.nn as nn",
"import torch.nn.functional as F",
"import torch.utils.data as torchdata",
"from torch.optim.optimizer import Optimizer"
] | 8 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"float",
"Any"
] | Any | def v0(v1: float, v2=True):
if v2:
return 10 ** (v1 / 20)
else:
return 10 ** (v1 / 10) | [] | [] | [] | 5 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v3 | [
"np.ndarray",
"float"
] | Any | def v3(v4: np.ndarray, v5: float):
v6 = v4 * v0(-v5)
return v6 | [
{
"name": "v0",
"input_types": [
"float",
"Any"
],
"output_type": "Any",
"code": "def v0(v1: float, v2=True):\n if v2:\n return 10 ** (v1 / 20)\n else:\n return 10 ** (v1 / 10)",
"dependencies": []
}
] | [] | [] | 3 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"np.ndarray",
"int",
"int",
"int"
] | Any | def v0(v1: np.ndarray, v2: int, v3: int, v4: int):
v5 = v1.shape[v2]
v6 = v1.min()
for v7 in range(v4):
v8 = np.random.randint(low=0, high=v3, size=(1,))[0]
v9 = np.random.randint(low=0, high=v5 - v8, size=(1,))[0]
if v2 == 0:
v1[v9:v9 + v8] = v6
elif v2 == 1:
... | [] | [
"numpy"
] | [
"import numpy as np"
] | 13 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"torch.Tensor",
"torch.Tensor"
] | Any | def v0(v1: torch.Tensor, v2: torch.Tensor):
v3 = (v1[0::2].transpose(0, -1) * v2[0::2] + v1[1::2].transpose(0, -1) * v2[1::2]).transpose(0, -1)
return v3 | [] | [] | [] | 3 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"torch.Tensor",
"int"
] | Any | def v0(v1: torch.Tensor, v2: int):
(v3, v4, v5) = v1.shape
v6 = v1[:, :, None, :].repeat(1, 1, v2, 1)
v6 = v6.reshape(v3, v4 * v2, v5)
return v6 | [] | [] | [] | 5 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"torch.Tensor",
"int"
] | Any | def v0(v1: torch.Tensor, v2: int):
v3 = F.interpolate(v1.unsqueeze(1), size=(v2, v1.size(2)), align_corners=True, mode='bilinear').squeeze(1)
return v3 | [] | [
"torch"
] | [
"import torch",
"import torch.optim as optim",
"import torch.nn as nn",
"import torch.nn.functional as F",
"import torch.utils.data as torchdata",
"from torch.optim.optimizer import Optimizer"
] | 3 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"torch.FloatTensor"
] | Any | def v0(self, v1: torch.FloatTensor):
if torch.isnan(v1).any():
v1 = torch.zeros(len(v1), dtype=torch.float)
return v1 | [] | [
"torch"
] | [
"import torch",
"import torch.optim as optim",
"import torch.nn as nn",
"import torch.nn.functional as F",
"import torch.utils.data as torchdata",
"from torch.optim.optimizer import Optimizer"
] | 4 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... | null |
v0 | [
"tweepy.Status"
] | Set[str] | def v0(v1: tweepy.Status) -> Set[str]:
v2 = set()
for v3 in v1.entities['urls']:
v4 = v3['expanded_url']
if 'arxiv.org/' in v4:
if 'pdf' in v4:
v4 = v4.replace('.pdf', '').replace('pdf', 'abs')
v2.add(v4)
return v2 | [] | [] | [] | 9 | import configparser
import os
import pickle
from typing import Set
from bs4 import BeautifulSoup
import requests
import tweepy
config = configparser.ConfigParser()
config.read("settings.ini")
# cache settings
CACHE_FOLDER = config["cache"]["cache_folder"]
CACHE_FILE = config["cache"]["cache_file"]
CACHE_PATH = f"{CA... | null |
v25 | [] | None | def v25() -> None:
v26 = v13()
v27 = v21()
v28 = v26 - v27
print(f'Found {len(v28)} new tweets.')
for v29 in v28:
v30 = v0(v29)
if v30:
v27.add(v29)
else:
print(f'Error downloading {v29}')
v23(v27) | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "bool",
"code": "def v0(v1: str) -> bool:\n if 'abs' not in v1:\n return True\n print(f'Downloading link at: {v1}')\n v2 = get_arvix_title(v1)\n v3 = f\"{config['pdf']['pdf_folder_path']}/{v2}.pdf\"\n v4 = v1.re... | [
"os",
"pickle",
"requests"
] | [
"import os",
"import pickle",
"import requests"
] | 12 | import configparser
import os
import pickle
from typing import Set
from bs4 import BeautifulSoup
import requests
import tweepy
config = configparser.ConfigParser()
config.read("settings.ini")
# cache settings
CACHE_FOLDER = config["cache"]["cache_folder"]
CACHE_FILE = config["cache"]["cache_file"]
CACHE_PATH = f"{CA... | null |
v0 | [
"sqlite3.Connection"
] | List[str] | def v0(v1: sqlite3.Connection) -> List[str]:
v2 = v1.cursor()
v2.execute('SELECT ZTITLE FROM ZSFNOTE')
v3 = v2.fetchall()
return [row[0] for v4 in v3] | [] | [] | [] | 5 | """Bear database handling methods"""
# pylint: disable=E1101
import sqlite3
from pathlib import Path
from dataclasses import dataclass
from typing import Dict, List
import re
from collections import Counter
HOME: str = str(Path.home())
@dataclass
class Task:
"""Class to hold information about a single task"""
... | null |
v0 | [
"sqlite3.Connection"
] | None | def v0(v1: sqlite3.Connection) -> None:
v2 = v1.cursor()
v2.execute('SELECT ZTITLE FROM ZSFNOTE')
v3 = v2.fetchall()
v4 = Counter([row[0] for v5 in v3])
v6 = 0
for v7 in v4.items():
if v7[1] > 1:
print(f'{v7[0]}: {v7[1]}')
v6 += v7[1] - 1
print('-' * 80)
p... | [] | [
"collections"
] | [
"from collections import Counter"
] | 12 | """Bear database handling methods"""
# pylint: disable=E1101
import sqlite3
from pathlib import Path
from dataclasses import dataclass
from typing import Dict, List
import re
from collections import Counter
HOME: str = str(Path.home())
@dataclass
class Task:
"""Class to hold information about a single task"""
... | null |
v0 | [] | None | def v0(self) -> None:
for v1 in self.observers:
v1.update(self.state) | [] | [] | [] | 3 | # Observer pattern is a behavioral design pattern.
# Observer pattern is used when the change in state of one object is
# required to be accessed by other objects. One example where this
# pattern fits is GUI components like buttons (subject) and their
# onClick listeners (observer).
from __future__ import annotatio... | null |
v0 | [] | None | def v0(self) -> None:
self._state += 1
self.notify() | [] | [] | [] | 3 | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import List
class FastModel:
def __init__(self, filepath: str) -> None:
self.filepath = filepath
self.fish_counts = {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": ... | null |
v0 | [
"jnp.ndarray"
] | jnp.ndarray | def v0(v1: jnp.ndarray) -> jnp.ndarray:
v2 = v1.shape[-2:]
v3 = v1.shape[:-2]
v1 = v1.reshape((-1, *v2))
v1 = v1.transpose((0, 2, 1))
v1 = v1.reshape((*v3, v2[1], v2[0]))
v1 = v1.conj()
return v1 | [] | [] | [] | 8 | import jax.numpy as jnp
from typing import Tuple
from jax import vmap
PRNGKey = jnp.array
def adj(a: jnp.ndarray) -> jnp.ndarray:
"""Returns adjoint matrix.
Args:
a: complex valued tensor of shape (..., n1, n2)
Returns:
complex valued tensor of shape (..., n2, n1)"""
matrix_shape ... | null |
v0 | [
"jnp.ndarray"
] | jnp.ndarray | def v0(v1: jnp.ndarray) -> jnp.ndarray:
v2 = v1.shape[:-2]
v3 = v1.shape[-2:]
v1 = vmap(jnp.diag)(v1.reshape((-1, *v3)))
v1 = v1.reshape((*v2, -1))
return v1 | [] | [] | [] | 6 | import jax.numpy as jnp
from typing import Tuple
from jax import vmap
PRNGKey = jnp.array
def adj(a: jnp.ndarray) -> jnp.ndarray:
"""Returns adjoint matrix.
Args:
a: complex valued tensor of shape (..., n1, n2)
Returns:
complex valued tensor of shape (..., n2, n1)"""
matrix_shape ... | null |
v0 | [
"jnp.ndarray",
"jnp.ndarray"
] | Tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray] | def v0(v1: jnp.ndarray, v2: jnp.ndarray) -> Tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray]:
(v3, v4) = v1.shape[-2:]
v5 = v1.shape[:-2]
v1 = v1.reshape((-1, v3, v4))
v2 = v2.reshape((-1, v3, v4))
v6 = vmap(lambda x: jnp.linalg.qr(x, mode='complete')[0])(v1)[..., v4:]
v7 = v1.conj().transpose((0, 2... | [] | [] | [] | 12 | import jax.numpy as jnp
from typing import Tuple
from jax import vmap
PRNGKey = jnp.array
def adj(a: jnp.ndarray) -> jnp.ndarray:
"""Returns adjoint matrix.
Args:
a: complex valued tensor of shape (..., n1, n2)
Returns:
complex valued tensor of shape (..., n2, n1)"""
matrix_shape ... | null |
v0 | [] | int | def v0(self) -> int:
if not self.isReady():
raise ConnectionError('Not connected')
v1 = self._reqIdSeq
self._reqIdSeq += 1
return v1 | [] | [] | [] | 6 | """Socket client for communicating with Interactive Brokers."""
import asyncio
import io
import logging
import struct
import time
from collections import deque
from typing import List, Optional
from eventkit import Event
from .connection import Connection
from .contract import Contract
from .decoder import Decoder
f... | null |
v0 | [] | List[str] | def v0(self) -> List[str]:
if not self.isReady():
raise ConnectionError('Not connected')
return self._accounts | [] | [] | [] | 4 | """Socket client for communicating with Interactive Brokers."""
import asyncio
import io
import logging
import struct
import time
from collections import deque
from typing import List, Optional
from eventkit import Event
from .connection import Connection
from .contract import Contract
from .decoder import Decoder
f... | null |
v0 | [
"str"
] | int | def v0(self, v1: str) -> int:
if len(set(v1)) == 1 or len(set(v1)) == len(v1):
return 0
v2 = 0
for v3 in set(v1):
for v4 in set(v1):
if v3 == v4:
continue
v2 = max(v2, self.calculate(v3, v4, v1))
return v2 | [] | [] | [] | 10 | from cmath import inf
from string import ascii_lowercase
class Solution:
def largestVariance(self, s: str) -> int:
if len(set(s)) == 1 or len(set(s)) == len(s):
return 0
result = 0
for x in set(s):
for y in set(s):
if x == y:
con... | null |
v0 | [
"str",
"str",
"str"
] | int | def v0(self, v1: str, v2: str, v3: str) -> int:
v4 = 0
(v5, v6) = (0, -inf)
for v7 in v3:
if v7 == v1:
v5 += 1
v6 += 1
if v7 == v2:
v5 -= 1
v6 = v5
v5 = max(0, v5)
v4 = max(v4, v6)
return v4 | [] | [
"cmath"
] | [
"from cmath import inf"
] | 13 | from cmath import inf
from string import ascii_lowercase
class Solution:
def largestVariance(self, s: str) -> int:
if len(set(s)) == 1 or len(set(s)) == len(s):
return 0
result = 0
for x in set(s):
for y in set(s):
if x == y:
con... | null |
v0 | [
"int"
] | str | def v0(self, v1: int) -> str:
v2 = self.bot.get_user(v1)
return v2.name if v2 is not None else 'Unknown or Deleted User' | [] | [] | [] | 3 | # Copyright (c) 2021 - Jojo#7791
# Licensed under MIT
from redbot.core import commands
from ..abc import TodoMixin
from ..utils import NonBotMember
class Managers(TodoMixin):
"""Manage a user's managers for their todo list"""
@commands.group()
async def todo(self, *args):
pass
@todo.group(... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
v2 = ''.join((x for v3 in v1.title() if v3.isalnum()))
return v2[0].lower() + v2[1:] | [] | [] | [] | 3 | """Data Models for Parsing Arista JSON Response."""
# Standard Library
from typing import Dict, List, Optional
from datetime import datetime
# Project
from hyperglass.log import log
# Local
from ..main import HyperglassModel
from .serialized import ParsedRoutes
RPKI_STATE_MAP = {
"invalid": 0,
"valid": 1,
... | null |
v0 | [] | np.ndarray | def v0(self) -> np.ndarray:
v1 = self.scene.get_obj_pos(self.goal)[0]
v2 = self.scene.get_obj_pos(self.box)[0]
v3 = np.concatenate([v1, v2])
return np.concatenate([self.robot_state(), v3]) | [] | [
"numpy"
] | [
"import numpy as np"
] | 5 | import numpy as np
from gym.spaces import Box as SamplingSpace
from alr_sim.controllers.Controller import ControllerBase
from alr_sim.core.Scene import Scene
from alr_sim.gyms.gym_env_wrapper import GymEnvWrapper
from alr_sim.gyms.gym_utils.helpers import obj_distance
from alr_sim.sims.universal_sim.PrimitiveObjects i... | null |
v105 | [
"v0",
"Any",
"Any"
] | Any | def v105(self, v106: v0, v107, v108):
if v107 < 0 or v107 > 1:
raise ValueError('fraction must be in [0, 1]')
v109 = lambda : (v107, v108)
return self.__do_unary_process_and_create_table(table=v106, user_func=v109, stub_func=self.proc_stub.sample) | [] | [] | [] | 5 | #
# Copyright 2019 The Eggroll 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 ap... | [
"class v0(object):\n\n def __init__(self, v1, v2=1, v3=False):\n self._namespace = v1.namespace\n self._name = v1.name\n self._type = storage_basic_pb2.StorageType.Name(v1.type)\n self._partitions = v2\n self.schema = {}\n self._in_place_computing = v3\n self.gc_e... |
v105 | [
"v0",
"Any",
"Any"
] | Any | def v105(self, v106: v0, v107, v108):
v109 = self.__create_unary_process(table=v106, func=v107)
return v108(v109) | [] | [] | [] | 3 | #
# Copyright 2019 The Eggroll 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 ap... | [
"class v0(object):\n\n def __init__(self, v1, v2=1, v3=False):\n self._namespace = v1.namespace\n self._name = v1.name\n self._type = storage_basic_pb2.StorageType.Name(v1.type)\n self._partitions = v2\n self.schema = {}\n self._in_place_computing = v3\n self.gc_e... |
v105 | [
"v0",
"Any",
"Any"
] | Any | def v105(self, v106: v0, v107, v108):
v109 = self.__do_unary_process(table=v106, user_func=v107, stub_func=v108)
return self._create_table_from_locator(v109, v106) | [] | [] | [] | 3 | #
# Copyright 2019 The Eggroll 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 ap... | [
"class v0(object):\n\n def __init__(self, v1, v2=1, v3=False):\n self._namespace = v1.namespace\n self._name = v1.name\n self._type = storage_basic_pb2.StorageType.Name(v1.type)\n self._partitions = v2\n self.schema = {}\n self._in_place_computing = v3\n self.gc_e... |
v105 | [
"v0",
"v0",
"Any",
"Any"
] | Any | def v105(self, v106: v0, v107: v0, v108, v109):
v110 = self.__create_binary_process(left=v106, right=v107, func=v108, session=self.eggroll_session.to_protobuf())
return v109(v110) | [] | [] | [] | 3 | #
# Copyright 2019 The Eggroll 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 ap... | [
"class v0(object):\n\n def __init__(self, v1, v2=1, v3=False):\n self._namespace = v1.namespace\n self._name = v1.name\n self._type = storage_basic_pb2.StorageType.Name(v1.type)\n self._partitions = v2\n self.schema = {}\n self._in_place_computing = v3\n self.gc_e... |
v105 | [
"v0",
"v0",
"Any",
"Any"
] | Any | def v105(self, v106: v0, v107: v0, v108, v109):
v110 = self.__do_binary_process(left=v106, right=v107, user_func=v108, stub_func=v109)
return self._create_table_from_locator(v110, v106) | [] | [] | [] | 3 | #
# Copyright 2019 The Eggroll 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 ap... | [
"class v0(object):\n\n def __init__(self, v1, v2=1, v3=False):\n self._namespace = v1.namespace\n self._name = v1.name\n self._type = storage_basic_pb2.StorageType.Name(v1.type)\n self._partitions = v2\n self.schema = {}\n self._in_place_computing = v3\n self.gc_e... |
v0 | [
"str"
] | int | def v0(self, v1: str) -> int:
v1 = list(v1)
v2 = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}
for v3 in range(len(v1)):
for v4 in v2:
if v1[v3] == v4:
v1[v3] = v2[v4]
v5 = 0
while len(v1) != 0:
if len(v1) > 1:
if v1[0] < v1... | [] | [] | [] | 21 | class Solution:
def romanToInt(self, s: str) -> int:
s = list(s)
trans = {'M': 1000, "D": 500, "C": 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}
for q in range(len(s)):
for key in trans:
if s[q] == key:
s[q] = trans[key]
final = 0
... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
(v2, v3, v4) = v1.partition('.')
return v2 if not v4 else f'{v2}.{v4.lower()}' | [] | [] | [] | 3 | from typing import Union
import os
from pathlib import Path
def is_running_in_ipython() -> bool:
try:
assert __IPYTHON__ # type: ignore
return True
except (NameError, AttributeError):
return False
def is_special(attribute: str) -> bool:
return attribute.startswith("_") and attri... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
v1 = cleandoc(v1).strip()
return v1 | [] | [
"inspect"
] | [
"from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature"
] | 3 | from __future__ import absolute_import
from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
from typing import Any, Iterable, Optional, Tuple
from .console import RenderableType, RenderGroup
from .highlighter import ReprHighlighter
from .jupyter import JupyterMixin
from .panel import Panel
from... | null |
v0 | [
"Tuple[str, Any]"
] | Tuple[bool, str] | def v0(v1: Tuple[str, Any]) -> Tuple[bool, str]:
(v2, (v3, v4)) = v1
return (callable(v4), v2.strip('_').lower()) | [] | [] | [] | 3 | from __future__ import absolute_import
from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
from typing import Any, Iterable, Optional, Tuple
from .console import RenderableType, RenderGroup
from .highlighter import ReprHighlighter
from .jupyter import JupyterMixin
from .panel import Panel
from... | null |
v0 | [] | int | def v0() -> int:
v1 = [2]
v2 = 3
while len(v1) < 10001:
if all((v2 % p > 0 for v3 in v1 if v3 * v3 <= v2)):
v1.append(v2)
v2 += 2
return v1[-1] | [] | [] | [] | 8 | def run() -> int:
primes = [2]
current = 3
while len(primes) < 10_001:
if all(current % p > 0 for p in primes if p * p <= current):
primes.append(current)
current += 2
return primes[-1]
if __name__ == '__main__':
print(f'10_001st prime: {run()}')
| null |
v0 | [
"str",
"str",
"List[str]"
] | int | def v0(self, v1: str, v2: str, v3: List[str]) -> int:
v4 = set(v3)
if v2 not in v4:
return 0
(v5, v6, v7, v8) = (1, set(), {v1}, {v2})
while len(v7) > 0 and len(v8) > 0:
if len(v7) > len(v8):
(v7, v8) = (v8, v7)
v5 += 1
v9 = set()
for v10 in v7:
... | [] | [] | [] | 21 | from typing import List
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
wordListSet = set(wordList)
if endWord not in wordListSet: return 0
result, visited, s1, s2 = 1, set(), {beginWord}, {endWord}
while len(s1) > 0 and len(s2) > 0:
if len(s1) ... | null |
v42 | [
"str",
"v0",
"Dict[str, Dict[str, Any]]"
] | str | def v42(v43: str, v44: v0, v45: Dict[str, Dict[str, Any]]) -> str:
v46 = 6
v47 = 120
v48 = int(120 / v46)
v49 = v10(table_width=v47, column_width=v48, cve_count=v44)
v50 = True if v45 else False
v51 = v18(table_width=v47, column_count=v46, cve_count=v44, vulnerable_packages=v50)
v52 = v26(ta... | [
{
"name": "v10",
"input_types": [
"int",
"int",
"v0"
],
"output_type": "List[str]",
"code": "def v10(v11: int, v12: int, v13: v0) -> List[str]:\n v14 = PrettyTable(header=False, padding_width=1, min_table_width=v11, max_table_width=v11)\n v14.set_style(SINGLE_BORDER)\n ... | [] | [] | 9 | import itertools
from collections import defaultdict
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import List, Union, Dict, Any
from packaging import version as packaging_version
from prettytable import PrettyTable, SINGLE_BORDER
from checkov.common.models.enums import CheckR... | [
"@dataclass\nclass v0:\n v1: int = 0\n v2: int = 0\n v3: int = 0\n v4: int = 0\n v5: int = 0\n v6: int = 0\n v7: int = 0\n v8: int = 0\n\n def v9(self) -> List[str]:\n return [f'Total CVEs: {self.total}', f'critical: {self.critical}', f'high: {self.high}', f'medium: {self.medium}',... |
v0 | [
"List[str]",
"Any"
] | None | def v0(self, v1: List[str]=None, v2=False) -> None:
self.add_tokens(tokens=self.specials + v1, lower=v2)
assert len(self.stoi) == len(self.itos) | [] | [] | [] | 3 | # coding: utf-8
"""
Vocabulary module
"""
from collections import defaultdict, Counter
from typing import List
import numpy as np
from torchtext.data import Dataset
from joeynmt.constants import UNK_TOKEN, DEFAULT_UNK_ID, EOS_TOKEN, BOS_TOKEN, PAD_TOKEN,DEFAULT_ENCODING
class Vocabulary:
'''Vocabulary represen... | null |
v0 | [
"str"
] | None | def v0(self, v1: str) -> None:
v2 = []
with open(v1, 'r', encoding='utf-8') as v3:
for v4 in v3:
v2.append(v4.strip('\n'))
self._from_list(v2) | [] | [] | [] | 6 | # coding: utf-8
"""
Vocabulary module
"""
from collections import defaultdict, Counter
from typing import List
import numpy as np
try:
from torchtext.data import Dataset
except:
from torchtext.legacy.data import Dataset
from joeynmt.constants import UNK_TOKEN, DEFAULT_UNK_ID, \
EOS_TOKEN, BOS_TOKEN, PAD_... | null |
v0 | [
"str"
] | Any | def v0(self, v1: str):
with open(v1, mode='w', encoding='utf-8') as v2:
for v3 in self.do_files:
v4 = v3.render()
v2.write(v4) | [] | [] | [] | 5 | """A module for the DoFileCollection class."""
from typing import List
from .do_file import DoFile
from .settings import SettingsManager
from ..dataset import DatasetCollection
class DoFileCollection:
"""A class to represent do files coming from the same ODK file.
The DoFileCollection class corresponds to t... | null |
v0 | [
"List[str]"
] | None | def v0(self, v1: List[str]) -> None:
for v2 in v1:
v3 = len(self.itos)
if v2 not in self.itos:
self.itos.append(v2)
self.stoi[v2] = v3 | [] | [] | [] | 6 | # coding: utf-8
"""
Vocabulary module
"""
from collections import defaultdict, Counter
from typing import List
import numpy as np
try:
from torchtext.data import Dataset
except:
from torchtext.legacy.data import Dataset
from joeynmt.constants import UNK_TOKEN, DEFAULT_UNK_ID, \
EOS_TOKEN, BOS_TOKEN, PAD_... | null |
v0 | [
"np.array",
"Any",
"Any"
] | List[List[str]] | def v0(self, v1: np.array, v2=True, v3=True) -> List[List[str]]:
v4 = []
for v5 in v1:
v4.append(self._array_to_sentence(array=v5, cut_at_eos=v2, skip_pad=v3))
return v4 | [] | [] | [] | 5 | # coding: utf-8
"""
Vocabulary module
"""
from collections import defaultdict, Counter
from typing import List
import numpy as np
from torchtext.data import Dataset
from joeynmt.constants import UNK_TOKEN, DEFAULT_UNK_ID, EOS_TOKEN, BOS_TOKEN, PAD_TOKEN,DEFAULT_ENCODING
class Vocabulary:
'''Vocabulary represen... | null |
v0 | [
"Counter",
"int"
] | Any | def v0(v1: Counter, v2: int):
v3 = Counter({t: c for (v4, v5) in v1.items() if v5 >= v2})
return v3 | [] | [
"collections"
] | [
"from collections import defaultdict, Counter"
] | 3 | # coding: utf-8
"""
Vocabulary module
"""
from collections import defaultdict, Counter
from typing import List
import numpy as np
try:
from torchtext.data import Dataset
except:
from torchtext.legacy.data import Dataset
from joeynmt.constants import UNK_TOKEN, DEFAULT_UNK_ID, \
EOS_TOKEN, BOS_TOKEN, PAD_... | null |
v0 | [
"Any",
"str",
"bool",
"bool"
] | Any | def v0(v1, v2: str, v3: bool=False, v4: bool=True):
v5 = v1.queue_declare(v2, exclusive=v3, durable=v4, auto_delete=False)
return v5 | [] | [] | [] | 3 | """
Helper functions for using RabbitMQ
"""
import asyncio
import sys
import json
from typing import Optional
import pika
from configs.base.consts import ASYNC_SLEEP
from configs.base.rabbit_connection import RABBITMQ_HOST, RABBITMQ_PORT, RABBIT_USER, RABBIT_PW
from sys import platform
if platform != 'win32':
im... | null |
v29 | [
"str",
"Optional[str]",
"int",
"int"
] | v0 | def v29(v30: str, v31: Optional[str], v32: int, v33: int) -> v0:
if v31 is None:
return v1(paths=[v30], num_words=v32, min_count=v33)
else:
return v24(v31) | [
{
"name": "v1",
"input_types": [
"List[str]",
"Optional[int]",
"int"
],
"output_type": "v0",
"code": "def v1(v2: List[str], v3: Optional[int]=None, v4: int=1) -> v0:\n with ExitStack() as v5:\n logger.info('Building vocabulary from dataset(s): %s', v2)\n v6 = (... | [
"collections",
"contextlib",
"itertools",
"json"
] | [
"import json",
"from collections import Counter",
"from contextlib import ExitStack",
"from itertools import chain, islice"
] | 5 | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | [
"v0 = Dict[str, int]"
] |
v0 | [] | None | def v0(self) -> None:
self.set_models({'meeting/222': {'name': 'name_SNLGsvIV', 'motions_number_min_digits': 3, 'motions_number_type': 'per_category'}, 'user/1': {'meeting_ids': [222]}, 'motion_workflow/12': {'name': 'name_workflow1', 'first_state_id': 34, 'state_ids': [34]}, 'motion_state/34': {'name': 'name_state... | [] | [] | [] | 10 | from tests.system.action.base import BaseActionTestCase
class MotionSetNumberMixinTest(BaseActionTestCase):
def test_create_set_number_return_because_number_preset(self) -> None:
self.set_models(
{
"meeting/222": {
"name": "name_SNLGsvIV",
... | null |
v0 | [] | None | def v0(self) -> None:
self.set_models({'meeting/222': {'name': 'name_SNLGsvIV', 'motions_number_min_digits': 3, 'motions_number_with_blank': True, 'motions_amendments_prefix': 'B'}, 'user/1': {'meeting_ids': [222]}, 'motion_workflow/12': {'name': 'name_workflow1', 'first_state_id': 34, 'state_ids': [34]}, 'motion_s... | [] | [] | [] | 10 | from tests.system.action.base import BaseActionTestCase
class MotionSetNumberMixinTest(BaseActionTestCase):
def test_create_set_number_return_because_number_preset(self) -> None:
self.set_models(
{
"meeting/222": {
"name": "name_SNLGsvIV",
... | null |
v0 | [] | None | def v0(self) -> None:
self.set_models({'meeting/222': {'name': 'name_SNLGsvIV', 'is_active_in_organization_id': 1}, 'motion_workflow/1': {'name': 'test1', 'state_ids': [76, 77], 'first_state_id': 76, 'meeting_id': 222}, 'motion_state/76': {'name': 'test0', 'motion_ids': [], 'workflow_id': 1, 'first_state_of_workflo... | [] | [] | [] | 7 | import time
from openslides_backend.permissions.permissions import Permissions
from tests.system.action.base import BaseActionTestCase
class MotionResetStateActionTest(BaseActionTestCase):
def setUp(self) -> None:
super().setUp()
self.permission_test_model = {
"motion_workflow/1": {
... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.