name stringclasses 484
values | input_types listlengths 0 49 | output_type stringlengths 1 180 | code stringlengths 35 97.8k | dependencies listlengths 0 6 | lib_used listlengths 0 13 | imports listlengths 0 44 | line_count int64 3 192 | full_code stringlengths 51 1M | input_type_defs listlengths 1 11 ⌀ |
|---|---|---|---|---|---|---|---|---|---|
v0 | [] | Optional[str] | def v0(self) -> Optional[str]:
if not self.useColor:
return None
return ['r', 'g', 'b'][self.channel % 3] | [] | [] | [] | 4 | import attr
from typing import List, Optional, Tuple
from .options import ProjectOptions
from .tree.branch import Branch
from .tree.point import Point
from .tree.tree import Tree
from .drawMode import DrawMode
from .uiState import UIState
from pydynamo_brain.util import SAVE_META, ImageCache, locationMinus, locatio... | null |
v0 | [] | str | def v0(self) -> str:
v1 = '%04x' % self._nextBranchID
self._nextBranchID += 1
return v1 | [] | [] | [] | 4 | import attr
from typing import List, Optional, Tuple
from .options import ProjectOptions
from .tree.branch import Branch
from .tree.point import Point
from .tree.tree import Tree
from .drawMode import DrawMode
from .uiState import UIState
from pydynamo_brain.util import SAVE_META, ImageCache, locationMinus, locatio... | null |
v0 | [
"List[str]",
"Optional[str]"
] | List[str] | def v0(self, v1: List[str], v2: Optional[str]) -> List[str]:
v3 = []
self._acquire_lock()
try:
for v4 in v1:
v5 = f'{v2}/{v4}'
v5 = self._get_value(v5)
v3.append(v5)
finally:
self._lock.release()
return v3 | [] | [] | [] | 11 | """
Module that handles parsing of XML files.
Copyright (C) 2019-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import logging
import os
import pathlib
import shutil
import xmlschema
from typing import Any, Optional, List, Union, Tuple, Dict
from pathlib import Path
from defusedxml impor... | null |
v0 | [] | Iterator[Tuple[str, int]] | def v0(self) -> Iterator[Tuple[str, int]]:
v1 = self.build()
for (v2, v3) in v1.subqueries:
if v2 in self._filter_types:
yield (v2, v3.distinct().count()) | [] | [] | [] | 5 | from functools import reduce
from itertools import islice
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple
import sqlalchemy as sa
from sqlalchemy.orm.query import Query
from sqlalchemy.sql.expression import cast as sa_cast
from redun.backends.db import (
JSON,
Argument,
... | null |
v0 | [
"bool"
] | Iterator[Any] | def v0(self, *v2: Iterable[str], v1: bool=False) -> Iterator[Any]:
for v3 in self.all():
v4 = []
for v5 in v2:
if v5 == 'id':
v6 = self.MODEL_PKS[type(v3)]
v4.append(getattr(v3, v6))
elif v5 == 'type':
v4.append(type(v3).__name_... | [] | [] | [] | 16 | from functools import reduce
from itertools import islice
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple
import sqlalchemy as sa
from sqlalchemy.orm.query import Query
from sqlalchemy.sql.expression import cast as sa_cast
from redun.backends.db import (
JSON,
Argument,
... | null |
v0 | [] | bytes | def v0(self) -> bytes:
v1 = '<?xml version="1.0" encoding="utf-8"?>' + os.linesep + '<LogFile SessionID="%s" SessionStartTime="%s">' % (str(self.GetSessionID()), self.GetSessionStartTime().isoformat()) + os.linesep
return v1.encode('utf-8') | [] | [
"os"
] | [
"import os"
] | 3 | from __future__ import annotations
import datetime
import enum_lib
import json
import os
import platform
import threading
import traceback
import typing
import uuid
from xml.sax import saxutils
from NeonOcean.S4.Order import Language, Paths, This
from NeonOcean.S4.Order.Data import Global
from NeonOcean.S4.Order.Tool... | null |
v2 | [] | None | def v2(self) -> None:
self._loggingDirectoryName = v0(datetime.datetime.now())
self._isContinuation = True
self._sessionInformation = self._CreateSessionInformation()
self._modsDirectoryInformation = self._CreateModsDirectoryInformation() | [
{
"name": "v0",
"input_types": [
"datetime.datetime"
],
"output_type": "str",
"code": "def v0(v1: datetime.datetime) -> str:\n return v1.date().isoformat() + ' ' + v1.time().isoformat().replace(':', '.')",
"dependencies": []
}
] | [
"datetime"
] | [
"import datetime"
] | 5 | from __future__ import annotations
import datetime
import enum_lib
import json
import os
import platform
import threading
import traceback
import typing
import uuid
from xml.sax import saxutils
from NeonOcean.S4.Order import Language, Paths, This
from NeonOcean.S4.Order.Data import Global
from NeonOcean.S4.Order.Tool... | null |
v5 | [] | threading.Thread | def v5(self) -> threading.Thread:
v6 = threading.main_thread()
v7 = v6.is_alive()
def v8() -> None:
nonlocal mainThreadAlive
v9 = v6.is_alive()
try:
while len(self._reportStorage) != 0:
v10 = len(self._reportStorage)
v11 = self._reportStor... | [
{
"name": "v0",
"input_types": [],
"output_type": "None",
"code": "def v0() -> None:\n nonlocal mainThreadAlive\n v1 = mainThread.is_alive()\n try:\n while len(self._reportStorage) != 0:\n v2 = len(self._reportStorage)\n v3 = self._reportStorage[:v2]\n ... | [
"threading"
] | [
"import threading"
] | 23 | from __future__ import annotations
import datetime
import enum_lib
import json
import os
import platform
import threading
import traceback
import typing
import uuid
from xml.sax import saxutils
from NeonOcean.S4.Order import Language, Paths, This
from NeonOcean.S4.Order.Data import Global
from NeonOcean.S4.Order.Tool... | null |
v0 | [
"str"
] | None | def v0(self, v1: str) -> None:
v2 = self.GetLogEndBytes()
with open(v1, 'rb') as v3:
v3.seek(-len(v2), os.SEEK_END)
if v2 != v3.read():
raise Exception("The end of the log file doesn't match what was expected.") | [] | [
"os"
] | [
"import os"
] | 6 | from __future__ import annotations
import datetime
import enum_lib
import json
import os
import platform
import threading
import traceback
import typing
import uuid
from xml.sax import saxutils
from NeonOcean.S4.Order import Language, Paths, This
from NeonOcean.S4.Order.Data import Global
from NeonOcean.S4.Order.Tool... | null |
v0 | [
"Tensor"
] | Tensor | def v0(self, v1: Tensor) -> Tensor:
v2 = self.w_posterior.sample()
v3 = self.bias_posterior.sample()
v4 = self.w_prior.log_prior(v2)
v5 = self.bias_prior.log_prior(v3)
v6 = self.w_posterior.log_posterior()
v7 = self.bias_posterior.log_posterior()
v8 = v4 + v5
v9 = v6 + v7
self.kl_div... | [] | [
"torch"
] | [
"import torch",
"import torch.nn.functional as F",
"from torch import Tensor"
] | 11 | from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
from .base_bayesian import BayesianModule
from .samplers.gaussian_variational import GaussianVariational
from .samplers.scale_mixture import ScaleMixture
class BayesLinear(BayesianModule):
"""Bayesian Linear Layer... | null |
v0 | [
"Dict[str, Tensor]",
"Dict[str, Tensor]"
] | Any | def v0(self, v1: Dict[str, Tensor], v2: Dict[str, Tensor]):
assert 'embedding_1' in v2 and 'embedding_2' in v2, 'Embedding names must be available before loss calculation'
v3 = v2['embedding_1']
v4 = v2['embedding_2']
v5 = v3 @ v4.T
v6 = torch.arange(v5.shape[0], device=v5.device)
v7 = F.cross_e... | [] | [
"torch"
] | [
"import torch",
"import torch.nn as nn",
"import torch.nn.functional as F",
"from torch import Tensor",
"from torch.nn.utils.rnn import pack_padded_sequence"
] | 9 | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Losses module contains implementations for various losses used generally
in vision and language space. One can register custom losses to be detected by
MMF using the following example.
.. code::
from mmf.common.registry import registry
from torch import nn
... | null |
v0 | [] | None | def v0(self) -> None:
v1 = {bs: set((ue for v2 in ues if self.check_connectivity(bs, v2))) for (v3, v4) in self.connections.items()}
self.connections.clear()
self.connections.update(v1) | [] | [] | [] | 4 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [
"Dict[int, int]"
] | Any | def v0(self, v1: Dict[int, int]):
assert not self.done, 'step() called on already terminated episode'
v1 = self.handler.action(self, v1)
self.update_connections()
for (v2, v3) in v1.items():
self.apply_action(v3, self.users[v2])
self.datarates = {}
for v4 in self.stations.values():
... | [] | [] | [] | 33 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [
"Any"
] | Dict | def v0(self, v1) -> Dict:
v2 = self.connections[v1]
v3 = [self.channel.snr(v1, ue) for v4 in v2]
v5 = [self.channel.datarate(v1, v4, snr) for (v6, v4) in zip(v3, v2)]
v7 = self.scheduler.share(v1, v5)
return {(v1, v4): rate for (v4, v8) in zip(v2, v7)} | [] | [] | [] | 6 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v27 | [] | Dict[int, Dict[str, np.ndarray]] | def v27(self) -> Dict[int, Dict[str, np.ndarray]]:
v28 = sorted([bs for v29 in self.stations.values()], key=lambda bs: v29.bs_id)
v30 = self.station_utilities()
def v31(v32):
"""Define local observation vector for UEs."""
v33 = [v29 for v34 in v28 if v32 in self.connections[v34]]
v3... | [
{
"name": "v0",
"input_types": [
"Any"
],
"output_type": "Any",
"code": "def v0(v1):\n v2 = np.zeros(self.NUM_STATIONS, dtype=np.float32)\n v3 = np.zeros(self.NUM_STATIONS, dtype=np.float32)\n v4 = np.asarray([self.utility.scale(self.utility.lower)], dtype=np.float32)\n v5 = se... | [
"numpy"
] | [
"import numpy as np"
] | 40 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
v2 = self.monitor.scalar_results['mean utility']
v3 = v2[-1]
v4 = np.mean(v2)
v5 = self.monitor.scalar_results['mean datarate']
v6 = v5[-1]
v7 = np.mean(v5)
v1.get_xaxis().set_visible(False)
v1.get_yaxis().set_visible(False)
v1.spines['top'].set_visible(Fals... | [] | [
"numpy"
] | [
"import numpy as np"
] | 19 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
v2 = np.arange(self.time)
v3 = self.monitor.scalar_results['mean utility']
v1.plot(v2, v3, linewidth=1, color='black')
v1.set_ylabel('Avg. Utility')
v1.set_xlim([0.0, self.EP_MAX_TIME])
v1.set_ylim([self.utility.lower, self.utility.upper]) | [] | [
"numpy"
] | [
"import numpy as np"
] | 7 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
v2 = np.arange(self.time)
v3 = self.monitor.scalar_results['number connected']
v1.plot(v2, v3, linewidth=1, color='black')
v1.set_xlabel('Time')
v1.set_ylabel('#Conn. UEs')
v1.set_xlim([0.0, self.EP_MAX_TIME])
v1.set_ylim([0.0, len(self.users)]) | [] | [
"numpy"
] | [
"import numpy as np"
] | 8 | import string
from typing import List, Tuple, Dict, Set
from collections import Counter, defaultdict
import gym
import pygame
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as pe
from pygame import Surface
from matplotlib import cm
from matplotlib.backends.backend_agg import FigureCan... | null |
v0 | [] | Iterator[Tuple[BytesIO, str]] | def v0(self) -> Iterator[Tuple[BytesIO, str]]:
for (v1, v2) in zip(self.zipfiles_extractor_files, self.ZIP_FILES):
yield (BytesIO(v1.read()), v2) | [] | [
"io"
] | [
"from io import BufferedReader, BytesIO"
] | 3 | from io import BufferedReader, BytesIO
from tempfile import SpooledTemporaryFile
from typing import Iterator, Tuple
from zipfile import ZipFile
from flask import json
from werkzeug.datastructures import FileStorage
import lms.extractors.base as extractor
import lms.extractors.ziparchive as zipfilearchive
from lms.lms... | null |
v0 | [
"str"
] | str | def v0(v1: str) -> str:
v1 = v1.replace('\n', ' ')
for v2 in range(20):
v3 = v1.replace(' ', ' ')
if v3 == v1:
break
v1 = v3
return v1 | [] | [] | [] | 8 | """
Make question json file
This sript works on:
1. Check the bleu score among the original questions and the patched questions
2. Simple parsing
Notes
--------
Please change the squad in config
"""
import os
import sys
import json
import nltk
from nltk.translate.bleu_score import sentence_bleu
from itertools ... | null |
v0 | [
"list"
] | Dict[str, str] | def v0(v1: list) -> Dict[str, str]:
v2 = dict()
for v3 in v1:
for v4 in v3['paragraphs']:
for v5 in v4['qas']:
v6 = v5['id']
v7 = v5['question']
v2[v6] = v7
return v2 | [] | [] | [] | 9 | """
Make question json file
This sript works on:
1. Check the bleu score among the original questions and the patched questions
2. Simple parsing
Notes
--------
Please change the squad in config
"""
import os
import sys
import json
import nltk
from nltk.translate.bleu_score import sentence_bleu
from itertools ... | null |
v0 | [
"str"
] | List[str] | def v0(self, v1: str) -> List[str]:
v2 = ParentedTree.fromstring(v1)
for v3 in v2.subtrees(filter=self.is_wh_interrogative):
v4 = v3.parent().leaves()
if v4:
return v4
for v3 in v2.subtrees(filter=self.is_inverse_question):
v4 = v3.leaves()
if v4:
retu... | [] | [
"nltk"
] | [
"import nltk",
"from nltk.translate.bleu_score import sentence_bleu",
"from nltk.translate.bleu_score import SmoothingFunction",
"from nltk.tree import ParentedTree"
] | 14 | """
Make question json file
This sript works on:
1. Check the bleu score among the original questions and the patched questions
2. Simple parsing
Notes
--------
Please change the squad in config
"""
import os
import sys
import json
import nltk
from nltk.translate.bleu_score import sentence_bleu
from itertools ... | null |
v0 | [] | list[str] | def v0() -> list[str]:
v1 = []
with open('input.txt') as v2:
for v3 in v2:
v4 = v3.rstrip()
v1.append(v4)
return v1 | [] | [] | [] | 7 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v4 | [
"int",
"int",
"list[str]"
] | int | def v4(v5: int, v6: int, v7: list[str]) -> int:
def v8(v9: int, v10: int, v11: list[str]) -> int:
if 0 <= v9 < len(v7[0]) and 0 <= v10 < len(v7):
if v7[v10][v9] == '#':
return 1
return 0
v12 = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
... | [
{
"name": "v0",
"input_types": [
"int",
"int",
"list[str]"
],
"output_type": "int",
"code": "def v0(v1: int, v2: int, v3: list[str]) -> int:\n if 0 <= v1 < len(data[0]) and 0 <= v2 < len(data):\n if data[v2][v1] == '#':\n return 1\n return 0",
"depen... | [] | [] | 12 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v0 | [
"list[str]",
"Callable",
"int"
] | Any | def v0(v1: list[str], v2: Callable, v3: int):
v4 = []
for v5 in range(len(v1)):
v6 = ''
for v7 in range(len(v1[0])):
if v1[v5][v7] == '#' and v2(v7, v5, v1) >= v3:
v8 = 'L'
elif v1[v5][v7] == 'L' and v2(v7, v5, v1) == 0:
v8 = '#'
... | [] | [] | [] | 14 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v14 | [
"list[str]",
"Callable",
"int",
"int"
] | Union[None, list[str]] | def v14(v15: list[str], v16: Callable, v17: int=4, v18: int=10000) -> Union[None, list[str]]:
def v19(v20: list[str], v21: list[str]) -> bool:
for v22 in range(len(v20)):
for v23 in range(len(v20[0])):
if v20[v22][v23] != v21[v22][v23]:
return True
re... | [
{
"name": "v0",
"input_types": [
"list[str]",
"Callable",
"int"
],
"output_type": "Any",
"code": "def v0(v1: list[str], v2: Callable, v3: int):\n v4 = []\n for v5 in range(len(v1)):\n v6 = ''\n for v7 in range(len(v1[0])):\n if v1[v5][v7] == '#' a... | [] | [] | 14 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v42 | [
"list[str]"
] | int | def v42(v43: list[str]) -> int:
v44 = v16(v43, counting_func=v4, threshold=4)
if v44 is None:
return -1
v45 = 0
for v46 in v44:
v45 += v46.count('#')
return v45 | [
{
"name": "v0",
"input_types": [
"int",
"int",
"list[str]"
],
"output_type": "int",
"code": "def v0(v1: int, v2: int, v3: list[str]) -> int:\n if 0 <= v1 < len(data[0]) and 0 <= v2 < len(data):\n if data[v2][v1] == '#':\n return 1\n return 0",
"depen... | [] | [] | 8 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v8 | [
"int",
"int",
"list[str]"
] | int | def v8(v9: int, v10: int, v11: list[str]) -> int:
def v12(v13: (int, int), v14: (int, int), v15: list[str]) -> int:
(v16, v17) = v13
(v18, v19) = v14
while 0 <= (v16 := (v16 + v18)) < len(v11[0]) and 0 <= (v17 := (v17 + v19)) < len(v11):
if v11[v17][v16] == '#':
... | [
{
"name": "v0",
"input_types": [
"(int, int)",
"(int, int)",
"list[str]"
],
"output_type": "int",
"code": "def v0(v1: (int, int), v2: (int, int), v3: list[str]) -> int:\n (v4, v5) = v1\n (v6, v7) = v2\n while 0 <= (v4 := (v4 + v6)) < len(data[0]) and 0 <= (v5 := (v5 + ... | [] | [] | 16 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v49 | [
"list[str]"
] | int | def v49(v50: list[str]) -> int:
v51 = v23(v50, counting_func=v8, threshold=5)
if v51 is None:
return -1
v52 = 0
for v53 in v51:
v52 += v53.count('#')
return v52 | [
{
"name": "v0",
"input_types": [
"(int, int)",
"(int, int)",
"list[str]"
],
"output_type": "int",
"code": "def v0(v1: (int, int), v2: (int, int), v3: list[str]) -> int:\n (v4, v5) = v1\n (v6, v7) = v2\n while 0 <= (v4 := (v4 + v6)) < len(data[0]) and 0 <= (v5 := (v5 + ... | [] | [] | 8 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v0 | [
"list[str]",
"list[str]"
] | bool | def v0(v1: list[str], v2: list[str]) -> bool:
for v3 in range(len(v1)):
for v4 in range(len(v1[0])):
if v1[v3][v4] != v2[v3][v4]:
return True
return False | [] | [] | [] | 6 | from typing import Union, Callable
def parse_data() -> list[str]:
data = []
with open("input.txt") as file:
for line in file:
_line = line.rstrip()
data.append(_line)
return data
# Count occupied seats *adjacent* to the seat at position (x, y)
def count_adjacent(x: int, y... | null |
v0 | [
"List[str]",
"Dict[str, int]"
] | Any | def v0(self, v1: List[str], v2: Dict[str, int]):
v3 = v2.copy()
while '' in v1:
v1.remove('')
v4 = []
for v5 in range(self.seq_max_len):
v6 = []
for v7 in range(self.max_len_char):
try:
v8 = v3.get(v1[v5][v7])
if v8:
... | [] | [] | [] | 21 | from datetime import datetime
from pipelines.encoder import BaseEncoder
import numpy as np
from typing import List, Dict, Union, Any, Optional, Tuple
import gin
import os
from pipelines import utils as sc
import json
from keras.preprocessing.sequence import pad_sequences
@gin.configurable
class PricingEncoder(BaseEn... | null |
v0 | [
"List[str]",
"Dict[str, int]"
] | Any | def v0(self, v1: List[str], v2: Dict[str, int]):
v3 = v2.copy()
v4 = []
for v5 in v1:
if v5 in v3.keys():
v4.append(v3[v5])
elif self.update_maps:
v3[v5] = len(v3.keys()) + 1
v4.append(v3[v5])
else:
v4.append(v3['UNK'])
return (v4, ... | [] | [] | [] | 12 | from datetime import datetime
from pipelines.encoder import BaseEncoder
import numpy as np
from typing import List, Dict, Union, Any, Optional, Tuple
import gin
import os
from pipelines import utils as sc
import json
from keras.preprocessing.sequence import pad_sequences
@gin.configurable
class PricingEncoder(BaseEn... | null |
v0 | [
"Any"
] | list | def v0(v1) -> list:
v2 = [0] * 256
for v3 in range(v1.shape[0]):
for v4 in range(v1.shape[1]):
v2[v1[v3][v4]] += 1
return v2 | [] | [] | [] | 6 | import cv2
import copy
import matplotlib.pyplot as plt
import numpy as np
img_original_path = 'p6.jpg'
img_specified_path = 'p5.jpg'
# calculate histogram
def calc_hist(img) -> list:
hist = [0] * 256
for i in range(img.shape[0]):
for j in range(img.shape[1]):
hist[img[i][j]] += 1
re... | null |
v5 | [
"Any"
] | list | def v5(v6) -> list:
v7 = [0] * 256
v8 = v0(v6)
v9 = v6.shape[0] * v6.shape[1]
for v10 in range(0, 256):
v7[v10] = v8[v10] / v9
for v10 in range(1, 256):
v7[v10] += v7[v10 - 1]
v7 = [round(v10 * 255) for v10 in v7]
return v7 | [
{
"name": "v0",
"input_types": [
"Any"
],
"output_type": "list",
"code": "def v0(v1) -> list:\n v2 = [0] * 256\n for v3 in range(v1.shape[0]):\n for v4 in range(v1.shape[1]):\n v2[v1[v3][v4]] += 1\n return v2",
"dependencies": []
}
] | [] | [] | 10 | import cv2
import copy
import matplotlib.pyplot as plt
import numpy as np
img_original_path = 'p6.jpg'
img_specified_path = 'p5.jpg'
# calculate histogram
def calc_hist(img) -> list:
hist = [0] * 256
for i in range(img.shape[0]):
for j in range(img.shape[1]):
hist[img[i][j]] += 1
re... | null |
v7 | [] | ssl.SSLContext | def v7() -> ssl.SSLContext:
global _server_ssl_context
if _server_ssl_context is None:
v8 = v0()
v9 = ssl.create_default_context(purpose=Purpose.CLIENT_AUTH, cafile=v8['incoming_trust'])
v9.load_cert_chain(v8['cert'], keyfile=v8['key'], password=None)
v9.verify_mode = ssl.CERT_OP... | [
{
"name": "v0",
"input_types": [],
"output_type": "Dict[str, str]",
"code": "def v0() -> Dict[str, str]:\n v1 = os.environ.get('HAIL_SSL_CONFIG_FILE', '/ssl-config/ssl-config.json')\n if os.path.isfile(v1):\n log.info(f'ssl config file found at {v1}')\n with open(v1, 'r') as v2:\... | [
"json",
"os",
"ssl"
] | [
"import json",
"import os",
"import ssl",
"from ssl import Purpose"
] | 9 | from typing import Dict
import logging
import json
import os
import ssl
from ssl import Purpose
log = logging.getLogger('hailtop.tls')
_server_ssl_context = None
_client_ssl_context = None
class NoSSLConfigFound(Exception):
pass
def _get_ssl_config() -> Dict[str, str]:
config_file = os.environ.get('HAIL_SS... | null |
v7 | [] | ssl.SSLContext | def v7() -> ssl.SSLContext:
global _client_ssl_context
if _client_ssl_context is None:
v8 = v0()
v9 = ssl.create_default_context(purpose=Purpose.SERVER_AUTH, cafile=v8['outgoing_trust'])
v9.load_default_certs()
v9.load_cert_chain(v8['cert'], keyfile=v8['key'], password=None)
... | [
{
"name": "v0",
"input_types": [],
"output_type": "Dict[str, str]",
"code": "def v0() -> Dict[str, str]:\n v1 = os.environ.get('HAIL_SSL_CONFIG_FILE', '/ssl-config/ssl-config.json')\n if os.path.isfile(v1):\n log.info(f'ssl config file found at {v1}')\n with open(v1, 'r') as v2:\... | [
"json",
"os",
"ssl"
] | [
"import json",
"import os",
"import ssl",
"from ssl import Purpose"
] | 10 | from typing import Dict
import logging
import json
import os
import ssl
from ssl import Purpose
log = logging.getLogger('hailtop.tls')
_server_ssl_context = None
_client_ssl_context = None
class NoSSLConfigFound(Exception):
pass
def _get_ssl_config() -> Dict[str, str]:
config_file = os.environ.get('HAIL_SS... | null |
v0 | [
"tf.Tensor"
] | Any | def v0(self, v1: tf.Tensor):
v2 = {'input_mask': tf.io.VarLenFeature(tf.int64), 'masked_lm_positions': tf.io.VarLenFeature(tf.int64), 'masked_lm_ids': tf.io.VarLenFeature(tf.int64), 'masked_lm_weights': tf.io.VarLenFeature(tf.float32)}
if self._params.use_v2_feature_names:
v3 = 'input_word_ids'
... | [] | [
"tensorflow"
] | [
"import tensorflow as tf"
] | 30 | # Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | null |
v0 | [
"dict"
] | Any | def v0(self, v1: dict):
[sprite.update_size() for v2 in v1.values() for v3 in v2.values()]
self.visible_sprites |= v1 | [] | [] | [] | 3 | import itertools as it
from lib.abstract_data_types import Matrix
from src.controller import EventDispatcher as Ed
from src.events import MoveCamera
from src.events import Click
from src.events import Tick
from src.events import Wheel
from src.references import Layer
from src.view.sprites import CellSprite
from src.vie... | null |
v3 | [
"v0",
"str",
"Any"
] | int | def v3(v4: v0, v5: str, v6='') -> int:
print('Logging in...')
v7 = f'https://when2meet.com/ProcessLogin.php?id={v4.id}&name={v5}&password={v6}'
v8 = requests.get(v7)
if 'Wrong' in v8.text:
raise RuntimeError(v8.text)
return int(v8.text) | [] | [
"requests"
] | [
"import requests"
] | 7 | import math
from html.parser import HTMLParser
import collections
from enum import Enum
from typing import List, Tuple, Dict
import requests
TEST = True
class Instance:
"""
Represents a single When2Meet "instance". Identified by an id and a code.
"""
def __init__(self, _id, code):
self.id = ... | [
"class v0:\n\n def __init__(self, v1, v2):\n self.id = v1\n self.code = v2\n self.timeslots = []\n self.mode = Mode.WEEKDAY"
] |
v0 | [
"Dict[str, str]"
] | Any | def v0(v1: Dict[str, str]):
v2 = logging.getLogger()
if v2.hasHandlers():
return
v3 = logging.Formatter('%(asctime)s: %(levelname)s: %(message)s')
v4 = logging.DEBUG if v1['DEBUG_MESSAGING'] else logging.INFO
v5 = logging.StreamHandler()
v5.setLevel(v4)
v5.setFormatter(v3)
v2.add... | [] | [
"datetime",
"logging",
"os"
] | [
"import logging",
"import os",
"import datetime"
] | 18 | import logging
import os # fix(clean): remove?
import datetime
from functools import wraps
from typing import Dict
import flask # fix(clean): remove?
from flask import request, redirect, current_app
from .config import init_flask_config
# decorator require SSL for a view
# from http://flask.pocoo.org/snippets/93/
... | null |
v44 | [
"v0",
"str",
"int"
] | bool | def v44(v45: v0, v46: str, v47: int) -> bool:
v46 = os.path.abspath(v46)
v48 = os.path.basename(v46).replace('.patch', '')
v49 = '.patched-' + v48
if os.path.exists(v49):
return False
v45.log.debug('applying patch %s' % v48)
v17(v45, 'patch', 'required to apply source patches')
with ... | [
{
"name": "v14",
"input_types": [
"Iterable[Any]"
],
"output_type": "str",
"code": "def v14(v15: Iterable[Any]) -> str:\n return ' '.join((shlex.quote(str(arg)) for v16 in v15))",
"dependencies": []
},
{
"name": "v17",
"input_types": [
"v0",
"str",
"Opt... | [
"contextlib",
"io",
"os",
"shlex",
"shutil",
"subprocess",
"sys"
] | [
"import os",
"import sys",
"import subprocess",
"import shlex",
"import io",
"import shutil",
"from contextlib import redirect_stdout"
] | 12 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | [
"class v0(dict):\n\n def v1(self, v2):\n return self[v2]\n\n def v3(self, v4, v5):\n self[v4] = v5\n\n def v6(self) -> 'Namespace':\n \"\"\"\n Make a deepcopy of this namespace, but only copy values with type\n ``Namespace|list|dict``.\n \"\"\"\n v7 = self._... |
v14 | [
"v0",
"str",
"Optional[str]"
] | Any | def v14(v15: v0, v16: str, v17: Optional[str]=None):
if v17:
v15.log.debug('downloading %s to %s' % (v16, v17))
else:
v17 = os.path.basename(urlparse(v16).path)
v15.log.debug('downloading %s' % v16)
urlretrieve(v16, v17) | [] | [
"os",
"urllib"
] | [
"import os",
"from urllib.request import urlretrieve",
"from urllib.parse import urlparse"
] | 7 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | [
"class v0(dict):\n\n def v1(self, v2):\n return self[v2]\n\n def v3(self, v4, v5):\n self[v4] = v5\n\n def v6(self) -> 'Namespace':\n \"\"\"\n Make a deepcopy of this namespace, but only copy values with type\n ``Namespace|list|dict``.\n \"\"\"\n v7 = self._... |
v6 | [
"Callable"
] | Callable | def v6(v7: Callable) -> Callable:
v8 = inspect.signature(v7).parameters
v9 = [p.name for v10 in v8.values() if v10.kind == v10.POSITIONAL_OR_KEYWORD]
assert v9.pop(0) == 'self'
@functools.wraps(v7)
def v11(self, *v12, **v13):
for (v14, v15) in v8.items():
if v14 in v13:
... | [
{
"name": "v0",
"input_types": [],
"output_type": "Any",
"code": "@functools.wraps(constructor)\ndef v0(self, *v1, **v2):\n for (v3, v4) in params.items():\n if v3 in v2:\n setattr(self, v3, v2[v3])\n elif v4.default != v4.empty:\n setattr(self, v3, v4.default)... | [
"inspect"
] | [
"import inspect"
] | 16 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | null |
v44 | [
"v0",
"str",
"Optional[str]",
"Any",
"Optional[str]"
] | Any | def v44(v45: v0, v46: str, v47: Optional[str]=None, *, v48=True, v49: Optional[str]=None):
if v49 is None:
v49 = re.sub('\\.tar(\\.\\w+)?', '', v46)
v17(v45, 'tar', 'required to unpack source tarfile')
v23(v45, ['tar', '-xf', v46])
if v47:
shutil.move(v49, v47)
if v48:
os.rem... | [
{
"name": "v14",
"input_types": [
"Iterable[Any]"
],
"output_type": "str",
"code": "def v14(v15: Iterable[Any]) -> str:\n return ' '.join((shlex.quote(str(arg)) for v16 in v15))",
"dependencies": []
},
{
"name": "v17",
"input_types": [
"v0",
"str",
"Opt... | [
"contextlib",
"io",
"os",
"re",
"shlex",
"shutil",
"subprocess",
"sys"
] | [
"import os",
"import sys",
"import subprocess",
"import shlex",
"import io",
"import shutil",
"import re",
"from contextlib import redirect_stdout"
] | 9 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | [
"class v0(dict):\n\n def v1(self, v2):\n return self[v2]\n\n def v3(self, v4, v5):\n self[v4] = v5\n\n def v6(self) -> 'Namespace':\n \"\"\"\n Make a deepcopy of this namespace, but only copy values with type\n ``Namespace|list|dict``.\n \"\"\"\n v7 = self._... |
v0 | [] | 'Namespace' | def v0(self) -> 'Namespace':
v1 = self.__class__()
for (v2, v3) in self.items():
if isinstance(v3, (self.__class__, list, dict)):
v3 = v3.copy()
v1[v2] = v3
return v1 | [] | [] | [] | 7 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | null |
v0 | [] | 'Namespace' | def v0(self) -> 'Namespace':
v1 = self.__class__()
for (v2, v3) in self.items():
if isinstance(v3, (tuple, list)):
v3 = ':'.join(v3)
elif isinstance(v3, self.__class__):
v3 = v3.join_paths()
v1[v2] = str(v3)
return v1 | [] | [] | [] | 9 | import os
import sys
import subprocess
import shlex
import io
import threading
import select
import inspect
import functools
import shutil
import argparse
import csv
import re
from collections import OrderedDict
from typing import Union, List, Dict, Iterable, Optional, Callable, Any
from urllib.request import urlretrie... | null |
v0 | [
"tf.Tensor",
"tf.Tensor"
] | tf.Tensor | def v0(v1: tf.Tensor, v2: tf.Tensor) -> tf.Tensor:
assert len(v1.shape) == 5, f'y_mask should be of rank 5 but got {len(v1.shape)} with shape as {v1.shape}'
assert len(v2.shape) == 5, f'y_pred should be of rank 5 but got {len(v2.shape)} with shape as {v2.shape}'
v3 = 1e-15
v2 = tf.cast(tf.math.greater(v... | [] | [
"tensorflow"
] | [
"import tensorflow as tf"
] | 10 | '''
The following scripts contains various Metric evaluation function
to compute the performance of Multi-class 3D-segmentation.
1. Dice Coef
2. Dice Coef for Multi-Class
3. IoU measure
4. IoU measure for Multi-Class
5. Precision
6. Recall
=================================LICENSE====================================
M... | null |
v0 | [
"tf.Tensor",
"tf.Tensor"
] | tf.Tensor | def v0(v1: tf.Tensor, v2: tf.Tensor) -> tf.Tensor:
assert len(v1.shape) == 5, f'y_mask should be of rank 5 but got {len(v1.shape)} with shape as {v1.shape}'
assert len(v2.shape) == 5, f'y_pred should be of rank 5 but got {len(v2.shape)} with shape as {v2.shape}'
v2 = tf.cast(tf.greater(v2, 0.5), dtype=tf.fl... | [] | [
"tensorflow"
] | [
"import tensorflow as tf"
] | 9 | '''
The following scripts contains various Metric evaluation function
to compute the performance of Multi-class 3D-segmentation.
1. Dice Coef
2. Dice Coef for Multi-Class
3. IoU measure
4. IoU measure for Multi-Class
5. Precision
6. Recall
=================================LICENSE====================================
M... | null |
v0 | [
"str"
] | Any | def v0(v1: str):
v2 = []
v3 = False
for v4 in range(len(v1)):
v5 = v1[v4]
if v3:
v3 = False
elif v5 == '\\\\':
v3 = True
elif v5 == '*':
v2.append(v4)
v6 = []
v7 = 0
for v4 in v2:
v6.append(v1[v7:v4])
v7 = v4 + 1... | [] | [
"shlex"
] | [
"import shlex"
] | 18 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str"
] | Any | def v0(v1: str):
if not v1 or ' ' not in v1:
return v1
v2 = len(v1)
if v2 == 1:
return '\\ ' if v1 == ' ' else v1
v3 = ''
if v1[0] == ' ':
v3 = '\\'
for v4 in range(v2 - 1):
if v1[v4] != '\\' and v1[v4 + 1] == ' ':
v3 += v1[v4] + '\\'
else:
... | [] | [] | [] | 16 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str",
"bool"
] | Any | def v0(v1: str, v2: bool=True):
if v2:
v3 = 'a'
v4 = 'an'
else:
v3 = 'A'
v4 = 'An'
if v1[0].lower() in ['a', 'e', 'i', 'o', 'u']:
return v4
else:
return v3 | [] | [] | [] | 11 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v16 | [
"str"
] | Any | def v16(self, v17: str):
if self.glob_able:
v18 = v8(self.cmd_string % v0(v17), ignore_rc=self.ignore_rc, ignore_stderr=self.ignore_stderr)
return self.fn(v17, v18)
else:
raise ValueError(f'Pattern search not allowed for "{self.cmd_name}".') | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "Any",
"code": "def v0(v1: str):\n v2 = []\n v3 = False\n for v4 in range(len(v1)):\n v5 = v1[v4]\n if v3:\n v3 = False\n elif v5 == '\\\\\\\\':\n v3 = True\n elif v5 == '*':... | [
"shlex",
"subprocess",
"typing"
] | [
"import subprocess",
"import shlex",
"from typing import Pattern, Union, Iterable, Any"
] | 6 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str"
] | Any | def v0(self, v1: str):
if v1.startswith('###') and v1.endswith('###'):
self._mode_ = v1.strip('# ').lower()
else:
if self._mode_ is None:
raise ValueError(v1)
if len(v1.strip()) > 0:
self._cmd_parser_[self._mode_](v1) | [] | [] | [] | 8 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v5 | [
"str",
"str"
] | Any | def v5(v6: str, v7: str):
v8 = []
v9 = v7.splitlines()
for v10 in v9:
v11 = re.search('^([^:]*):\\s+(.*)$', v10)
if v11:
v12 = v11.group(1)
v13 = v11.group(2)
v14 = v0(v13)
if 'No such file or directory' in v13:
pass
... | [
{
"name": "v0",
"input_types": [
"str",
"bool"
],
"output_type": "Any",
"code": "def v0(v1: str, v2: bool=True):\n if v2:\n v3 = 'a'\n v4 = 'an'\n else:\n v3 = 'A'\n v4 = 'An'\n if v1[0].lower() in ['a', 'e', 'i', 'o', 'u']:\n return v4\n ... | [
"re"
] | [
"import re"
] | 16 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str",
"str"
] | Any | def v0(v1: str, v2: str):
v3 = []
v4 = v2.splitlines()
if v4:
v5 = v4[0].find('Filesystem')
v6 = v4[0].find('Type')
for v7 in v4[1:]:
v8 = v7[:v5].strip()
v9 = v7[v5:v6].strip()
v10 = v7[v6:].strip()
v3.append(f'{v8} is on filesystem {v... | [] | [] | [] | 12 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str",
"str"
] | Any | def v0(v1: str, v2: str):
v3 = []
for v4 in v2.splitlines():
v3.append(f'{v1} is the command {v4}.')
return v3 | [] | [] | [] | 5 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str",
"str"
] | Any | def v0(v1: str, v2: str):
if v1.strip() == '' or v2 in ['', 'dir', '*manpages*']:
return []
if os.path.abspath(v1) == os.path.abspath(v2):
return []
return [f'{v1} has an info page.'] | [] | [
"os"
] | [
"import os"
] | 6 | #!/usr/bin/env python3
# ***************************************************************************
# Copyright 2020 Pete DiMarco
#
# 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... | null |
v0 | [
"str",
"str",
"bool",
"bool",
"bool",
"bool",
"bool",
"bool",
"bool",
"list",
"bool",
"float",
"Any",
"int",
"int",
"bool"
] | np.ndarray | def v0(self, v1: str=None, v2: str=None, v3: bool=False, v4: bool=True, v5: bool=False, v6: bool=True, v7: bool=True, v8: bool=True, v9: bool=True, v10: list=None, v11: bool=True, v12: float=0.3, v13=None, v14: int=None, v15: int=None, v16: bool=False) -> np.ndarray:
if v13 is None:
v13 = []
v17 = v1.co... | [] | [] | [] | 17 | # from __future__ import annotations
import json
import os
import sys
import timeit
from datetime import datetime
from functools import partial
from shutil import Error
from sys import exit as x
from typing import List, Union
import cv2
import jaitool.inference.d2_infer
import numpy as np
import pandas as pd
import pr... | null |
v5 | [
"str"
] | bool | def v5(v6: str) -> bool:
try:
return all((len(str(int(v6))) == 6, any((ln >= 2 for (v7, v8) in v0(v6))), all((x <= y for (v9, v10) in zip(v6, v6[1:])))))
except (ValueError, IndexError):
return False | [
{
"name": "v0",
"input_types": [
"str"
],
"output_type": "Iterable[Tuple[str, int]]",
"code": "def v0(v1: str) -> Iterable[Tuple[str, int]]:\n return ((x, sum((1 for v2 in y))) for (v3, v4) in groupby(v1))",
"dependencies": []
}
] | [
"itertools"
] | [
"from itertools import groupby"
] | 5 | """
--- Day 4: Secure Container ---
"""
import logging
from dataclasses import dataclass, field
from itertools import groupby
from numbers import Number
from typing import Tuple, Iterable, List, NoReturn, Dict
from aoc.day_04.seed import p1
def rle(data: str) -> Iterable[Tuple[str, int]]:
"""Returns run-lengthh-e... | null |
v0 | [
"dict"
] | Any | def v0(self, v1: dict=None):
v2 = {'Content-Type': 'application/json'}
v3 = requests.request('GET', self.url, headers=v2, data='')
try:
v4 = json.loads(v3.text)
except:
v4 = {}
(v5, v6) = ({}, {})
if v1:
for v7 in v4.keys():
if v7 in v1.keys():
... | [] | [
"json",
"requests"
] | [
"import requests",
"import json"
] | 19 | import requests
import json
from . import PyPantry
class PyPantryBasket:
def __init__(self, pantry:PyPantry, basket:str):
self.url = pantry.url+f"/basket/{basket}"
def find(self, query:dict=None):
headers = {
'Content-Type': 'application/json'
}
response = reque... | null |
v0 | [
"str",
"Any"
] | Any | def v0(self, v1: str, v2):
v3 = self.find()
v3[v1] = v2
v4 = json.dumps(v3)
v5 = {'Content-Type': 'application/json'}
v6 = requests.request('POST', self.url, headers=v5, data=v4) | [] | [
"json",
"requests"
] | [
"import requests",
"import json"
] | 6 | import requests
import json
from . import PyPantry
class PyPantryBasket:
def __init__(self, pantry:PyPantry, basket:str):
self.url = pantry.url+f"/basket/{basket}"
def find(self, query:dict=None):
headers = {
'Content-Type': 'application/json'
}
response = reque... | null |
v2 | [
"np.float"
] | Callable[[np.float], np.float] | def v2(v3: np.float) -> Callable[[np.float], np.float]:
v4 = v3 * v3
def v5(v6):
return math.exp(-v6 / v4)
return v5 | [
{
"name": "v0",
"input_types": [
"Any"
],
"output_type": "Any",
"code": "def v0(v1):\n return math.exp(-v1 / sigma_squared)",
"dependencies": []
}
] | [
"math"
] | [
"import math"
] | 6 | """
Provide similarity metrics as described in the paper
'A New Approach to Data-Driven Clustering'
Functions provided here should be non-negative, monotonically
decreasing functions
"""
import math
import numpy as np
from typing import Callable
def make_gaussian_similarity(sigma: np.float) -> Callable[[np.float],... | null |
v7 | [
"np.ndarray",
"np.float"
] | Callable[[np.float], np.float] | def v7(v8: np.ndarray, v9: np.float) -> Callable[[np.float], np.float]:
v10 = np.percentile(v8, v9)
return v2(v10) | [
{
"name": "v0",
"input_types": [
"Any"
],
"output_type": "Any",
"code": "def v0(v1):\n return math.exp(-v1 / sigma_squared)",
"dependencies": []
},
{
"name": "v2",
"input_types": [
"np.float"
],
"output_type": "Callable[[np.float], np.float]",
"code": "... | [
"math",
"numpy"
] | [
"import math",
"import numpy as np"
] | 3 | """
Provide similarity metrics as described in the paper
'A New Approach to Data-Driven Clustering'
Functions provided here should be non-negative, monotonically
decreasing functions
"""
import math
import numpy as np
from typing import Callable
def make_gaussian_similarity(sigma: np.float) -> Callable[[np.float],... | null |
v0 | [
"Any"
] | list | def v0(self, v1) -> list:
v2 = []
v3 = ['ANALYSIS', 'CALIBRATION', 'IRRADIANCE', 'RADIANCE']
for v4 in '12345678':
for v5 in v3:
v6 = f'BAND{v4}_{v5}'
if v6 in self.fid:
v7 = self.fid[v6]
v2 += [s for v8 in v7 if v8.startswith(v1)]
return l... | [] | [] | [] | 10 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"str",
"Any"
] | str | def v0(self, v1: str, v2=None) -> str:
self.bands = ''
self.__msm_path = None
if v2 is None:
v3 = ['ANALYSIS', 'CALIBRATION', 'IRRADIANCE', 'RADIANCE']
for v4 in '12345678':
for v5 in v3:
v6 = PurePosixPath(f'BAND{v4}_{v5}', v1)
if str(v6) in self.... | [] | [
"pathlib"
] | [
"from pathlib import Path, PurePosixPath"
] | 21 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any"
] | datetime | def v0(self, v1=None) -> datetime:
v2 = datetime(2010, 1, 1, 0, 0, 0)
if not self.__msm_path:
return v2
if v1 is None:
v1 = self.bands[0]
elif v1 not in self.bands:
raise ValueError('band not found in product')
v3 = str(self.__msm_path).replace('%', v1)
v4 = self.__msm_pa... | [] | [
"datetime",
"pathlib"
] | [
"from datetime import datetime, timedelta",
"from pathlib import Path, PurePosixPath"
] | 32 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any"
] | np.ndarray | def v0(self, v1=None) -> np.ndarray:
if not self.__msm_path:
return None
if v1 is None:
v1 = self.bands[0]
elif v1 not in self.bands:
raise ValueError('band not found in product')
v2 = str(self.__msm_path).replace('%', v1)
v3 = self.__msm_path.name
v4 = None
if v3 in ... | [] | [
"numpy",
"pathlib"
] | [
"from pathlib import Path, PurePosixPath",
"import numpy as np"
] | 45 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any"
] | list | def v0(self, v1=None) -> list:
if v1 is None:
v1 = self.bands[0]
elif v1 not in self.bands:
raise ValueError('band not found in product')
v2 = self.get_instrument_settings(v1)
if v2 is None:
return None
v3 = []
for v4 in v2:
if int(v1) > 6:
v3.append(1... | [] | [] | [] | 15 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any",
"Any"
] | None | def v0(self, v1, v2=None) -> None:
if not self.__rw:
raise PermissionError('read/write access required')
if not self.__msm_path:
return
if v2 is None:
v2 = self.bands[0]
elif v2 not in self.bands:
raise ValueError('band not found in product')
v3 = str(self.__msm_path)... | [] | [
"pathlib"
] | [
"from pathlib import Path, PurePosixPath"
] | 19 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any",
"Any",
"Any"
] | None | def v0(self, v1, v2, v3='78') -> None:
v4 = float.fromhex('0x1.ep+122')
if not self.__rw:
raise PermissionError('read/write access required')
if not self.__msm_path:
return
if not isinstance(v3, str):
raise TypeError('band must be a string')
if v3 not in self.bands:
r... | [] | [
"numpy",
"pathlib"
] | [
"from pathlib import Path, PurePosixPath",
"import numpy as np"
] | 53 | """
This file is part of pyS5p
https://github.com/rmvanhees/pys5p.git
The class ICMio provides read access to S5p Tropomi ICM_CA_SIR products
Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
from datetime import datetime, timedelta
from pathli... | null |
v0 | [
"Any",
"Any",
"Any",
"Any"
] | Dict | async def v0(self, v1, v2, v3=False, v4=BaseClient.PUBLIC_API_VERSION, **v5) -> Dict:
v6 = self._create_api_uri(v2, v3, v4)
return await self._request(v1, v6, v3, **v5) | [] | [] | [] | 3 | from typing import Dict, Optional, List, Tuple
import aiohttp
import asyncio
import hashlib
import hmac
import requests
import time
from operator import itemgetter
from urllib.parse import urlencode
from .helpers import interval_to_milliseconds, convert_ts_str
from .exceptions import BinanceAPIException, BinanceRequ... | null |
v0 | [] | None | def v0(self) -> None:
self._widget.swapBuffers()
self.set_default_viewport()
self._app.processEvents()
self._frames += 1 | [] | [] | [] | 5 | from typing import Tuple
from PySide2 import QtCore, QtOpenGL, QtWidgets
from moderngl_window.context.base import BaseWindow
from moderngl_window.context.pyside2.keys import Keys
class Window(BaseWindow):
"""
A basic window implementation using PySide2 with the goal of
creating an OpenGL contex... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
(v2, v3) = (v1.x(), v1.y())
(v4, v5) = self._calc_mouse_delta(v2, v3)
if self.mouse_states.any:
self._mouse_drag_event_func(v2, v3, v4, v5)
else:
self._mouse_position_event_func(v2, v3, v4, v5) | [] | [] | [] | 7 | from typing import Tuple
from PySide2 import QtCore, QtOpenGL, QtWidgets
from moderngl_window.context.base import BaseWindow
from moderngl_window.context.pyside2.keys import Keys
class Window(BaseWindow):
"""
A basic window implementation using PySide2 with the goal of
creating an OpenGL contex... | null |
v0 | [
"Any"
] | None | def v0(self, v1) -> None:
v2 = self._mouse_button_map.get(v1.button())
if v2 is None:
return
self._handle_mouse_button_state_change(v2, False)
self.mouse_release_event_func(v1.x(), v1.y(), v2) | [] | [] | [] | 6 | from typing import Tuple
from PySide2 import QtCore, QtOpenGL, QtWidgets
from moderngl_window.context.base import BaseWindow
from moderngl_window.context.pyside2.keys import Keys
class Window(BaseWindow):
"""
A basic window implementation using PySide2 with the goal of
creating an OpenGL contex... | null |
v0 | [] | int | def v0(self) -> int:
if self.user_timeout:
return self.user_timeout
elif self.kp_name == 'RTX-KG2':
return 600
else:
return 120 | [] | [] | [] | 7 | #!/bin/env python3
import concurrent
import copy
import json
import sys
import os
import time
import aiohttp
import requests
from typing import List, Dict, Set, Union, Optional
import requests_cache
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import Expand.expand_utilities as eu
from Expand.expand_ut... | null |
v0 | [
"Collection[str]",
"bool"
] | Mapping[str, int] | async def v0(self, v1: Collection[str], v2: bool=True) -> Mapping[str, int]:
if v2:
await self._partial_state_events_tracker.await_full_state(v1)
return await self.stores.main._get_state_group_for_events(v1) | [] | [] | [] | 4 | # Copyright 2014-2016 OpenMarket Ltd
# Copyright 2022 The Matrix.org Foundation C.I.C.
#
# 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
#
# U... | null |
v0 | [
"pathlib.Path"
] | Dict[str, str] | def v0(v1: pathlib.Path) -> Dict[str, str]:
v2 = tarfile.open(mode='r|*', fileobj=v1.open('rb'))
v3 = hashlib.sha256()
v4 = {}
for v5 in v2:
if not v5.isfile():
continue
v6 = v2.extractfile(v5)
v4[v5.name] = v6.read()
return v4 | [] | [
"hashlib",
"tarfile"
] | [
"import hashlib",
"import tarfile"
] | 10 | #!/usr/bin/env python
import difflib
import hashlib
import os
import pathlib
import re
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
from urllib.request import urlopen
import zipfile
import click
import git
import pkg_resources
import yaml
from dataclasses import dataclass, fiel... | null |
v0 | [
"Dict[str, str]",
"Dict[str, str]"
] | bool | def v0(v1: Dict[str, str], v2: Dict[str, str]) -> bool:
if len(v1.keys()) != len(v1.keys()):
print('number of contents is not same')
print(v1.keys())
print(v2.keys())
return False
for v3 in v1.keys():
if v3 not in v2:
print(f'file does not exist: {v3}')
... | [] | [
"difflib"
] | [
"import difflib"
] | 16 | #!/usr/bin/env python
import difflib
import hashlib
import os
import pathlib
import re
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
from urllib.request import urlopen
import zipfile
import click
import git
import pkg_resources
import yaml
from dataclasses import dataclass, fiel... | null |
v54 | [
"pathlib.Path",
"pathlib.Path",
"pathlib.Path",
"bool",
"Optional[str]"
] | None | def v54(v55: pathlib.Path, v56: pathlib.Path, v57: pathlib.Path, v58: bool, v59: Optional[str]=None) -> None:
v60 = v57.name
v61 = v55 / v60
shutil.rmtree(v61, ignore_errors=True)
def v62(v63, v64):
os.makedirs(v64)
v65 = os.listdir(v63)
for v66 in v65:
v67 = os.path... | [
{
"name": "v0",
"input_types": [
"pathlib.Path",
"pathlib.Path",
"bool",
"Optional[str]",
"Optional[str]",
"List[str]",
"List[str]",
"bool",
"bool"
],
"output_type": "None",
"code": "def v0(v1: pathlib.Path, v2: pathlib.Path, v3: bool=False, ... | [
"difflib",
"hashlib",
"os",
"re",
"shutil",
"stat",
"subprocess",
"sys",
"tarfile"
] | [
"import difflib",
"import hashlib",
"import os",
"import re",
"import shutil",
"import stat",
"import subprocess",
"import sys",
"import tarfile"
] | 21 | #!/usr/bin/env python
import difflib
import hashlib
import os
import pathlib
import re
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
from urllib.request import urlopen
import zipfile
import click
import git
import pkg_resources
import yaml
from dataclasses import dataclass, fiel... | null |
v0 | [] | None | def v0(self) -> None:
self.image_tool_widget.show()
self.app.exec_() | [] | [] | [] | 3 | """
A general tool for plotting, slicing, and analyzing xarray DataArrays.
"""
# ----------------------------------------------------------------------------------
import numpy as np
import pyqtgraph as pg
from pyqtgraph import dockarea, QtGui
import xarray as xr
# ---------------------------------------------------... | null |
v0 | [] | None | async def v0(self) -> None:
self._status.set_stopping()
self.logger.info('Closing %s connection to %s', self.name, self.dst)
await self._close_connection()
await super().close()
await self.protocol_factory.close()
self._status.set_stopped() | [] | [] | [] | 7 | from abc import abstractmethod
import asyncio
from dataclasses import dataclass, field, replace
from pathlib import Path
from typing import Tuple, Sequence, AnyStr
from aionetworking.compatibility import Protocol
from aionetworking.logging.loggers import get_logger_sender
from aionetworking.types.logging import Logge... | null |
v0 | [] | None | async def v0(self) -> None:
if self.conn and self.transport:
await self.conn.wait_current_tasks()
self.transport.close()
await self.conn.wait_closed()
self.transport = None | [] | [] | [] | 6 | from abc import abstractmethod
import asyncio
from dataclasses import dataclass, field, replace
from pathlib import Path
from typing import Tuple, Sequence, AnyStr
from aionetworking.compatibility import Protocol
from aionetworking.logging.loggers import get_logger_sender
from aionetworking.types.logging import Logge... | null |
v0 | [] | None | async def v0(self) -> None:
if not self._status.is_stopping_or_stopped():
self.logger.info('%s connection to %s was closed on the other end', self.name, self.dst)
self._status.set_stopping()
await self.protocol_factory.close()
self._status.set_stopped() | [] | [] | [] | 6 | from abc import abstractmethod
import asyncio
from dataclasses import dataclass, field, replace
from pathlib import Path
from typing import Tuple, Sequence, AnyStr
from aionetworking.compatibility import Protocol
from aionetworking.logging.loggers import get_logger_sender
from aionetworking.types.logging import Logge... | null |
v3 | [] | None | def v3(self) -> None:
self.patchConnectionCallable('Connection')
v0(None)
self.assertEqual(self.connections, [':memory:']) | [
{
"name": "v0",
"input_types": [
"Optional[str]"
],
"output_type": "Connection",
"code": "def v0(v1: Optional[str]) -> Connection:\n if v1 is None:\n v1 = ':memory:'\n v2 = ErrneousSQLiteConnection(v1)\n return v2",
"dependencies": []
}
] | [] | [] | 4 | """
Tests for :mod:`ranger-ims-server.ext.sqlite`
"""
from contextlib import contextmanager
from io import StringIO
from pathlib import Path
from sqlite3 import Error as SQLiteError
from textwrap import dedent
from typing import Any, Iterator, Mapping, Optional, Union, cast
from .. import sqlite
from ..sqlite import ... | null |
v0 | [] | argparse.Namespace | def v0() -> argparse.Namespace:
v1 = argparse.ArgumentParser(description='Test Interoperability of DSSs')
v1.add_argument('--auth', help='Auth spec for obtaining authorization to DSS instances; see README.md')
v1.add_argument('DSS', help='List of URIs to DSS Servers. At least 2 DSSs', nargs='+')
return ... | [] | [
"argparse"
] | [
"import argparse"
] | 5 | #!env/bin/python3
import os
import sys
import argparse
from typing import Dict
from monitoring.monitorlib import auth, infrastructure
from monitoring.interoperability.interop_test_suite import InterOpTestSuite
def parseArgs() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Test Interoperabi... | null |
v3 | [
"np.ndarray"
] | np.ndarray | def v3(self, v4: np.ndarray) -> np.ndarray:
for v5 in range(len(self.biases)):
v6 = []
v7 = self.biases[v5]
v8 = self.weights[v5]
for v9 in range(len(v7)):
v10 = v7[v9]
v11 = v8[v9]
v6.append(v0(v11 @ v4 + v10))
v4 = np.array(v6)
return... | [
{
"name": "v0",
"input_types": [
"np.ndarray",
"bool"
],
"output_type": "np.ndarray",
"code": "def v0(v1: np.ndarray, v2: bool=False) -> np.ndarray:\n if v2:\n return v0(v1) * (1 - v0(v1))\n return 1 / (1 + np.exp(-v1))",
"dependencies": []
}
] | [
"numpy"
] | [
"import numpy as np"
] | 11 | """
Fully connected feedforward neural network
"""
from typing import List, Tuple
import numpy as np
import mnist_loader
import random
def sigmoid(x: np.ndarray, derivative: bool = False) -> np.ndarray:
"""
The sigmoid function which is given by
1/(1+exp(-x))
Where x is a number or np vector. if der... | null |
v4 | [
"list",
"float",
"int",
"int"
] | None | def v4(self, v5: list, v6: float, v7: int=1, v8: int=10) -> None:
v5 = v5[:]
for v9 in range(v7):
print(f'\n Epoch: {v9 + 1}/{v7}', end='')
random.shuffle(v5)
v10 = v0(v5, v8)
for v11 in v10:
self.backprop(v11, v6)
print()
print('\n Process complete') | [
{
"name": "v0",
"input_types": [
"Any",
"Any"
],
"output_type": "Any",
"code": "def v0(v1, v2):\n try:\n assert float(v2) % 1 == 0, 'n is not a whole number'\n except ValueError:\n 'Make sure n is a whole number'\n assert isinstance(v1, list), 'Make sure that l... | [
"random"
] | [
"import random"
] | 10 | """
Fully connected feedforward neural network
"""
from typing import List, Tuple
import numpy as np
import mnist_loader
import random
def sigmoid(x: np.ndarray, derivative: bool = False) -> np.ndarray:
"""
The sigmoid function which is given by
1/(1+exp(-x))
Where x is a number or np vector. if der... | null |
v3 | [
"Any",
"float"
] | None | def v3(self, v4, v5: float) -> None:
v6 = [np.zeros(bias.shape) for v7 in self.biases]
v8 = [np.zeros(weight.shape) for v9 in self.weights]
for (v10, v11) in v4:
v12 = [np.zeros(b.shape) for v13 in self.biases]
v14 = [np.zeros(w.shape) for v15 in self.weights]
v16 = v10
v17 =... | [
{
"name": "v0",
"input_types": [
"np.ndarray",
"bool"
],
"output_type": "np.ndarray",
"code": "def v0(v1: np.ndarray, v2: bool=False) -> np.ndarray:\n if v2:\n return v0(v1) * (1 - v0(v1))\n return 1 / (1 + np.exp(-v1))",
"dependencies": []
}
] | [
"numpy"
] | [
"import numpy as np"
] | 29 | """
Fully connected feedforward neural network
"""
from typing import List, Tuple
import numpy as np
import mnist_loader
import random
def sigmoid(x: np.ndarray, derivative: bool = False) -> np.ndarray:
"""
The sigmoid function which is given by
1/(1+exp(-x))
Where x is a number or np vector. if der... | null |
v0 | [
"list"
] | Tuple[int, int] | def v0(self, v1: list) -> Tuple[int, int]:
v2 = np.array([(np.argmax(self.forward(pixels)), answer) for (v3, v4) in v1])
v5 = sum(v2[:, 0] == v2[:, 1])
return (v5, len(v2)) | [] | [
"numpy"
] | [
"import numpy as np"
] | 4 | """
Fully connected feedforward neural network
"""
from typing import List, Tuple
import numpy as np
import mnist_loader
import random
def sigmoid(x: np.ndarray, derivative: bool = False) -> np.ndarray:
"""
The sigmoid function which is given by
1/(1+exp(-x))
Where x is a number or np vector. if der... | null |
v0 | [
"common.CodeDisplay",
"str",
"int"
] | Any | def v0(self, v1: common.CodeDisplay, v2: str, v3: int):
v4 = random.uniform(0, 1)
if v2 == 'Initial' or v2 == 'Terminal':
v5 = v2
else:
v5 = f'{v2}_{v3}'
self.base_template['states'][v5] = {'type': v2, 'name': v5, 'distributed_transition': [{'transition': v1.name, 'distribution': v4}, {'... | [] | [
"random"
] | [
"import random"
] | 7 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | null |
v0 | [] | None | def v0(self) -> None:
v1 = self.example_email('hamlet')
self.login(v1)
v2 = self.client_patch('/json/settings', dict(full_name='Opheli*'))
self.assert_json_error(v2, 'Invalid characters in name!') | [] | [] | [] | 5 |
import ujson
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict
from zerver.lib.initial_password import initial_password
from zerver.lib.sessions import get_session_dict_user
from zerver.lib.test_classes import ZulipTestCase
from zerver.... | null |
v0 | [] | None | def v0(self) -> None:
v1 = self.example_user('hamlet')
v2 = v1.email
self.login(v2)
v3 = v1.api_key
v4 = self.client_post('/json/users/me/api_key/regenerate')
self.assert_json_success(v4)
v5 = v4.json()['api_key']
self.assertNotEqual(v3, v5)
v1 = self.example_user('hamlet')
self.... | [] | [] | [] | 11 |
import ujson
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict
from zerver.lib.initial_password import initial_password
from zerver.lib.sessions import get_session_dict_user
from zerver.lib.test_classes import ZulipTestCase
from zerver.... | null |
v0 | [
"Any",
"Any",
"str"
] | Any | def v0(v1, v2, v3: str):
v4 = v3.splitlines()
v5 = -1
v6 = -1
v7 = -1
v8 = False
for (v9, v10) in enumerate(v4):
v11 = False
v12 = False
v13 = False
if v10.find('kernel id') != -1:
v5 += 1
v7 = -1
elif v10.find('array id:') != -1:
... | [] | [] | [] | 35 | from collections import namedtuple
import subprocess
import os
import sys
from test_cases import Test
from utils import pipe_read
class ValuePatternTest(Test):
Config = namedtuple('Config', ['files', 'op_counts', 'kernel_patterns'])
def __init__(self, arch):
super().__init__('ValuePatternTest', arch... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.