blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
a45685fda5adf543b9fbe358ebe0f2259e1f230e
[ "result = {}\ndpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx')\nfor line in dpkg_grep_nginx_out:\n gwe = re.match(self.dpkg_l_re, line)\n if gwe:\n if gwe.group(2).startswith('nginx'):\n result[gwe.group(2)] = gwe.group(3)\nreturn result", "package_name = None\ndpkg_s_nginx_out, ...
<|body_start_0|> result = {} dpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx') for line in dpkg_grep_nginx_out: gwe = re.match(self.dpkg_l_re, line) if gwe: if gwe.group(2).startswith('nginx'): result[gwe.group(2)] = gwe.group(...
Redefines package search method
NginxDebianMetaCollector
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" <|body_0|> def find_packages(self, meta): """Find a package with running binary""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_004200
1,998
permissive
[ { "docstring": "trying to find some installed packages", "name": "installed_nginx_packages", "signature": "def installed_nginx_packages(self)" }, { "docstring": "Find a package with running binary", "name": "find_packages", "signature": "def find_packages(self, meta)" } ]
2
stack_v2_sparse_classes_30k_train_003754
Implement the Python class `NginxDebianMetaCollector` described below. Class description: Redefines package search method Method signatures and docstrings: - def installed_nginx_packages(self): trying to find some installed packages - def find_packages(self, meta): Find a package with running binary
Implement the Python class `NginxDebianMetaCollector` described below. Class description: Redefines package search method Method signatures and docstrings: - def installed_nginx_packages(self): trying to find some installed packages - def find_packages(self, meta): Find a package with running binary <|skeleton|> cla...
66d15b16302ea81ac927f0c0dc41d66e47f482f3
<|skeleton|> class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" <|body_0|> def find_packages(self, meta): """Find a package with running binary""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NginxDebianMetaCollector: """Redefines package search method""" def installed_nginx_packages(self): """trying to find some installed packages""" result = {} dpkg_grep_nginx_out, _ = subp.call('dpkg -l | grep nginx') for line in dpkg_grep_nginx_out: gwe = re.mat...
the_stack_v2_python_sparse
amplify/agent/containers/nginx/collectors/meta/deb.py
heartshare/nginx-amplify-agent
train
0
488451854a3c0df8eaf4c34fbf79defc064719fc
[ "self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir)\nself.task = 'data2text'\nself.dimensions = ['naturalness', 'informativeness']", "n_data = len(data)\neval_scores = [{} for _ in ra...
<|body_start_0|> self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, device=device, cache_dir=cache_dir) self.task = 'data2text' self.dimensions = ['naturalness', 'informativeness'] <|end_body_0|> <|bo...
D2tEvaluator
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class D2tEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for data-to-text""" <|body_0|> def evaluate(self, data, category, dims=None, overall=True): """Get the scores of all the given dimensions categ...
stack_v2_sparse_classes_10k_train_004201
14,573
permissive
[ { "docstring": "Set up evaluator for data-to-text", "name": "__init__", "signature": "def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None)" }, { "docstring": "Get the scores of all the given dimensions category: The category to be evaluated. dims: A list of di...
2
stack_v2_sparse_classes_30k_train_006451
Implement the Python class `D2tEvaluator` described below. Class description: Implement the D2tEvaluator class. Method signatures and docstrings: - def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for data-to-text - def evaluate(self, data, category, dims=None...
Implement the Python class `D2tEvaluator` described below. Class description: Implement the D2tEvaluator class. Method signatures and docstrings: - def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): Set up evaluator for data-to-text - def evaluate(self, data, category, dims=None...
c7b60f75470f067d1342705708810a660eabd684
<|skeleton|> class D2tEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for data-to-text""" <|body_0|> def evaluate(self, data, category, dims=None, overall=True): """Get the scores of all the given dimensions categ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class D2tEvaluator: def __init__(self, model_name_or_path, max_length=1024, device='cuda:0', cache_dir=None): """Set up evaluator for data-to-text""" self.scorer = UniEvaluator(model_name_or_path='MingZhong/unieval-sum' if model_name_or_path == '' else model_name_or_path, max_length=max_length, devi...
the_stack_v2_python_sparse
applications/Chat/evaluate/unieval/evaluator.py
hpcaitech/ColossalAI
train
32,044
cc2c825f163c75d6aba81cd1bfae822e20fd95ae
[ "queryset = obj.detalles_entrada.all()\nif self.context['fecha_inicio']:\n queryset = queryset.filter(entrada__fecha__gte=self.context['fecha_inicio'])\nif self.context['fecha_fin']:\n queryset = queryset.filter(entrada__fecha__lte=self.context['fecha_fin'])\nreturn queryset.count()", "queryset = obj.detall...
<|body_start_0|> queryset = obj.detalles_entrada.all() if self.context['fecha_inicio']: queryset = queryset.filter(entrada__fecha__gte=self.context['fecha_inicio']) if self.context['fecha_fin']: queryset = queryset.filter(entrada__fecha__lte=self.context['fecha_fin']) ...
EquipoSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" ...
stack_v2_sparse_classes_10k_train_004202
4,844
no_license
[ { "docstring": "Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int", "name": "get_cantidad_entrada", "signature": "def get_cantidad...
4
null
Implement the Python class `EquipoSerializer` described below. Class description: Implement the EquipoSerializer class. Method signatures and docstrings: - def get_cantidad_entrada(self, obj): Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado p...
Implement the Python class `EquipoSerializer` described below. Class description: Implement the EquipoSerializer class. Method signatures and docstrings: - def get_cantidad_entrada(self, obj): Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado p...
0e37786d7173abe820fd10b094ffcc2db9593a9c
<|skeleton|> class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" queryset ...
the_stack_v2_python_sparse
src/apps/kardex/serializers.py
jinchuika/app-suni
train
7
6d3c93b85ed0c36b6601883d68679eceb36fed26
[ "if not nums:\n return self.res\nself.holes = [None] * len(nums)\nself.dfs(nums, 0, 0)\nreturn self.res", "if idx == len(nums):\n self.res.append(self.holes.copy())\n return\nfor i in range(0, len(nums)):\n if not state >> i & 1:\n self.holes[i] = nums[idx]\n self.dfs(nums, idx + 1, stat...
<|body_start_0|> if not nums: return self.res self.holes = [None] * len(nums) self.dfs(nums, 0, 0) return self.res <|end_body_0|> <|body_start_1|> if idx == len(nums): self.res.append(self.holes.copy()) return for i in range(0, len(num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permutation(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def dfs(self, nums, idx, state): """:param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:""" <|bod...
stack_v2_sparse_classes_10k_train_004203
1,244
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permutation", "signature": "def permutation(self, nums)" }, { "docstring": ":param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:", "name": "dfs", "signatur...
2
stack_v2_sparse_classes_30k_train_006829
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permutation(self, nums): :type nums: List[int] :rtype: List[List[int]] - def dfs(self, nums, idx, state): :param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permutation(self, nums): :type nums: List[int] :rtype: List[List[int]] - def dfs(self, nums, idx, state): :param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state:...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Solution: def permutation(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def dfs(self, nums, idx, state): """:param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def permutation(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" if not nums: return self.res self.holes = [None] * len(nums) self.dfs(nums, 0, 0) return self.res def dfs(self, nums, idx, state): """:param nums: 输入的数组 :...
the_stack_v2_python_sparse
jianzhi_offer/31_数字的全排列_无重复.py
ryanatgz/data_structure_and_algorithm
train
0
3141d9ca784492daaa725d83922d5a64712ac371
[ "self.share_param = share_param\nself.path_param = path_param\nself.write = write", "def wrapped_f(*args, **kwargs):\n from bioshareX.models import Share\n share = kwargs.get(self.share_param, None)\n if share:\n if not isinstance(kwargs[self.share_param], Share):\n try:\n ...
<|body_start_0|> self.share_param = share_param self.path_param = path_param self.write = write <|end_body_0|> <|body_start_1|> def wrapped_f(*args, **kwargs): from bioshareX.models import Share share = kwargs.get(self.share_param, None) if share: ...
safe_path_decorator
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class safe_path_decorator: def __init__(self, share_param='share', path_param='subpath', write=False): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator argumen...
stack_v2_sparse_classes_10k_train_004204
21,345
permissive
[ { "docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!", "name": "__init__", "signature": "def __init__(self, share_param='share', path_param='subpath', write=False)" }, { "docstring": "If there are decorator arguments, __call__() is only...
2
stack_v2_sparse_classes_30k_train_006294
Implement the Python class `safe_path_decorator` described below. Class description: Implement the safe_path_decorator class. Method signatures and docstrings: - def __init__(self, share_param='share', path_param='subpath', write=False): If there are decorator arguments, the function to be decorated is not passed to ...
Implement the Python class `safe_path_decorator` described below. Class description: Implement the safe_path_decorator class. Method signatures and docstrings: - def __init__(self, share_param='share', path_param='subpath', write=False): If there are decorator arguments, the function to be decorated is not passed to ...
03ad22c6ecd02c75b58234795c1c84736768d4af
<|skeleton|> class safe_path_decorator: def __init__(self, share_param='share', path_param='subpath', write=False): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" <|body_0|> def __call__(self, f): """If there are decorator argumen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class safe_path_decorator: def __init__(self, share_param='share', path_param='subpath', write=False): """If there are decorator arguments, the function to be decorated is not passed to the constructor!""" self.share_param = share_param self.path_param = path_param self.write = write...
the_stack_v2_python_sparse
bioshareX/utils.py
amschaal/bioshare
train
11
ccbe48d5b49a060038f846c1e0daf778fb293263
[ "hashmap = dict()\nfor x in nums:\n hashmap[x] = hashmap.get(x, 0) + 1\nresult = []\nfor k in hashmap:\n if hashmap[k] == 2:\n result.append(k)\nreturn result", "result = []\nfor i in range(len(nums)):\n index = abs(nums[i]) - 1\n if nums[index] < 0:\n result.append(abs(nums[i]))\n nu...
<|body_start_0|> hashmap = dict() for x in nums: hashmap[x] = hashmap.get(x, 0) + 1 result = [] for k in hashmap: if hashmap[k] == 2: result.append(k) return result <|end_body_0|> <|body_start_1|> result = [] for i in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" <|body_0|> def findDuplicates2(self, nums): """1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_004205
1,543
no_license
[ { "docstring": "哈希表 :param list[int] nums: :return: list[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" }, { "docstring": "1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]", "name": "findDuplicates2", "si...
2
stack_v2_sparse_classes_30k_train_002766
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): 哈希表 :param list[int] nums: :return: list[int] - def findDuplicates2(self, nums): 1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): 哈希表 :param list[int] nums: :return: list[int] - def findDuplicates2(self, nums): 1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" <|body_0|> def findDuplicates2(self, nums): """1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" hashmap = dict() for x in nums: hashmap[x] = hashmap.get(x, 0) + 1 result = [] for k in hashmap: if hashmap[k] == 2: result.append(k) ...
the_stack_v2_python_sparse
华为题库/数组中重复的数据.py
2226171237/Algorithmpractice
train
0
0bce5d590b96e434cd8aee7531a321bc648c1981
[ "self.graph = graph\nself.parent = dict()\nself.dag = self.graph.__class__(self.graph.v(), directed=True)\nfor node in self.graph.iternodes():\n self.dag.add_node(node)", "if source is not None:\n self._visit(source, pre_action, post_action)\nelse:\n for node in self.graph.iternodes():\n if node n...
<|body_start_0|> self.graph = graph self.parent = dict() self.dag = self.graph.__class__(self.graph.v(), directed=True) for node in self.graph.iternodes(): self.dag.add_node(node) <|end_body_0|> <|body_start_1|> if source is not None: self._visit(source, ...
Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.traversing.bfs import SimpleBFS >>> G = Graph(n=10, False) # an exe...
SimpleBFS
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleBFS: """Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.traversing.bfs import SimpleBF...
stack_v2_sparse_classes_10k_train_004206
6,370
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None, pre_action=None, post_action=None)" }, { "docstring": "Explore the conn...
4
stack_v2_sparse_classes_30k_test_000130
Implement the Python class `SimpleBFS` described below. Class description: Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from gra...
Implement the Python class `SimpleBFS` described below. Class description: Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from gra...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class SimpleBFS: """Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.traversing.bfs import SimpleBF...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimpleBFS: """Breadth-First Search. Attributes ---------- graph : input graph parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from graphtheory.traversing.bfs import SimpleBFS >>> G = Gra...
the_stack_v2_python_sparse
graphtheory/traversing/bfs.py
kgashok/graphs-dict
train
0
9f1bb1feaf46134c745b053a89994751f99fdc8d
[ "items = Balance.objects.filter(date__lt=date)\ntotal = sum((i.value for i in items))\nreturn total", "items = Balance.objects.filter(date__year=year, date__month=month)\ntotal = sum((i.value for i in items))\nreturn total" ]
<|body_start_0|> items = Balance.objects.filter(date__lt=date) total = sum((i.value for i in items)) return total <|end_body_0|> <|body_start_1|> items = Balance.objects.filter(date__year=year, date__month=month) total = sum((i.value for i in items)) return total <|end_b...
Balance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Balance: def total_balance_before(date): """Returns the total value until the date that was given.""" <|body_0|> def balance_from_month(year, month): """Returns the total value from the year and month that was given.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_004207
5,267
permissive
[ { "docstring": "Returns the total value until the date that was given.", "name": "total_balance_before", "signature": "def total_balance_before(date)" }, { "docstring": "Returns the total value from the year and month that was given.", "name": "balance_from_month", "signature": "def bala...
2
stack_v2_sparse_classes_30k_train_002779
Implement the Python class `Balance` described below. Class description: Implement the Balance class. Method signatures and docstrings: - def total_balance_before(date): Returns the total value until the date that was given. - def balance_from_month(year, month): Returns the total value from the year and month that w...
Implement the Python class `Balance` described below. Class description: Implement the Balance class. Method signatures and docstrings: - def total_balance_before(date): Returns the total value until the date that was given. - def balance_from_month(year, month): Returns the total value from the year and month that w...
2f46ba65fb0e376361ff47c86ea7a62c50b6c91b
<|skeleton|> class Balance: def total_balance_before(date): """Returns the total value until the date that was given.""" <|body_0|> def balance_from_month(year, month): """Returns the total value from the year and month that was given.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Balance: def total_balance_before(date): """Returns the total value until the date that was given.""" items = Balance.objects.filter(date__lt=date) total = sum((i.value for i in items)) return total def balance_from_month(year, month): """Returns the total value fr...
the_stack_v2_python_sparse
estofadora/statement/models.py
delete/estofadora
train
6
2d75c2ea0fe56e1d5d34af2e465f157258b9179f
[ "Camera.__init__(self)\nself._installation = installation\nself._camera = camera\nself._auth = auth\nself._attr_unique_id = f'{installation.contract} {camera.id}'\nself._attr_name = camera.description\nself._attr_device_info = DeviceInfo(name=f'Contract {installation.contract}', manufacturer='Prosegur', model='smar...
<|body_start_0|> Camera.__init__(self) self._installation = installation self._camera = camera self._auth = auth self._attr_unique_id = f'{installation.contract} {camera.id}' self._attr_name = camera.description self._attr_device_info = DeviceInfo(name=f'Contract ...
Representation of a Smart Prosegur Camera.
ProsegurCamera
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProsegurCamera: """Representation of a Smart Prosegur Camera.""" def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: """Initialize Prosegur Camera component.""" <|body_0|> async def async_camera_image(self, width: int | None=No...
stack_v2_sparse_classes_10k_train_004208
3,129
permissive
[ { "docstring": "Initialize Prosegur Camera component.", "name": "__init__", "signature": "def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None" }, { "docstring": "Return bytes of camera image.", "name": "async_camera_image", "signature": "async d...
3
stack_v2_sparse_classes_30k_train_000303
Implement the Python class `ProsegurCamera` described below. Class description: Representation of a Smart Prosegur Camera. Method signatures and docstrings: - def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: Initialize Prosegur Camera component. - async def async_camera_...
Implement the Python class `ProsegurCamera` described below. Class description: Representation of a Smart Prosegur Camera. Method signatures and docstrings: - def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: Initialize Prosegur Camera component. - async def async_camera_...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ProsegurCamera: """Representation of a Smart Prosegur Camera.""" def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: """Initialize Prosegur Camera component.""" <|body_0|> async def async_camera_image(self, width: int | None=No...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProsegurCamera: """Representation of a Smart Prosegur Camera.""" def __init__(self, installation: Installation, camera: InstallationCamera, auth: Auth) -> None: """Initialize Prosegur Camera component.""" Camera.__init__(self) self._installation = installation self._camera...
the_stack_v2_python_sparse
homeassistant/components/prosegur/camera.py
home-assistant/core
train
35,501
8020e48bd85371c334c9f7fd1d44b1b12562e01d
[ "from collections import OrderedDict\nself.capacity = capacity\nself.cache = OrderedDict()", "if key not in self.cache:\n return -1\nv = self.cache.pop(key)\nself.cache[key] = v\nreturn v", "if key in self.cache:\n self.cache.pop(key)\nself.cache[key] = value\nwhile len(self.cache) > self.capacity:\n s...
<|body_start_0|> from collections import OrderedDict self.capacity = capacity self.cache = OrderedDict() <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 v = self.cache.pop(key) self.cache[key] = v return v <|end_body_1|> <|body_st...
LRUCache2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache2: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_...
stack_v2_sparse_classes_10k_train_004209
3,024
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_000134
Implement the Python class `LRUCache2` described below. Class description: Implement the LRUCache2 class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache2` described below. Class description: Implement the LRUCache2 class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|...
080d3815c3bf568f6dd0a62c8221b4a7a84c2f86
<|skeleton|> class LRUCache2: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache2: def __init__(self, capacity): """:type capacity: int""" from collections import OrderedDict self.capacity = capacity self.cache = OrderedDict() def get(self, key): """:type key: int :rtype: int""" if key not in self.cache: return -1 ...
the_stack_v2_python_sparse
146. LRU Cache.py
EastonLee/leetcode_python_solutions
train
1
2b1f50089e57aa15008055ed5be78d6de98c8f2d
[ "used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct()\nqs = field.related_model.objects.filter(pk__in=used_ids)\nchoice_ids = field.related_model.objects.get_queryset_ancestors(qs, include_self=True).values_list('id', flat=True).distinct()\nordering = self.field_admin_ordering(field...
<|body_start_0|> used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct() qs = field.related_model.objects.filter(pk__in=used_ids) choice_ids = field.related_model.objects.get_queryset_ancestors(qs, include_self=True).values_list('id', flat=True).distinct() o...
TreeModelFieldListFilter
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" <|body_0|> def queryset(self, request, queryset): """Remove old filter and replace i...
stack_v2_sparse_classes_10k_train_004210
14,210
permissive
[ { "docstring": "Return only choices, which are actually used. Include children of selected object in the results", "name": "field_choices", "signature": "def field_choices(self, field, request, model_admin)" }, { "docstring": "Remove old filter and replace it with a filter that includes children...
2
null
Implement the Python class `TreeModelFieldListFilter` described below. Class description: Implement the TreeModelFieldListFilter class. Method signatures and docstrings: - def field_choices(self, field, request, model_admin): Return only choices, which are actually used. Include children of selected object in the res...
Implement the Python class `TreeModelFieldListFilter` described below. Class description: Implement the TreeModelFieldListFilter class. Method signatures and docstrings: - def field_choices(self, field, request, model_admin): Return only choices, which are actually used. Include children of selected object in the res...
aef660099fa251b66c5a8c56214a09e9b52bcc57
<|skeleton|> class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" <|body_0|> def queryset(self, request, queryset): """Remove old filter and replace i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TreeModelFieldListFilter: def field_choices(self, field, request, model_admin): """Return only choices, which are actually used. Include children of selected object in the results""" used_ids = model_admin.model.objects.values_list(field.attname, flat=True).distinct() qs = field.relate...
the_stack_v2_python_sparse
traffic_control/admin/utils.py
City-of-Helsinki/city-infrastructure-platform
train
5
8ad2c37b556940498fdfb3ab37f383efcfe337f1
[ "self.ami = pyAMI.client.Client('atlas')\nif options.config:\n self.configFileName = os.path.expanduser(options.config)\nelse:\n sys.exit('No authentication file specified')\nprint(self.configFileName)", "if isinstance(cmd, str):\n cmd = cmd.split()\nprint('PRINT AMI CMD', cmd)\nresults = self.ami.execut...
<|body_start_0|> self.ami = pyAMI.client.Client('atlas') if options.config: self.configFileName = os.path.expanduser(options.config) else: sys.exit('No authentication file specified') print(self.configFileName) <|end_body_0|> <|body_start_1|> if isinstanc...
AMIWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AMIWrapper: def __init__(self): """Initalise AMI""" <|body_0|> def run(self, cmd): """Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)""" <|body_1|> def periods(self, period=None, le...
stack_v2_sparse_classes_10k_train_004211
4,397
permissive
[ { "docstring": "Initalise AMI", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)", "name": "run", "signature": "def run(self, cmd)" }, { ...
5
null
Implement the Python class `AMIWrapper` described below. Class description: Implement the AMIWrapper class. Method signatures and docstrings: - def __init__(self): Initalise AMI - def run(self, cmd): Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenienc...
Implement the Python class `AMIWrapper` described below. Class description: Implement the AMIWrapper class. Method signatures and docstrings: - def __init__(self): Initalise AMI - def run(self, cmd): Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenienc...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class AMIWrapper: def __init__(self): """Initalise AMI""" <|body_0|> def run(self, cmd): """Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)""" <|body_1|> def periods(self, period=None, le...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AMIWrapper: def __init__(self): """Initalise AMI""" self.ami = pyAMI.client.Client('atlas') if options.config: self.configFileName = os.path.expanduser(options.config) else: sys.exit('No authentication file specified') print(self.configFileName) ...
the_stack_v2_python_sparse
InnerDetector/InDetExample/InDetBeamSpotExample/bin/periodInfo.py
strigazi/athena
train
0
bd1b24f536bd75a33690848d4b8f6eee045cf609
[ "self.context = context\nself.field = field\nself.widget = widget", "html = self.widget.render().strip()\ntransforms = getToolByName(self.context, 'portal_transforms')\nstream = transforms.convertTo('text/plain', html, mimetype='text/html')\nreturn stream.getData().strip()" ]
<|body_start_0|> self.context = context self.field = field self.widget = widget <|end_body_0|> <|body_start_1|> html = self.widget.render().strip() transforms = getToolByName(self.context, 'portal_transforms') stream = transforms.convertTo('text/plain', html, mimetype='t...
Fallback field converter which uses the rendered widget in display mode for generating a indexable string.
DefaultDexterityTextIndexFieldConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_10k_train_004212
5,051
no_license
[ { "docstring": "Initialize field converter", "name": "__init__", "signature": "def __init__(self, context, field, widget)" }, { "docstring": "Convert the adapted field value to text/plain for indexing", "name": "convert", "signature": "def convert(self)" } ]
2
stack_v2_sparse_classes_30k_train_002520
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
51827ba0f63d8d342a360cd4b10213fd3a29557f
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" self.context = context self.field = field ...
the_stack_v2_python_sparse
plone/app/dexterity/textindexer/converters.py
plone/plone.app.dexterity
train
12
5088b2127080b5b8bec304a92c88e945cb058640
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ndatabase = 'scratch/toy.db'\ntalon.get_counters(database)\nedge_dict = init_refs.make_edge_dict(cursor)\nrun_info = talon.init_run_info(database, build)\nconn.close()\nchrom = 'chr1'\nvertex_IDs = [1, 2, 3, 4, 5, 6]\nstrand = '+'\nedge_IDs, novelty = talon.match...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' talon.get_counters(database) edge_dict = init_refs.make_edge_dict(cursor) run_info = talon.init_run_info(database, build) conn.close() chrom = 'chr1' ve...
TestMatchAllEdges
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMatchAllEdges: def test_all_known_edges(self): """Example where the toy transcript database contains matches for all vertices.""" <|body_0|> def test_antisense(self): """Example where all of the vertices are in the database, but the edges are not, because they ar...
stack_v2_sparse_classes_10k_train_004213
1,910
permissive
[ { "docstring": "Example where the toy transcript database contains matches for all vertices.", "name": "test_all_known_edges", "signature": "def test_all_known_edges(self)" }, { "docstring": "Example where all of the vertices are in the database, but the edges are not, because they are antisense...
2
stack_v2_sparse_classes_30k_train_000516
Implement the Python class `TestMatchAllEdges` described below. Class description: Implement the TestMatchAllEdges class. Method signatures and docstrings: - def test_all_known_edges(self): Example where the toy transcript database contains matches for all vertices. - def test_antisense(self): Example where all of th...
Implement the Python class `TestMatchAllEdges` described below. Class description: Implement the TestMatchAllEdges class. Method signatures and docstrings: - def test_all_known_edges(self): Example where the toy transcript database contains matches for all vertices. - def test_antisense(self): Example where all of th...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestMatchAllEdges: def test_all_known_edges(self): """Example where the toy transcript database contains matches for all vertices.""" <|body_0|> def test_antisense(self): """Example where all of the vertices are in the database, but the edges are not, because they ar...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestMatchAllEdges: def test_all_known_edges(self): """Example where the toy transcript database contains matches for all vertices.""" conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' talon.get_counters(database) edge_dict = init_ref...
the_stack_v2_python_sparse
testing_suite/test_match_all_transcript_edges.py
kopardev/TALON
train
0
37081236a165401bca921277d405d18d5f852a38
[ "try:\n print('收到获取试题详情的请求')\n body = json.loads(self.request.body)\n self.sqlhandler = None\n self.stuUid = body['stuUid']\n self.practiceId = body['practiceId']\n if self.getPractice():\n self.write({'success': True, 'data': self.examDetail})\n self.finish()\n else:\n rai...
<|body_start_0|> try: print('收到获取试题详情的请求') body = json.loads(self.request.body) self.sqlhandler = None self.stuUid = body['stuUid'] self.practiceId = body['practiceId'] if self.getPractice(): self.write({'success': True, 'da...
StuPracticeRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" <|body_0|> def getPractice(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: print('收到获取试题详情的请求') body = json.loads(self.request.body)...
stack_v2_sparse_classes_10k_train_004214
1,943
no_license
[ { "docstring": "从数据库获取学生练习题返回给客户端", "name": "post", "signature": "def post(self)" }, { "docstring": "从数据库读取学生信息", "name": "getPractice", "signature": "def getPractice(self)" } ]
2
stack_v2_sparse_classes_30k_train_003184
Implement the Python class `StuPracticeRequestHandler` described below. Class description: Implement the StuPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 从数据库获取学生练习题返回给客户端 - def getPractice(self): 从数据库读取学生信息
Implement the Python class `StuPracticeRequestHandler` described below. Class description: Implement the StuPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 从数据库获取学生练习题返回给客户端 - def getPractice(self): 从数据库读取学生信息 <|skeleton|> class StuPracticeRequestHandler: def post(self): ...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" <|body_0|> def getPractice(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StuPracticeRequestHandler: def post(self): """从数据库获取学生练习题返回给客户端""" try: print('收到获取试题详情的请求') body = json.loads(self.request.body) self.sqlhandler = None self.stuUid = body['stuUid'] self.practiceId = body['practiceId'] if ...
the_stack_v2_python_sparse
app/src/main/pythonWork/stuRequest/StuPracticeRequestHandler.py
lyh-ADT/edu-app
train
1
97f609308acef6f319d15ca528eb04389b2f4d44
[ "s = ''\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n if node:\n s += str(node.val)\n queue.append(node.left)\n queue.append(node.right)\n else:\n s += '#'\n s += ' '\nreturn s", "s = data.split(',')\nif s[0] == '#':\n return None\nroot = TreeNode(int(s[0]))\nque...
<|body_start_0|> s = '' queue = [root] while queue: node = queue.pop(0) if node: s += str(node.val) queue.append(node.left) queue.append(node.right) else: s += '#' s += ' ' ret...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004215
4,066
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004007
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" s = '' queue = [root] while queue: node = queue.pop(0) if node: s += str(node.val) queue.append(node.left) ...
the_stack_v2_python_sparse
leetcode/4_二叉树专题/10_二叉树的序列化与反序列化.py
ryanatgz/data_structure_and_algorithm
train
0
68313708978cc5db86d8d2cd819e6da388645e55
[ "self.object_attribute_parameters = object_attribute_parameters\nself.object_parameters = object_parameters\nself.mtype = mtype", "if dictionary is None:\n return None\nobject_attribute_parameters = cohesity_management_sdk.models.ad_object_attribute_parameters.AdObjectAttributeParameters.from_dictionary(dictio...
<|body_start_0|> self.object_attribute_parameters = object_attribute_parameters self.object_parameters = object_parameters self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None object_attribute_parameters = cohesity_management_sdk.mode...
Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restore parameters with the list of attributes to be restored. This is set only when type...
AdRestoreOptions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdRestoreOptions: """Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restore parameters with the list of attribute...
stack_v2_sparse_classes_10k_train_004216
3,153
permissive
[ { "docstring": "Constructor for the AdRestoreOptions class", "name": "__init__", "signature": "def __init__(self, object_attribute_parameters=None, object_parameters=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A diction...
2
stack_v2_sparse_classes_30k_train_001953
Implement the Python class `AdRestoreOptions` described below. Class description: Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restor...
Implement the Python class `AdRestoreOptions` described below. Class description: Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restor...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AdRestoreOptions: """Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restore parameters with the list of attribute...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdRestoreOptions: """Implementation of the 'AdRestoreOptions' model. AdRestoreOptions are the AD specific options for the restore task being updated Attributes: object_attribute_parameters (AdObjectAttributeParameters): Specifies the object attributes restore parameters with the list of attributes to be resto...
the_stack_v2_python_sparse
cohesity_management_sdk/models/ad_restore_options.py
cohesity/management-sdk-python
train
24
edca32cf06c8460b5918b66aa7495fc3562b2d1f
[ "result = []\nfor i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j]:\n result.extend([i, j])\n return result", "r = []\nnum_copy = copy.deepcopy(nums)\nnums.sort()\nj = len(nums) - 1\ni = 0\nwhile i < j:\n if nums[i] + nums[j] > target:\n j...
<|body_start_0|> result = [] for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j]: result.extend([i, j]) return result <|end_body_0|> <|body_start_1|> r = [] num_copy = copy.deepcopy(nums) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumTest(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_10k_train_004217
1,651
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSumTest", "signature": "def twoSumTest(self, nums, target...
2
stack_v2_sparse_classes_30k_train_006864
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumTest(self, nums, target): :type nums: List[int] :type target: int :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSumTest(self, nums, target): :type nums: List[int] :type target: int :rtype: Li...
90d07a53a537212f41740adb8e65c4e30c3c4f64
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSumTest(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" result = [] for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j]: result.extend([i, j]) ...
the_stack_v2_python_sparse
数组与字符串/sumTest.py
xianytt/LeetCode
train
0
f6b190448cd9d756c127d35f070bb804392b84cd
[ "prefix = f'{slugify(prefix)}_' if prefix else ''\nextension = f'.{extension}' if extension else ''\nreturn f'{prefix}{slugify(title)}{extension}'", "match = re.match('^(?P<title>.*)(\\\\.{extension_regex:s})$'.format(extension_regex=EXTENSION_REGEX), value)\nif match:\n return match.group('title')\nreturn val...
<|body_start_0|> prefix = f'{slugify(prefix)}_' if prefix else '' extension = f'.{extension}' if extension else '' return f'{prefix}{slugify(title)}{extension}' <|end_body_0|> <|body_start_1|> match = re.match('^(?P<title>.*)(\\.{extension_regex:s})$'.format(extension_regex=EXTENSION_RE...
Set of function used by uploadable files managing an extension.
UploadableFileWithExtensionSerializerMixin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadableFileWithExtensionSerializerMixin: """Set of function used by uploadable files managing an extension.""" def _get_filename(self, title, extension=None, prefix=None): """Filename of an object. Parameters ---------- title : Type[string] The raw object title extension: Type[str...
stack_v2_sparse_classes_10k_train_004218
8,960
permissive
[ { "docstring": "Filename of an object. Parameters ---------- title : Type[string] The raw object title extension: Type[string] The file extension if any prefix: Type[string] The file prefix if any Returns ------- String The document's filename", "name": "_get_filename", "signature": "def _get_filename(s...
2
null
Implement the Python class `UploadableFileWithExtensionSerializerMixin` described below. Class description: Set of function used by uploadable files managing an extension. Method signatures and docstrings: - def _get_filename(self, title, extension=None, prefix=None): Filename of an object. Parameters ---------- titl...
Implement the Python class `UploadableFileWithExtensionSerializerMixin` described below. Class description: Set of function used by uploadable files managing an extension. Method signatures and docstrings: - def _get_filename(self, title, extension=None, prefix=None): Filename of an object. Parameters ---------- titl...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class UploadableFileWithExtensionSerializerMixin: """Set of function used by uploadable files managing an extension.""" def _get_filename(self, title, extension=None, prefix=None): """Filename of an object. Parameters ---------- title : Type[string] The raw object title extension: Type[str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UploadableFileWithExtensionSerializerMixin: """Set of function used by uploadable files managing an extension.""" def _get_filename(self, title, extension=None, prefix=None): """Filename of an object. Parameters ---------- title : Type[string] The raw object title extension: Type[string] The file...
the_stack_v2_python_sparse
src/backend/marsha/core/serializers/base.py
openfun/marsha
train
92
9c7f8fd6d4c422e379bf79c3263c14975a9ceaa3
[ "self.name = pname\nself.max_items = pmax\nself.items = plist", "if len(self.items) == 0:\n print('The player has no items')\nelse:\n print(self.items)", "if self.max_items <= len(self.items):\n print('The player item list has been exceeded the maximum number of \\n items the player can carry')\nelse:\...
<|body_start_0|> self.name = pname self.max_items = pmax self.items = plist <|end_body_0|> <|body_start_1|> if len(self.items) == 0: print('The player has no items') else: print(self.items) <|end_body_1|> <|body_start_2|> if self.max_items <= len...
represents a player carrying a list of items attributes: name(str), max_items(int), items(list)
Player
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_004219
1,787
no_license
[ { "docstring": "initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None", "name": "__init__", "signature": "def __init__(self, pname, pmax, plist)" }, { "docstring": "displays the players inventory items Player -> None", "name": "inventory", ...
4
stack_v2_sparse_classes_30k_train_000292
Implement the Python class `Player` described below. Class description: represents a player carrying a list of items attributes: name(str), max_items(int), items(list) Method signatures and docstrings: - def __init__(self, pname, pmax, plist): initializes Player with name, max items carry avaliable, list of items Pla...
Implement the Python class `Player` described below. Class description: represents a player carrying a list of items attributes: name(str), max_items(int), items(list) Method signatures and docstrings: - def __init__(self, pname, pmax, plist): initializes Player with name, max items carry avaliable, list of items Pla...
c9a7604147d9efee5bc2386cc9ae8d5240eaf450
<|skeleton|> class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" self.name = pname self...
the_stack_v2_python_sparse
Intro-to-Programming/pa11/pa11-b.py
jaeyoung-jane-choi/2019_Indiana_University
train
1
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(Conv1dGenerated, self).__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.kernel_size = kernel_size\nself.groups = groups\nself.stride = stride\nself.padding = padding\nself.dilation = dilation\nself.bottleneck = nn.Linear(E_1, E_2) if E_1 is not None else nn.Parameter(torch.r...
<|body_start_0|> super(Conv1dGenerated, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self.kernel_size = kernel_size self.groups = groups self.stride = stride self.padding = padding self.dilation = dilation self.b...
1D convolution with a kernel generated by a linear transformation of the instrument embedding
Conv1dGenerated
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of th...
stack_v2_sparse_classes_10k_train_004220
37,269
no_license
[ { "docstring": "Arguments: E_1 {int} -- Dimension of the instrument embedding E_2 {int} -- Dimension of the instrument embedding bottleneck in_channels {int} -- Number of channels of the input out_channels {int} -- Number of channels of the output kernel_size {int} -- Kernel size of the convolution Keyword Argu...
2
stack_v2_sparse_classes_30k_train_006365
Implement the Python class `Conv1dGenerated` described below. Class description: 1D convolution with a kernel generated by a linear transformation of the instrument embedding Method signatures and docstrings: - def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, group...
Implement the Python class `Conv1dGenerated` described below. Class description: 1D convolution with a kernel generated by a linear transformation of the instrument embedding Method signatures and docstrings: - def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, group...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of the instrument ...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
084f10ed710f8e6a2f1527fc547e5ae2a2b10b2d
[ "assert check_argument_types()\nsuper().__init__()\nself.conv = nn.LayerList()\nfor idx in range(n_layers):\n in_chans = idim if idx == 0 else n_chans\n self.conv.append(nn.Sequential(nn.Conv1D(in_chans, n_chans, kernel_size, stride=1, padding=(kernel_size - 1) // 2, bias_attr=True), nn.ReLU(), LayerNorm(n_ch...
<|body_start_0|> assert check_argument_types() super().__init__() self.conv = nn.LayerList() for idx in range(n_layers): in_chans = idim if idx == 0 else n_chans self.conv.append(nn.Sequential(nn.Conv1D(in_chans, n_chans, kernel_size, stride=1, padding=(kernel_siz...
Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/2006.04558
VariancePredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariancePredictor: """Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/2006.04558""" def __init__(self, i...
stack_v2_sparse_classes_10k_train_004221
3,387
permissive
[ { "docstring": "Initilize duration predictor module. Parameters ---------- idim : int Input dimension. n_layers : int, optional Number of convolutional layers. n_chans : int, optional Number of channels of convolutional layers. kernel_size : int, optional Kernel size of convolutional layers. dropout_rate : floa...
2
stack_v2_sparse_classes_30k_train_005346
Implement the Python class `VariancePredictor` described below. Class description: Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/...
Implement the Python class `VariancePredictor` described below. Class description: Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/...
8705a2a8405e3c63f2174d69880d2b5525a6c9fd
<|skeleton|> class VariancePredictor: """Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/2006.04558""" def __init__(self, i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VariancePredictor: """Variance predictor module. This is a module of variacne predictor described in `FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`_. .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`: https://arxiv.org/abs/2006.04558""" def __init__(self, idim: int, n_l...
the_stack_v2_python_sparse
parakeet/modules/fastspeech2_predictor/variance_predictor.py
PaddlePaddle/Parakeet
train
609
8fe70f778074ee2ce032fe11375889317f383c57
[ "super(HyperOptNoTraining, self).__init__(params, data)\nself.objective = None\nself.trial_losses = None\nself.best_trial = None\nself.trial_list = None", "self.trial_list = trial_list\nif self.trial_list is None:\n raise Exception('Sorry, Hyperparameter optimization without training currently only works if a ...
<|body_start_0|> super(HyperOptNoTraining, self).__init__(params, data) self.objective = None self.trial_losses = None self.best_trial = None self.trial_list = None <|end_body_0|> <|body_start_1|> self.trial_list = trial_list if self.trial_list is None: ...
Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian.
HyperOptNoTraining
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HyperOptNoTraining: """Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian.""" def __init__(self, params, data): """Create a HyperOptNoTraining object. Parameters ---------- params : mala.common.parametes.Parameters Parameters us...
stack_v2_sparse_classes_10k_train_004222
2,999
permissive
[ { "docstring": "Create a HyperOptNoTraining object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create this hyperparameter optimizer. data : mala.datahandling.data_handler.DataHandler DataHandler holding the data for the hyperparameter optimization.", "name": "__init__...
3
stack_v2_sparse_classes_30k_train_003587
Implement the Python class `HyperOptNoTraining` described below. Class description: Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian. Method signatures and docstrings: - def __init__(self, params, data): Create a HyperOptNoTraining object. Parameters ---------...
Implement the Python class `HyperOptNoTraining` described below. Class description: Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian. Method signatures and docstrings: - def __init__(self, params, data): Create a HyperOptNoTraining object. Parameters ---------...
9cc771b0cdc4178c7f66fd717684658abbb0d95c
<|skeleton|> class HyperOptNoTraining: """Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian.""" def __init__(self, params, data): """Create a HyperOptNoTraining object. Parameters ---------- params : mala.common.parametes.Parameters Parameters us...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HyperOptNoTraining: """Hyperparameter optimizer that does not require training networks. Networks are analysed using the Jacobian.""" def __init__(self, params, data): """Create a HyperOptNoTraining object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create ...
the_stack_v2_python_sparse
mala/network/hyper_opt_notraining.py
icamps/mala
train
0
e1e2074cd9c8f90baffffb2d96d4f32b5f4b0646
[ "test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http:/jobs.com/awesomejob', active=True)\ntest_jobposting.save()\nself.assertEqual(test_jobposting.pk, 1)", "test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http...
<|body_start_0|> test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http:/jobs.com/awesomejob', active=True) test_jobposting.save() self.assertEqual(test_jobposting.pk, 1) <|end_body_0|> <|body_start_1|> test_jobposting = JobPosting(title...
Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.
JobPostingModelTests
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" ...
stack_v2_sparse_classes_10k_train_004223
5,452
permissive
[ { "docstring": "This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered", "name": "test_create_jobposting_minimal", "signature": "def test_create_jobposting_minimal(self)" }, { "docstring": "This is a test for creating a new ::class:`JobPosting` ...
3
stack_v2_sparse_classes_30k_train_000695
Implement the Python class `JobPostingModelTests` described below. Class description: Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app. Method signatures and docstrings: - def test_create_jobposting_minimal(self): This is a test for creating a new ::class:`JobPosting` ...
Implement the Python class `JobPostingModelTests` described below. Class description: Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app. Method signatures and docstrings: - def test_create_jobposting_minimal(self): This is a test for creating a new ::class:`JobPosting` ...
d6f6c9c068bbf668c253e5943d9514947023e66d
<|skeleton|> class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" test_job...
the_stack_v2_python_sparse
personnel/tests.py
BridgesLab/Lab-Website
train
0
68f44addfb9163bb2696f511e6bb58378f22e780
[ "try:\n if self.id is None:\n return self.query.all()\n if self.id is not None and type(self.id) is int and (self.id >= 0):\n return self.query.get(self.id)\nexcept Exception as e:\n return e.__cause__.args[1]", "try:\n db.session.add(self)\n return db.session.commit()\nexcept Excepti...
<|body_start_0|> try: if self.id is None: return self.query.all() if self.id is not None and type(self.id) is int and (self.id >= 0): return self.query.get(self.id) except Exception as e: return e.__cause__.args[1] <|end_body_0|> <|bod...
Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]
Cache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cache: """Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]""" ...
stack_v2_sparse_classes_10k_train_004224
5,599
no_license
[ { "docstring": "[summary] [description] Keyword Arguments: id {[type]} -- [description] (default: {None}) Returns: [None] -- [When successed] [Message] -- [When failed]", "name": "get", "signature": "def get(self)" }, { "docstring": "[summary] [description] Arguments: key {[type]} -- [descriptio...
3
stack_v2_sparse_classes_30k_train_003985
Implement the Python class `Cache` described below. Class description: Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expirat...
Implement the Python class `Cache` described below. Class description: Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expirat...
052956e5006f7d274d19a43b061c2fe4a6456cc0
<|skeleton|> class Cache: """Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cache: """Using to create a cache [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of cache] key {[string(255)]} -- [The key value of cache] value {[text]} -- [The value of key in cache] expiration {[int]} -- [The expiration]""" def get(self...
the_stack_v2_python_sparse
models/cache.py
BoTranVan/statuspage
train
0
0a1ee42ef5d5173186bf631d9190e131b4c34ea3
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
BufferServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BufferServicer: """Missing associated documentation comment in .proto file.""" def SendTrajectories(self, request_iterator, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SendExperiences(self, request_iterator, context): "...
stack_v2_sparse_classes_10k_train_004225
3,945
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "SendTrajectories", "signature": "def SendTrajectories(self, request_iterator, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "SendExperiences", "signature"...
2
stack_v2_sparse_classes_30k_train_006871
Implement the Python class `BufferServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def SendTrajectories(self, request_iterator, context): Missing associated documentation comment in .proto file. - def SendExperiences(self, reque...
Implement the Python class `BufferServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def SendTrajectories(self, request_iterator, context): Missing associated documentation comment in .proto file. - def SendExperiences(self, reque...
28723664cd408e3e33c40658284ed24b0068027f
<|skeleton|> class BufferServicer: """Missing associated documentation comment in .proto file.""" def SendTrajectories(self, request_iterator, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SendExperiences(self, request_iterator, context): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BufferServicer: """Missing associated documentation comment in .proto file.""" def SendTrajectories(self, request_iterator, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not impl...
the_stack_v2_python_sparse
rls/distribute/pb2/apex_buffer_pb2_grpc.py
nisheethjaiswal/RLs
train
0
ebb7360a92565566b9eeeb34a054aaf70a7e4b88
[ "user = users.get_current_user()\nif not utils.IsValidSheriffUser():\n message = 'User \"%s\" not authorized.' % user\n self.response.out.write(json.dumps({'error': message}))\n return\nstep = self.request.get('step')\nif step == 'prefill-info':\n result = _PrefillInfo(self.request.get('test_path'))\nel...
<|body_start_0|> user = users.get_current_user() if not utils.IsValidSheriffUser(): message = 'User "%s" not authorized.' % user self.response.out.write(json.dumps({'error': message})) return step = self.request.get('step') if step == 'prefill-info': ...
URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with some info to fill into the form. "perform-bisec...
StartBisectHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with s...
stack_v2_sparse_classes_10k_train_004226
32,152
permissive
[ { "docstring": "Performs one of several bisect-related actions depending on parameters. The only required parameter is \"step\", which indicates what to do. This end-point should always output valid JSON with different contents depending on the value of \"step\".", "name": "post", "signature": "def post...
3
stack_v2_sparse_classes_30k_train_005578
Implement the Python class `StartBisectHandler` described below. Class description: URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" paramet...
Implement the Python class `StartBisectHandler` described below. Class description: URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" paramet...
9df8ce98c2a14fb60c2f581853011e32eb4bed0f
<|skeleton|> class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StartBisectHandler: """URL endpoint for AJAX requests for bisect config handling. Requests are made to this end-point by bisect and trace forms. This handler does several different types of things depending on what is given as the value of the "step" parameter: "prefill-info": Returns JSON with some info to f...
the_stack_v2_python_sparse
third_party/catapult/dashboard/dashboard/start_try_job.py
hanpfei/chromium-net
train
297
ad5481e9b26a8ea9f9d56a19ed369ce6fad3ce59
[ "user = request.user\ncheck_user_status(user)\nvalidate(instance=request.data, schema=schemas.restaurant_insert_draft_schema)\nbody = request.data\nPendingRestaurant.field_validate_draft(body)\nrestaurant = PendingRestaurant.insert(body)\nreturn JsonResponse(model_to_json(restaurant))", "user = request.user\nchec...
<|body_start_0|> user = request.user check_user_status(user) validate(instance=request.data, schema=schemas.restaurant_insert_draft_schema) body = request.data PendingRestaurant.field_validate_draft(body) restaurant = PendingRestaurant.insert(body) return JsonResp...
insert restaurant draft view
RestaurantDraftView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestaurantDraftView: """insert restaurant draft view""" def post(self, request): """Insert new restaurant as a draft into database""" <|body_0|> def put(self, request): """Edit a restaurant profile and save it as a draft in the database""" <|body_1|> <|e...
stack_v2_sparse_classes_10k_train_004227
19,356
no_license
[ { "docstring": "Insert new restaurant as a draft into database", "name": "post", "signature": "def post(self, request)" }, { "docstring": "Edit a restaurant profile and save it as a draft in the database", "name": "put", "signature": "def put(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_004363
Implement the Python class `RestaurantDraftView` described below. Class description: insert restaurant draft view Method signatures and docstrings: - def post(self, request): Insert new restaurant as a draft into database - def put(self, request): Edit a restaurant profile and save it as a draft in the database
Implement the Python class `RestaurantDraftView` described below. Class description: insert restaurant draft view Method signatures and docstrings: - def post(self, request): Insert new restaurant as a draft into database - def put(self, request): Edit a restaurant profile and save it as a draft in the database <|sk...
2707062c9a9a8bb4baca955e8a60ba08cc9f8953
<|skeleton|> class RestaurantDraftView: """insert restaurant draft view""" def post(self, request): """Insert new restaurant as a draft into database""" <|body_0|> def put(self, request): """Edit a restaurant profile and save it as a draft in the database""" <|body_1|> <|e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RestaurantDraftView: """insert restaurant draft view""" def post(self, request): """Insert new restaurant as a draft into database""" user = request.user check_user_status(user) validate(instance=request.data, schema=schemas.restaurant_insert_draft_schema) body = r...
the_stack_v2_python_sparse
backend/restaurant/views.py
MochiTarts/Find-Dining-The-Bridge
train
1
127b536d18395e0b543d55cd05265cf700cf6b83
[ "ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, group_id=group_id, role_id=role_id))\nPROVIDERS.assignment_api.get_grant(project_id=project_id, group_id=group_id, role_id=role_id, inherited_to_projects=True)\nreturn (None, h...
<|body_start_0|> ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, group_id=group_id, role_id=role_id)) PROVIDERS.assignment_api.get_grant(project_id=project_id, group_id=group_id, role_id=role_id, inherited_to_proj...
OSInheritProjectGroupResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, project_id, ...
stack_v2_sparse_classes_10k_train_004228
19,022
permissive
[ { "docstring": "Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects", "name": "get", "signature": "def get(self, project_id, group_id, role_id)" }, { "docstring": "Create an inherited grant for...
3
stack_v2_sparse_classes_30k_train_006800
Implement the Python class `OSInheritProjectGroupResource` described below. Class description: Implement the OSInheritProjectGroupResource class. Method signatures and docstrings: - def get(self, project_id, group_id, role_id): Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{proj...
Implement the Python class `OSInheritProjectGroupResource` described below. Class description: Implement the OSInheritProjectGroupResource class. Method signatures and docstrings: - def get(self, project_id, group_id, role_id): Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{proj...
03a0a8146a78682ede9eca12a5a7fdacde2035c8
<|skeleton|> class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, project_id, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" ENFORCER.enforce_call(action='identity:check_grant', bui...
the_stack_v2_python_sparse
keystone/api/os_inherit.py
sapcc/keystone
train
0
dfb3cb00901145667477975d43c55445d752eda1
[ "behavior.Behavior.__init__(self, nodename, ctrlrID)\nself._uses_wp_control = True\nself._last_wp_id = 0\nself.wp_msg = LLA()\nself._wpPublisher = rospy.Publisher('autopilot/payload_waypoint', LLA, tcp_nodelay=True, latch=True, queue_size=1)", "if wp.alt >= enums.MIN_REL_ALT and wp.alt <= enums.MAX_REL_ALT and (a...
<|body_start_0|> behavior.Behavior.__init__(self, nodename, ctrlrID) self._uses_wp_control = True self._last_wp_id = 0 self.wp_msg = LLA() self._wpPublisher = rospy.Publisher('autopilot/payload_waypoint', LLA, tcp_nodelay=True, latch=True, queue_size=1) <|end_body_0|> <|body_sta...
Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _wpPublisher: publisher object for publishing ...
WaypointBehavior
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _w...
stack_v2_sparse_classes_10k_train_004229
4,100
no_license
[ { "docstring": "Class initializer sets up the publisher for the waypoint topic @param nodename: name of the node that the object is contained in @param ctrlrID: identifier (int) for this particular behavior", "name": "__init__", "signature": "def __init__(self, nodename, ctrlrID)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_001564
Implement the Python class `WaypointBehavior` described below. Class description: Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the approp...
Implement the Python class `WaypointBehavior` described below. Class description: Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the approp...
ec2b5c43abed51a37c17bde0c000c2dfbfcbb9b1
<|skeleton|> class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _w...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WaypointBehavior: """Abstract class for wrapping a control-order-issuing ACS ROS object Control is implemented through the generation of waypoint commands. Instantiated objects will provide a waypoint publisher that publishes computed waypoints to the appropriate topic. Class member variables: _wpPublisher: p...
the_stack_v2_python_sparse
ap_lib/src/ap_lib/waypoint_behavior.py
jaymonty/autonomy-payload
train
0
341c9408d0606b00a640efc1abc4d1a19f69955c
[ "if value is not None:\n if isinstance(value, dict):\n return value\n else:\n return value.to_dict()", "try:\n if isinstance(value, dict):\n sub_instance = kwargs['obj_type']()\n sub_instance.from_dict(value)\n sub_instance.validate_dict(value)\n return sub_insta...
<|body_start_0|> if value is not None: if isinstance(value, dict): return value else: return value.to_dict() <|end_body_0|> <|body_start_1|> try: if isinstance(value, dict): sub_instance = kwargs['obj_type']() ...
ObjectType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectType: def serialize(value, **kwargs): """Convert a value to a JSON serializable value""" <|body_0|> def deserialize(value, **kwargs): """Convert value to object""" <|body_1|> <|end_skeleton|> <|body_start_0|> if value is not None: ...
stack_v2_sparse_classes_10k_train_004230
1,336
no_license
[ { "docstring": "Convert a value to a JSON serializable value", "name": "serialize", "signature": "def serialize(value, **kwargs)" }, { "docstring": "Convert value to object", "name": "deserialize", "signature": "def deserialize(value, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_003147
Implement the Python class `ObjectType` described below. Class description: Implement the ObjectType class. Method signatures and docstrings: - def serialize(value, **kwargs): Convert a value to a JSON serializable value - def deserialize(value, **kwargs): Convert value to object
Implement the Python class `ObjectType` described below. Class description: Implement the ObjectType class. Method signatures and docstrings: - def serialize(value, **kwargs): Convert a value to a JSON serializable value - def deserialize(value, **kwargs): Convert value to object <|skeleton|> class ObjectType: ...
e2ef4c7b56c4e7e06964fe6f64ae6c497ac31727
<|skeleton|> class ObjectType: def serialize(value, **kwargs): """Convert a value to a JSON serializable value""" <|body_0|> def deserialize(value, **kwargs): """Convert value to object""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjectType: def serialize(value, **kwargs): """Convert a value to a JSON serializable value""" if value is not None: if isinstance(value, dict): return value else: return value.to_dict() def deserialize(value, **kwargs): """C...
the_stack_v2_python_sparse
nio/properties/util/object_type.py
niolabs/nio
train
5
bbeac40f058d522b15a6dfbf1b0c0bc5b877df51
[ "def wrapper(t_cls):\n \"\"\"Register class with wrapper function.\n\n :param t_cls: class need to register\n :return: wrapper of t_cls\n \"\"\"\n t_cls_name = alias if alias is not None else t_cls.__name__\n if type_name not in cls.__registry__:\n cls.__registry__[t...
<|body_start_0|> def wrapper(t_cls): """Register class with wrapper function. :param t_cls: class need to register :return: wrapper of t_cls """ t_cls_name = alias if alias is not None else t_cls.__name__ if type_na...
A Factory Class to manage all class need to register with config.
ClassFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassFactory: """A Factory Class to manage all class need to register with config.""" def register(cls, type_name=ClassType.GENERAL, alias=None): """Register class into registry. :param type_name: type_name: type name of class registry :param alias: alias of class name :return: wrapp...
stack_v2_sparse_classes_10k_train_004231
6,906
permissive
[ { "docstring": "Register class into registry. :param type_name: type_name: type name of class registry :param alias: alias of class name :return: wrapper", "name": "register", "signature": "def register(cls, type_name=ClassType.GENERAL, alias=None)" }, { "docstring": "Register class with type na...
6
stack_v2_sparse_classes_30k_train_007128
Implement the Python class `ClassFactory` described below. Class description: A Factory Class to manage all class need to register with config. Method signatures and docstrings: - def register(cls, type_name=ClassType.GENERAL, alias=None): Register class into registry. :param type_name: type_name: type name of class ...
Implement the Python class `ClassFactory` described below. Class description: A Factory Class to manage all class need to register with config. Method signatures and docstrings: - def register(cls, type_name=ClassType.GENERAL, alias=None): Register class into registry. :param type_name: type_name: type name of class ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ClassFactory: """A Factory Class to manage all class need to register with config.""" def register(cls, type_name=ClassType.GENERAL, alias=None): """Register class into registry. :param type_name: type_name: type name of class registry :param alias: alias of class name :return: wrapp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassFactory: """A Factory Class to manage all class need to register with config.""" def register(cls, type_name=ClassType.GENERAL, alias=None): """Register class into registry. :param type_name: type_name: type name of class registry :param alias: alias of class name :return: wrapper""" ...
the_stack_v2_python_sparse
zeus/common/class_factory.py
huawei-noah/xingtian
train
308
76158a960c8a2aa3090a9fb8ba41c13ab2fa2174
[ "base.Action.__init__(self, self.__openBrowser)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__frame = frame\nif wxnat is None:\n self.enabled = False", "hosts = fslsettings.read('fsleyes.xnat.hosts', [])\naccounts = fslsettings.read('fsleyes.xnat.accounts', {})\ndlg = XNATBrowser(se...
<|body_start_0|> base.Action.__init__(self, self.__openBrowser) self.__overlayList = overlayList self.__displayCtx = displayCtx self.__frame = frame if wxnat is None: self.enabled = False <|end_body_0|> <|body_start_1|> hosts = fslsettings.read('fsleyes.xnat....
The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.
BrowseXNATAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``Browse...
stack_v2_sparse_classes_10k_train_004232
7,179
permissive
[ { "docstring": "Create a ``BrowseXNATAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, frame)" }, { "docstring": "Opens a :c...
2
null
Implement the Python class `BrowseXNATAction` described below. Class description: The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`. Method signatures and docstrings: - def __init__...
Implement the Python class `BrowseXNATAction` described below. Class description: The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`. Method signatures and docstrings: - def __init__...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``Browse...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``BrowseXNATAction``....
the_stack_v2_python_sparse
fsleyes/actions/browsexnat.py
sanjayankur31/fsleyes
train
1
14ebbb9fbe80ef81332110dc2a3416b7b6b3f6f5
[ "self._attr_entity_category = EntityCategory.DIAGNOSTIC\nself.entity_domain = ENTITY_DOMAIN\nsuper().__init__(config_entry=config_entry, coordinator=coordinator, description=description)", "if self.coordinator.data:\n if self.entity_description.state_value:\n return self.entity_description.state_value(s...
<|body_start_0|> self._attr_entity_category = EntityCategory.DIAGNOSTIC self.entity_domain = ENTITY_DOMAIN super().__init__(config_entry=config_entry, coordinator=coordinator, description=description) <|end_body_0|> <|body_start_1|> if self.coordinator.data: if self.entity_d...
Representation of a binary sensor.
HDHomerunBinarySensor
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" <|body_0|> def is_on(self) -> bool: "...
stack_v2_sparse_classes_10k_train_004233
10,682
permissive
[ { "docstring": "Initialise.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None" }, { "docstring": "Return if the service is on.", "name": "is_on", "signature": ...
2
null
Implement the Python class `HDHomerunBinarySensor` described below. Class description: Representation of a binary sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: Initialise. - de...
Implement the Python class `HDHomerunBinarySensor` described below. Class description: Representation of a binary sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: Initialise. - de...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" <|body_0|> def is_on(self) -> bool: "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" self._attr_entity_category = EntityCategory.DIAGNOSTIC ...
the_stack_v2_python_sparse
custom_components/hdhomerun/binary_sensor.py
bacco007/HomeAssistantConfig
train
98
bf0d84f204b3936db47a4eed12a5a9f24a8d7ed9
[ "fileInfo, hduInfoList = self.parse.getInfo(infile)\ncalibType = self.parse.getCalibType(infile)\nif calibType not in self.register.config.tables:\n self.log.warn(str(\"Skipped adding %s of observation type '%s' to registry (must be one of %s)\" % (infile, calibType, ', '.join(self.register.config.tables))))\n ...
<|body_start_0|> fileInfo, hduInfoList = self.parse.getInfo(infile) calibType = self.parse.getCalibType(infile) if calibType not in self.register.config.tables: self.log.warn(str("Skipped adding %s of observation type '%s' to registry (must be one of %s)" % (infile, calibType, ', '.j...
PfsIngestCalibsTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PfsIngestCalibsTask: def runFile(self, infile, registry, args): """Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite3.Connection` Registry database connection. args : `argparse.Namespace` Parsed command-line arguments. Retur...
stack_v2_sparse_classes_10k_train_004234
39,514
no_license
[ { "docstring": "Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite3.Connection` Registry database connection. args : `argparse.Namespace` Parsed command-line arguments. Returns ------- calibType : `str` Calibration type (e.g., bias, dark, flat), or ...
2
stack_v2_sparse_classes_30k_train_002375
Implement the Python class `PfsIngestCalibsTask` described below. Class description: Implement the PfsIngestCalibsTask class. Method signatures and docstrings: - def runFile(self, infile, registry, args): Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite...
Implement the Python class `PfsIngestCalibsTask` described below. Class description: Implement the PfsIngestCalibsTask class. Method signatures and docstrings: - def runFile(self, infile, registry, args): Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite...
d3b59dd73a68da6da3471c12abe203019c6a3cbe
<|skeleton|> class PfsIngestCalibsTask: def runFile(self, infile, registry, args): """Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite3.Connection` Registry database connection. args : `argparse.Namespace` Parsed command-line arguments. Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PfsIngestCalibsTask: def runFile(self, infile, registry, args): """Examine and ingest a single file Parameters ---------- infile : `str` Name of file to process. registry : `sqlite3.Connection` Registry database connection. args : `argparse.Namespace` Parsed command-line arguments. Returns ------- cal...
the_stack_v2_python_sparse
python/lsst/obs/pfs/ingest.py
Subaru-PFS/obs_pfs
train
1
21ecc5119db1855689f6c4580a78adf4ddd825e7
[ "self.player = player\nself.item = item\nself.quant = 1\nself.max_quant = player.bag[item.type][item]\nself.is_dead = False\nself.how_many_dialogue = Dialogue('30', self.player, self.player, show_curs=False, replace=[item.name.upper()])\nself.text_maker = TextMaker(join('fonts', 'party_txt_font.png'))\nself.menu_fr...
<|body_start_0|> self.player = player self.item = item self.quant = 1 self.max_quant = player.bag[item.type][item] self.is_dead = False self.how_many_dialogue = Dialogue('30', self.player, self.player, show_curs=False, replace=[item.name.upper()]) self.text_maker ...
SellHowMany
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SellHowMany: def __init__(self, player, item): """Creates an event which determines how many of an item that the user wants to sell.""" <|body_0|> def update(self, ticks): """Updates the sell event if it exists. Otherwise update the quantity cursor.""" <|body...
stack_v2_sparse_classes_10k_train_004235
36,471
no_license
[ { "docstring": "Creates an event which determines how many of an item that the user wants to sell.", "name": "__init__", "signature": "def __init__(self, player, item)" }, { "docstring": "Updates the sell event if it exists. Otherwise update the quantity cursor.", "name": "update", "sign...
5
stack_v2_sparse_classes_30k_train_003765
Implement the Python class `SellHowMany` described below. Class description: Implement the SellHowMany class. Method signatures and docstrings: - def __init__(self, player, item): Creates an event which determines how many of an item that the user wants to sell. - def update(self, ticks): Updates the sell event if it...
Implement the Python class `SellHowMany` described below. Class description: Implement the SellHowMany class. Method signatures and docstrings: - def __init__(self, player, item): Creates an event which determines how many of an item that the user wants to sell. - def update(self, ticks): Updates the sell event if it...
6718fdb6555d87f0b7b331c10d64a604431f8e81
<|skeleton|> class SellHowMany: def __init__(self, player, item): """Creates an event which determines how many of an item that the user wants to sell.""" <|body_0|> def update(self, ticks): """Updates the sell event if it exists. Otherwise update the quantity cursor.""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SellHowMany: def __init__(self, player, item): """Creates an event which determines how many of an item that the user wants to sell.""" self.player = player self.item = item self.quant = 1 self.max_quant = player.bag[item.type][item] self.is_dead = False ...
the_stack_v2_python_sparse
pokered/modules/events/poke_mart_event.py
surranc20/pokered
train
44
91a3945e0a5c64e742044561e604036f4a408ea6
[ "max_sum = nums[0]\nmax_sub_sum = nums[0]\nfor i in range(1, len(nums)):\n max_sub_sum = max(nums[i], max_sub_sum + nums[i])\n max_sum = max(max_sub_sum, max_sum)\nreturn max_sum", "max_sum = nums[0]\nfor i in range(len(nums)):\n sub_sum = 0\n for j in range(len(nums) - i):\n sub_sum += nums[i ...
<|body_start_0|> max_sum = nums[0] max_sub_sum = nums[0] for i in range(1, len(nums)): max_sub_sum = max(nums[i], max_sub_sum + nums[i]) max_sum = max(max_sub_sum, max_sum) return max_sum <|end_body_0|> <|body_start_1|> max_sum = nums[0] for i in ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray1(self, nums): """dynamical programming, O(n)""" <|body_0|> def maxSubArray2(self, nums): """brutal solution, bad""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_sum = nums[0] max_sub_sum = nums[0] for i ...
stack_v2_sparse_classes_10k_train_004236
1,076
permissive
[ { "docstring": "dynamical programming, O(n)", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums)" }, { "docstring": "brutal solution, bad", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums): dynamical programming, O(n) - def maxSubArray2(self, nums): brutal solution, bad
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums): dynamical programming, O(n) - def maxSubArray2(self, nums): brutal solution, bad <|skeleton|> class Solution: def maxSubArray1(self, nums): ...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def maxSubArray1(self, nums): """dynamical programming, O(n)""" <|body_0|> def maxSubArray2(self, nums): """brutal solution, bad""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray1(self, nums): """dynamical programming, O(n)""" max_sum = nums[0] max_sub_sum = nums[0] for i in range(1, len(nums)): max_sub_sum = max(nums[i], max_sub_sum + nums[i]) max_sum = max(max_sub_sum, max_sum) return max_sum ...
the_stack_v2_python_sparse
leetcode/0053_maximum_subarray.py
chaosWsF/Python-Practice
train
1
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('register_courses', kwargs={'level': int(data['level']), 'semester': int(data['semester'])})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Where To Register Courses'\ncontext['detail_text'] = ...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('register_courses', kwargs={'level': int(data['level']), 'semester': int(data['semester'])}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context[...
View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid.
RegisterCourseView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterCourseView: """View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_...
stack_v2_sparse_classes_10k_train_004237
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_train_006990
Implement the Python class `RegisterCourseView` described below. Class description: View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and ca...
Implement the Python class `RegisterCourseView` described below. Class description: View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL and ca...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class RegisterCourseView: """View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> def get_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegisterCourseView: """View for choosing the courses to register. Check that the user's account is still active. Redirects to register_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data self...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
c1cb22f544a3df2e8b70f65f03fcd2c4dd5ce453
[ "if not root:\n return ''\nret = []\nst = []\nst.append(root)\nwhile len(st):\n nd = st.pop()\n ret.append(str(nd.val))\n if nd.right:\n st.append(nd.right)\n if nd.left:\n st.append(nd.left)\nreturn ','.join(ret)", "dataArr = data.split(',')\nl = len(dataArr)\nif l < 1:\n return N...
<|body_start_0|> if not root: return '' ret = [] st = [] st.append(root) while len(st): nd = st.pop() ret.append(str(nd.val)) if nd.right: st.append(nd.right) if nd.left: st.append(nd.left...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004238
1,743
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' ret = [] st = [] st.append(root) while len(st): nd = st.pop() ret.append(str(nd.val)) ...
the_stack_v2_python_sparse
leetcode/449.py
liuweilin17/algorithm
train
3
3bd58e0409fc500e81a85348c1413c3dbbf89680
[ "@lru_cache(None)\ndef lcs(i, j):\n if i == -1 or j == -1:\n return 0\n m = 0\n if word1[i] == word2[j]:\n m = max([m, lcs(i - 1, j - 1) + 1])\n else:\n m = max([lcs(i - 1, j), lcs(i, j - 1)])\n return m\nlcs_length = lcs(len(word1) - 1, len(word2) - 1)\nreturn len(word1) + len(w...
<|body_start_0|> @lru_cache(None) def lcs(i, j): if i == -1 or j == -1: return 0 m = 0 if word1[i] == word2[j]: m = max([m, lcs(i - 1, j - 1) + 1]) else: m = max([lcs(i - 1, j), lcs(i, j - 1)]) re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def minDista...
stack_v2_sparse_classes_10k_train_004239
3,799
no_license
[ { "docstring": "06/13/2020 10:44", "name": "minDistance", "signature": "def minDistance(self, word1: str, word2: str) -> int" }, { "docstring": "Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)", "name": "minDistance", "signature": "def minDistance(self, word1: st...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: 06/13/2020 10:44 - def minDistance(self, word1: str, word2: str) -> int: Top-down DP (recursion) Time complexity: O(n^2) Spa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: 06/13/2020 10:44 - def minDistance(self, word1: str, word2: str) -> int: Top-down DP (recursion) Time complexity: O(n^2) Spa...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def minDista...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" @lru_cache(None) def lcs(i, j): if i == -1 or j == -1: return 0 m = 0 if word1[i] == word2[j]: m = max([m, lcs(i - 1, j - 1) + 1]) ...
the_stack_v2_python_sparse
leetcode/solved/583_Delete_Operation_for_Two_Strings/solution.py
sungminoh/algorithms
train
0
29a8e30590090fdb239510371528bf28671d5b6c
[ "if not root:\n return []\norder = [[]]\nqueue = [(root, 0)]\nwhile queue:\n curr = queue[0]\n if len(order) < curr[1] + 1:\n order.append([])\n order[curr[1]].append(curr[0].val)\n del queue[0]\n if curr[0].left:\n queue.append((curr[0].left, curr[1] + 1))\n if curr[0].right:\n ...
<|body_start_0|> if not root: return [] order = [[]] queue = [(root, 0)] while queue: curr = queue[0] if len(order) < curr[1] + 1: order.append([]) order[curr[1]].append(curr[0].val) del queue[0] if c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_004240
2,510
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrderBottom", "signature": "def levelOrderBottom(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> class Solu...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if not root: return [] order = [[]] queue = [(root, 0)] while queue: curr = queue[0] if len(order) < curr[1] + 1: order.append([]...
the_stack_v2_python_sparse
python_solution/101_110/BinaryTreeLevelOrderTraversal.py
CescWang1991/LeetCode-Python
train
1
ea9a9fa10e4b7a94a57fe2e8f0ea4cd47c546d8c
[ "follow = 0\nfor byte in data:\n if not byte & 128:\n if follow:\n return False\n elif byte & 192 == 128:\n if not follow:\n return False\n follow -= 1\n elif byte & 224 == 192:\n if follow:\n return False\n follow = 1\n elif byte & 240...
<|body_start_0|> follow = 0 for byte in data: if not byte & 128: if follow: return False elif byte & 192 == 128: if not follow: return False follow -= 1 elif byte & 224 == 192: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def rewrite(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> def rewrite2(self, data): """:type data: List[int] :rtype: bool""" <|bod...
stack_v2_sparse_classes_10k_train_004241
6,087
no_license
[ { "docstring": ":type data: List[int] :rtype: bool", "name": "validUtf8", "signature": "def validUtf8(self, data)" }, { "docstring": ":type data: List[int] :rtype: bool", "name": "rewrite", "signature": "def rewrite(self, data)" }, { "docstring": ":type data: List[int] :rtype: bo...
3
stack_v2_sparse_classes_30k_train_005814
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def rewrite(self, data): :type data: List[int] :rtype: bool - def rewrite2(self, data): :type data: List[int] :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data): :type data: List[int] :rtype: bool - def rewrite(self, data): :type data: List[int] :rtype: bool - def rewrite2(self, data): :type data: List[int] :rty...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" <|body_0|> def rewrite(self, data): """:type data: List[int] :rtype: bool""" <|body_1|> def rewrite2(self, data): """:type data: List[int] :rtype: bool""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def validUtf8(self, data): """:type data: List[int] :rtype: bool""" follow = 0 for byte in data: if not byte & 128: if follow: return False elif byte & 192 == 128: if not follow: r...
the_stack_v2_python_sparse
co_fb/393_UTF-8_Validation.py
vsdrun/lc_public
train
6
69f67fad47f8148b6a6b0f7e6369809ebf81f3c3
[ "ans = []\n\ndef dfs(node):\n if not node:\n ans.append('null')\n return\n ans.append(str(node.val))\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nreturn ','.join(ans)", "data = data.split(',')\n\ndef dfs(nodes):\n rootV = nodes.pop(0)\n if rootV == 'null':\n return None\n ...
<|body_start_0|> ans = [] def dfs(node): if not node: ans.append('null') return ans.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ','.join(ans) <|end_body_0|> <|body_start_1|> ...
前序模式
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: """前序模式""" def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004242
1,465
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: 前序模式 Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: 前序模式 Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Codec: """前序模式""" ...
aa3be0350424aab2412f57f402e20e7cabe35747
<|skeleton|> class Codec: """前序模式""" def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: """前序模式""" def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" ans = [] def dfs(node): if not node: ans.append('null') return ans.append(str(node.val)) dfs(node.left) ...
the_stack_v2_python_sparse
algorithm/leetCode_xx/297.二叉树的序列化与反序列化.py
aizigao/keepTraining
train
0
fbcfee703782feea559cb08ec1bbaf2feb2acd79
[ "Editeur.__init__(self, pere, objet, attribut)\nself.dictionnaire = dictionnaire or {}\nself.autoriser_none = autoriser_none\nself.feminin = feminin\nself.ajouter_option('s', self.opt_supprimer)", "objet = getattr(self.objet, self.attribut)\nif objet is None:\n objet = '|att|aucun|ff|'\n if self.feminin:\n ...
<|body_start_0|> Editeur.__init__(self, pere, objet, attribut) self.dictionnaire = dictionnaire or {} self.autoriser_none = autoriser_none self.feminin = feminin self.ajouter_option('s', self.opt_supprimer) <|end_body_0|> <|body_start_1|> objet = getattr(self.objet, self...
Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir un joueur, une étendue d'eau, un prototype d'objet ou bien d'autres choses.
ChoixObjet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChoixObjet: """Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir un joueur, une étendue d'eau, un prototy...
stack_v2_sparse_classes_10k_train_004243
4,193
permissive
[ { "docstring": "Constructeur de l'éditeur.", "name": "__init__", "signature": "def __init__(self, pere, objet=None, attribut=None, dictionnaire=None, autoriser_none=True, feminin=False)" }, { "docstring": "Retourne l'aide courte", "name": "accueil", "signature": "def accueil(self)" }, ...
5
stack_v2_sparse_classes_30k_train_002731
Implement the Python class `ChoixObjet` described below. Class description: Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir u...
Implement the Python class `ChoixObjet` described below. Class description: Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir u...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class ChoixObjet: """Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir un joueur, une étendue d'eau, un prototy...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChoixObjet: """Contexte-éditeur choix. Ce contexte permet de faire choisir l'utilisateur une option parmi un dictionnaire : les clés doivent être les chaînes de choix et les valeurs sont les objets correspondants. Cet éditeur peut être utilisé pour choisir un joueur, une étendue d'eau, un prototype d'objet ou...
the_stack_v2_python_sparse
src/primaires/interpreteur/editeur/choix_objet.py
vincent-lg/tsunami
train
5
1e67d877a398575070d0734a96a63f238d8869ae
[ "dir_name = 'test_dir'\nif not os.path.exists(dir_name):\n os.makedirs(dir_name)\n download_csv_file(NASA_URL, NASA_CON_NAME + CSV_END, dir_name)\n path = os.path.join(os.getcwd(), dir_name, NASA_CON_NAME + CSV_END)\n self.assertTrue(os.path.exists(path))\n os.remove(path)\n os.rmdir(dir_name)\nel...
<|body_start_0|> dir_name = 'test_dir' if not os.path.exists(dir_name): os.makedirs(dir_name) download_csv_file(NASA_URL, NASA_CON_NAME + CSV_END, dir_name) path = os.path.join(os.getcwd(), dir_name, NASA_CON_NAME + CSV_END) self.assertTrue(os.path.exists(...
Test class to test the csv downloader module
TestCSVDownloader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCSVDownloader: """Test class to test the csv downloader module""" def test_nasa_site(self): """Test Nasa Exoplanet site""" <|body_0|> def test_exoplanet_site(self): """Test Nasa Exoplanet site""" <|body_1|> def test_Invalid(self): """chec...
stack_v2_sparse_classes_10k_train_004244
1,259
no_license
[ { "docstring": "Test Nasa Exoplanet site", "name": "test_nasa_site", "signature": "def test_nasa_site(self)" }, { "docstring": "Test Nasa Exoplanet site", "name": "test_exoplanet_site", "signature": "def test_exoplanet_site(self)" }, { "docstring": "check if ValueError cause the ...
3
stack_v2_sparse_classes_30k_train_002940
Implement the Python class `TestCSVDownloader` described below. Class description: Test class to test the csv downloader module Method signatures and docstrings: - def test_nasa_site(self): Test Nasa Exoplanet site - def test_exoplanet_site(self): Test Nasa Exoplanet site - def test_Invalid(self): check if ValueError...
Implement the Python class `TestCSVDownloader` described below. Class description: Test class to test the csv downloader module Method signatures and docstrings: - def test_nasa_site(self): Test Nasa Exoplanet site - def test_exoplanet_site(self): Test Nasa Exoplanet site - def test_Invalid(self): check if ValueError...
de5c0690c7891eaa5f6b29f12995ba46d5fb6d15
<|skeleton|> class TestCSVDownloader: """Test class to test the csv downloader module""" def test_nasa_site(self): """Test Nasa Exoplanet site""" <|body_0|> def test_exoplanet_site(self): """Test Nasa Exoplanet site""" <|body_1|> def test_Invalid(self): """chec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestCSVDownloader: """Test class to test the csv downloader module""" def test_nasa_site(self): """Test Nasa Exoplanet site""" dir_name = 'test_dir' if not os.path.exists(dir_name): os.makedirs(dir_name) download_csv_file(NASA_URL, NASA_CON_NAME + CSV_END, ...
the_stack_v2_python_sparse
OECSynchronizer/test_csv_downloader.py
marhabac33/oec-synchronizer
train
0
de5bdcf5a8363ba879073aee8e66ce7485141306
[ "prefix = nums[:]\nfor i in range(1, len(prefix)):\n prefix[i] += prefix[i - 1]\nself.prefix = prefix", "if i == 0:\n return self.prefix[j]\nelse:\n return self.prefix[j] - self.prefix[i - 1]" ]
<|body_start_0|> prefix = nums[:] for i in range(1, len(prefix)): prefix[i] += prefix[i - 1] self.prefix = prefix <|end_body_0|> <|body_start_1|> if i == 0: return self.prefix[j] else: return self.prefix[j] - self.prefix[i - 1] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> prefix = nums[:] for i in range(1, len(prefix)): ...
stack_v2_sparse_classes_10k_train_004245
586
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
0e35e4cc87bd41144b8e34302aafe776fec1b356
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" prefix = nums[:] for i in range(1, len(prefix)): prefix[i] += prefix[i - 1] self.prefix = prefix def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i == 0: ...
the_stack_v2_python_sparse
LeetCode/303-range_sum_query_immutable.py
davll/practical-algorithms
train
0
7264f7018531a0b39d2eefdcc4aec3aa42e1b040
[ "super(AttentionEncoder, self).__init__()\nself.lookup = nn.Embedding(vocab_size, emb_size)\nif pretrained_emb is None:\n xavier_uniform(self.lookup.weight.data)\nelse:\n assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has incorrect size: {} instead of {}'.format(w_emb.size(), (...
<|body_start_0|> super(AttentionEncoder, self).__init__() self.lookup = nn.Embedding(vocab_size, emb_size) if pretrained_emb is None: xavier_uniform(self.lookup.weight.data) else: assert pretrained_emb.size() == (vocab_size, emb_size), 'Word embedding matrix has i...
Segment encoder that produces segment vectors as the weighted average of word embeddings.
AttentionEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embe...
stack_v2_sparse_classes_10k_train_004246
22,149
permissive
[ { "docstring": "Initializes the encoder using a [vocab_size x emb_size] embedding matrix. The encoder learns a matrix M, which may be initialized explicitely or randomly. Parameters: vocab_size (int): the vocabulary size emb_size (int): dimensionality of embeddings bias (bool): whether or not to use a bias vect...
2
stack_v2_sparse_classes_30k_train_006128
Implement the Python class `AttentionEncoder` described below. Class description: Segment encoder that produces segment vectors as the weighted average of word embeddings. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini...
Implement the Python class `AttentionEncoder` described below. Class description: Segment encoder that produces segment vectors as the weighted average of word embeddings. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): Ini...
41452f447284491cf8ade8e09f3bc4e314ec64f7
<|skeleton|> class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttentionEncoder: """Segment encoder that produces segment vectors as the weighted average of word embeddings.""" def __init__(self, vocab_size, emb_size, bias=True, M=None, b=None, pretrained_emb=None, fix_w_emb=False): """Initializes the encoder using a [vocab_size x emb_size] embedding matrix....
the_stack_v2_python_sparse
iswd/model_library.py
gkaramanolakis/ISWD
train
7
3e0fa2e54938d72afe0ee795890c28920402d6dc
[ "if self.kill:\n return\nif self.text_timer[index].IsRunning():\n self.text_timer[index].Stop()\nelse:\n self.saved_text = self.GetStatusText(index)\nself.SetStatusText(text, index)\nself.text_timer[index].Start(3000, oneShot=True)", "if self.kill:\n return\nif self.text_timer[index].IsRunning():\n ...
<|body_start_0|> if self.kill: return if self.text_timer[index].IsRunning(): self.text_timer[index].Stop() else: self.saved_text = self.GetStatusText(index) self.SetStatusText(text, index) self.text_timer[index].Start(3000, oneShot=True) <|end_...
Timed status in status bar.
TimedStatusExtension
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" <|body_0|> def cancel_timed_status(self, index=0): """C...
stack_v2_sparse_classes_10k_train_004247
9,581
permissive
[ { "docstring": "Set the status for a short time. Save the previous status for restore when the timed status completes.", "name": "set_timed_status", "signature": "def set_timed_status(self, text, index=0)" }, { "docstring": "Cancel running timed status.", "name": "cancel_timed_status", "...
6
stack_v2_sparse_classes_30k_train_003149
Implement the Python class `TimedStatusExtension` described below. Class description: Timed status in status bar. Method signatures and docstrings: - def set_timed_status(self, text, index=0): Set the status for a short time. Save the previous status for restore when the timed status completes. - def cancel_timed_sta...
Implement the Python class `TimedStatusExtension` described below. Class description: Timed status in status bar. Method signatures and docstrings: - def set_timed_status(self, text, index=0): Set the status for a short time. Save the previous status for restore when the timed status completes. - def cancel_timed_sta...
95129ca054384a4c59a4effdb3fe32a7a66af6ff
<|skeleton|> class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" <|body_0|> def cancel_timed_status(self, index=0): """C...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" if self.kill: return if self.text_timer[index].IsRunning(): ...
the_stack_v2_python_sparse
rummage/lib/gui/controls/custom_statusbar.py
facelessuser/Rummage
train
70
0c2c64f1f55803c137a85775fefc1ad648fb8969
[ "self.id_db_int_DBI = id_db_int_DBI\nself.designation_source = designation_source\nself.database_name = database_name", "listOfDomainsSources = []\nsqlObj = _DB_interaction_DDI_SQL(db_name=self.database_name)\nresults = sqlObj.select_all_sources_DDI_name()\nfor element in results:\n listOfDomainsSources.append...
<|body_start_0|> self.id_db_int_DBI = id_db_int_DBI self.designation_source = designation_source self.database_name = database_name <|end_body_0|> <|body_start_1|> listOfDomainsSources = [] sqlObj = _DB_interaction_DDI_SQL(db_name=self.database_name) results = sqlObj.sel...
This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration
DB_interaction_DDI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', data...
stack_v2_sparse_classes_10k_train_004248
2,715
permissive
[ { "docstring": "Constructor of the DDI source data object. All the parameters have a default value :param id_db_int_DBI: id of DDI interaction - -1 if unknown :param designation_source: id of the domain A :param database_name: name of the database. See Factory_databases_access :type id_db_int_DBI: int - not req...
4
null
Implement the Python class `DB_interaction_DDI` described below. Class description: This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration Method signatures and docstrings...
Implement the Python class `DB_interaction_DDI` described below. Class description: This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration Method signatures and docstrings...
862eb85746e8a3a9bbc0d6aef9abbd5eebe9765f
<|skeleton|> class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', data...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DB_interaction_DDI: """This class treat the source that give the information about the DDI object has it exists in DB_interaction_DDI table database By default, all FK are in the lasts positions in the parameters declaration""" def __init__(self, id_db_int_DBI=-1, designation_source='', database_name='IN...
the_stack_v2_python_sparse
objects_new/DB_interaction_DDI_new.py
diogo1790/inphinity
train
1
bceefa6cd417ba55be1502cff3a23e6f78a7272f
[ "result = ''\nif pooltable in ['tp_threadpool', 'tp_threadpool_buffer_in', 'tp_threadpool_buffer_out']:\n sqlStr = \"\\nSELECT min(id) FROM %s WHERE component = :component AND\\nthread_pool_id = :thread_pool_id AND state='queued'\\n \" % pooltable\n result = self.execute(sqlStr, args)\nelse:\n sqlSt...
<|body_start_0|> result = '' if pooltable in ['tp_threadpool', 'tp_threadpool_buffer_in', 'tp_threadpool_buffer_out']: sqlStr = "\nSELECT min(id) FROM %s WHERE component = :component AND\nthread_pool_id = :thread_pool_id AND state='queued'\n " % pooltable result = self.exe...
_Queries_ This module implements the Oracle backend for the persistent threadpool.
Queries
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queries: """_Queries_ This module implements the Oracle backend for the persistent threadpool.""" def selectWork(self, args, pooltable='tp_threadpool'): """Select work that is not yet being processed.""" <|body_0|> def updateWorkStatus(self, args, pooltable='tp_threadpoo...
stack_v2_sparse_classes_10k_train_004249
6,188
permissive
[ { "docstring": "Select work that is not yet being processed.", "name": "selectWork", "signature": "def selectWork(self, args, pooltable='tp_threadpool')" }, { "docstring": "Updates work status of work being processed.", "name": "updateWorkStatus", "signature": "def updateWorkStatus(self,...
6
stack_v2_sparse_classes_30k_train_001850
Implement the Python class `Queries` described below. Class description: _Queries_ This module implements the Oracle backend for the persistent threadpool. Method signatures and docstrings: - def selectWork(self, args, pooltable='tp_threadpool'): Select work that is not yet being processed. - def updateWorkStatus(sel...
Implement the Python class `Queries` described below. Class description: _Queries_ This module implements the Oracle backend for the persistent threadpool. Method signatures and docstrings: - def selectWork(self, args, pooltable='tp_threadpool'): Select work that is not yet being processed. - def updateWorkStatus(sel...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class Queries: """_Queries_ This module implements the Oracle backend for the persistent threadpool.""" def selectWork(self, args, pooltable='tp_threadpool'): """Select work that is not yet being processed.""" <|body_0|> def updateWorkStatus(self, args, pooltable='tp_threadpoo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Queries: """_Queries_ This module implements the Oracle backend for the persistent threadpool.""" def selectWork(self, args, pooltable='tp_threadpool'): """Select work that is not yet being processed.""" result = '' if pooltable in ['tp_threadpool', 'tp_threadpool_buffer_in', 'tp_...
the_stack_v2_python_sparse
src/python/WMCore/ThreadPool/Oracle/Queries.py
vkuznet/WMCore
train
0
555c572b289633145f5c1f2068058b7f1cb4896c
[ "self.file_name = file_name\nself.append_file = append_file\nself.result_keys = None\nif self.append_file:\n if not os.path.isfile(file_name):\n msg = 'File not found at path: {}. When using append=True in CSVWriter, the file must exist at the prescribed path before data is written to it.'.format(file_nam...
<|body_start_0|> self.file_name = file_name self.append_file = append_file self.result_keys = None if self.append_file: if not os.path.isfile(file_name): msg = 'File not found at path: {}. When using append=True in CSVWriter, the file must exist at the prescri...
Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come.
CSVWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVWriter: """Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come.""" def __init__(self, file_name: str='output.csv', append_file: bool=False): """Initialize ...
stack_v2_sparse_classes_10k_train_004250
26,819
no_license
[ { "docstring": "Initialize the basics of the output file Parameters ---------- file_name : str, default 'output.csv' Name of the output CSV file append_file : bool, default False Add more rows to an existing CSV file", "name": "__init__", "signature": "def __init__(self, file_name: str='output.csv', app...
3
stack_v2_sparse_classes_30k_train_000574
Implement the Python class `CSVWriter` described below. Class description: Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come. Method signatures and docstrings: - def __init__(self, file_name...
Implement the Python class `CSVWriter` described below. Class description: Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come. Method signatures and docstrings: - def __init__(self, file_name...
560e840f87a6a8f86929cd3b37a799504e46e53b
<|skeleton|> class CSVWriter: """Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come.""" def __init__(self, file_name: str='output.csv', append_file: bool=False): """Initialize ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CSVWriter: """Class which builds a CSV file to store the output of analysis tools. It can only be used to store relatively basic quantities (scalars, strings, etc.) More documentation to come.""" def __init__(self, file_name: str='output.csv', append_file: bool=False): """Initialize the basics of...
the_stack_v2_python_sparse
mlreco/iotools/writers.py
DeepLearnPhysics/lartpc_mlreco3d
train
9
e6164e470ea8b3e7fb60a21db9dd465ee5738e07
[ "miner = Miner.objects.create(name='Some Miner', version='1.0.0')\nwith self.assertRaises(ValidationError):\n request = Request(name='Some Request', request='invalid json', miner=miner)\n request.full_clean()\n request.save()", "miner = Miner.objects.create(name='Some Miner', version='1.0.0')\nrequest = ...
<|body_start_0|> miner = Miner.objects.create(name='Some Miner', version='1.0.0') with self.assertRaises(ValidationError): request = Request(name='Some Request', request='invalid json', miner=miner) request.full_clean() request.save() <|end_body_0|> <|body_start_1|> ...
Тестирование валидатора json
JsonValidatorTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonValidatorTest: """Тестирование валидатора json""" def test_validate_invalid_json(self): """Тестирование invalid json""" <|body_0|> def test_validate_valid_json(self): """Тестирование valid json""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004251
13,105
permissive
[ { "docstring": "Тестирование invalid json", "name": "test_validate_invalid_json", "signature": "def test_validate_invalid_json(self)" }, { "docstring": "Тестирование valid json", "name": "test_validate_valid_json", "signature": "def test_validate_valid_json(self)" } ]
2
stack_v2_sparse_classes_30k_train_003308
Implement the Python class `JsonValidatorTest` described below. Class description: Тестирование валидатора json Method signatures and docstrings: - def test_validate_invalid_json(self): Тестирование invalid json - def test_validate_valid_json(self): Тестирование valid json
Implement the Python class `JsonValidatorTest` described below. Class description: Тестирование валидатора json Method signatures and docstrings: - def test_validate_invalid_json(self): Тестирование invalid json - def test_validate_valid_json(self): Тестирование valid json <|skeleton|> class JsonValidatorTest: "...
d173f1bee44d0752eefb53b1a0da847a3882a352
<|skeleton|> class JsonValidatorTest: """Тестирование валидатора json""" def test_validate_invalid_json(self): """Тестирование invalid json""" <|body_0|> def test_validate_valid_json(self): """Тестирование valid json""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JsonValidatorTest: """Тестирование валидатора json""" def test_validate_invalid_json(self): """Тестирование invalid json""" miner = Miner.objects.create(name='Some Miner', version='1.0.0') with self.assertRaises(ValidationError): request = Request(name='Some Request', ...
the_stack_v2_python_sparse
miningstatistic/core/tests.py
crowmurk/miners
train
0
0f76b35dc98c38a9c0559169a3544e943cb235a3
[ "if connect_string is None:\n connect_string = config.get_database()\nif connect_string.startswith('sqlite:'):\n import sqlite3\n f_name = connect_string[7:]\n util.create_dir(os.path.dirname(f_name))\n con = sqlite3.connect(f_name, detect_types=sqlite3.PARSE_DECLTYPES)\n con.row_factory = sqlite3...
<|body_start_0|> if connect_string is None: connect_string = config.get_database() if connect_string.startswith('sqlite:'): import sqlite3 f_name = connect_string[7:] util.create_dir(os.path.dirname(f_name)) con = sqlite3.connect(f_name, detect...
The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connection.
DatabaseDriver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseDriver: """The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connection.""" def connect(connect_string=...
stack_v2_sparse_classes_10k_train_004252
4,249
permissive
[ { "docstring": "Connect to the database management system. The connect string has two parts: dbms-identifier:connect-info The dbms-identifier is used to identify the database management system that is being used by the application. The driver currently supports two different systems: sqlite and postgres The con...
3
stack_v2_sparse_classes_30k_val_000273
Implement the Python class `DatabaseDriver` described below. Class description: The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connecti...
Implement the Python class `DatabaseDriver` described below. Class description: The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connecti...
7ee5a841c1de873e8cafe2f10da4a23652395f29
<|skeleton|> class DatabaseDriver: """The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connection.""" def connect(connect_string=...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DatabaseDriver: """The database driver establishes a connection to the database system that is used by the application. The static connect method is a wrapper around the different implementations used by supported database systems for establishing a connection.""" def connect(connect_string=None): ...
the_stack_v2_python_sparse
benchengine/db.py
scailfin/benchmark-engine
train
0
1cf4f8a86c1d161204c22447b7026d96507c4192
[ "self.userId = userId\nself.question = question\nself.comment = comment", "commnt = dict(userId=self.userId, question=self.question, comment=self.comment)\ncommentData = {'comment': 'comment'}\ntable = 'comments'\ncolumns = ', '.join(commnt.keys())\nvalues = \"', '\".join(map(str, commnt.values()))\ndetails = ','...
<|body_start_0|> self.userId = userId self.question = question self.comment = comment <|end_body_0|> <|body_start_1|> commnt = dict(userId=self.userId, question=self.question, comment=self.comment) commentData = {'comment': 'comment'} table = 'comments' columns =...
Class for comments CRUD operations
CommentModels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" <|body_0|> def create_comment(self): """method for posting comments""" <|body_1|> def fetch_quest(self, questio...
stack_v2_sparse_classes_10k_train_004253
2,329
no_license
[ { "docstring": "Initialize the comment models", "name": "__init__", "signature": "def __init__(self, userId, question, comment)" }, { "docstring": "method for posting comments", "name": "create_comment", "signature": "def create_comment(self)" }, { "docstring": "Method to fetch q...
5
stack_v2_sparse_classes_30k_train_003916
Implement the Python class `CommentModels` described below. Class description: Class for comments CRUD operations Method signatures and docstrings: - def __init__(self, userId, question, comment): Initialize the comment models - def create_comment(self): method for posting comments - def fetch_quest(self, questionId)...
Implement the Python class `CommentModels` described below. Class description: Class for comments CRUD operations Method signatures and docstrings: - def __init__(self, userId, question, comment): Initialize the comment models - def create_comment(self): method for posting comments - def fetch_quest(self, questionId)...
93c7aeb54c240b6312e6164859acd2c878e85825
<|skeleton|> class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" <|body_0|> def create_comment(self): """method for posting comments""" <|body_1|> def fetch_quest(self, questio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" self.userId = userId self.question = question self.comment = comment def create_comment(self): """method for posting comm...
the_stack_v2_python_sparse
app/api/v2/models/comment_models.py
matthenge/Questioner-api-v2
train
0
386f788ab7515fe91edb6d1d019063b0a083cbe3
[ "self.found = found\nself.displaying = displaying\nself.more_available = more_available\nself.created_date = created_date\nself.institutions = institutions\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nfound = dictionary.get('found')\ndisplaying = dictionary.get('...
<|body_start_0|> self.found = found self.displaying = displaying self.more_available = more_available self.created_date = created_date self.institutions = institutions self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionar...
Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are more institutions to display that match t...
GetInstitutionsResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetInstitutionsResponse: """Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if ...
stack_v2_sparse_classes_10k_train_004254
3,101
permissive
[ { "docstring": "Constructor for the GetInstitutionsResponse class", "name": "__init__", "signature": "def __init__(self, found=None, displaying=None, more_available=None, created_date=None, institutions=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a ...
2
stack_v2_sparse_classes_30k_train_004019
Implement the Python class `GetInstitutionsResponse` described below. Class description: Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying cou...
Implement the Python class `GetInstitutionsResponse` described below. Class description: Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying cou...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class GetInstitutionsResponse: """Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetInstitutionsResponse: """Implementation of the 'Get Institutions Response' model. A list of Finicity financial institutions from the standard get institutions response Attributes: found (int): Total number of results found displaying (int): Displaying count more_available (bool): Indicates if there are mor...
the_stack_v2_python_sparse
finicityapi/models/get_institutions_response.py
monarchmoney/finicity-python
train
0
13faae550a4f408fcabffbe45a858c3803a2f863
[ "templates = mall_models.ProductPropertyTemplate.objects.filter(owner=request.manager)\nfor template in templates:\n template.properties = []\nid2templates = dict([(template.id, template) for template in templates])\ntemplate_ids = [template.id for template in templates]\nproperties = mall_models.TemplatePropert...
<|body_start_0|> templates = mall_models.ProductPropertyTemplate.objects.filter(owner=request.manager) for template in templates: template.properties = [] id2templates = dict([(template.id, template) for template in templates]) template_ids = [template.id for template in temp...
PropertyList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertyList: def get(request): """商品属性模板列表页面.""" <|body_0|> def api_get(request): """获得属性模板中的属性集合 Args: id: 属性模板id Return json: Example: [{ id: 1, name: "属性1", value: "属性1的描述" }, { ...... }]""" <|body_1|> <|end_skeleton|> <|body_start_0|> templates...
stack_v2_sparse_classes_10k_train_004255
5,912
no_license
[ { "docstring": "商品属性模板列表页面.", "name": "get", "signature": "def get(request)" }, { "docstring": "获得属性模板中的属性集合 Args: id: 属性模板id Return json: Example: [{ id: 1, name: \"属性1\", value: \"属性1的描述\" }, { ...... }]", "name": "api_get", "signature": "def api_get(request)" } ]
2
stack_v2_sparse_classes_30k_train_004222
Implement the Python class `PropertyList` described below. Class description: Implement the PropertyList class. Method signatures and docstrings: - def get(request): 商品属性模板列表页面. - def api_get(request): 获得属性模板中的属性集合 Args: id: 属性模板id Return json: Example: [{ id: 1, name: "属性1", value: "属性1的描述" }, { ...... }]
Implement the Python class `PropertyList` described below. Class description: Implement the PropertyList class. Method signatures and docstrings: - def get(request): 商品属性模板列表页面. - def api_get(request): 获得属性模板中的属性集合 Args: id: 属性模板id Return json: Example: [{ id: 1, name: "属性1", value: "属性1的描述" }, { ...... }] <|skeleto...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class PropertyList: def get(request): """商品属性模板列表页面.""" <|body_0|> def api_get(request): """获得属性模板中的属性集合 Args: id: 属性模板id Return json: Example: [{ id: 1, name: "属性1", value: "属性1的描述" }, { ...... }]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PropertyList: def get(request): """商品属性模板列表页面.""" templates = mall_models.ProductPropertyTemplate.objects.filter(owner=request.manager) for template in templates: template.properties = [] id2templates = dict([(template.id, template) for template in templates]) ...
the_stack_v2_python_sparse
weapp/mall/product/properties.py
chengdg/weizoom
train
1
f963cdc9054c19c75a5060fb3a0bf8ae695c6206
[ "super(MultiHeadedLocalAttention, self).__init__()\nself.is_adaptive = opts.is_adaptive\nassert size % num_heads == 0\nself.head_size = head_size = size // num_heads\nself.model_size = size\nself.num_heads = num_heads\nself.k_layer = nn.Linear(size, num_heads * head_size)\nself.v_layer = nn.Linear(size, num_heads *...
<|body_start_0|> super(MultiHeadedLocalAttention, self).__init__() self.is_adaptive = opts.is_adaptive assert size % num_heads == 0 self.head_size = head_size = size // num_heads self.model_size = size self.num_heads = num_heads self.k_layer = nn.Linear(size, num_...
Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py
MultiHeadedLocalAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedLocalAttention: """Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py""" def __init__(self, opts, num_heads: int, size: int, dropout: float=0.1): """Create a multi-headed attention lay...
stack_v2_sparse_classes_10k_train_004256
4,908
no_license
[ { "docstring": "Create a multi-headed attention layer. :param num_heads: the number of heads :param size: model size (must be divisible by num_heads) :param dropout: probability of dropping a unit", "name": "__init__", "signature": "def __init__(self, opts, num_heads: int, size: int, dropout: float=0.1)...
2
stack_v2_sparse_classes_30k_train_000030
Implement the Python class `MultiHeadedLocalAttention` described below. Class description: Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py Method signatures and docstrings: - def __init__(self, opts, num_heads: int, size: int,...
Implement the Python class `MultiHeadedLocalAttention` described below. Class description: Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py Method signatures and docstrings: - def __init__(self, opts, num_heads: int, size: int,...
e213665be8d3820fa2fc0aa9afe9949fd2e3d488
<|skeleton|> class MultiHeadedLocalAttention: """Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py""" def __init__(self, opts, num_heads: int, size: int, dropout: float=0.1): """Create a multi-headed attention lay...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiHeadedLocalAttention: """Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py""" def __init__(self, opts, num_heads: int, size: int, dropout: float=0.1): """Create a multi-headed attention layer. :param nu...
the_stack_v2_python_sparse
modules/multihead_local_attention.py
zqp111/transformer_ar
train
1
e690b6a5db5957d2d8ebf43f84e048fbe4ae9433
[ "if 'QI' not in params:\n params['QI'] = 'IE'\nsuper().__init__(params)\nself.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI)", "L = self.level\nP = L.prob\nme = []\nfor m in range(1, self.coll.num_nodes + 1):\n me.append(P.dtype_u(P.init, val=0.0))\n for j in range(1, self.coll.num_node...
<|body_start_0|> if 'QI' not in params: params['QI'] = 'IE' super().__init__(params) self.QI = self.get_Qdelta_implicit(self.coll, qd_type=self.params.QI) <|end_body_0|> <|body_start_1|> L = self.level P = L.prob me = [] for m in range(1, self.coll.nu...
Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix
generic_implicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class generic_implicit: """Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix""" def __init__(self, params): """Initialization routine for the custom sweeper Args: params: parameters for the sweeper""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_004257
3,929
permissive
[ { "docstring": "Initialization routine for the custom sweeper Args: params: parameters for the sweeper", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Integrates the right-hand side Returns: list of dtype_u: containing the integral as values", "name": "inte...
4
stack_v2_sparse_classes_30k_train_003205
Implement the Python class `generic_implicit` described below. Class description: Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix Method signatures and docstrings: - def __init__(self, params): Initialization routine for the custom sweeper Args: params...
Implement the Python class `generic_implicit` described below. Class description: Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix Method signatures and docstrings: - def __init__(self, params): Initialization routine for the custom sweeper Args: params...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class generic_implicit: """Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix""" def __init__(self, params): """Initialization routine for the custom sweeper Args: params: parameters for the sweeper""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class generic_implicit: """Generic implicit sweeper, expecting lower triangular matrix type as input Attributes: QI: lower triangular matrix""" def __init__(self, params): """Initialization routine for the custom sweeper Args: params: parameters for the sweeper""" if 'QI' not in params: ...
the_stack_v2_python_sparse
pySDC/implementations/sweeper_classes/generic_implicit.py
Parallel-in-Time/pySDC
train
30
1fd63650323be9b69abc24f01f34b991ff5f1d5b
[ "def inner(result):\n pbar.update(1)\n self.results.append(result)\nreturn inner", "if not os.path.exists(self.target):\n os.makedirs(self.target)\nself.replicate(self.corpus.root)\nself.results = []\nfileids = self.fileids(fileids, categories)\nwith tqdm(total=len(fileids), unit='Docs') as pbar:\n po...
<|body_start_0|> def inner(result): pbar.update(1) self.results.append(result) return inner <|end_body_0|> <|body_start_1|> if not os.path.exists(self.target): os.makedirs(self.target) self.replicate(self.corpus.root) self.results = [] ...
Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...
ProgressParallelPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicat...
stack_v2_sparse_classes_10k_train_004258
13,132
no_license
[ { "docstring": "Indicates progress on result.", "name": "on_result", "signature": "def on_result(self, pbar)" }, { "docstring": "Setup the progress bar before conducting multiprocess transform.", "name": "transform", "signature": "def transform(self, fileids=None, categories=None)" } ]
2
stack_v2_sparse_classes_30k_train_002701
Implement the Python class `ProgressParallelPreprocessor` described below. Class description: Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ... Method signat...
Implement the Python class `ProgressParallelPreprocessor` described below. Class description: Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ... Method signat...
22395f7c83c9b561ec75e7ac8729f92444bd799b
<|skeleton|> class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicates progress o...
the_stack_v2_python_sparse
benjamin_bengfort_applied_text_analysis/10_parallell/multi_preprocess.py
olegzinkevich/programming_books_notes_and_codes
train
0
32c1571a62386f6d4fb490056be5dc4bfd9763d7
[ "super(CaffeGraphConverter, self).__init__(framework, base_path)\nprint('{} bmodel converter init'.format(model_name))\nself.model_name = model_name\nself.models_path = models_path\nself.weights_path = weights_path\nself.shapes = shapes\nself.dyns = dyns\nself.outdirs = outdirs\nself.target = target\nself.bmodel_co...
<|body_start_0|> super(CaffeGraphConverter, self).__init__(framework, base_path) print('{} bmodel converter init'.format(model_name)) self.model_name = model_name self.models_path = models_path self.weights_path = weights_path self.shapes = shapes self.dyns = dyns...
caffe graph bmodel converter
CaffeGraphConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaffeGraphConverter: """caffe graph bmodel converter""" def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): """Init caffe graph bmodel converter""" <|body_0|> def converter(self): """conv...
stack_v2_sparse_classes_10k_train_004259
15,723
permissive
[ { "docstring": "Init caffe graph bmodel converter", "name": "__init__", "signature": "def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine)" }, { "docstring": "convert caffe graph", "name": "converter", "signature":...
2
stack_v2_sparse_classes_30k_train_001241
Implement the Python class `CaffeGraphConverter` described below. Class description: caffe graph bmodel converter Method signatures and docstrings: - def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): Init caffe graph bmodel converter - def ...
Implement the Python class `CaffeGraphConverter` described below. Class description: caffe graph bmodel converter Method signatures and docstrings: - def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): Init caffe graph bmodel converter - def ...
c9fa07851da663dda4953dba72e1d3937299a4ea
<|skeleton|> class CaffeGraphConverter: """caffe graph bmodel converter""" def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): """Init caffe graph bmodel converter""" <|body_0|> def converter(self): """conv...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CaffeGraphConverter: """caffe graph bmodel converter""" def __init__(self, model_name, base_path, models_path, weights_path, shapes, dyns, outdirs, framework, target, bmodel_combine): """Init caffe graph bmodel converter""" super(CaffeGraphConverter, self).__init__(framework, base_path) ...
the_stack_v2_python_sparse
modules/utils/bmodel_converter.py
sophon-ai-algo/sophon-inference
train
32
69af30d67b25d4adfa14de6e4d932ab1bae5b846
[ "counts = collections.defaultdict(int)\nfor v in nums:\n counts[v] += 1\n if len(counts.keys()) == 3:\n rmks = []\n for k in counts.keys():\n counts[k] -= 1\n if counts[k] == 0:\n rmks.append(k)\n for k in rmks:\n counts.pop(k)\nreturn list(...
<|body_start_0|> counts = collections.defaultdict(int) for v in nums: counts[v] += 1 if len(counts.keys()) == 3: rmks = [] for k in counts.keys(): counts[k] -= 1 if counts[k] == 0: rmk...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums): """每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :param nums: :return:""" <|body_0|> def majorityElement2(self, nums): """Very f...
stack_v2_sparse_classes_10k_train_004260
2,062
permissive
[ { "docstring": "每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :param nums: :return:", "name": "majorityElement", "signature": "def majorityElement(self, nums)" }, { "docstring": "Very fast, but not O(...
2
stack_v2_sparse_classes_30k_train_002182
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): 每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :pa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): 每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :pa...
2830c7e2ada8dfd3dcdda7c06846116d4f944a27
<|skeleton|> class Solution: def majorityElement(self, nums): """每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :param nums: :return:""" <|body_0|> def majorityElement2(self, nums): """Very f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElement(self, nums): """每次去除3个不一样的数字,最后剩下的数字中一定包含出现次数超过1/3的数字。 1. 假设出现次数超过1/3的数字是X,假设最后剩下的数字中不包含它,那么即使前面 每次去掉的三个数字中都包含一个X,它出现的次数也只有N//3,与题意矛盾。 2. 最后最多剩下2个数字, 再分别遍历一次 :param nums: :return:""" counts = collections.defaultdict(int) for v in nums: counts[v...
the_stack_v2_python_sparse
leetcode/medium/Major_Element_II.py
shhuan/algorithms
train
0
aba0708e11fcc763d2fe0adb2db515c2c2c51412
[ "self.subtotal = subtotal\nself.state = state\nself.county = county", "tax_rate = self.STATE_TAX.get(self.state, 0) + self.COUNTY_TAX.get(self.state, {}).get(self.county, 0)\ntax = self.subtotal * tax_rate\norder = {'tax': float(tax), 'total': float(self.subtotal + tax)}\nreturn order" ]
<|body_start_0|> self.subtotal = subtotal self.state = state self.county = county <|end_body_0|> <|body_start_1|> tax_rate = self.STATE_TAX.get(self.state, 0) + self.COUNTY_TAX.get(self.state, {}).get(self.county, 0) tax = self.subtotal * tax_rate order = {'tax': float(t...
Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Total purchase amount before taxes state: (Stri...
MultistateTaxes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultistateTaxes: """Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Tota...
stack_v2_sparse_classes_10k_train_004261
3,005
no_license
[ { "docstring": "Initializes the class -- prompts user for input", "name": "__init__", "signature": "def __init__(self, subtotal=None, state=None, county=None)" }, { "docstring": "Calculates the total charges for the customer Args: n/a -- uses class attributes Returns: order: (Dict) { tax: (Float...
2
stack_v2_sparse_classes_30k_train_003198
Implement the Python class `MultistateTaxes` described below. Class description: Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each ...
Implement the Python class `MultistateTaxes` described below. Class description: Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each ...
218894fbad8ac3389003ce7321fd4c4020239fd6
<|skeleton|> class MultistateTaxes: """Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Tota...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultistateTaxes: """Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Total purchase am...
the_stack_v2_python_sparse
challenges/c20_MultistateSalesTax/multistate_tax/multistate_tax.py
andrew-rietz/FiftySeven_Coding_Challenges
train
0
a317a7fbc38595d9aa056a169e01826692cafc3e
[ "self.mMapComponent2Object = {}\nself.mMapObject2Component = {}\nfor line in infile:\n if line[0] == '#':\n continue\n data = line[:-1].split('\\t')\n obj_id, obj_start, obj_end, ncoms, com_type, com_id = data[:6]\n if com_type == 'N':\n continue\n com_start, com_end, orientation = data...
<|body_start_0|> self.mMapComponent2Object = {} self.mMapObject2Component = {} for line in infile: if line[0] == '#': continue data = line[:-1].split('\t') obj_id, obj_start, obj_end, ncoms, com_type, com_id = data[:6] if com_type =...
Parser for AGP formatted files.
AGP
[ "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih....
stack_v2_sparse_classes_10k_train_004262
2,378
permissive
[ { "docstring": "read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih.gov/genome/guide/Assembly/AGP_Specification.html) objects (obj) like scaffolds are assembl...
2
stack_v2_sparse_classes_30k_train_005276
Implement the Python class `AGP` described below. Class description: Parser for AGP formatted files. Method signatures and docstrings: - def readFromFile(self, infile): read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/close...
Implement the Python class `AGP` described below. Class description: Parser for AGP formatted files. Method signatures and docstrings: - def readFromFile(self, infile): read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/close...
1ec3733ca0b9bb6ee2931201fc0c329b9e079564
<|skeleton|> class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih.gov/genome/gu...
the_stack_v2_python_sparse
cgat/AGP.py
cgat-developers/cgat-apps
train
31
300026554d56b5c8db50d4aeb8214ac13f36d766
[ "args = get_checkin_parser.parse_args()\nlimit = min(args['limit'], 10)\nres = Checkins.get_all(g.user.id, limit)\nreturn (res, 200)", "args = post_checkin_parser.parse_args()\nres = Checkins.add(g.user.id, args['slot_id'])\nif not res:\n api.abort(404, 'No slot existing with this id')\nreturn (res, 201)" ]
<|body_start_0|> args = get_checkin_parser.parse_args() limit = min(args['limit'], 10) res = Checkins.get_all(g.user.id, limit) return (res, 200) <|end_body_0|> <|body_start_1|> args = post_checkin_parser.parse_args() res = Checkins.add(g.user.id, args['slot_id']) ...
CheckinList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckinList: def get(self): """Get the list of last checkins. List has a max length of 10 checkins.""" <|body_0|> def post(self): """Add a new checkin""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = get_checkin_parser.parse_args() lim...
stack_v2_sparse_classes_10k_train_004263
36,924
permissive
[ { "docstring": "Get the list of last checkins. List has a max length of 10 checkins.", "name": "get", "signature": "def get(self)" }, { "docstring": "Add a new checkin", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_000007
Implement the Python class `CheckinList` described below. Class description: Implement the CheckinList class. Method signatures and docstrings: - def get(self): Get the list of last checkins. List has a max length of 10 checkins. - def post(self): Add a new checkin
Implement the Python class `CheckinList` described below. Class description: Implement the CheckinList class. Method signatures and docstrings: - def get(self): Get the list of last checkins. List has a max length of 10 checkins. - def post(self): Add a new checkin <|skeleton|> class CheckinList: def get(self):...
aa8110de839233dd9b0905f010ca9994c6f3ffb7
<|skeleton|> class CheckinList: def get(self): """Get the list of last checkins. List has a max length of 10 checkins.""" <|body_0|> def post(self): """Add a new checkin""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckinList: def get(self): """Get the list of last checkins. List has a max length of 10 checkins.""" args = get_checkin_parser.parse_args() limit = min(args['limit'], 10) res = Checkins.get_all(g.user.id, limit) return (res, 200) def post(self): """Add a ...
the_stack_v2_python_sparse
prkng/api/public/v1.py
OmniaProbitate/api
train
0
fbb5f8d9ad107e9eb0949031e21c44463e580496
[ "with create_session() as session:\n matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one()\n entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list)\n raise Return(entity)", "with create_session() as session:\n matched_park...
<|body_start_0|> with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).filter(MatchedParkingSpaceList.plate == plate).one() entity = MatchedParkingSpaceMapper.to_entity(record=matched_parking_list) raise Return(entity) <|end_body_0|> ...
MatchedParkingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_10k_train_004264
3,429
no_license
[ { "docstring": "Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user", "name": "read_one", "signature": "def read_one(cls, plate)" }, { "docstring": "Read many and only return list<MatchedParkingSpace> :param str user...
5
stack_v2_sparse_classes_30k_train_001219
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
Implement the Python class `MatchedParkingList` described below. Class description: Implement the MatchedParkingList class. Method signatures and docstrings: - def read_one(cls, plate): Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user ...
fd759c16b9864f6b1b47b1ba3f1af77f8d08af20
<|skeleton|> class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" <|body_0|> def read_many(cls, user_id): """Read many and only return list<MatchedPa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MatchedParkingList: def read_one(cls, plate): """Read one by plate :param str plate: :return MatchedParkingSpace: :raises vehicle with given plate doesn't have matched waiting user""" with create_session() as session: matched_parking_list = session.query(MatchedParkingSpaceList).fi...
the_stack_v2_python_sparse
ParkingFinder/repositories/matched_parking_list.py
Big-Lemon/ParkingFinder
train
2
a41d07f606937855b97dd9a7a565512634603b94
[ "if n > 2:\n ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2)\nelse:\n ans = n\nreturn ans", "if n > 2:\n ans = self.climbStairs_cacherec(n - 1) + self.climbStairs_cacherec(n - 2)\nelse:\n ans = n\nreturn ans", "if n == 1:\n return 1\nif n == 2:\n return 2\ndp = [0] * n\ndp[0] =...
<|body_start_0|> if n > 2: ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2) else: ans = n return ans <|end_body_0|> <|body_start_1|> if n > 2: ans = self.climbStairs_cacherec(n - 1) + self.climbStairs_cacherec(n - 2) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" <|body_1|> def climbStairs_dp(self, n): """:type n: int :rtype: int""" <|body_2|> def...
stack_v2_sparse_classes_10k_train_004265
2,932
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs_rec", "signature": "def climbStairs_rec(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs_cacherec", "signature": "def climbStairs_cacherec(self, n)" }, { "docstring": ":type n: int :rtype:...
5
stack_v2_sparse_classes_30k_train_007337
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs_rec(self, n): :type n: int :rtype: int - def climbStairs_cacherec(self, n): :type n: int :rtype: int - def climbStairs_dp(self, n): :type n: int :rtype: int - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs_rec(self, n): :type n: int :rtype: int - def climbStairs_cacherec(self, n): :type n: int :rtype: int - def climbStairs_dp(self, n): :type n: int :rtype: int - def...
3f7b2ea959308eb80f4c65be35aaeed666570f80
<|skeleton|> class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" <|body_1|> def climbStairs_dp(self, n): """:type n: int :rtype: int""" <|body_2|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs_rec(self, n): """:type n: int :rtype: int""" if n > 2: ans = self.climbStairs_rec(n - 1) + self.climbStairs_rec(n - 2) else: ans = n return ans def climbStairs_cacherec(self, n): """:type n: int :rtype: int""" ...
the_stack_v2_python_sparse
70.爬楼梯.py
dxc19951001/Everyday_LeetCode
train
1
b859e66503c61efd0f8e98519c9b0474425c6400
[ "self.cbb = DpFile(cbb_file)\nself.wbb = DpFile(wbb_file)\nself.sam = DpFile(sam_file)\nself.plate = plate\nself.model = self.sam.model\nif not dwr_file == None:\n self.dwr = DpFile(dwr_file)\nelse:\n self.dwr = None\nself._calibrate_measurement()", "cold_blackbody = bb_radiance(self.cbb.header.cbb_temperat...
<|body_start_0|> self.cbb = DpFile(cbb_file) self.wbb = DpFile(wbb_file) self.sam = DpFile(sam_file) self.plate = plate self.model = self.sam.model if not dwr_file == None: self.dwr = DpFile(dwr_file) else: self.dwr = None self._cal...
A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance holding the warm blackbody information. sam - A DpFile instance holding the samp...
DpMeasurement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DpMeasurement: """A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance holding the warm blackbody information....
stack_v2_sparse_classes_10k_train_004266
4,023
no_license
[ { "docstring": "DpMeasurement instance constructor. Arguments: cbb_file - The cold blackbody filename. wbb_file - The warm blackbody filename. sam_file - The sample filename. dwr_file - The downwelling filename. plate - The plate emissivity.", "name": "__init__", "signature": "def __init__(self, cbb_fil...
3
stack_v2_sparse_classes_30k_train_004738
Implement the Python class `DpMeasurement` described below. Class description: A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance ...
Implement the Python class `DpMeasurement` described below. Class description: A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance ...
743167940f700374755ea273b90da66befae1ba4
<|skeleton|> class DpMeasurement: """A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance holding the warm blackbody information....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DpMeasurement: """A class that holds the information relavent to a complete measurement taken with a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: cbb - A DpFile instance holding the cold blackbody information. wbb - A DpFile instance holding the warm blackbody information. sam - A DpFi...
the_stack_v2_python_sparse
tes/models/dp_models/dp_measurement.py
max19951001/TES
train
0
deddc093edcbd0ecbe5e5a821330de0d03642b86
[ "if not reservation.is_within_allowed_period_for_reservation() and (not (reservation.special or reservation.event)):\n return 'Reservasjoner kan bare lages {:} dager frem i tid'.format(reservation.reservation_future_limit_days)\nif self.request.user.has_perm('make_queue.can_create_event_reservation') and form.cl...
<|body_start_0|> if not reservation.is_within_allowed_period_for_reservation() and (not (reservation.special or reservation.event)): return 'Reservasjoner kan bare lages {:} dager frem i tid'.format(reservation.reservation_future_limit_days) if self.request.user.has_perm('make_queue.can_crea...
Base abstract class for the reservation create or change view
ReservationCreateOrChangeView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReservationCreateOrChangeView: """Base abstract class for the reservation create or change view""" def get_error_message(self, form, reservation): """Generates the correct error message for the given form :param reservation: The reservation to generate an error message for :param for...
stack_v2_sparse_classes_10k_train_004267
12,808
permissive
[ { "docstring": "Generates the correct error message for the given form :param reservation: The reservation to generate an error message for :param form: The form to generate an error message for :return: The error message", "name": "get_error_message", "signature": "def get_error_message(self, form, res...
5
stack_v2_sparse_classes_30k_train_004621
Implement the Python class `ReservationCreateOrChangeView` described below. Class description: Base abstract class for the reservation create or change view Method signatures and docstrings: - def get_error_message(self, form, reservation): Generates the correct error message for the given form :param reservation: Th...
Implement the Python class `ReservationCreateOrChangeView` described below. Class description: Base abstract class for the reservation create or change view Method signatures and docstrings: - def get_error_message(self, form, reservation): Generates the correct error message for the given form :param reservation: Th...
1d190a86e3277315804bfcc0b8f9abd4f9c1d780
<|skeleton|> class ReservationCreateOrChangeView: """Base abstract class for the reservation create or change view""" def get_error_message(self, form, reservation): """Generates the correct error message for the given form :param reservation: The reservation to generate an error message for :param for...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReservationCreateOrChangeView: """Base abstract class for the reservation create or change view""" def get_error_message(self, form, reservation): """Generates the correct error message for the given form :param reservation: The reservation to generate an error message for :param form: The form t...
the_stack_v2_python_sparse
make_queue/views/reservation/reservation.py
mahoyen/web
train
0
db9788aaa0ae45006e2157243c4972c3fd065ad0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.emailFileAssessmentRequest'.casefold():\n ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
ThreatAssessmentRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreatAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatAssessmentRequest: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and creat...
stack_v2_sparse_classes_10k_train_004268
7,669
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ThreatAssessmentRequest", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
stack_v2_sparse_classes_30k_train_006741
Implement the Python class `ThreatAssessmentRequest` described below. Class description: Implement the ThreatAssessmentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatAssessmentRequest: Creates a new instance of the appropriate clas...
Implement the Python class `ThreatAssessmentRequest` described below. Class description: Implement the ThreatAssessmentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatAssessmentRequest: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ThreatAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatAssessmentRequest: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and creat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThreatAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ThreatAssessmentRequest: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object R...
the_stack_v2_python_sparse
msgraph/generated/models/threat_assessment_request.py
microsoftgraph/msgraph-sdk-python
train
135
b3e27a0bebcfae245436903639233712e2837774
[ "self.__lib_sig = lib_sig\nself.__log_path = log_path\nself.__log_table = {}", "logger = logging.getLogger(log_name)\nif log_level < logger.level or logger.level == logging.NOTSET:\n logger.setLevel(log_level)\nif log_name in self.__log_table and self.__log_table[log_name] == Logger.FILE_AND_CONSOLE:\n retu...
<|body_start_0|> self.__lib_sig = lib_sig self.__log_path = log_path self.__log_table = {} <|end_body_0|> <|body_start_1|> logger = logging.getLogger(log_name) if log_level < logger.level or logger.level == logging.NOTSET: logger.setLevel(log_level) if log_na...
Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the constants: NOTSET, DEBUG, INFO, WARNING, ERROR, and CRITICAL. These constants ...
Logger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the constants: NOTSET, DEBUG, INFO, WARNING, ERR...
stack_v2_sparse_classes_10k_train_004269
5,366
permissive
[ { "docstring": "Inits Logger. Args: lib_sig: str Signature of the client library. [optional] log_path: str Absolute or relative path to the logs directory.", "name": "__init__", "signature": "def __init__(self, lib_sig, log_path=os.path.join(os.getcwd(), 'logs'))" }, { "docstring": "Creates the ...
3
stack_v2_sparse_classes_30k_val_000213
Implement the Python class `Logger` described below. Class description: Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the const...
Implement the Python class `Logger` described below. Class description: Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the const...
b30d90f74248cfd5ca52967e9ee77fc4cd1b9abc
<|skeleton|> class Logger: """Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the constants: NOTSET, DEBUG, INFO, WARNING, ERR...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Logger: """Responsible for impementing logging. Allows to write to an external log or a console. There are 4 types of handlers denoted by the handler constants: NONE, FILE, CONSOLE, and FILE_AND_CONSOLE. There are also 6 verbosity levels defined by the constants: NOTSET, DEBUG, INFO, WARNING, ERROR, and CRITI...
the_stack_v2_python_sparse
adspygoogle/common/Logger.py
nearlyfreeapps/python-googleadwords
train
2
fa62841e4604253c52f91eca580932b0c672c690
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn File()", "from .hashes import Hashes\nfrom .hashes import Hashes\nfields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes', n.get_object_value(Hashes)), 'mimeType': lambda n: setattr(self, 'mime_type', n.g...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return File() <|end_body_0|> <|body_start_1|> from .hashes import Hashes from .hashes import Hashes fields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes...
File
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File""" ...
stack_v2_sparse_classes_10k_train_004270
3,158
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
null
Implement the Python class `File` described below. Class description: Implement the File class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `File` described below. Class description: Implement the File class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/file.py
microsoftgraph/msgraph-sdk-python
train
135
7773e7756d4ab1e5aab18f5fe7722aa5b6badd3d
[ "print('wihtin Liner datetracker ', date_tracker)\nself.date_tracker = date_tracker\nself.roster_days = roster_days\nself.itinerary_builder = ItinBuilder()\nself.line_type = line_type\nmonth = self.date_tracker.month\nyear = self.date_tracker.year\nself.line = Line(month, year)\nself.unrecognized_events = []", "t...
<|body_start_0|> print('wihtin Liner datetracker ', date_tracker) self.date_tracker = date_tracker self.roster_days = roster_days self.itinerary_builder = ItinBuilder() self.line_type = line_type month = self.date_tracker.month year = self.date_tracker.year ...
´Turns a Roster Reader into a bidline
Liner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Liner: """´Turns a Roster Reader into a bidline""" def __init__(self, date_tracker, roster_days, line_type='scheduled'): """Mandatory arguments""" <|body_0|> def build_line(self): """Returns a Line object containing all data read from the text file but now turned...
stack_v2_sparse_classes_10k_train_004271
5,879
no_license
[ { "docstring": "Mandatory arguments", "name": "__init__", "signature": "def __init__(self, date_tracker, roster_days, line_type='scheduled')" }, { "docstring": "Returns a Line object containing all data read from the text file but now turned into corresponding objects", "name": "build_line",...
5
stack_v2_sparse_classes_30k_train_000285
Implement the Python class `Liner` described below. Class description: ´Turns a Roster Reader into a bidline Method signatures and docstrings: - def __init__(self, date_tracker, roster_days, line_type='scheduled'): Mandatory arguments - def build_line(self): Returns a Line object containing all data read from the tex...
Implement the Python class `Liner` described below. Class description: ´Turns a Roster Reader into a bidline Method signatures and docstrings: - def __init__(self, date_tracker, roster_days, line_type='scheduled'): Mandatory arguments - def build_line(self): Returns a Line object containing all data read from the tex...
0be9c5515f7ccd9ac7a07a2958c0d8aa9d19624c
<|skeleton|> class Liner: """´Turns a Roster Reader into a bidline""" def __init__(self, date_tracker, roster_days, line_type='scheduled'): """Mandatory arguments""" <|body_0|> def build_line(self): """Returns a Line object containing all data read from the text file but now turned...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Liner: """´Turns a Roster Reader into a bidline""" def __init__(self, date_tracker, roster_days, line_type='scheduled'): """Mandatory arguments""" print('wihtin Liner datetracker ', date_tracker) self.date_tracker = date_tracker self.roster_days = roster_days self....
the_stack_v2_python_sparse
rosterReaders/lineCreator.py
demxic/Orgutrip
train
0
a59a492015185b6e1a9af5b1fdf98acebc0c109e
[ "sc.logger.info('小影圈关注页面初始状态检查开始')\nfun_name = 'test_planet_page'\nsc.logger.info('点击小影圈主按钮')\np_btn = 'com.quvideo.xiaoying:id/img_find'\nWebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click()\ntime.sleep(1)\nsc.logger.info('开始查找小影圈关注tab')\nel_tab_list = sc.driver.find_elements_by_i...
<|body_start_0|> sc.logger.info('小影圈关注页面初始状态检查开始') fun_name = 'test_planet_page' sc.logger.info('点击小影圈主按钮') p_btn = 'com.quvideo.xiaoying:id/img_find' WebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click() time.sleep(1) sc.logger.in...
小影圈关注页UI的测试类,分步截图.
TestPlanetExploreUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPlanetExploreUI: """小影圈关注页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈关注页面初始状态测试.""" <|body_0|> def test_refresh(self): """测试下拉刷新.""" <|body_1|> def test_swipe_vertical(self): """测试上下方向的滑动.""" <|body_2|> def test_origin...
stack_v2_sparse_classes_10k_train_004272
3,656
no_license
[ { "docstring": "小影圈关注页面初始状态测试.", "name": "test_planet_page", "signature": "def test_planet_page(self)" }, { "docstring": "测试下拉刷新.", "name": "test_refresh", "signature": "def test_refresh(self)" }, { "docstring": "测试上下方向的滑动.", "name": "test_swipe_vertical", "signature": "d...
4
stack_v2_sparse_classes_30k_train_000846
Implement the Python class `TestPlanetExploreUI` described below. Class description: 小影圈关注页UI的测试类,分步截图. Method signatures and docstrings: - def test_planet_page(self): 小影圈关注页面初始状态测试. - def test_refresh(self): 测试下拉刷新. - def test_swipe_vertical(self): 测试上下方向的滑动. - def test_origin_home(self): 关注页tab的功能.
Implement the Python class `TestPlanetExploreUI` described below. Class description: 小影圈关注页UI的测试类,分步截图. Method signatures and docstrings: - def test_planet_page(self): 小影圈关注页面初始状态测试. - def test_refresh(self): 测试下拉刷新. - def test_swipe_vertical(self): 测试上下方向的滑动. - def test_origin_home(self): 关注页tab的功能. <|skeleton|> cl...
0003b68fc8e26a96ee1661c1eb1f26f96810e909
<|skeleton|> class TestPlanetExploreUI: """小影圈关注页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈关注页面初始状态测试.""" <|body_0|> def test_refresh(self): """测试下拉刷新.""" <|body_1|> def test_swipe_vertical(self): """测试上下方向的滑动.""" <|body_2|> def test_origin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestPlanetExploreUI: """小影圈关注页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈关注页面初始状态测试.""" sc.logger.info('小影圈关注页面初始状态检查开始') fun_name = 'test_planet_page' sc.logger.info('点击小影圈主按钮') p_btn = 'com.quvideo.xiaoying:id/img_find' WebDriverWait(sc.driver, 10,...
the_stack_v2_python_sparse
iOS/VivaVideo/test_community/test_personal/test_follow.py
Lemonzhulixin/UItest
train
5
3ca0031e4c3c28e7b0be28110c1bfc293bce7f2b
[ "prev_date = ''\ncurr_date = ''\nentries_by_date = {}\ncurr_date_entries = []\nfor entry in entries:\n curr_date = entry['date']\n if prev_date == '':\n curr_date_entries.append(entry)\n else:\n if curr_date != prev_date:\n entries_by_date[prev_date] = self.get_m_freqs(curr_date_en...
<|body_start_0|> prev_date = '' curr_date = '' entries_by_date = {} curr_date_entries = [] for entry in entries: curr_date = entry['date'] if prev_date == '': curr_date_entries.append(entry) else: if curr_date !=...
Reporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reporter: def get_freqs_by_date(self, entries): """Given an array of entries returns the frequencies, as a Counter""" <|body_0|> def get_m_freqs(self, entries): """Given an array of entries returns the frequencies, as a Counter""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_10k_train_004273
1,516
no_license
[ { "docstring": "Given an array of entries returns the frequencies, as a Counter", "name": "get_freqs_by_date", "signature": "def get_freqs_by_date(self, entries)" }, { "docstring": "Given an array of entries returns the frequencies, as a Counter", "name": "get_m_freqs", "signature": "def...
2
stack_v2_sparse_classes_30k_train_002121
Implement the Python class `Reporter` described below. Class description: Implement the Reporter class. Method signatures and docstrings: - def get_freqs_by_date(self, entries): Given an array of entries returns the frequencies, as a Counter - def get_m_freqs(self, entries): Given an array of entries returns the freq...
Implement the Python class `Reporter` described below. Class description: Implement the Reporter class. Method signatures and docstrings: - def get_freqs_by_date(self, entries): Given an array of entries returns the frequencies, as a Counter - def get_m_freqs(self, entries): Given an array of entries returns the freq...
3ac8f8c87365229646d9f7e739a1552c7668d80f
<|skeleton|> class Reporter: def get_freqs_by_date(self, entries): """Given an array of entries returns the frequencies, as a Counter""" <|body_0|> def get_m_freqs(self, entries): """Given an array of entries returns the frequencies, as a Counter""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Reporter: def get_freqs_by_date(self, entries): """Given an array of entries returns the frequencies, as a Counter""" prev_date = '' curr_date = '' entries_by_date = {} curr_date_entries = [] for entry in entries: curr_date = entry['date'] ...
the_stack_v2_python_sparse
source/day04/modules/reporter.py
adagio/advent-of-code
train
0
df20a5ae94b92f6045167b95caf1eedef296b3d9
[ "super().__init__(cols, tab_width=tab_width, column_borders=column_borders, padding=padding, border_fg=border_fg, border_bg=border_bg, header_bg=header_bg)\nself.row_num = 1\nself.odd_bg = odd_bg\nself.even_bg = even_bg", "if self.row_num % 2 == 0 and self.even_bg is not None:\n return ansi.style(value, bg=sel...
<|body_start_0|> super().__init__(cols, tab_width=tab_width, column_borders=column_borders, padding=padding, border_fg=border_fg, border_bg=border_bg, header_bg=header_bg) self.row_num = 1 self.odd_bg = odd_bg self.even_bg = even_bg <|end_body_0|> <|body_start_1|> if self.row_nu...
Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within another AlternatingTable, set style_data_text to False on the Column which contains the ...
AlternatingTable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlternatingTable: """Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within another AlternatingTable, set style_data_tex...
stack_v2_sparse_classes_10k_train_004274
47,543
permissive
[ { "docstring": "AlternatingTable initializer Note: Specify background colors using subclasses of BgColor (e.g. Bg, EightBitBg, RgbBg) :param cols: column definitions for this table :param tab_width: all tabs will be replaced with this many spaces. If a row's fill_char is a tab, then it will be converted to one ...
4
stack_v2_sparse_classes_30k_train_003617
Implement the Python class `AlternatingTable` described below. Class description: Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within anoth...
Implement the Python class `AlternatingTable` described below. Class description: Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within anoth...
9886b82c71face043e1fac871a6cdbebbf0e864c
<|skeleton|> class AlternatingTable: """Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within another AlternatingTable, set style_data_tex...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlternatingTable: """Implementation of BorderedTable which uses background colors to distinguish between rows instead of row border lines. This class can be used to create the whole table at once or one row at a time. To nest an AlternatingTable within another AlternatingTable, set style_data_text to False on...
the_stack_v2_python_sparse
cmd2/table_creator.py
python-cmd2/cmd2
train
571
8368b26db219b23c5d2f64e1b2c7593c828f1334
[ "super(IperfTest, self).__init__()\nself.sender_command = sender_command\nself.receiver_command = receiver_command\nself.wait_events = wait_events\nself._sleep = sleep\nself._kill = None\nreturn", "if self._kill is None:\n self._kill = KillAll(name='iperf')\nreturn self._kill", "if self._sleep is None:\n ...
<|body_start_0|> super(IperfTest, self).__init__() self.sender_command = sender_command self.receiver_command = receiver_command self.wait_events = wait_events self._sleep = sleep self._kill = None return <|end_body_0|> <|body_start_1|> if self._kill is N...
The Iperf Test runs a single iperf test.
IperfTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IperfTest: """The Iperf Test runs a single iperf test.""" def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): """:param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server...
stack_v2_sparse_classes_10k_train_004275
4,384
permissive
[ { "docstring": ":param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server parameters - `sleep`: A Sleep object with the sleep time preset - `wait_events`: list of events to wait for", "name": "__init__", "signature": "def __init__(s...
5
null
Implement the Python class `IperfTest` described below. Class description: The Iperf Test runs a single iperf test. Method signatures and docstrings: - def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): :param: - `sender_command`: an IperfCommand bundled with client paramete...
Implement the Python class `IperfTest` described below. Class description: The Iperf Test runs a single iperf test. Method signatures and docstrings: - def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): :param: - `sender_command`: an IperfCommand bundled with client paramete...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class IperfTest: """The Iperf Test runs a single iperf test.""" def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): """:param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IperfTest: """The Iperf Test runs a single iperf test.""" def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): """:param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server parameters -...
the_stack_v2_python_sparse
apetools/tools/iperftest.py
russell-n/oldape
train
0
400594ef30b70c494f8249cae5ab982b4e25936c
[ "self.length = length\nself.mass = mass\nself.deck_space = deck_space", "key = 'blade_fasten_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Fasten Blade', time)", "key = 'blade_release_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Release Blade', time)" ]
<|body_start_0|> self.length = length self.mass = mass self.deck_space = deck_space <|end_body_0|> <|body_start_1|> key = 'blade_fasten_time' time = kwargs.get(key, pt[key]) return ('Fasten Blade', time) <|end_body_1|> <|body_start_2|> key = 'blade_release_time'...
Blade Cargo
Blade
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a blade at port.""" <|body_1|> def release(**kwa...
stack_v2_sparse_classes_10k_train_004276
7,645
permissive
[ { "docstring": "Creates an instance of `Blade`.", "name": "__init__", "signature": "def __init__(self, length=None, mass=None, deck_space=None, **kwargs)" }, { "docstring": "Returns time required to fasten a blade at port.", "name": "fasten", "signature": "def fasten(**kwargs)" }, { ...
3
stack_v2_sparse_classes_30k_val_000307
Implement the Python class `Blade` described below. Class description: Blade Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `Blade`. - def fasten(**kwargs): Returns time required to fasten a blade at port. - def release(**kwargs)...
Implement the Python class `Blade` described below. Class description: Blade Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `Blade`. - def fasten(**kwargs): Returns time required to fasten a blade at port. - def release(**kwargs)...
d7270ebe1c554293a9d36730d67ab555c071cb17
<|skeleton|> class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a blade at port.""" <|body_1|> def release(**kwa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" self.length = length self.mass = mass self.deck_space = deck_space def fasten(**kwargs): """Returns time required to fasten a ...
the_stack_v2_python_sparse
wisdem/orbit/phases/install/turbine_install/common.py
WISDEM/WISDEM
train
120
94239537bd6c69e1b6ee9abcdb4f8b5907df5e21
[ "flag = 1 if x > -1 else -1\npositiveX = flag * x\nstrX = str(positiveX)\nrevsedX = strX[::-1]\nrevsedIntX = int(revsedX) * flag\nif revsedIntX < -2 ** 31 or revsedIntX > 2 ** 31 - 1:\n revsedIntX = 0\nreturn revsedIntX", "flag = 1 if x > -1 else -1\npositiveX = flag * x\nres = 0\nwhile positiveX > 0:\n res...
<|body_start_0|> flag = 1 if x > -1 else -1 positiveX = flag * x strX = str(positiveX) revsedX = strX[::-1] revsedIntX = int(revsedX) * flag if revsedIntX < -2 ** 31 or revsedIntX > 2 ** 31 - 1: revsedIntX = 0 return revsedIntX <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse2(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> flag = 1 if x > -1 else -1 positiveX = flag * x strX = str(p...
stack_v2_sparse_classes_10k_train_004277
790
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse2", "signature": "def reverse2(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_003532
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse2(self, x): :type x: int :rtype: int - def reverse(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse2(self, x): :type x: int :rtype: int - def reverse(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def reverse2(self, x): """:type x: int...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class Solution: def reverse2(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverse2(self, x): """:type x: int :rtype: int""" flag = 1 if x > -1 else -1 positiveX = flag * x strX = str(positiveX) revsedX = strX[::-1] revsedIntX = int(revsedX) * flag if revsedIntX < -2 ** 31 or revsedIntX > 2 ** 31 - 1: ...
the_stack_v2_python_sparse
problems/ReverseInteger.py
wan-catherine/Leetcode
train
5
5f36120cfe2eb3459e1c85f1ea1cf7fef8ad9bbf
[ "previous_index = 0\ntotal_profit = 0\nfor index in range(0, len(prices)):\n if previous_index == index:\n continue\n previous_price = prices[previous_index]\n current_price = prices[index]\n if previous_price < current_price:\n total_profit += current_price - previous_price\n previous_...
<|body_start_0|> previous_index = 0 total_profit = 0 for index in range(0, len(prices)): if previous_index == index: continue previous_price = prices[previous_index] current_price = prices[index] if previous_price < current_price: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> previous_index = 0 total_profi...
stack_v2_sparse_classes_10k_train_004278
1,420
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" } ]
2
stack_v2_sparse_classes_30k_val_000252
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxP...
dae0a5e6e688a34e6b870a93ecb210416a54d67a
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" previous_index = 0 total_profit = 0 for index in range(0, len(prices)): if previous_index == index: continue previous_price = prices[previous_index] ...
the_stack_v2_python_sparse
python/algorithms/arrays/max_profit.py
nathanle89/interview
train
0
4dd498c5771e025ac0ba9c15433a31104b0310dd
[ "if request.GET.get('code'):\n code = request.GET.get('code')\n auth_type = request.GET.get('auth_type', 'web')\n instance = AccessToken.update_access_token(code, auth_type=auth_type)\n if instance is None:\n return Response(dict(message='code 无效,请重新登录'), status=status.HTTP_401_UNAUTHORIZED)\n ...
<|body_start_0|> if request.GET.get('code'): code = request.GET.get('code') auth_type = request.GET.get('auth_type', 'web') instance = AccessToken.update_access_token(code, auth_type=auth_type) if instance is None: return Response(dict(message='cod...
WxLoginView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" <|body_0|> def post(self, request, *args, **kwargs): """小程序端获取登录 Session""" <|body_1|> <|end_skeleton|> <|body_start_0|> if request.GET.get('code'): code = request.GET.ge...
stack_v2_sparse_classes_10k_train_004279
3,730
permissive
[ { "docstring": "获取登录链接", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "小程序端获取登录 Session", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `WxLoginView` described below. Class description: Implement the WxLoginView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取登录链接 - def post(self, request, *args, **kwargs): 小程序端获取登录 Session
Implement the Python class `WxLoginView` described below. Class description: Implement the WxLoginView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取登录链接 - def post(self, request, *args, **kwargs): 小程序端获取登录 Session <|skeleton|> class WxLoginView: def get(self, request, *a...
b8021250bf3d8cf7adc566deebdba55225148316
<|skeleton|> class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" <|body_0|> def post(self, request, *args, **kwargs): """小程序端获取登录 Session""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" if request.GET.get('code'): code = request.GET.get('code') auth_type = request.GET.get('auth_type', 'web') instance = AccessToken.update_access_token(code, auth_type=auth_type) if...
the_stack_v2_python_sparse
wxapp/views.py
lianxiaopang/camel-store-api
train
0
7e77df16a663ed6ff725875b8d2746d7cd9ba258
[ "try:\n entry = session.query(db.RememberEntry).filter(db.RememberEntry.id == rejected_entry_id).one()\nexcept NoResultFound:\n raise NotFoundError('rejected entry ID %d not found' % rejected_entry_id)\nreturn jsonify(rejected_entry_to_dict(entry))", "try:\n entry = session.query(db.RememberEntry).filter...
<|body_start_0|> try: entry = session.query(db.RememberEntry).filter(db.RememberEntry.id == rejected_entry_id).one() except NoResultFound: raise NotFoundError('rejected entry ID %d not found' % rejected_entry_id) return jsonify(rejected_entry_to_dict(entry)) <|end_body_0|...
RejectedEntry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RejectedEntry: def get(self, rejected_entry_id, session=None): """Returns a rejected entry""" <|body_0|> def delete(self, rejected_entry_id, session=None): """Deletes a rejected entry""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_10k_train_004280
5,092
permissive
[ { "docstring": "Returns a rejected entry", "name": "get", "signature": "def get(self, rejected_entry_id, session=None)" }, { "docstring": "Deletes a rejected entry", "name": "delete", "signature": "def delete(self, rejected_entry_id, session=None)" } ]
2
null
Implement the Python class `RejectedEntry` described below. Class description: Implement the RejectedEntry class. Method signatures and docstrings: - def get(self, rejected_entry_id, session=None): Returns a rejected entry - def delete(self, rejected_entry_id, session=None): Deletes a rejected entry
Implement the Python class `RejectedEntry` described below. Class description: Implement the RejectedEntry class. Method signatures and docstrings: - def get(self, rejected_entry_id, session=None): Returns a rejected entry - def delete(self, rejected_entry_id, session=None): Deletes a rejected entry <|skeleton|> cla...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class RejectedEntry: def get(self, rejected_entry_id, session=None): """Returns a rejected entry""" <|body_0|> def delete(self, rejected_entry_id, session=None): """Deletes a rejected entry""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RejectedEntry: def get(self, rejected_entry_id, session=None): """Returns a rejected entry""" try: entry = session.query(db.RememberEntry).filter(db.RememberEntry.id == rejected_entry_id).one() except NoResultFound: raise NotFoundError('rejected entry ID %d not ...
the_stack_v2_python_sparse
flexget/components/rejected/api.py
BrutuZ/Flexget
train
1
6025e5db41aa0cfaddb439bb0ff37a6db9fe24ce
[ "def preorder(root):\n if not root:\n return '#,'\n return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right)\nreturn preorder(root)", "if not data or data == '#':\n return\nnodes = data.split(',')\n\ndef preorder(i):\n if i >= len(nodes) or nodes[i] == '#':\n r...
<|body_start_0|> def preorder(root): if not root: return '#,' return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right) return preorder(root) <|end_body_0|> <|body_start_1|> if not data or data == '#': return ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def preorder(r...
stack_v2_sparse_classes_10k_train_004281
1,243
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_001461
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
3a5649357e0f21cbbc5e238351300cd706d533b3
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def preorder(root): if not root: return '#,' return str(root.val) + ',' + self.serialize(root.left) + self.serialize(root.right) return preorder(root) ...
the_stack_v2_python_sparse
leetcode-py/leetcode449.py
cicihou/LearningProject
train
0
1baef454925aa40e2ed9d96329db730225ee1881
[ "val_list = []\ncur = head\nwhile cur:\n val_list.append(cur.val)\n cur = cur.next\nreturn val_list == val_list[::-1]", "rev = None\nfast, slow = (head, head)\nwhile fast and fast.next:\n fast = fast.next.next\n rev, rev.next, slow = (slow, rev, slow.next)\nif fast:\n slow = slow.next\nwhile rev an...
<|body_start_0|> val_list = [] cur = head while cur: val_list.append(cur.val) cur = cur.next return val_list == val_list[::-1] <|end_body_0|> <|body_start_1|> rev = None fast, slow = (head, head) while fast and fast.next: fast ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_palindrome(cls, head: ListNode) -> bool: """将值复制到数组中判断是否回文""" <|body_0|> def is_palindrome_v2(cls, head: ListNode) -> bool: """双指针""" <|body_1|> <|end_skeleton|> <|body_start_0|> val_list = [] cur = head while cur: ...
stack_v2_sparse_classes_10k_train_004282
1,284
no_license
[ { "docstring": "将值复制到数组中判断是否回文", "name": "is_palindrome", "signature": "def is_palindrome(cls, head: ListNode) -> bool" }, { "docstring": "双指针", "name": "is_palindrome_v2", "signature": "def is_palindrome_v2(cls, head: ListNode) -> bool" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome(cls, head: ListNode) -> bool: 将值复制到数组中判断是否回文 - def is_palindrome_v2(cls, head: ListNode) -> bool: 双指针
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_palindrome(cls, head: ListNode) -> bool: 将值复制到数组中判断是否回文 - def is_palindrome_v2(cls, head: ListNode) -> bool: 双指针 <|skeleton|> class Solution: def is_palindrome(cls, ...
1d1876620a55ff88af7bc390cf1a4fd4350d8d16
<|skeleton|> class Solution: def is_palindrome(cls, head: ListNode) -> bool: """将值复制到数组中判断是否回文""" <|body_0|> def is_palindrome_v2(cls, head: ListNode) -> bool: """双指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def is_palindrome(cls, head: ListNode) -> bool: """将值复制到数组中判断是否回文""" val_list = [] cur = head while cur: val_list.append(cur.val) cur = cur.next return val_list == val_list[::-1] def is_palindrome_v2(cls, head: ListNode) -> bool: ...
the_stack_v2_python_sparse
02-算法思想/双指针/234.回文链表.py
jh-lau/leetcode_in_python
train
0
981db8e6227436fa28617cab2656a7401f230519
[ "try:\n tags = TagDao().list_all_tags()\n self.finish(json_dumps({'status': 0, 'msg': 'ok', 'values': tags}))\nexcept Exception as err:\n logger.error(err)\n self.finish(json_dumps({'status': -1, 'msg': 'fail to get data from database'}))", "body = self.request.body\ntry:\n tags = [dict(app='nebula...
<|body_start_0|> try: tags = TagDao().list_all_tags() self.finish(json_dumps({'status': 0, 'msg': 'ok', 'values': tags})) except Exception as err: logger.error(err) self.finish(json_dumps({'status': -1, 'msg': 'fail to get data from database'})) <|end_body...
TagsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagsHandler: def get(self): """获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json""" <|body_0|> def post(self): """新增tag @API summary: add a list of tags notes: add new tags tags: - nebula parameters: - name: tags in: body ...
stack_v2_sparse_classes_10k_train_004283
20,036
permissive
[ { "docstring": "获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json", "name": "get", "signature": "def get(self)" }, { "docstring": "新增tag @API summary: add a list of tags notes: add new tags tags: - nebula parameters: - name: tags in: body required: tr...
2
stack_v2_sparse_classes_30k_train_001643
Implement the Python class `TagsHandler` described below. Class description: Implement the TagsHandler class. Method signatures and docstrings: - def get(self): 获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json - def post(self): 新增tag @API summary: add a list of tags notes...
Implement the Python class `TagsHandler` described below. Class description: Implement the TagsHandler class. Method signatures and docstrings: - def get(self): 获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json - def post(self): 新增tag @API summary: add a list of tags notes...
2e32e6e7b225e0bd87ee8c847c22862f12c51bb1
<|skeleton|> class TagsHandler: def get(self): """获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json""" <|body_0|> def post(self): """新增tag @API summary: add a list of tags notes: add new tags tags: - nebula parameters: - name: tags in: body ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TagsHandler: def get(self): """获取所有的tags @API summary: 获取所有的tags notes: 获取所有的tags tags: - nebula produces: - application/json""" try: tags = TagDao().list_all_tags() self.finish(json_dumps({'status': 0, 'msg': 'ok', 'values': tags})) except Exception as err: ...
the_stack_v2_python_sparse
nebula/views/strategy.py
threathunterX/nebula_web
train
2
9bc1553fb682dc3a39650cb2b9ee1b3c9e213a1a
[ "assert os.path.exists(template_path), 'Expected the path %s to exist' % template_path\nassert isinstance(out_dir_path, str), 'Expected `out_dir_path` to be a string'\nif not os.path.exists(out_dir_path):\n mkpath(out_dir_path)\nwith open(template_path, mode='r') as f:\n variables_and_template = yaml.load_all...
<|body_start_0|> assert os.path.exists(template_path), 'Expected the path %s to exist' % template_path assert isinstance(out_dir_path, str), 'Expected `out_dir_path` to be a string' if not os.path.exists(out_dir_path): mkpath(out_dir_path) with open(template_path, mode='r') a...
Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified.
ConfigGenerator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigGenerator: """Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified.""" def __init__(self, template_p...
stack_v2_sparse_classes_10k_train_004284
5,965
permissive
[ { "docstring": "Initialize the generator. The generator loads the template from the specified path and ensures that the path `out_dir_path` exists by creating all missing folders along the path if necessary. Args: template_path (str): Path to the template out_dir_path (str): Path that indicates where generated ...
4
stack_v2_sparse_classes_30k_train_004028
Implement the Python class `ConfigGenerator` described below. Class description: Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified...
Implement the Python class `ConfigGenerator` described below. Class description: Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified...
b47b5e460e9f4425d06af8a56499bb4f4dbecc3a
<|skeleton|> class ConfigGenerator: """Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified.""" def __init__(self, template_p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigGenerator: """Objects of this class can be used to generate specific configuration files from templates. A template consists of a configuration file template with variables (strings) to replace. For each variable, a value interval needs to be specified.""" def __init__(self, template_path, out_dir_...
the_stack_v2_python_sparse
mtl-sequence-tagging-framework/src/ConfigGenerator.py
UKPLab/germeval2017-sentiment-detection
train
13
22dba2c5cf6c001c17dbedd38e4cd64a2c9be617
[ "self._export_dir = export_dir\nself._best = None\nself.cmp_fn = cmp_fn\nself._best_result = None", "log.debug('New evaluate result: %s \\nold: %s' % (repr(eval_result), repr(self._best)))\nif self._best is None and state['best_model'] is not None:\n self._best = state['best_model']\n log.debug('restoring b...
<|body_start_0|> self._export_dir = export_dir self._best = None self.cmp_fn = cmp_fn self._best_result = None <|end_body_0|> <|body_start_1|> log.debug('New evaluate result: %s \nold: %s' % (repr(eval_result), repr(self._best))) if self._best is None and state['best_mod...
export saved model accordingto `cmp_fn`
BestExporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BestExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" <|body_0|> def export(self, exe, program, eval_model_spec, eval_result, state): """doc""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004285
8,759
permissive
[ { "docstring": "doc", "name": "__init__", "signature": "def __init__(self, export_dir, cmp_fn)" }, { "docstring": "doc", "name": "export", "signature": "def export(self, exe, program, eval_model_spec, eval_result, state)" } ]
2
stack_v2_sparse_classes_30k_train_000568
Implement the Python class `BestExporter` described below. Class description: export saved model accordingto `cmp_fn` Method signatures and docstrings: - def __init__(self, export_dir, cmp_fn): doc - def export(self, exe, program, eval_model_spec, eval_result, state): doc
Implement the Python class `BestExporter` described below. Class description: export saved model accordingto `cmp_fn` Method signatures and docstrings: - def __init__(self, export_dir, cmp_fn): doc - def export(self, exe, program, eval_model_spec, eval_result, state): doc <|skeleton|> class BestExporter: """expo...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class BestExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" <|body_0|> def export(self, exe, program, eval_model_spec, eval_result, state): """doc""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BestExporter: """export saved model accordingto `cmp_fn`""" def __init__(self, export_dir, cmp_fn): """doc""" self._export_dir = export_dir self._best = None self.cmp_fn = cmp_fn self._best_result = None def export(self, exe, program, eval_model_spec, eval_res...
the_stack_v2_python_sparse
competition/ogbg_molhiv/propeller/paddle/train/exporter.py
PaddlePaddle/PaddleHelix
train
771
9c5c20446e41bbe90b3b51b0c6059018bfa498f2
[ "Thread.__init__(self, name='Writer' + str(instance))\nself.accessCount = accessCount\nself.cell = cell\nself.sleepMax = sleepMax", "print('%s starting up' % self.getName())\nfor count in range(self.accessCount):\n time.sleep(random.randint(1, self.sleepMax))\n value = self.cell.write(lambda counter: counte...
<|body_start_0|> Thread.__init__(self, name='Writer' + str(instance)) self.accessCount = accessCount self.cell = cell self.sleepMax = sleepMax <|end_body_0|> <|body_start_1|> print('%s starting up' % self.getName()) for count in range(self.accessCount): time....
Increments the value in the shared cell
Writer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Writer: """Increments the value in the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a writer to the given shared cell, number of accesses, and maximum sleep interval.""" <|body_0|> def run(self): """Announce start-up, sleep ...
stack_v2_sparse_classes_10k_train_004286
5,757
no_license
[ { "docstring": "Create a writer to the given shared cell, number of accesses, and maximum sleep interval.", "name": "__init__", "signature": "def __init__(self, cell, accessCount, sleepMax, instance)" }, { "docstring": "Announce start-up, sleep and write to shared cell the given number of times,...
2
stack_v2_sparse_classes_30k_train_003609
Implement the Python class `Writer` described below. Class description: Increments the value in the shared cell Method signatures and docstrings: - def __init__(self, cell, accessCount, sleepMax, instance): Create a writer to the given shared cell, number of accesses, and maximum sleep interval. - def run(self): Anno...
Implement the Python class `Writer` described below. Class description: Increments the value in the shared cell Method signatures and docstrings: - def __init__(self, cell, accessCount, sleepMax, instance): Create a writer to the given shared cell, number of accesses, and maximum sleep interval. - def run(self): Anno...
30375264cf0103e3455fdf92c35a2c5c15b5d7ef
<|skeleton|> class Writer: """Increments the value in the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a writer to the given shared cell, number of accesses, and maximum sleep interval.""" <|body_0|> def run(self): """Announce start-up, sleep ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Writer: """Increments the value in the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a writer to the given shared cell, number of accesses, and maximum sleep interval.""" Thread.__init__(self, name='Writer' + str(instance)) self.accessCount = ...
the_stack_v2_python_sparse
Ch10 exercises/reader-writer.py
davelpat/Fundamentals_of_Python
train
1
ee644b691f362ecf0a605681cf0fe314bcc5756b
[ "if k <= 0 or not prices:\n return 0\nN = len(prices)\nif k >= N:\n _sum = 0\n for i in range(1, N):\n if prices[i] > prices[i - 1]:\n _sum += prices[i] - prices[i - 1]\n return _sum\ng = [0] * (k + 1)\nl = [0] * (k + 1)\nfor i in range(N - 1):\n diff = prices[i + 1] - prices[i]\n ...
<|body_start_0|> if k <= 0 or not prices: return 0 N = len(prices) if k >= N: _sum = 0 for i in range(1, N): if prices[i] > prices[i - 1]: _sum += prices[i] - prices[i - 1] return _sum g = [0] * (k + 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, k, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if k <= 0 or not pric...
stack_v2_sparse_classes_10k_train_004287
2,542
no_license
[ { "docstring": ":type k: int :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, k, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, k, prices)" } ]
2
stack_v2_sparse_classes_30k_train_001457
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfit1(self, k, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfit1(self, k, prices): :type prices: List[int] :rtype: int <|skeleton|> class Soluti...
1379a6dc2400751ecf79ccd6ed401a1fb0d78046
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, k, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" if k <= 0 or not prices: return 0 N = len(prices) if k >= N: _sum = 0 for i in range(1, N): if prices[i] > prices[i - 1]: ...
the_stack_v2_python_sparse
Python3.6/188-Py3-Best Time to Buy and Sell Stock IV.py
Hidenver2016/Leetcode
train
1
bfdfbd37aa19e6eae8425030c406b35e3f4a33e0
[ "assert query_params is None or isinstance(query_params, APIQueryParams)\nassert queries_params is None or isinstance(queries_params, dict)\nif queries_params is not None:\n assert all((isinstance(query, APIQueryParams) for query in queries_params.values()))\nassert not (query_params is None and queries_params i...
<|body_start_0|> assert query_params is None or isinstance(query_params, APIQueryParams) assert queries_params is None or isinstance(queries_params, dict) if queries_params is not None: assert all((isinstance(query, APIQueryParams) for query in queries_params.values())) asser...
SDAPIQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SDAPIQuery: def submit_query(cls, query_params: Optional[APIQueryParams]=None, queries_params: Optional[Dict[str, APIQueryParams]]=None, timeout: Optional[float]=None, headers: Optional[Dict[str, str]]=None) -> Union[T_DF, Dict[str, T_DF]]: """Determines the proper method to use and pass...
stack_v2_sparse_classes_10k_train_004288
17,212
permissive
[ { "docstring": "Determines the proper method to use and passes values along for request submission Parameters ---------- query_params: Optional[APIQueryParams] = None A single query params object to submit as part of the request queries_params: Optional[Dict[str, APIQueryParams]] = None A list of dicts, with qu...
4
stack_v2_sparse_classes_30k_train_002168
Implement the Python class `SDAPIQuery` described below. Class description: Implement the SDAPIQuery class. Method signatures and docstrings: - def submit_query(cls, query_params: Optional[APIQueryParams]=None, queries_params: Optional[Dict[str, APIQueryParams]]=None, timeout: Optional[float]=None, headers: Optional[...
Implement the Python class `SDAPIQuery` described below. Class description: Implement the SDAPIQuery class. Method signatures and docstrings: - def submit_query(cls, query_params: Optional[APIQueryParams]=None, queries_params: Optional[Dict[str, APIQueryParams]]=None, timeout: Optional[float]=None, headers: Optional[...
392413cd821c05b8db0e385a7f5ad629b5b04759
<|skeleton|> class SDAPIQuery: def submit_query(cls, query_params: Optional[APIQueryParams]=None, queries_params: Optional[Dict[str, APIQueryParams]]=None, timeout: Optional[float]=None, headers: Optional[Dict[str, str]]=None) -> Union[T_DF, Dict[str, T_DF]]: """Determines the proper method to use and pass...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SDAPIQuery: def submit_query(cls, query_params: Optional[APIQueryParams]=None, queries_params: Optional[Dict[str, APIQueryParams]]=None, timeout: Optional[float]=None, headers: Optional[Dict[str, str]]=None) -> Union[T_DF, Dict[str, T_DF]]: """Determines the proper method to use and passes values alon...
the_stack_v2_python_sparse
strato_query/api_query.py
StratoDem/strato-query
train
1
1b198fb4280f326490a1dfb1b49303a94aa19f4c
[ "domish.Element.__init__(self, (None, 'iq'))\nself.addUniqueId()\nself['type'] = stanzaType\nself._xmlstream = xmlstream", "if to is not None:\n self['to'] = to\nif not ijabber.IIQResponseTracker.providedBy(self._xmlstream):\n upgradeWithIQResponseTracker(self._xmlstream)\nd = defer.Deferred()\nself._xmlstr...
<|body_start_0|> domish.Element.__init__(self, (None, 'iq')) self.addUniqueId() self['type'] = stanzaType self._xmlstream = xmlstream <|end_body_0|> <|body_start_1|> if to is not None: self['to'] = to if not ijabber.IIQResponseTracker.providedBy(self._xmlstre...
Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{send} will have its errback call...
IQ
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IQ: """Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{se...
stack_v2_sparse_classes_10k_train_004289
36,848
permissive
[ { "docstring": "@type xmlstream: L{xmlstream.XmlStream} @param xmlstream: XmlStream to use for transmission of this IQ @type stanzaType: C{str} @param stanzaType: IQ type identifier ('get' or 'set')", "name": "__init__", "signature": "def __init__(self, xmlstream, stanzaType='set')" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_006205
Implement the Python class `IQ` described below. Class description: Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period af...
Implement the Python class `IQ` described below. Class description: Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period af...
40861791ec4ed3bbd14b07875af25cc740f76920
<|skeleton|> class IQ: """Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IQ: """Wrapper for an iq stanza. Iq stanzas are used for communications with a request-response behaviour. Each iq request is associated with an XML stream and has its own unique id to be able to track the response. @ivar timeout: if set, a timeout period after which the deferred returned by C{send} will have...
the_stack_v2_python_sparse
stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/jabber/xmlstream.py
wistbean/learn_python3_spider
train
14,403
afcfa1cbc68632c2acc0fafe0c1427319653fd69
[ "passports = parse(filename)\nvalid_passports = [passport for passport in passports if is_valid_passport1(passport)]\nreturn len(valid_passports)", "passports = parse(filename)\nvalid_passports = [passport for passport in passports if is_valid_passport2(passport)]\nreturn len(valid_passports)" ]
<|body_start_0|> passports = parse(filename) valid_passports = [passport for passport in passports if is_valid_passport1(passport)] return len(valid_passports) <|end_body_0|> <|body_start_1|> passports = parse(filename) valid_passports = [passport for passport in passports if is...
AoC 2020 Day 04
Day04
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 04 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004290
2,461
no_license
[ { "docstring": "Given a filename, solve 2020 day 04 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2020 day 04 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_005475
Implement the Python class `Day04` described below. Class description: AoC 2020 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 04 part 2
Implement the Python class `Day04` described below. Class description: AoC 2020 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 04 part 2 <|skeleton|> class Day04: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 04 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" passports = parse(filename) valid_passports = [passport for passport in passports if is_valid_passport1(passport)] return len(valid_passports) def part2(file...
the_stack_v2_python_sparse
2020/python2020/aoc/day04.py
mreishus/aoc
train
16
9cbc33ce5507bc5e170d5d53435d107a91f1dea1
[ "rental_data = [['Elisa Miles', 'LC04', 'Leather Chair', '12.0'], ['Edward Data', 'CT78', 'Coffee Table', '10.0'], ['Alex Gonzales', 'BR01', 'Bed Frame', '80.0']]\ninvoice_file = 'rental_data.csv'\nfor record in rental_data:\n add_furniture(invoice_file, record[0], record[1], record[2], record[3])\nwith open(inv...
<|body_start_0|> rental_data = [['Elisa Miles', 'LC04', 'Leather Chair', '12.0'], ['Edward Data', 'CT78', 'Coffee Table', '10.0'], ['Alex Gonzales', 'BR01', 'Bed Frame', '80.0']] invoice_file = 'rental_data.csv' for record in rental_data: add_furniture(invoice_file, record[0], record...
Unit tests for inventory functions
TestInventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestInventory: """Unit tests for inventory functions""" def test_add_furniture(self): """Tests function to add rental data to csv file""" <|body_0|> def test_single_customer(self): """Tests function to add multiple rental data for a single customer""" <|b...
stack_v2_sparse_classes_10k_train_004291
1,574
no_license
[ { "docstring": "Tests function to add rental data to csv file", "name": "test_add_furniture", "signature": "def test_add_furniture(self)" }, { "docstring": "Tests function to add multiple rental data for a single customer", "name": "test_single_customer", "signature": "def test_single_cu...
2
null
Implement the Python class `TestInventory` described below. Class description: Unit tests for inventory functions Method signatures and docstrings: - def test_add_furniture(self): Tests function to add rental data to csv file - def test_single_customer(self): Tests function to add multiple rental data for a single cu...
Implement the Python class `TestInventory` described below. Class description: Unit tests for inventory functions Method signatures and docstrings: - def test_add_furniture(self): Tests function to add rental data to csv file - def test_single_customer(self): Tests function to add multiple rental data for a single cu...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestInventory: """Unit tests for inventory functions""" def test_add_furniture(self): """Tests function to add rental data to csv file""" <|body_0|> def test_single_customer(self): """Tests function to add multiple rental data for a single customer""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestInventory: """Unit tests for inventory functions""" def test_add_furniture(self): """Tests function to add rental data to csv file""" rental_data = [['Elisa Miles', 'LC04', 'Leather Chair', '12.0'], ['Edward Data', 'CT78', 'Coffee Table', '10.0'], ['Alex Gonzales', 'BR01', 'Bed Frame'...
the_stack_v2_python_sparse
students/joli-u/lesson08/test_inventory.py
JavaRod/SP_Python220B_2019
train
1
9875779c98a5b505aa1a0d194a4af1e55f3450ed
[ "self.wins = np.zeros(2)\nself.m1, self.m2 = (m1, m2)\nself.mcst1, self.mcst2 = (MCST(args), MCST(args))\nself.game_setup = game\nself.num_duels = args.num_duels\nself.num_sims = args.num_sims_duel\nself.terminal = False\nself.args = args", "if self.terminal:\n raise Exception('This pit has already been played...
<|body_start_0|> self.wins = np.zeros(2) self.m1, self.m2 = (m1, m2) self.mcst1, self.mcst2 = (MCST(args), MCST(args)) self.game_setup = game self.num_duels = args.num_duels self.num_sims = args.num_sims_duel self.terminal = False self.args = args <|end_bo...
Two models enter the pit to play a number of games to see which model is better
Pit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pit: """Two models enter the pit to play a number of games to see which model is better""" def __init__(self, m1: Model, m2: Model, game: callable, args: argparse.Namespace): """Create a new pit :param m1: Model 1 :param m2: Model 2 :param game: Function that returns the initial game...
stack_v2_sparse_classes_10k_train_004292
3,233
no_license
[ { "docstring": "Create a new pit :param m1: Model 1 :param m2: Model 2 :param game: Function that returns the initial game state of the game to be played (typically its constructor) Takes 1 argument. Namely the argparse.Namespace used to pass parameters :param args: Parsed arguments containing hyperparameters -...
2
stack_v2_sparse_classes_30k_train_005112
Implement the Python class `Pit` described below. Class description: Two models enter the pit to play a number of games to see which model is better Method signatures and docstrings: - def __init__(self, m1: Model, m2: Model, game: callable, args: argparse.Namespace): Create a new pit :param m1: Model 1 :param m2: Mo...
Implement the Python class `Pit` described below. Class description: Two models enter the pit to play a number of games to see which model is better Method signatures and docstrings: - def __init__(self, m1: Model, m2: Model, game: callable, args: argparse.Namespace): Create a new pit :param m1: Model 1 :param m2: Mo...
2a01e61dc6e64341c3dda204990f1ffce828b957
<|skeleton|> class Pit: """Two models enter the pit to play a number of games to see which model is better""" def __init__(self, m1: Model, m2: Model, game: callable, args: argparse.Namespace): """Create a new pit :param m1: Model 1 :param m2: Model 2 :param game: Function that returns the initial game...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pit: """Two models enter the pit to play a number of games to see which model is better""" def __init__(self, m1: Model, m2: Model, game: callable, args: argparse.Namespace): """Create a new pit :param m1: Model 1 :param m2: Model 2 :param game: Function that returns the initial game state of the...
the_stack_v2_python_sparse
alphazero/duel.py
ronvree/AlphaZero
train
0
b92760b21a9131bf40847b2a8448974340dad85e
[ "tensors = arg\nif args:\n tensors = (arg,) + args\nelse:\n tensors = arg\nflattened_tensors = nest.flatten(tensors)\nflattened_values = []\nfor t in flattened_tensors:\n if isinstance(t, ops.Tensor):\n flattened_values.append(t)\n elif isinstance(t, sparse_tensor.SparseTensor):\n flattene...
<|body_start_0|> tensors = arg if args: tensors = (arg,) + args else: tensors = arg flattened_tensors = nest.flatten(tensors) flattened_values = [] for t in flattened_tensors: if isinstance(t, ops.Tensor): flattened_valu...
Keys for different tensor kinds.
TensorKinds
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" <|body_0|> def denormalize(cls, structure, flatten_structure, tensors): """Denormalize structure from list of tensors.""" <...
stack_v2_sparse_classes_10k_train_004293
7,164
permissive
[ { "docstring": "Normalize structure into list of tensors.", "name": "normalize", "signature": "def normalize(cls, arg, *args)" }, { "docstring": "Denormalize structure from list of tensors.", "name": "denormalize", "signature": "def denormalize(cls, structure, flatten_structure, tensors)...
2
stack_v2_sparse_classes_30k_train_005513
Implement the Python class `TensorKinds` described below. Class description: Keys for different tensor kinds. Method signatures and docstrings: - def normalize(cls, arg, *args): Normalize structure into list of tensors. - def denormalize(cls, structure, flatten_structure, tensors): Denormalize structure from list of ...
Implement the Python class `TensorKinds` described below. Class description: Keys for different tensor kinds. Method signatures and docstrings: - def normalize(cls, arg, *args): Normalize structure into list of tensors. - def denormalize(cls, structure, flatten_structure, tensors): Denormalize structure from list of ...
4486ba138515a1dbdb6f7d542d7ad23a27476524
<|skeleton|> class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" <|body_0|> def denormalize(cls, structure, flatten_structure, tensors): """Denormalize structure from list of tensors.""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TensorKinds: """Keys for different tensor kinds.""" def normalize(cls, arg, *args): """Normalize structure into list of tensors.""" tensors = arg if args: tensors = (arg,) + args else: tensors = arg flattened_tensors = nest.flatten(tensors) ...
the_stack_v2_python_sparse
hybridbackend/tensorflow/framework/ops.py
DeepRec-AI/HybridBackend
train
10
6f629d586d089cff54e3944f26e4febdf32fd2e5
[ "super().__init__(coordinator=coordinator)\nself.entity_description = description\nself._attr_unique_id = f'{domain}_{description.key}'\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, domain)}, name=domain, entry_type=DeviceEntryType.SERVICE)\nself._domain = domain", "if self.coordinator.data is None:\...
<|body_start_0|> super().__init__(coordinator=coordinator) self.entity_description = description self._attr_unique_id = f'{domain}_{description.key}' self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, domain)}, name=domain, entry_type=DeviceEntryType.SERVICE) self._domain ...
Implementation of a WHOIS sensor.
WhoisSensorEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhoisSensorEntity: """Implementation of a WHOIS sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self) -> datetime | ...
stack_v2_sparse_classes_10k_train_004294
7,153
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None" }, { "docstring": "Return the state of the sensor.", "name": "native_value", "...
3
stack_v2_sparse_classes_30k_train_004515
Implement the Python class `WhoisSensorEntity` described below. Class description: Implementation of a WHOIS sensor. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None: Initialize the sensor. - def n...
Implement the Python class `WhoisSensorEntity` described below. Class description: Implementation of a WHOIS sensor. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None: Initialize the sensor. - def n...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class WhoisSensorEntity: """Implementation of a WHOIS sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self) -> datetime | ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WhoisSensorEntity: """Implementation of a WHOIS sensor.""" def __init__(self, coordinator: DataUpdateCoordinator[Domain | None], description: WhoisSensorEntityDescription, domain: str) -> None: """Initialize the sensor.""" super().__init__(coordinator=coordinator) self.entity_desc...
the_stack_v2_python_sparse
homeassistant/components/whois/sensor.py
home-assistant/core
train
35,501
e0fe56975cc73becdc5b8364b51699dd7c60ce9c
[ "if self.request.user.is_superuser:\n return models.Workflow.objects.all()\nreturn models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct()", "if self.request.user.is_superuser:\n serializer.save()\nelse:\n serializer.save(Q(user=self.request.user) | Q(shared=sel...
<|body_start_0|> if self.request.user.is_superuser: return models.Workflow.objects.all() return models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct() <|end_body_0|> <|body_start_1|> if self.request.user.is_superuser: serialize...
API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fields in the workshop (the rest remain unchanged) delete: Delete the workflow
WorkflowAPIRetrieveUpdateDestroy
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowAPIRetrieveUpdateDestroy: """API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fields in the workshop (the rest remain un...
stack_v2_sparse_classes_10k_train_004295
4,435
permissive
[ { "docstring": "Access the relevant workflow.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create the workflow element.", "name": "perform_create", "signature": "def perform_create(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_002271
Implement the Python class `WorkflowAPIRetrieveUpdateDestroy` described below. Class description: API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fie...
Implement the Python class `WorkflowAPIRetrieveUpdateDestroy` described below. Class description: API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fie...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class WorkflowAPIRetrieveUpdateDestroy: """API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fields in the workshop (the rest remain un...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkflowAPIRetrieveUpdateDestroy: """API to manage workflow operations. get: Returns the information stored for the workflow put: Modifies the workflow with the information included in the request (all fields are overwritten) patch: Update only the given fields in the workshop (the rest remain unchanged) dele...
the_stack_v2_python_sparse
ontask/workflow/api.py
abelardopardo/ontask_b
train
43
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Toner {color}'\nself._color = color\nself._unit_of_measurement = PERCENTAGE\nself._id_suffix = f'_toner_{color}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.toner_status().get(self._color, {})\n self._state = self._attributes.g...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Toner {color}' self._color = color self._unit_of_measurement = PERCENTAGE self._id_suffix = f'_toner_{color}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attribute...
Implementation of a Samsung Printer toner sensor platform.
SyncThruTonerSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruTonerSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body...
stack_v2_sparse_classes_10k_train_004296
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, color)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SyncThruTonerSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the sta...
Implement the Python class `SyncThruTonerSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the sta...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruTonerSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyncThruTonerSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Toner {color}' self._color = color self._unit_of_mea...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
5fd0796eb7d9c272870d5eceedb9458ac91c5ba7
[ "self.bandwidth_bytes_per_second = bandwidth_bytes_per_second\nself.cassandra_backup_job_params = cassandra_backup_job_params\nself.compaction_job_interval_secs = compaction_job_interval_secs\nself.concurrency = concurrency\nself.couchbase_backup_job_params = couchbase_backup_job_params\nself.gc_job_interval_secs =...
<|body_start_0|> self.bandwidth_bytes_per_second = bandwidth_bytes_per_second self.cassandra_backup_job_params = cassandra_backup_job_params self.compaction_job_interval_secs = compaction_job_interval_secs self.concurrency = concurrency self.couchbase_backup_job_params = couchbas...
Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params specific to cassandra backup job. compaction_job_inte...
NoSqlBackupJobParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params speci...
stack_v2_sparse_classes_10k_train_004297
7,871
permissive
[ { "docstring": "Constructor for the NoSqlBackupJobParams class", "name": "__init__", "signature": "def __init__(self, bandwidth_bytes_per_second=None, cassandra_backup_job_params=None, compaction_job_interval_secs=None, concurrency=None, couchbase_backup_job_params=None, gc_job_interval_secs=None, gc_re...
2
stack_v2_sparse_classes_30k_train_001326
Implement the Python class `NoSqlBackupJobParams` described below. Class description: Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (...
Implement the Python class `NoSqlBackupJobParams` described below. Class description: Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (...
0093194d125fc6746f55b8499da1270c64f473fc
<|skeleton|> class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params speci...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params specific to cassan...
the_stack_v2_python_sparse
cohesity_management_sdk/models/no_sql_backup_job_params.py
hsantoyo2/management-sdk-python
train
0
e9c40dcd362a9460ae71be3cf3caec7ccee12c67
[ "try:\n data_stream = pkgutil.get_data('scattertext', 'data/rotten_tomatoes_corpus.csv.bz2')\nexcept:\n url = ROTTEN_TOMATOES_DATA_URL\n data_stream = urlopen(url).read()\nreturn pd.read_csv(io.BytesIO(bz2.decompress(data_stream)))", "try:\n data_stream = pkgutil.get_data('scattertext', 'data/rotten_t...
<|body_start_0|> try: data_stream = pkgutil.get_data('scattertext', 'data/rotten_tomatoes_corpus.csv.bz2') except: url = ROTTEN_TOMATOES_DATA_URL data_stream = urlopen(url).read() return pd.read_csv(io.BytesIO(bz2.decompress(data_stream))) <|end_body_0|> <|bo...
Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts'', Proceedings of the ACL, 2004.
RottenTomatoes
[ "MIT", "CC-BY-NC-SA-4.0", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RottenTomatoes: """Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts'', Proceedings of the ACL, 2004....
stack_v2_sparse_classes_10k_train_004298
5,362
permissive
[ { "docstring": "Returns ------- pd.DataFrame I.e., >>> convention_df.iloc[0] category plot filename subjectivity_html/obj/2002/Abandon.html text A senior at an elite college (Katie Holmes), a... movie_name abandon", "name": "get_data", "signature": "def get_data()" }, { "docstring": "Returns all...
2
null
Implement the Python class `RottenTomatoes` described below. Class description: Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimu...
Implement the Python class `RottenTomatoes` described below. Class description: Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimu...
b41e3a875faf6dd886e49e524345202432db1b21
<|skeleton|> class RottenTomatoes: """Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts'', Proceedings of the ACL, 2004....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RottenTomatoes: """Derived from the sentiment polarity/subjectivity datasets from http://www.cs.cornell.edu/people/pabo/movie-review-data/ Bo Pang and Lillian Lee. ``A Sentimental Education: Sentiment Analysis Using Subjectivity Summarization Based on Minimum Cuts'', Proceedings of the ACL, 2004.""" def ...
the_stack_v2_python_sparse
scattertext/SampleCorpora.py
JasonKessler/scattertext
train
2,187
9a0c62c86f0d12e9acd8a43cf1d9692fcd68b662
[ "random_bytes = Random.get_random_bytes(AccessToken._TOKEN_BYTE_LENGTH)\nsession_token = base64.b64encode(random_bytes)\ntoken = cls(parent=cls.default_ancestor(), associated_user=user.key, token_string=session_token)\ntoken.put()\nreturn token", "results = cls.query(cls.associated_user == user.key, cls.valid == ...
<|body_start_0|> random_bytes = Random.get_random_bytes(AccessToken._TOKEN_BYTE_LENGTH) session_token = base64.b64encode(random_bytes) token = cls(parent=cls.default_ancestor(), associated_user=user.key, token_string=session_token) token.put() return token <|end_body_0|> <|body_...
Access token ndb model
AccessToken
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessToken: """Access token ndb model""" def create(cls, user): """Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. The token is stored as a valid token in the datastore befor...
stack_v2_sparse_classes_10k_train_004299
3,487
no_license
[ { "docstring": "Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. The token is stored as a valid token in the datastore before this method returns. Args: user: A valid instance of the User model. Returns: ...
3
stack_v2_sparse_classes_30k_val_000100
Implement the Python class `AccessToken` described below. Class description: Access token ndb model Method signatures and docstrings: - def create(cls, user): Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. Th...
Implement the Python class `AccessToken` described below. Class description: Access token ndb model Method signatures and docstrings: - def create(cls, user): Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. Th...
99af4ea077fc6abf8672834d88213ec93a9b7fdf
<|skeleton|> class AccessToken: """Access token ndb model""" def create(cls, user): """Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. The token is stored as a valid token in the datastore befor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccessToken: """Access token ndb model""" def create(cls, user): """Create a new secure session token for the user, the token_string is generated as a 32-byte cryptographic-random sequence then encoded using base64 encoding. The token is stored as a valid token in the datastore before this method...
the_stack_v2_python_sparse
src/python/xplore/database/models/auth.py
dballesteros7/explore-city-server
train
0