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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5c175ee625eeb113853583bc163e1592c8f39e98 | [
"if not nums:\n return 0\nn = len(nums)\nyes, no = ([0] * n, [0] * n)\nyes[0], no[0] = (nums[0], 0)\nfor i in range(1, n):\n yes[i] = nums[i] + no[i - 1]\n no[i] = max(no[i - 1], yes[i - 1])\nreturn max(yes[-1], no[-1])",
"if not nums:\n return 0\nyes, no = (0, 0)\nfor i in nums:\n yes, no = (i + n... | <|body_start_0|>
if not nums:
return 0
n = len(nums)
yes, no = ([0] * n, [0] * n)
yes[0], no[0] = (nums[0], 0)
for i in range(1, n):
yes[i] = nums[i] + no[i - 1]
no[i] = max(no[i - 1], yes[i - 1])
return max(yes[-1], no[-1])
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob(self, nums: list) -> int:
"""动态规划 O(n) time O(n) space"""
<|body_0|>
def rob_2(self, nums: list) -> int:
"""动态规划-优化 O(n) time O(1) space"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return 0
n = ... | stack_v2_sparse_classes_10k_train_004500 | 1,292 | no_license | [
{
"docstring": "动态规划 O(n) time O(n) space",
"name": "rob",
"signature": "def rob(self, nums: list) -> int"
},
{
"docstring": "动态规划-优化 O(n) time O(1) space",
"name": "rob_2",
"signature": "def rob_2(self, nums: list) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_005248 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums: list) -> int: 动态规划 O(n) time O(n) space
- def rob_2(self, nums: list) -> int: 动态规划-优化 O(n) time O(1) space | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums: list) -> int: 动态规划 O(n) time O(n) space
- def rob_2(self, nums: list) -> int: 动态规划-优化 O(n) time O(1) space
<|skeleton|>
class Solution:
def rob(self, nu... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def rob(self, nums: list) -> int:
"""动态规划 O(n) time O(n) space"""
<|body_0|>
def rob_2(self, nums: list) -> int:
"""动态规划-优化 O(n) time O(1) space"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def rob(self, nums: list) -> int:
"""动态规划 O(n) time O(n) space"""
if not nums:
return 0
n = len(nums)
yes, no = ([0] * n, [0] * n)
yes[0], no[0] = (nums[0], 0)
for i in range(1, n):
yes[i] = nums[i] + no[i - 1]
no[i]... | the_stack_v2_python_sparse | algorithm/leetcode/dp/01-打家劫舍.py | lxconfig/UbuntuCode_bak | train | 0 | |
e95597e1994587cf9ce83131016915ae184582ed | [
"include = option.search if option.search else include\nif include:\n match = True if self.isIp(include, True) else match\nahost, nhost = ({}, {})\nhost_key = ['name', 'ip', 'user', 'passwd', 'port', 'sudo']\nkey, ikey = (1, 1)\nincludes = self.getArgs(include)\nwith open(self.sshfile) as rhost:\n for line in... | <|body_start_0|>
include = option.search if option.search else include
if include:
match = True if self.isIp(include, True) else match
ahost, nhost = ({}, {})
host_key = ['name', 'ip', 'user', 'passwd', 'port', 'sudo']
key, ikey = (1, 1)
includes = self.getArg... | 暂时保留 | BaseHandle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseHandle:
"""暂时保留"""
def oldGetHost(self, include=None, pattern=False, match=False):
"""获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)"""
<|body_0|>
def searchHost(self, include=None, pattern=False, match=False):
"""... | stack_v2_sparse_classes_10k_train_004501 | 5,633 | no_license | [
{
"docstring": "获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)",
"name": "oldGetHost",
"signature": "def oldGetHost(self, include=None, pattern=False, match=False)"
},
{
"docstring": "获取主机信息, 基于sqlite3 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) m... | 2 | stack_v2_sparse_classes_30k_train_003326 | Implement the Python class `BaseHandle` described below.
Class description:
暂时保留
Method signatures and docstrings:
- def oldGetHost(self, include=None, pattern=False, match=False): 获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)
- def searchHost(self, include=None, pattern=... | Implement the Python class `BaseHandle` described below.
Class description:
暂时保留
Method signatures and docstrings:
- def oldGetHost(self, include=None, pattern=False, match=False): 获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)
- def searchHost(self, include=None, pattern=... | 2a4e1e71c9ac3ad3fceeaf9828a0f39d8f205bd8 | <|skeleton|>
class BaseHandle:
"""暂时保留"""
def oldGetHost(self, include=None, pattern=False, match=False):
"""获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)"""
<|body_0|>
def searchHost(self, include=None, pattern=False, match=False):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseHandle:
"""暂时保留"""
def oldGetHost(self, include=None, pattern=False, match=False):
"""获取主机信息,old数据 include : 用于过滤列表 pattern : 开启返回空字典,默认False(不返回) match : 开启精确匹配模式,默认False(模糊匹配)"""
include = option.search if option.search else include
if include:
match = True if se... | the_stack_v2_python_sparse | build/lib/antshell/install.py | ooppwwqq0/AntShell | train | 5 |
9f3b0ac250df991444202b1fb1d8c40ac18036bc | [
"nums.sort(key=lambda x: x != 0)\nprint(nums)\npoint = 0\nfor index, value in enumerate(nums):\n if value != 0:\n point = index\n break\nnums[point:] = list(reversed(nums[point:]))\nprint(nums)\nnums.reverse()\nprint(nums)",
"p1, p2 = (0, 0)\nN = len(nums)\nwhile p2 < N:\n while p1 < N and num... | <|body_start_0|>
nums.sort(key=lambda x: x != 0)
print(nums)
point = 0
for index, value in enumerate(nums):
if value != 0:
point = index
break
nums[point:] = list(reversed(nums[point:]))
print(nums)
nums.reverse()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_10k_train_004502 | 1,125 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def moveZeroes(self, nums) -> None"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes2",
"signature": "def moveZeroes2(self, nums) -> N... | 2 | stack_v2_sparse_classes_30k_test_000378 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums) -> None: Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums) -> None: Do not return anything, modify nums in-place inst... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums) -> None: Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums) -> None: Do not return anything, modify nums in-place inst... | 59313bbf699ba71adff0f614a49d1c3a669eb7f3 | <|skeleton|>
class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead."""
nums.sort(key=lambda x: x != 0)
print(nums)
point = 0
for index, value in enumerate(nums):
if value != 0:
point = index
... | the_stack_v2_python_sparse | amazing/move zeroes.py | Johnson-xie/jeetcode | train | 0 | |
ea4e446001cbff70b872e5742f86aad87d67f76e | [
"self.class_name = class_name.lower()\ntry:\n if _req.json is not None:\n self.parse.json = _req.json\n if bool(_req.form):\n self.parse.form = _req.form.to_dict(flat=False)\n if bool(_req.files):\n self.parse.file = _req.files.to_dict(flat=False)\n if bool(_req.args):\n ... | <|body_start_0|>
self.class_name = class_name.lower()
try:
if _req.json is not None:
self.parse.json = _req.json
if bool(_req.form):
self.parse.form = _req.form.to_dict(flat=False)
if bool(_req.files):
self.parse... | Requests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Requests:
def __init__(self, class_name):
"""## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and validation for incoming requests."""
<|body_0|>
def validation(self, csrf_enable=True, **k... | stack_v2_sparse_classes_10k_train_004503 | 4,554 | permissive | [
{
"docstring": "## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and validation for incoming requests.",
"name": "__init__",
"signature": "def __init__(self, class_name)"
},
{
"docstring": "## validation :para... | 2 | stack_v2_sparse_classes_30k_test_000150 | Implement the Python class `Requests` described below.
Class description:
Implement the Requests class.
Method signatures and docstrings:
- def __init__(self, class_name): ## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and valida... | Implement the Python class `Requests` described below.
Class description:
Implement the Requests class.
Method signatures and docstrings:
- def __init__(self, class_name): ## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and valida... | a9a9ddc284a12618a93febe238f12a71f95dd9f1 | <|skeleton|>
class Requests:
def __init__(self, class_name):
"""## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and validation for incoming requests."""
<|body_0|>
def validation(self, csrf_enable=True, **k... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Requests:
def __init__(self, class_name):
"""## Requests [ID] Class ini berguna untuk melakukan parsing dan validasi terhadap requests yang masuk. [EN] This class is used to parsed and validation for incoming requests."""
self.class_name = class_name.lower()
try:
if _req.js... | the_stack_v2_python_sparse | metric/app/resource.py | metric-python/metric | train | 1 | |
ada8ccf58df8e113b632e5dda96b142d18234d1e | [
"self.k = k\nself.nums = nums\nheapq.heapify(self.nums)\nwhile len(self.nums) > k:\n heapq.heappop(self.nums)",
"if len(self.nums) < self.k:\n heapq.heappush(self.nums, val)\nelif val > self.nums[0]:\n heapq.heapreplace(self.nums, val)\nreturn self.nums[0]"
] | <|body_start_0|>
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > k:
heapq.heappop(self.nums)
<|end_body_0|>
<|body_start_1|>
if len(self.nums) < self.k:
heapq.heappush(self.nums, val)
elif val > self.nums[0]:
... | KthLargest1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest1:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.nums = nums
heapq.heapify... | stack_v2_sparse_classes_10k_train_004504 | 1,362 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003229 | Implement the Python class `KthLargest1` described below.
Class description:
Implement the KthLargest1 class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest1` described below.
Class description:
Implement the KthLargest1 class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest1:
def __init__(self, k,... | d4a33dc28a6d3f99d5179fdb6a83b2ab8c5a0beb | <|skeleton|>
class KthLargest1:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KthLargest1:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > k:
heapq.heappop(self.nums)
def add(self, val):
""":type val: int :rtype: int"""
... | the_stack_v2_python_sparse | leetcode/703_kth_largest_num.py | 294150302hxq/python_learn | train | 0 | |
337dc67ed4620a488f66b001d77dd9753dde6486 | [
"try:\n exception = request.json\n (services.log_service().upsert_exception(exception), 201)\nexcept Exception as e:\n nsp.abort(500, 'An internal error has occurred: {}'.format(e))",
"try:\n exception = request.json\n (services.log_service().upsert_exception(exception), 204)\nexcept Exception as e... | <|body_start_0|>
try:
exception = request.json
(services.log_service().upsert_exception(exception), 201)
except Exception as e:
nsp.abort(500, 'An internal error has occurred: {}'.format(e))
<|end_body_0|>
<|body_start_1|>
try:
exception = request... | Exception | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exception:
def post(self):
"""Insert a new exception log"""
<|body_0|>
def put(self):
"""Update an exception object by it's id."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
exception = request.json
(services.log_servi... | stack_v2_sparse_classes_10k_train_004505 | 4,427 | no_license | [
{
"docstring": "Insert a new exception log",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Update an exception object by it's id.",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003536 | Implement the Python class `Exception` described below.
Class description:
Implement the Exception class.
Method signatures and docstrings:
- def post(self): Insert a new exception log
- def put(self): Update an exception object by it's id. | Implement the Python class `Exception` described below.
Class description:
Implement the Exception class.
Method signatures and docstrings:
- def post(self): Insert a new exception log
- def put(self): Update an exception object by it's id.
<|skeleton|>
class Exception:
def post(self):
"""Insert a new e... | df826cf7098aee59e0a1ced6f465c2e8bb3df9a5 | <|skeleton|>
class Exception:
def post(self):
"""Insert a new exception log"""
<|body_0|>
def put(self):
"""Update an exception object by it's id."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Exception:
def post(self):
"""Insert a new exception log"""
try:
exception = request.json
(services.log_service().upsert_exception(exception), 201)
except Exception as e:
nsp.abort(500, 'An internal error has occurred: {}'.format(e))
def put(sel... | the_stack_v2_python_sparse | patient_portal/patient_portal/api/logs.py | bkh148/patient-cloud | train | 0 | |
7e685921c2e253937bc65b36df89bedde1284b08 | [
"TokenizerContainer.init()\ntokens, input_ids = cls.get_ids(f'[CLS] {HL.GetSentWithoutEdit()} [SEP]')\nsegments = cls.get_segments(tokens)\nmasks = cls.get_masks(tokens)\ninput_ids.extend(segments)\ninput_ids.extend(masks)\nreturn np.array(input_ids)",
"if len(tokens) > cls.MAX_LEN:\n raise IndexError('Token l... | <|body_start_0|>
TokenizerContainer.init()
tokens, input_ids = cls.get_ids(f'[CLS] {HL.GetSentWithoutEdit()} [SEP]')
segments = cls.get_segments(tokens)
masks = cls.get_masks(tokens)
input_ids.extend(segments)
input_ids.extend(masks)
return np.array(input_ids)
<|e... | AlbertTokenizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: n... | stack_v2_sparse_classes_10k_train_004506 | 2,082 | no_license | [
{
"docstring": "Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: np.ndarray: The computed feature vector",
"name": "compute_feature",
"signa... | 4 | stack_v2_sparse_classes_30k_train_001927 | Implement the Python class `AlbertTokenizer` described below.
Class description:
Implement the AlbertTokenizer class.
Method signatures and docstrings:
- def compute_feature(cls, HL: Headline) -> np.ndarray: Computes the feature. Implemented by the concrete classes, this method is called by Headline when building fea... | Implement the Python class `AlbertTokenizer` described below.
Class description:
Implement the AlbertTokenizer class.
Method signatures and docstrings:
- def compute_feature(cls, HL: Headline) -> np.ndarray: Computes the feature. Implemented by the concrete classes, this method is called by Headline when building fea... | 90ffd178a930bb80eb99e4f7f51fdd5cb2ff0710 | <|skeleton|>
class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: np.ndarray: The... | the_stack_v2_python_sparse | src/lib/features/albert_token.py | bachelorbois/HumorHeadlines | train | 0 | |
ad39751cc6ac7cc54e2738609dcdf25f520f1150 | [
"self.module = module\nself.model_parallel_group = model_parallel_group\nself.model_parallel_world_size = 1 if self.model_parallel_group is None else dist.get_world_size(self.model_parallel_group)\nself.parallelism = parallelism",
"dim1_size = self.module.weight.size(1)\nif self.parallelism == 'input':\n x = d... | <|body_start_0|>
self.module = module
self.model_parallel_group = model_parallel_group
self.model_parallel_world_size = 1 if self.model_parallel_group is None else dist.get_world_size(self.model_parallel_group)
self.parallelism = parallelism
<|end_body_0|>
<|body_start_1|>
dim1_... | ModuleHelper for GPTNeoX layers. | GPTNeoXLinearModuleHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GPTNeoXLinearModuleHelper:
"""ModuleHelper for GPTNeoX layers."""
def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']):
"""Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model... | stack_v2_sparse_classes_10k_train_004507 | 2,162 | permissive | [
{
"docstring": "Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model_parallel_group (ProcessGroup): model parallel distributed process group this rank belongs to. If None, it is assumed model parallelism size is 1 (i.e., there is no model parallelism). parallelism (str): \"input\" i... | 3 | stack_v2_sparse_classes_30k_train_004736 | Implement the Python class `GPTNeoXLinearModuleHelper` described below.
Class description:
ModuleHelper for GPTNeoX layers.
Method signatures and docstrings:
- def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): Init ModuleHelper. Args:... | Implement the Python class `GPTNeoXLinearModuleHelper` described below.
Class description:
ModuleHelper for GPTNeoX layers.
Method signatures and docstrings:
- def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']): Init ModuleHelper. Args:... | e2b0c7dd1b1534e53389e7af9c070164b50b5968 | <|skeleton|>
class GPTNeoXLinearModuleHelper:
"""ModuleHelper for GPTNeoX layers."""
def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']):
"""Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GPTNeoXLinearModuleHelper:
"""ModuleHelper for GPTNeoX layers."""
def __init__(self, module: torch.nn.Module, model_parallel_group: dist.ProcessGroup | None, parallelism: Literal['input', 'output']):
"""Init ModuleHelper. Args: module (torch.nn.Module): module in model to wrap. model_parallel_gro... | the_stack_v2_python_sparse | kfac/gpt_neox/modules.py | gpauloski/kfac-pytorch | train | 29 |
b3e3dc7b4762f3e9cfb754075e2c7e87da584f02 | [
"model.compile(optimizer=optimizer, loss=loss, metrics=metrics)\nself._model = model\nself._optimizer = optimizer\nself._loss = loss\nself._metrics = metrics\nif not pathlib.Path(str(out_dir)).is_dir():\n raise ValueError('Invalid output dir')\nself.out_dir = str(out_dir)\nself.tmp_dir = pathlib.Path(out_dir).jo... | <|body_start_0|>
model.compile(optimizer=optimizer, loss=loss, metrics=metrics)
self._model = model
self._optimizer = optimizer
self._loss = loss
self._metrics = metrics
if not pathlib.Path(str(out_dir)).is_dir():
raise ValueError('Invalid output dir')
... | KerasBaseTrainer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasBaseTrainer:
def __init__(self, model: keras.Model, loss: keras.losses.Loss, optimizer: keras.optimizers.Optimizer, out_dir: str, metrics: keras.metrics.Metric=None):
"""Create a KerasBaseTrainner instance Args: model (keras.Model): the target model to be trained loss (keras.losses.... | stack_v2_sparse_classes_10k_train_004508 | 4,536 | no_license | [
{
"docstring": "Create a KerasBaseTrainner instance Args: model (keras.Model): the target model to be trained loss (keras.losses.Loss): the loss to optimizer optimizer (keras.optimizers.Optimizer): the optimizer to use out_dir (str): the directory to store the trained model metrics (keras.metrics.Metric): The m... | 2 | stack_v2_sparse_classes_30k_train_005564 | Implement the Python class `KerasBaseTrainer` described below.
Class description:
Implement the KerasBaseTrainer class.
Method signatures and docstrings:
- def __init__(self, model: keras.Model, loss: keras.losses.Loss, optimizer: keras.optimizers.Optimizer, out_dir: str, metrics: keras.metrics.Metric=None): Create a... | Implement the Python class `KerasBaseTrainer` described below.
Class description:
Implement the KerasBaseTrainer class.
Method signatures and docstrings:
- def __init__(self, model: keras.Model, loss: keras.losses.Loss, optimizer: keras.optimizers.Optimizer, out_dir: str, metrics: keras.metrics.Metric=None): Create a... | 5da5317cedd380c244f20a96213e883d6ef29de2 | <|skeleton|>
class KerasBaseTrainer:
def __init__(self, model: keras.Model, loss: keras.losses.Loss, optimizer: keras.optimizers.Optimizer, out_dir: str, metrics: keras.metrics.Metric=None):
"""Create a KerasBaseTrainner instance Args: model (keras.Model): the target model to be trained loss (keras.losses.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KerasBaseTrainer:
def __init__(self, model: keras.Model, loss: keras.losses.Loss, optimizer: keras.optimizers.Optimizer, out_dir: str, metrics: keras.metrics.Metric=None):
"""Create a KerasBaseTrainner instance Args: model (keras.Model): the target model to be trained loss (keras.losses.Loss): the los... | the_stack_v2_python_sparse | Trainers/basetrainer.py | MingRuey/mlbox | train | 2 | |
90f2ae134d6af0ec71b0def9c901600c34b92e5c | [
"dg = Diagnosis.query.get(kf_id)\nif dg is None:\n abort(404, 'could not find {} `{}`'.format('diagnosis', kf_id))\nreturn DiagnosisSchema().jsonify(dg)",
"dg = Diagnosis.query.get(kf_id)\nif dg is None:\n abort(404, 'could not find {} `{}`'.format('diagnosis', kf_id))\nbody = request.get_json(force=True) o... | <|body_start_0|>
dg = Diagnosis.query.get(kf_id)
if dg is None:
abort(404, 'could not find {} `{}`'.format('diagnosis', kf_id))
return DiagnosisSchema().jsonify(dg)
<|end_body_0|>
<|body_start_1|>
dg = Diagnosis.query.get(kf_id)
if dg is None:
abort(404, ... | Diagnosis REST API | DiagnosisAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiagnosisAPI:
"""Diagnosis REST API"""
def get(self, kf_id):
"""Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis"""
<|body_0|>
def patch(self, kf_id):
"""Update an existing diagnosis. Allows partial update of resource --- te... | stack_v2_sparse_classes_10k_train_004509 | 5,021 | permissive | [
{
"docstring": "Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis",
"name": "get",
"signature": "def get(self, kf_id)"
},
{
"docstring": "Update an existing diagnosis. Allows partial update of resource --- template: path: update_by_id.yml properties: resourc... | 3 | stack_v2_sparse_classes_30k_train_000898 | Implement the Python class `DiagnosisAPI` described below.
Class description:
Diagnosis REST API
Method signatures and docstrings:
- def get(self, kf_id): Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis
- def patch(self, kf_id): Update an existing diagnosis. Allows partial upda... | Implement the Python class `DiagnosisAPI` described below.
Class description:
Diagnosis REST API
Method signatures and docstrings:
- def get(self, kf_id): Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis
- def patch(self, kf_id): Update an existing diagnosis. Allows partial upda... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class DiagnosisAPI:
"""Diagnosis REST API"""
def get(self, kf_id):
"""Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis"""
<|body_0|>
def patch(self, kf_id):
"""Update an existing diagnosis. Allows partial update of resource --- te... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DiagnosisAPI:
"""Diagnosis REST API"""
def get(self, kf_id):
"""Get a diagnosis by id --- template: path: get_by_id.yml properties: resource: Diagnosis"""
dg = Diagnosis.query.get(kf_id)
if dg is None:
abort(404, 'could not find {} `{}`'.format('diagnosis', kf_id))
... | the_stack_v2_python_sparse | dataservice/api/diagnosis/resources.py | kids-first/kf-api-dataservice | train | 9 |
eeb63cd79be481d770dd81c851b08af8896b5f78 | [
"names = []\nif self.children[1].type == 'annassign':\n names = _defined_names(self.children[0], include_setitem)\nreturn [name for i in range(0, len(self.children) - 2, 2) if '=' in self.children[i + 1].value for name in _defined_names(self.children[i], include_setitem)] + names",
"node = self.children[-1]\ni... | <|body_start_0|>
names = []
if self.children[1].type == 'annassign':
names = _defined_names(self.children[0], include_setitem)
return [name for i in range(0, len(self.children) - 2, 2) if '=' in self.children[i + 1].value for name in _defined_names(self.children[i], include_setitem)]... | ExprStmt | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExprStmt:
def get_defined_names(self, include_setitem=False):
"""Returns a list of `Name` defined before the `=` sign."""
<|body_0|>
def get_rhs(self):
"""Returns the right-hand-side of the equals."""
<|body_1|>
def yield_operators(self):
"""Retu... | stack_v2_sparse_classes_10k_train_004510 | 38,111 | permissive | [
{
"docstring": "Returns a list of `Name` defined before the `=` sign.",
"name": "get_defined_names",
"signature": "def get_defined_names(self, include_setitem=False)"
},
{
"docstring": "Returns the right-hand-side of the equals.",
"name": "get_rhs",
"signature": "def get_rhs(self)"
},
... | 3 | stack_v2_sparse_classes_30k_train_007219 | Implement the Python class `ExprStmt` described below.
Class description:
Implement the ExprStmt class.
Method signatures and docstrings:
- def get_defined_names(self, include_setitem=False): Returns a list of `Name` defined before the `=` sign.
- def get_rhs(self): Returns the right-hand-side of the equals.
- def yi... | Implement the Python class `ExprStmt` described below.
Class description:
Implement the ExprStmt class.
Method signatures and docstrings:
- def get_defined_names(self, include_setitem=False): Returns a list of `Name` defined before the `=` sign.
- def get_rhs(self): Returns the right-hand-side of the equals.
- def yi... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class ExprStmt:
def get_defined_names(self, include_setitem=False):
"""Returns a list of `Name` defined before the `=` sign."""
<|body_0|>
def get_rhs(self):
"""Returns the right-hand-side of the equals."""
<|body_1|>
def yield_operators(self):
"""Retu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExprStmt:
def get_defined_names(self, include_setitem=False):
"""Returns a list of `Name` defined before the `=` sign."""
names = []
if self.children[1].type == 'annassign':
names = _defined_names(self.children[0], include_setitem)
return [name for i in range(0, len... | the_stack_v2_python_sparse | contrib/python/parso/py2/parso/python/tree.py | catboost/catboost | train | 8,012 | |
9d63061cbfe69df19666738569c7fc6629c867a5 | [
"if not l1:\n return l2\nelif not l2:\n return l1\ndummy = ListNode(None)\nnode = dummy\nwhile l1 or l2:\n n1 = l1.val if l1 else float('inf')\n n2 = l2.val if l2 else float('inf')\n node.next = l1 if n1 <= n2 else l2\n l1 = l1.next if n1 <= n2 else l1\n l2 = l2.next if n2 < n1 else l2\n nod... | <|body_start_0|>
if not l1:
return l2
elif not l2:
return l1
dummy = ListNode(None)
node = dummy
while l1 or l2:
n1 = l1.val if l1 else float('inf')
n2 = l2.val if l2 else float('inf')
node.next = l1 if n1 <= n2 else l2
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeTwoLists_v2(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_004511 | 2,317 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists_v2",
"signature": "def mergeTwoLists_v2(self... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeTwoLists_v2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeTwoLists_v2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNo... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeTwoLists_v2(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
if not l1:
return l2
elif not l2:
return l1
dummy = ListNode(None)
node = dummy
while l1 or l2:
n1 = l1.val if l1 else flo... | the_stack_v2_python_sparse | src/lt_21.py | oxhead/CodingYourWay | train | 0 | |
d64d509554643fc585988153e0e87b869228657d | [
"if not prices:\n return 0\nn = len(prices)\ndp = [[0, 0] for _ in range(n)]\ndp[0][0] = -prices[0]\nfor i in range(1, n):\n dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] - prices[i])\n dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] + prices[i])\nreturn dp[-1][1]",
"n = len(prices)\nres = 0\nfor i in range(1, n):... | <|body_start_0|>
if not prices:
return 0
n = len(prices)
dp = [[0, 0] for _ in range(n)]
dp[0][0] = -prices[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] - prices[i])
dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] + prices[i])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益"""
<|body_0|>
def maxProfit2(self, prices: List[int]) -> int:
"""1. 扫描一遍 只要后一天比前一天大 就把这两天的差值加一下 2. 这种说法是正确的。因为 [1, 3, 4], 4-1 = (3-1) + (4-3)"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_004512 | 2,663 | no_license | [
{
"docstring": "思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益",
"name": "maxProfit1",
"signature": "def maxProfit1(self, prices: List[int]) -> int"
},
{
"docstring": "1. 扫描一遍 只要后一天比前一天大 就把这两天的差值加一下 2. 这种说法是正确的。因为 [1, 3, 4], 4-1 = (3-1) + (4-3)",
"name": "maxProfit2",
"signature": "def maxProfit2(self... | 2 | stack_v2_sparse_classes_30k_train_000435 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, prices: List[int]) -> int: 思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益
- def maxProfit2(self, prices: List[int]) -> int: 1. 扫描一遍 只要后一天比前一天大 就把这两天的差值加一下 2. 这种说法是正确的。因为 [... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, prices: List[int]) -> int: 思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益
- def maxProfit2(self, prices: List[int]) -> int: 1. 扫描一遍 只要后一天比前一天大 就把这两天的差值加一下 2. 这种说法是正确的。因为 [... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益"""
<|body_0|>
def maxProfit2(self, prices: List[int]) -> int:
"""1. 扫描一遍 只要后一天比前一天大 就把这两天的差值加一下 2. 这种说法是正确的。因为 [1, 3, 4], 4-1 = (3-1) + (4-3)"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:每次记录两个状态:买入和卖出,每次计算这两个操作的最大收益"""
if not prices:
return 0
n = len(prices)
dp = [[0, 0] for _ in range(n)]
dp[0][0] = -prices[0]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][... | the_stack_v2_python_sparse | LeetCode/股票购买专题/122. 买卖股票的最佳时机 II.py | yiming1012/MyLeetCode | train | 2 | |
e4aa3d1de6915eb0da0a862721dd9f56db2f65d1 | [
"self.timeout = timeout\ntry:\n self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, lts=self.parent.parameters.get('lts', {}), timeout=timeout)\nexcept Exception as e:\n self.errored(\"Section failed due to: '{e}'\".format(e=e))\nfor stp in steps.details:\n if stp.result.name... | <|body_start_0|>
self.timeout = timeout
try:
self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, lts=self.parent.parameters.get('lts', {}), timeout=timeout)
except Exception as e:
self.errored("Section failed due to: '{e}'".format(e=e))
... | Trigger class for UnconfigConfig action | TriggerUnconfigConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object.... | stack_v2_sparse_classes_10k_train_004513 | 5,764 | permissive | [
{
"docstring": "Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object timeout (`timeout obj`): Timeout Object Returns: None Raises: pyATS Res... | 6 | null | Implement the Python class `TriggerUnconfigConfig` described below.
Class description:
Trigger class for UnconfigConfig action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then ski... | Implement the Python class `TriggerUnconfigConfig` described below.
Class description:
Trigger class for UnconfigConfig action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then ski... | e42e51475cddcb10f5c7814d0fe892ac865742ba | <|skeleton|>
class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`o... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/triggers/unconfigconfig/unconfigconfig.py | CiscoTestAutomation/genielibs | train | 109 |
137739884ac6cd9409207f4ed45e4d3379e15636 | [
"url = self.ip + '/api/scm/auth/scm/scmPurchaseApplyH/saveOrUpdate.do'\nparams = purchase_apply_save_params\nbody = purchase_apply_body\nr = self.s.post(url=url, params=params, data=body)\nreturn r.json()",
"url = self.ip + '/api/scm/auth/scm/scmPurchaseApplyH/getDetailByOrderNo.do'\nparams = {'orderNo': purchase... | <|body_start_0|>
url = self.ip + '/api/scm/auth/scm/scmPurchaseApplyH/saveOrUpdate.do'
params = purchase_apply_save_params
body = purchase_apply_body
r = self.s.post(url=url, params=params, data=body)
return r.json()
<|end_body_0|>
<|body_start_1|>
url = self.ip + '/api/... | PurchaseApply | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PurchaseApply:
def purchase_apply_save(self):
"""申购单:保存,状态为草稿 :return:"""
<|body_0|>
def get_purchase_apply_detail(self, purchase_apply_order_no):
"""获取申购单物料明细 :return:"""
<|body_1|>
def get_purchase_apply_submit_body(self, purchase_apply_order_no):
... | stack_v2_sparse_classes_10k_train_004514 | 3,732 | no_license | [
{
"docstring": "申购单:保存,状态为草稿 :return:",
"name": "purchase_apply_save",
"signature": "def purchase_apply_save(self)"
},
{
"docstring": "获取申购单物料明细 :return:",
"name": "get_purchase_apply_detail",
"signature": "def get_purchase_apply_detail(self, purchase_apply_order_no)"
},
{
"docst... | 5 | stack_v2_sparse_classes_30k_train_003024 | Implement the Python class `PurchaseApply` described below.
Class description:
Implement the PurchaseApply class.
Method signatures and docstrings:
- def purchase_apply_save(self): 申购单:保存,状态为草稿 :return:
- def get_purchase_apply_detail(self, purchase_apply_order_no): 获取申购单物料明细 :return:
- def get_purchase_apply_submit_... | Implement the Python class `PurchaseApply` described below.
Class description:
Implement the PurchaseApply class.
Method signatures and docstrings:
- def purchase_apply_save(self): 申购单:保存,状态为草稿 :return:
- def get_purchase_apply_detail(self, purchase_apply_order_no): 获取申购单物料明细 :return:
- def get_purchase_apply_submit_... | 26d2ae773a999fd8446e18f9c0719d46402b19aa | <|skeleton|>
class PurchaseApply:
def purchase_apply_save(self):
"""申购单:保存,状态为草稿 :return:"""
<|body_0|>
def get_purchase_apply_detail(self, purchase_apply_order_no):
"""获取申购单物料明细 :return:"""
<|body_1|>
def get_purchase_apply_submit_body(self, purchase_apply_order_no):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PurchaseApply:
def purchase_apply_save(self):
"""申购单:保存,状态为草稿 :return:"""
url = self.ip + '/api/scm/auth/scm/scmPurchaseApplyH/saveOrUpdate.do'
params = purchase_apply_save_params
body = purchase_apply_body
r = self.s.post(url=url, params=params, data=body)
retu... | the_stack_v2_python_sparse | api/purchase_apply_api.py | Leofighting/dimi_api_test | train | 0 | |
bdd5690f6a2ddded83a22f8ae82b061e808fd38c | [
"if not root:\n return 0\nq = deque()\nq.append([1, root])\nwhile q:\n x = len(q)\n while x:\n d, node = q.popleft()\n if not node.left and (not node.right):\n return d\n if node.left:\n q.append([d + 1, node.left])\n if node.right:\n q.append([d... | <|body_start_0|>
if not root:
return 0
q = deque()
q.append([1, root])
while q:
x = len(q)
while x:
d, node = q.popleft()
if not node.left and (not node.right):
return d
if node.left:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
q = deque()... | stack_v2_sparse_classes_10k_train_004515 | 1,000 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000511 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def minDepth(self, root... | 31012a004ba14ddfb468a91925d86bc2dfb60dd4 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
if not root:
return 0
q = deque()
q.append([1, root])
while q:
x = len(q)
while x:
d, node = q.popleft()
if not node.left and (... | the_stack_v2_python_sparse | tree/MinimumDepthofBinaryTree.py | yuhangxiaocs/LeetCodePy | train | 1 | |
ae9d18ff5cd47707b62de44018aee927236d476b | [
"self._vehicle = vehicle\nself._K_P = K_P\nself._K_D = K_D\nself._K_I = K_I\nself._dt = dt\nself._e_buffer = deque(maxlen=30)",
"current_speed = get_speed(self._vehicle)\nif debug:\n print('Current speed = {}'.format(current_speed))\nreturn self._pid_control(target_speed, current_speed)",
"_e = target_speed ... | <|body_start_0|>
self._vehicle = vehicle
self._K_P = K_P
self._K_D = K_D
self._K_I = K_I
self._dt = dt
self._e_buffer = deque(maxlen=30)
<|end_body_0|>
<|body_start_1|>
current_speed = get_speed(self._vehicle)
if debug:
print('Current speed = ... | PIDLongitudinalController implements longitudinal control using a PID. | PIDLongitudinalController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differentia... | stack_v2_sparse_classes_10k_train_004516 | 13,383 | no_license | [
{
"docstring": ":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral term :param dt: time differential in seconds",
"name": "__init__",
"signature": "def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03)"
... | 3 | stack_v2_sparse_classes_30k_train_006828 | Implement the Python class `PIDLongitudinalController` described below.
Class description:
PIDLongitudinalController implements longitudinal control using a PID.
Method signatures and docstrings:
- def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03): :param vehicle: actor to apply to local planner logic o... | Implement the Python class `PIDLongitudinalController` described below.
Class description:
PIDLongitudinalController implements longitudinal control using a PID.
Method signatures and docstrings:
- def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03): :param vehicle: actor to apply to local planner logic o... | da35bfec7d40708e4f76d08f54e04587bef1dd8b | <|skeleton|>
class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differentia... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PIDLongitudinalController:
"""PIDLongitudinalController implements longitudinal control using a PID."""
def __init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03):
""":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param... | the_stack_v2_python_sparse | drive_interfaces/carla/comercial_cars/Navigation/controller.py | gy20073/CIL_modular | train | 2 |
9820628612a6ee1acf247a6d1c483b78e0ac111a | [
"self.dq = collections.deque()\nfor i in range(1, n + 1):\n self.dq.append(i)\nself.t = collections.deque()",
"if k == len(self.dq):\n return self.dq[-1]\nwhile k != 0:\n k -= 1\n self.t.append(self.dq.popleft())\nr = self.t[-1]\nself.dq.append(self.t.pop())\nwhile self.t:\n self.dq.appendleft(self... | <|body_start_0|>
self.dq = collections.deque()
for i in range(1, n + 1):
self.dq.append(i)
self.t = collections.deque()
<|end_body_0|>
<|body_start_1|>
if k == len(self.dq):
return self.dq[-1]
while k != 0:
k -= 1
self.t.append(sel... | MRUQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRUQueue:
def __init__(self, n):
""":type n: int"""
<|body_0|>
def fetch(self, k):
""":type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dq = collections.deque()
for i in range(1, n + 1):
self.dq.append... | stack_v2_sparse_classes_10k_train_004517 | 754 | no_license | [
{
"docstring": ":type n: int",
"name": "__init__",
"signature": "def __init__(self, n)"
},
{
"docstring": ":type k: int :rtype: int",
"name": "fetch",
"signature": "def fetch(self, k)"
}
] | 2 | null | Implement the Python class `MRUQueue` described below.
Class description:
Implement the MRUQueue class.
Method signatures and docstrings:
- def __init__(self, n): :type n: int
- def fetch(self, k): :type k: int :rtype: int | Implement the Python class `MRUQueue` described below.
Class description:
Implement the MRUQueue class.
Method signatures and docstrings:
- def __init__(self, n): :type n: int
- def fetch(self, k): :type k: int :rtype: int
<|skeleton|>
class MRUQueue:
def __init__(self, n):
""":type n: int"""
<|... | 20623defecf65cbc35b194d8b60d8b211816ee4f | <|skeleton|>
class MRUQueue:
def __init__(self, n):
""":type n: int"""
<|body_0|>
def fetch(self, k):
""":type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MRUQueue:
def __init__(self, n):
""":type n: int"""
self.dq = collections.deque()
for i in range(1, n + 1):
self.dq.append(i)
self.t = collections.deque()
def fetch(self, k):
""":type k: int :rtype: int"""
if k == len(self.dq):
retur... | the_stack_v2_python_sparse | in_Python/1756 Design Most Recently Used Queue.py | YangLiyli131/Leetcode2020 | train | 0 | |
f27fa8f844fd374a175fd9a1c73a102e9552a32a | [
"self.clusters_count = count\nself._leaders = [i for i in range(count)]\nself._ranks = [0] * count",
"ot = self.find(x)\nto = self.find(y)\nif ot == to:\n return\nself.clusters_count -= 1\nrank_ot = self._ranks[ot]\nrank_to = self._ranks[to]\nif rank_ot == rank_to:\n self._leaders[ot] = to\n self._ranks[... | <|body_start_0|>
self.clusters_count = count
self._leaders = [i for i in range(count)]
self._ranks = [0] * count
<|end_body_0|>
<|body_start_1|>
ot = self.find(x)
to = self.find(y)
if ot == to:
return
self.clusters_count -= 1
rank_ot = self._r... | UnionFind | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
<|body_0|>
def union(self, x, y):
"""Put x and y into one cluster"""
<|body_1|>
def find(self, i):
"""Find cluster for i"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_10k_train_004518 | 1,847 | no_license | [
{
"docstring": "Constructor of the union find structure",
"name": "__init__",
"signature": "def __init__(self, count)"
},
{
"docstring": "Put x and y into one cluster",
"name": "union",
"signature": "def union(self, x, y)"
},
{
"docstring": "Find cluster for i",
"name": "find... | 3 | stack_v2_sparse_classes_30k_train_003311 | Implement the Python class `UnionFind` described below.
Class description:
Implement the UnionFind class.
Method signatures and docstrings:
- def __init__(self, count): Constructor of the union find structure
- def union(self, x, y): Put x and y into one cluster
- def find(self, i): Find cluster for i | Implement the Python class `UnionFind` described below.
Class description:
Implement the UnionFind class.
Method signatures and docstrings:
- def __init__(self, count): Constructor of the union find structure
- def union(self, x, y): Put x and y into one cluster
- def find(self, i): Find cluster for i
<|skeleton|>
c... | 8eac3ac57066d3e91f4621abf88264c48ba0f691 | <|skeleton|>
class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
<|body_0|>
def union(self, x, y):
"""Put x and y into one cluster"""
<|body_1|>
def find(self, i):
"""Find cluster for i"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UnionFind:
def __init__(self, count):
"""Constructor of the union find structure"""
self.clusters_count = count
self._leaders = [i for i in range(count)]
self._ranks = [0] * count
def union(self, x, y):
"""Put x and y into one cluster"""
ot = self.find(x)
... | the_stack_v2_python_sparse | Pythoning/computer_science/datatypes/union_find.py | omikad/omikad-stuff | train | 0 | |
d5ba63c82e9e5f2b6af8084d93817476934db7e6 | [
"self.obj = None\nself.source_obj = None\nself.description = ''\nself.count = 0\nself.objection = UVMObjection()",
"self.obj = None\nself.source_obj = None\nself.description = ''\nself.count = 0\nself.objection = UVMObjection()"
] | <|body_start_0|>
self.obj = None
self.source_obj = None
self.description = ''
self.count = 0
self.objection = UVMObjection()
<|end_body_0|>
<|body_start_1|>
self.obj = None
self.source_obj = None
self.description = ''
self.count = 0
self.o... | UVMObjectionContextObject | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UVMObjectionContextObject:
def __init__(self):
"""uvm_object obj uvm_object source_obj string description int count uvm_objection objection"""
<|body_0|>
def clear(self):
"""Clears the values stored within the object, preventing memory leaks from reused objects"""
... | stack_v2_sparse_classes_10k_train_004519 | 49,193 | permissive | [
{
"docstring": "uvm_object obj uvm_object source_obj string description int count uvm_objection objection",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Clears the values stored within the object, preventing memory leaks from reused objects",
"name": "clear",
... | 2 | null | Implement the Python class `UVMObjectionContextObject` described below.
Class description:
Implement the UVMObjectionContextObject class.
Method signatures and docstrings:
- def __init__(self): uvm_object obj uvm_object source_obj string description int count uvm_objection objection
- def clear(self): Clears the valu... | Implement the Python class `UVMObjectionContextObject` described below.
Class description:
Implement the UVMObjectionContextObject class.
Method signatures and docstrings:
- def __init__(self): uvm_object obj uvm_object source_obj string description int count uvm_objection objection
- def clear(self): Clears the valu... | fc5f955701b2b56c1fddac195c70cb3ebb9139fe | <|skeleton|>
class UVMObjectionContextObject:
def __init__(self):
"""uvm_object obj uvm_object source_obj string description int count uvm_objection objection"""
<|body_0|>
def clear(self):
"""Clears the values stored within the object, preventing memory leaks from reused objects"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UVMObjectionContextObject:
def __init__(self):
"""uvm_object obj uvm_object source_obj string description int count uvm_objection objection"""
self.obj = None
self.source_obj = None
self.description = ''
self.count = 0
self.objection = UVMObjection()
def cl... | the_stack_v2_python_sparse | src/uvm/base/uvm_objection.py | tpoikela/uvm-python | train | 199 | |
736fddeb62eb70f0a2d9a27d8516a4810175668b | [
"left, right = (0, len(s) - 1)\nwhile left <= right:\n if s[left] == s[right]:\n left += 1\n right -= 1\n else:\n return s[left:right] == s[left:right][::-1] or s[left + 1:right + 1] == s[left + 1:right + 1][::-1]\nreturn True",
"left, right = (0, len(s) - 1)\nisPalindrome = lambda x: x... | <|body_start_0|>
left, right = (0, len(s) - 1)
while left <= right:
if s[left] == s[right]:
left += 1
right -= 1
else:
return s[left:right] == s[left:right][::-1] or s[left + 1:right + 1] == s[left + 1:right + 1][::-1]
retur... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def validPalindrome(self, s: str) -> bool:
"""执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]"""
<|body_0|>
def validPali... | stack_v2_sparse_classes_10k_train_004520 | 1,892 | no_license | [
{
"docstring": "执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]",
"name": "validPalindrome",
"signature": "def validPalindrome(self, s: str) -> bool"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_000066 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validPalindrome(self, s: str) -> bool: 执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validPalindrome(self, s: str) -> bool: 执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def validPalindrome(self, s: str) -> bool:
"""执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]"""
<|body_0|>
def validPali... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def validPalindrome(self, s: str) -> bool:
"""执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]"""
left, right = (0, len(s) - 1)
while... | the_stack_v2_python_sparse | LeetCode/双指针(two points)/680. Valid Palindrome II.py | yiming1012/MyLeetCode | train | 2 | |
2e22951686867aa72a212ce803f5395b70a991a1 | [
"ind = [str(i) for i in range(1, n + 1)]\nf = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]\nnum = ''\nnew_n = n - 1\nfor i in range(n):\n mi = f[new_n]\n index = k // mi\n if k % mi == 0:\n index -= 1\n num += ind.pop(index)\n k %= mi\n new_n -= 1\nreturn num",
"ind = [str(i) for i in range(1,... | <|body_start_0|>
ind = [str(i) for i in range(1, n + 1)]
f = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
num = ''
new_n = n - 1
for i in range(n):
mi = f[new_n]
index = k // mi
if k % mi == 0:
index -= 1
num += ind.pop(i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation_1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ind = [str(i) for i in range(... | stack_v2_sparse_classes_10k_train_004521 | 1,235 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation",
"signature": "def getPermutation(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: str",
"name": "getPermutation_1",
"signature": "def getPermutation_1(self, n, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation_1(self, n, k): :type n: int :type k: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
- def getPermutation_1(self, n, k): :type n: int :type k: int :rtype: str
<|skeleton|>
class Solution:
... | 5b535795cdd742b7810ea163e0868b022736647d | <|skeleton|>
class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_0|>
def getPermutation_1(self, n, k):
""":type n: int :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def getPermutation(self, n, k):
""":type n: int :type k: int :rtype: str"""
ind = [str(i) for i in range(1, n + 1)]
f = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
num = ''
new_n = n - 1
for i in range(n):
mi = f[new_n]
index = k //... | the_stack_v2_python_sparse | LeetCode_Kth_Permutation_Sequence.py | Cbkhare/Codes | train | 0 | |
abe34a11b4db2bc405d9c7957b01f83a911034b7 | [
"study_id = filter_params.pop('study_id', None)\nq = SequencingCenter.query.filter_by(**filter_params)\nfrom dataservice.api.participant.models import Participant\nfrom dataservice.api.biospecimen.models import Biospecimen\nif study_id:\n q = q.join(SequencingCenter.biospecimens).join(Biospecimen.participant).fi... | <|body_start_0|>
study_id = filter_params.pop('study_id', None)
q = SequencingCenter.query.filter_by(**filter_params)
from dataservice.api.participant.models import Participant
from dataservice.api.biospecimen.models import Biospecimen
if study_id:
q = q.join(Sequenci... | SequencingCenter REST API | SequencingCenterListAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequencingCenterListAPI:
"""SequencingCenter REST API"""
def get(self, filter_params, after, limit):
"""Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: SequencingCenter"""
<|body_0|>
def post(self)... | stack_v2_sparse_classes_10k_train_004522 | 5,230 | permissive | [
{
"docstring": "Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: SequencingCenter",
"name": "get",
"signature": "def get(self, filter_params, after, limit)"
},
{
"docstring": "Create a new sequencing_center --- template: pa... | 2 | stack_v2_sparse_classes_30k_train_006064 | Implement the Python class `SequencingCenterListAPI` described below.
Class description:
SequencingCenter REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: S... | Implement the Python class `SequencingCenterListAPI` described below.
Class description:
SequencingCenter REST API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: S... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class SequencingCenterListAPI:
"""SequencingCenter REST API"""
def get(self, filter_params, after, limit):
"""Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: SequencingCenter"""
<|body_0|>
def post(self)... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SequencingCenterListAPI:
"""SequencingCenter REST API"""
def get(self, filter_params, after, limit):
"""Get all sequencing_centers --- description: Get all sequencing_centers template: path: get_list.yml properties: resource: SequencingCenter"""
study_id = filter_params.pop('study_id', No... | the_stack_v2_python_sparse | dataservice/api/sequencing_center/resources.py | kids-first/kf-api-dataservice | train | 9 |
7f2409baf000c200f843a229735688d5263997e5 | [
"import re\nres = ''\ntmp = re.findall('^[-+]?[\\\\d]+', str.strip())\nif tmp:\n ms = tmp[0]\n if ms[0] == '-' or ms[0] == '+':\n res = ms[1:]\n else:\n res = ms\n res = int(res)\n if ms[0] == '-':\n return max(-res, -2147483648)\n return min(res, 2147483647)\nelse:\n retur... | <|body_start_0|>
import re
res = ''
tmp = re.findall('^[-+]?[\\d]+', str.strip())
if tmp:
ms = tmp[0]
if ms[0] == '-' or ms[0] == '+':
res = ms[1:]
else:
res = ms
res = int(res)
if ms[0] == '-':
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myAtoi(self, str):
""":type str: str :rtype: int"""
<|body_0|>
def myAtoi2(self, str):
""":type str: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import re
res = ''
tmp = re.findall('^[-+]?[\\d]+', st... | stack_v2_sparse_classes_10k_train_004523 | 1,417 | no_license | [
{
"docstring": ":type str: str :rtype: int",
"name": "myAtoi",
"signature": "def myAtoi(self, str)"
},
{
"docstring": ":type str: str :rtype: int",
"name": "myAtoi2",
"signature": "def myAtoi2(self, str)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003561 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, str): :type str: str :rtype: int
- def myAtoi2(self, str): :type str: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, str): :type str: str :rtype: int
- def myAtoi2(self, str): :type str: str :rtype: int
<|skeleton|>
class Solution:
def myAtoi(self, str):
""":type ... | 829f918a0d4d94da5fd3004768421974fbe056e7 | <|skeleton|>
class Solution:
def myAtoi(self, str):
""":type str: str :rtype: int"""
<|body_0|>
def myAtoi2(self, str):
""":type str: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def myAtoi(self, str):
""":type str: str :rtype: int"""
import re
res = ''
tmp = re.findall('^[-+]?[\\d]+', str.strip())
if tmp:
ms = tmp[0]
if ms[0] == '-' or ms[0] == '+':
res = ms[1:]
else:
... | the_stack_v2_python_sparse | leetcode/medium/8_字符串转换成整数.py | Weikoi/OJ_Python | train | 0 | |
7dacb85accedb807b19396bd44da07a6394dcd67 | [
"self.AddObserver('LeftButtonPressEvent', self._left_button_press_event)\nself.parent = parent\nself.highlight_button = self.parent.actions['highlight']\nself.is_eids = is_eids\nself.is_nids = is_nids\nself.representation = representation\nassert is_eids or is_nids, 'is_eids=%r is_nids=%r, must not both be False' %... | <|body_start_0|>
self.AddObserver('LeftButtonPressEvent', self._left_button_press_event)
self.parent = parent
self.highlight_button = self.parent.actions['highlight']
self.is_eids = is_eids
self.is_nids = is_nids
self.representation = representation
assert is_eids... | Highlights nodes & elements | HighlightStyle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HighlightStyle:
"""Highlights nodes & elements"""
def __init__(self, parent=None, is_eids=True, is_nids=True, representation='wire', name=None, callback=None):
"""Creates the HighlightStyle instance Parameters ---------- is_eids/is_nids : bool; default=True should elements/nodes be h... | stack_v2_sparse_classes_10k_train_004524 | 6,337 | no_license | [
{
"docstring": "Creates the HighlightStyle instance Parameters ---------- is_eids/is_nids : bool; default=True should elements/nodes be highlighted representation : str; default='wire' allowed = {'wire', 'points', 'surface'} name : str; default=None the name of the actor callback : function fill up a QLineEdit ... | 5 | null | Implement the Python class `HighlightStyle` described below.
Class description:
Highlights nodes & elements
Method signatures and docstrings:
- def __init__(self, parent=None, is_eids=True, is_nids=True, representation='wire', name=None, callback=None): Creates the HighlightStyle instance Parameters ---------- is_eid... | Implement the Python class `HighlightStyle` described below.
Class description:
Highlights nodes & elements
Method signatures and docstrings:
- def __init__(self, parent=None, is_eids=True, is_nids=True, representation='wire', name=None, callback=None): Creates the HighlightStyle instance Parameters ---------- is_eid... | d9ffdb4ac845b13bcf6aea96ff5d37cc026c5267 | <|skeleton|>
class HighlightStyle:
"""Highlights nodes & elements"""
def __init__(self, parent=None, is_eids=True, is_nids=True, representation='wire', name=None, callback=None):
"""Creates the HighlightStyle instance Parameters ---------- is_eids/is_nids : bool; default=True should elements/nodes be h... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HighlightStyle:
"""Highlights nodes & elements"""
def __init__(self, parent=None, is_eids=True, is_nids=True, representation='wire', name=None, callback=None):
"""Creates the HighlightStyle instance Parameters ---------- is_eids/is_nids : bool; default=True should elements/nodes be highlighted re... | the_stack_v2_python_sparse | pyNastran/gui/styles/highlight_style.py | ratalex/pyNastran | train | 0 |
02e594295d5e51cbe86844b04df342034b05d7e1 | [
"Filter.__init__(self)\nap = KWArgsProcessor(self, kwargs)\nap.add('verbosity', default=0)\nap.add('mutationVariate', default=None)\nap.add('mutation', default=EvolinoSubMutation())\nif self.mutationVariate is not None:\n self.mutation.mutationVariate = self.mutationVariate",
"max_n = population.getMaxNIndivid... | <|body_start_0|>
Filter.__init__(self)
ap = KWArgsProcessor(self, kwargs)
ap.add('verbosity', default=0)
ap.add('mutationVariate', default=None)
ap.add('mutation', default=EvolinoSubMutation())
if self.mutationVariate is not None:
self.mutation.mutationVariate... | Reproduction operator for EvolinoSubPopulation objects. | EvolinoSubReproduction | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvolinoSubReproduction:
"""Reproduction operator for EvolinoSubPopulation objects."""
def __init__(self, **kwargs):
""":key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutation: Defaults to EvolinoSubMutation"""
<|body_0|>... | stack_v2_sparse_classes_10k_train_004525 | 9,839 | permissive | [
{
"docstring": ":key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutation: Defaults to EvolinoSubMutation",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "First determines the number of individuals to be cr... | 2 | null | Implement the Python class `EvolinoSubReproduction` described below.
Class description:
Reproduction operator for EvolinoSubPopulation objects.
Method signatures and docstrings:
- def __init__(self, **kwargs): :key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutat... | Implement the Python class `EvolinoSubReproduction` described below.
Class description:
Reproduction operator for EvolinoSubPopulation objects.
Method signatures and docstrings:
- def __init__(self, **kwargs): :key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutat... | 33ead60704d126e58c10d458ddd1e5e5fd17b65d | <|skeleton|>
class EvolinoSubReproduction:
"""Reproduction operator for EvolinoSubPopulation objects."""
def __init__(self, **kwargs):
""":key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutation: Defaults to EvolinoSubMutation"""
<|body_0|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EvolinoSubReproduction:
"""Reproduction operator for EvolinoSubPopulation objects."""
def __init__(self, **kwargs):
""":key verbosity: Verbosity level :key mutationVariate: Variate used for mutation. Defaults to None :key mutation: Defaults to EvolinoSubMutation"""
Filter.__init__(self)
... | the_stack_v2_python_sparse | pybrain/supervised/evolino/filter.py | pybrain2/pybrain2 | train | 14 |
9c5c20446e41bbe90b3b51b0c6059018bfa498f2 | [
"Thread.__init__(self, name='Reader' + 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.read(lambda counter: self.ce... | <|body_start_0|>
Thread.__init__(self, name='Reader' + 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.... | Reads from the shared cell | Reader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reader:
"""Reads from the shared cell"""
def __init__(self, cell, accessCount, sleepMax, instance):
"""Create a reader of the given shared cell, number of accesses, and maximum sleep interval."""
<|body_0|>
def run(self):
"""Announce start-up, sleep and read from... | stack_v2_sparse_classes_10k_train_004526 | 5,757 | no_license | [
{
"docstring": "Create a reader of 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 read from shared cell the given number of times... | 2 | stack_v2_sparse_classes_30k_train_002593 | Implement the Python class `Reader` described below.
Class description:
Reads from the shared cell
Method signatures and docstrings:
- def __init__(self, cell, accessCount, sleepMax, instance): Create a reader of the given shared cell, number of accesses, and maximum sleep interval.
- def run(self): Announce start-up... | Implement the Python class `Reader` described below.
Class description:
Reads from the shared cell
Method signatures and docstrings:
- def __init__(self, cell, accessCount, sleepMax, instance): Create a reader of the given shared cell, number of accesses, and maximum sleep interval.
- def run(self): Announce start-up... | 30375264cf0103e3455fdf92c35a2c5c15b5d7ef | <|skeleton|>
class Reader:
"""Reads from the shared cell"""
def __init__(self, cell, accessCount, sleepMax, instance):
"""Create a reader of the given shared cell, number of accesses, and maximum sleep interval."""
<|body_0|>
def run(self):
"""Announce start-up, sleep and read from... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Reader:
"""Reads from the shared cell"""
def __init__(self, cell, accessCount, sleepMax, instance):
"""Create a reader of the given shared cell, number of accesses, and maximum sleep interval."""
Thread.__init__(self, name='Reader' + str(instance))
self.accessCount = accessCount
... | the_stack_v2_python_sparse | Ch10 exercises/reader-writer.py | davelpat/Fundamentals_of_Python | train | 1 |
3ca280ea2b0b584187cefc7cc5b96ec3447e4983 | [
"super(OpsimFieldSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)\nself.fieldID = None\nself.simDataFieldIDColName = simDataFieldIDColName\nself.fieldIDColName = fieldIDColName\nself.fieldRaColName = fieldRaColName\nself.fieldDecColName = fieldDecColName\nself.columnsNeeded = [simDataFiel... | <|body_start_0|>
super(OpsimFieldSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)
self.fieldID = None
self.simDataFieldIDColName = simDataFieldIDColName
self.fieldIDColName = fieldIDColName
self.fieldRaColName = fieldRaColName
self.fieldDecColNa... | Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID of the opsim fields to generate spatial matc... | OpsimFieldSlicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OpsimFieldSlicer:
"""Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID ... | stack_v2_sparse_classes_10k_train_004527 | 6,744 | no_license | [
{
"docstring": "Instantiate opsim field slicer (an index-based slicer that can do spatial plots). simDataFieldIDColName = the column name in simData for the field ID simDataFieldRaColName = the column name in simData for the field RA simDataFieldDecColName = the column name in simData for the field Dec fieldIDc... | 4 | stack_v2_sparse_classes_30k_train_006889 | Implement the Python class `OpsimFieldSlicer` described below.
Class description:
Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. ... | Implement the Python class `OpsimFieldSlicer` described below.
Class description:
Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. ... | 2b0faebd60fb4387366954d3531ac4d9df8c6fc4 | <|skeleton|>
class OpsimFieldSlicer:
"""Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OpsimFieldSlicer:
"""Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID of the opsim ... | the_stack_v2_python_sparse | python/lsst/sims/maf/slicers/opsimFieldSlicer.py | nanchenchen/sims_maf | train | 0 |
be805a89a401f81a532397b06d6191d5ef02ce35 | [
"self.loaded = False\nself.instances = instances\nself.path = path",
"if not self.instances and (not self.loaded):\n self.loaded = True\n self.instances = {}\n for importer_wrapper in dynamic_directory_importer(path):\n if importer_wrapper.error:\n logger.error('Error Loading Plugin: {0... | <|body_start_0|>
self.loaded = False
self.instances = instances
self.path = path
<|end_body_0|>
<|body_start_1|>
if not self.instances and (not self.loaded):
self.loaded = True
self.instances = {}
for importer_wrapper in dynamic_directory_importer(pat... | PluginManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PluginManager:
def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY):
"""Used to initialize plugin"""
<|body_0|>
def _load(self, path=BASE_PLUGIN_DIRECTORY):
"""Lazy loading of plugins"""
<|body_1|>
def __getattr__(self, plugin_name, path=BASE_P... | stack_v2_sparse_classes_10k_train_004528 | 8,795 | permissive | [
{
"docstring": "Used to initialize plugin",
"name": "__init__",
"signature": "def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY)"
},
{
"docstring": "Lazy loading of plugins",
"name": "_load",
"signature": "def _load(self, path=BASE_PLUGIN_DIRECTORY)"
},
{
"docstring":... | 5 | stack_v2_sparse_classes_30k_train_001602 | Implement the Python class `PluginManager` described below.
Class description:
Implement the PluginManager class.
Method signatures and docstrings:
- def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): Used to initialize plugin
- def _load(self, path=BASE_PLUGIN_DIRECTORY): Lazy loading of plugins
- def _... | Implement the Python class `PluginManager` described below.
Class description:
Implement the PluginManager class.
Method signatures and docstrings:
- def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): Used to initialize plugin
- def _load(self, path=BASE_PLUGIN_DIRECTORY): Lazy loading of plugins
- def _... | d31d00bb8a28a8d0c999813f616b398f41516244 | <|skeleton|>
class PluginManager:
def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY):
"""Used to initialize plugin"""
<|body_0|>
def _load(self, path=BASE_PLUGIN_DIRECTORY):
"""Lazy loading of plugins"""
<|body_1|>
def __getattr__(self, plugin_name, path=BASE_P... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PluginManager:
def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY):
"""Used to initialize plugin"""
self.loaded = False
self.instances = instances
self.path = path
def _load(self, path=BASE_PLUGIN_DIRECTORY):
"""Lazy loading of plugins"""
if not ... | the_stack_v2_python_sparse | plugins/plugin_manager.py | ozoneplatform/ozp-backend | train | 1 | |
a8e1442a084aba78bbb434009ab5c6463feef871 | [
"self.featstruct = featstruct\nself.readings = []\ntry:\n self.core = featstruct['CORE']\n self.store = featstruct['STORE']\nexcept KeyError:\n print('%s is not a Cooper storage structure' % featstruct)",
"remove = lambda lst0, index: lst0[:index] + lst0[index + 1:]\nif lst:\n for index, x in enumerat... | <|body_start_0|>
self.featstruct = featstruct
self.readings = []
try:
self.core = featstruct['CORE']
self.store = featstruct['STORE']
except KeyError:
print('%s is not a Cooper storage structure' % featstruct)
<|end_body_0|>
<|body_start_1|>
r... | A container for handling quantifier ambiguity via Cooper storage. | CooperStore | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-NC-ND-3.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CooperStore:
"""A container for handling quantifier ambiguity via Cooper storage."""
def __init__(self, featstruct):
""":param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: FeatStruct (with features ``core`` and ``store``)"""
... | stack_v2_sparse_classes_10k_train_004529 | 4,086 | permissive | [
{
"docstring": ":param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: FeatStruct (with features ``core`` and ``store``)",
"name": "__init__",
"signature": "def __init__(self, featstruct)"
},
{
"docstring": ":return: An iterator over the permut... | 3 | stack_v2_sparse_classes_30k_train_003663 | Implement the Python class `CooperStore` described below.
Class description:
A container for handling quantifier ambiguity via Cooper storage.
Method signatures and docstrings:
- def __init__(self, featstruct): :param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: ... | Implement the Python class `CooperStore` described below.
Class description:
A container for handling quantifier ambiguity via Cooper storage.
Method signatures and docstrings:
- def __init__(self, featstruct): :param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: ... | 582e6e35f0e6c984b44ec49dcb8846d9c011d0a8 | <|skeleton|>
class CooperStore:
"""A container for handling quantifier ambiguity via Cooper storage."""
def __init__(self, featstruct):
""":param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: FeatStruct (with features ``core`` and ``store``)"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CooperStore:
"""A container for handling quantifier ambiguity via Cooper storage."""
def __init__(self, featstruct):
""":param featstruct: The value of the ``sem`` node in a tree from ``parse_with_bindops()`` :type featstruct: FeatStruct (with features ``core`` and ``store``)"""
self.feat... | the_stack_v2_python_sparse | nltk/sem/cooper_storage.py | nltk/nltk | train | 11,860 |
1415b50a597925d7f0c4db41dcf642d935aa187f | [
"cur1 = l1\ncur2 = l2\nresult = []\nhead = ListNode('head')\ncur = head\nwhile cur1 != None or cur2 != None:\n if cur1 != None and cur2 == None:\n rv = cur1.val\n cur1 = cur1.next\n if cur1 == None and cur2 != None:\n rv = cur2.val\n cur2 = cur2.next\n if cur1 != None and cur2 !... | <|body_start_0|>
cur1 = l1
cur2 = l2
result = []
head = ListNode('head')
cur = head
while cur1 != None or cur2 != None:
if cur1 != None and cur2 == None:
rv = cur1.val
cur1 = cur1.next
if cur1 == None and cur2 != Non... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cur1 = l... | stack_v2_sparse_classes_10k_train_004530 | 1,657 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003194 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>... | 6401928a042f98dbbe513ec5cd673fa029cc4bce | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
cur1 = l1
cur2 = l2
result = []
head = ListNode('head')
cur = head
while cur1 != None or cur2 != None:
if cur1 != None and cur2 == None:
... | the_stack_v2_python_sparse | python/023-merge-k-sorted-lists.py | xupingmao/leetcode | train | 1 | |
483974fc72c45d1054c8c9804c31393dc197e523 | [
"self.host = host\nself.port = port\nself.server = server\nself.node = node",
"log_func.info(u'UniReader <%s>. Communication parameters:' % str(self))\nlog_func.info(u'\\tHost <%s>' % self.host)\nlog_func.info(u'\\tPort <%s>' % self.port)\nlog_func.info(u'\\tNode <%s>' % self.node)\nlog_func.info(u'\\tServer <%s>... | <|body_start_0|>
self.host = host
self.port = port
self.server = server
self.node = node
<|end_body_0|>
<|body_start_1|>
log_func.info(u'UniReader <%s>. Communication parameters:' % str(self))
log_func.info(u'\tHost <%s>' % self.host)
log_func.info(u'\tPort <%s>'... | Universal Remote Read Controller <UniReader Remote Service>. | iqUniReaderControllerProto | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqUniReaderControllerProto:
"""Universal Remote Read Controller <UniReader Remote Service>."""
def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs):
"""Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: S... | stack_v2_sparse_classes_10k_train_004531 | 5,228 | no_license | [
{
"docstring": "Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: Server name. :param node: Node name.",
"name": "__init__",
"signature": "def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs)"
},
{
"docstring": "Dis... | 5 | stack_v2_sparse_classes_30k_train_002387 | Implement the Python class `iqUniReaderControllerProto` described below.
Class description:
Universal Remote Read Controller <UniReader Remote Service>.
Method signatures and docstrings:
- def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): Constructor. :param host: Server host.... | Implement the Python class `iqUniReaderControllerProto` described below.
Class description:
Universal Remote Read Controller <UniReader Remote Service>.
Method signatures and docstrings:
- def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): Constructor. :param host: Server host.... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqUniReaderControllerProto:
"""Universal Remote Read Controller <UniReader Remote Service>."""
def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs):
"""Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: S... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class iqUniReaderControllerProto:
"""Universal Remote Read Controller <UniReader Remote Service>."""
def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs):
"""Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: Server name. :... | the_stack_v2_python_sparse | iq/components/uni_reader/uni_reader_controller.py | XHermitOne/iq_framework | train | 1 |
2b9c10bb38dc33c14dc98a09d9a1f6248ce03461 | [
"n = len(nums)\nself.dp = [0] * n\nfor i in range(len(nums)):\n if i == 0:\n self.dp[i] = nums[i]\n else:\n self.dp[i] = self.dp[i - 1] + nums[i]",
"if i != 0:\n return self.dp[j] - self.dp[i - 1]\nelse:\n return self.dp[j]"
] | <|body_start_0|>
n = len(nums)
self.dp = [0] * n
for i in range(len(nums)):
if i == 0:
self.dp[i] = nums[i]
else:
self.dp[i] = self.dp[i - 1] + nums[i]
<|end_body_0|>
<|body_start_1|>
if i != 0:
return self.dp[j] - self... | 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|>
n = len(nums)
self.dp = [0] * n
for i in ra... | stack_v2_sparse_classes_10k_train_004532 | 1,359 | 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):
... | e4c02084f26384cedbd87c4c60e9bdfbf77228cc | <|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]"""
n = len(nums)
self.dp = [0] * n
for i in range(len(nums)):
if i == 0:
self.dp[i] = nums[i]
else:
self.dp[i] = self.dp[i - 1] + nums[i]
def sumRange(self,... | the_stack_v2_python_sparse | Dynamic Programming/303. Range Sum Query - Immutable Easy.py | dongbo910220/leetcode_ | train | 0 | |
b5ee02de4d4bea5f6a615576363a5972f436d29e | [
"min_num = nums[0]\nfor i in nums:\n if i < min_num:\n min_num = i\nreturn min_num",
"if len(nums) == 1:\n return nums[0]\nleft, right = (0, len(nums) - 1)\nif nums[right] > nums[0]:\n return nums[0]\nwhile left < right:\n mid = (right + left) // 2\n if nums[mid] > nums[mid + 1]:\n re... | <|body_start_0|>
min_num = nums[0]
for i in nums:
if i < min_num:
min_num = i
return min_num
<|end_body_0|>
<|body_start_1|>
if len(nums) == 1:
return nums[0]
left, right = (0, len(nums) - 1)
if nums[right] > nums[0]:
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMin(self, nums: List[int]) -> int:
"""暴力搜索,时间复杂度O(n)"""
<|body_0|>
def findMin_2(self, nums: List[int]) -> int:
"""二分查找"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
min_num = nums[0]
for i in nums:
if i < min... | stack_v2_sparse_classes_10k_train_004533 | 1,623 | no_license | [
{
"docstring": "暴力搜索,时间复杂度O(n)",
"name": "findMin",
"signature": "def findMin(self, nums: List[int]) -> int"
},
{
"docstring": "二分查找",
"name": "findMin_2",
"signature": "def findMin_2(self, nums: List[int]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_003710 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin(self, nums: List[int]) -> int: 暴力搜索,时间复杂度O(n)
- def findMin_2(self, nums: List[int]) -> int: 二分查找 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin(self, nums: List[int]) -> int: 暴力搜索,时间复杂度O(n)
- def findMin_2(self, nums: List[int]) -> int: 二分查找
<|skeleton|>
class Solution:
def findMin(self, nums: List[int]... | 13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08 | <|skeleton|>
class Solution:
def findMin(self, nums: List[int]) -> int:
"""暴力搜索,时间复杂度O(n)"""
<|body_0|>
def findMin_2(self, nums: List[int]) -> int:
"""二分查找"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findMin(self, nums: List[int]) -> int:
"""暴力搜索,时间复杂度O(n)"""
min_num = nums[0]
for i in nums:
if i < min_num:
min_num = i
return min_num
def findMin_2(self, nums: List[int]) -> int:
"""二分查找"""
if len(nums) == 1:
... | the_stack_v2_python_sparse | Algorithms/153_Find_Minimum_in_Rotated_Sorted_Array/Find_Minimum_in_Rotated_Sorted_Array.py | lirui-ML/my_leetcode | train | 1 | |
a38edfb4d11a8be7b8b782cd0d8b2d74dcbd878a | [
"book_list = BookInfo.objects.all()\n\"\\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\\n\\n [\\n {},\\n {},\\n ...\\n ]\\n pep8\\n \"\nbook_serializer = Book2Serializer(book_list, many=True)\nbook_dict_list = book_serializer.data\nreturn Json... | <|body_start_0|>
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n [\n {},\n {},\n ...\n ]\n pep8\n "
book_serializer = Book2Serializer(book_list, many=True)
book_dict_list = boo... | BooksView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""增加"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n ... | stack_v2_sparse_classes_10k_train_004534 | 3,452 | permissive | [
{
"docstring": "查询所有",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "增加",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001222 | Implement the Python class `BooksView` described below.
Class description:
Implement the BooksView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 增加 | Implement the Python class `BooksView` described below.
Class description:
Implement the BooksView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 增加
<|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self,... | 63ae6891d3be243c5c46329e65fcf47133c5890f | <|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""增加"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BooksView:
def get(self, request):
"""查询所有"""
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n [\n {},\n {},\n ...\n ]\n pep8\n "
book_serializer = Book2Serializer(boo... | the_stack_v2_python_sparse | pro_drf/demo1/booktest/views.py | yongfang117/pro_useful_code | train | 0 | |
f4be023aa1220b4a51d353188b6e5d2634bbf010 | [
"self.surface = pygame.Surface(DIM)\nappendix = ' ' * (self.surface.get_width() // size)\nself.text = appendix + text + appendix\nself.hpos = hpos\nself.amplitude = amplitude\nself.frequency = frequency\nself.color = color\nself.size = size\nself.position = 0\nself.font = pygame.font.SysFont('mono', self.size, bold... | <|body_start_0|>
self.surface = pygame.Surface(DIM)
appendix = ' ' * (self.surface.get_width() // size)
self.text = appendix + text + appendix
self.hpos = hpos
self.amplitude = amplitude
self.frequency = frequency
self.color = color
self.size = size
... | Sinus wave scroll text | SinusText | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SinusText:
"""Sinus wave scroll text"""
def __init__(self, dim: tuple, text: str, hpos: int, amplitude: int, frequency: int, color: tuple, size: int=30):
""":param surface: surface to draw on :param text: text to draw :param hpos: horizontal position on y axis :param amplitude: ampli... | stack_v2_sparse_classes_10k_train_004535 | 2,922 | no_license | [
{
"docstring": ":param surface: surface to draw on :param text: text to draw :param hpos: horizontal position on y axis :param amplitude: amplitude of sinus wave :param frequency: frequency of sinus wave :param color: color of font :param size: size of font",
"name": "__init__",
"signature": "def __init... | 2 | stack_v2_sparse_classes_30k_train_001201 | Implement the Python class `SinusText` described below.
Class description:
Sinus wave scroll text
Method signatures and docstrings:
- def __init__(self, dim: tuple, text: str, hpos: int, amplitude: int, frequency: int, color: tuple, size: int=30): :param surface: surface to draw on :param text: text to draw :param hp... | Implement the Python class `SinusText` described below.
Class description:
Sinus wave scroll text
Method signatures and docstrings:
- def __init__(self, dim: tuple, text: str, hpos: int, amplitude: int, frequency: int, color: tuple, size: int=30): :param surface: surface to draw on :param text: text to draw :param hp... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class SinusText:
"""Sinus wave scroll text"""
def __init__(self, dim: tuple, text: str, hpos: int, amplitude: int, frequency: int, color: tuple, size: int=30):
""":param surface: surface to draw on :param text: text to draw :param hpos: horizontal position on y axis :param amplitude: ampli... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SinusText:
"""Sinus wave scroll text"""
def __init__(self, dim: tuple, text: str, hpos: int, amplitude: int, frequency: int, color: tuple, size: int=30):
""":param surface: surface to draw on :param text: text to draw :param hpos: horizontal position on y axis :param amplitude: amplitude of sinus... | the_stack_v2_python_sparse | effects/SinusText.py | gunny26/pygame | train | 5 |
081eeea2ba6d25fdf59e65583fe89e665157a39f | [
"if dtype:\n pyKeOps_Warning('keyword argument dtype in Genred is deprecated ; argument is ignored.')\nif cuda_type:\n pyKeOps_Warning('keyword argument cuda_type in Genred is deprecated ; argument is ignored.')\nself.reduction_op = reduction_op\nreduction_op_internal, formula2 = preprocess(reduction_op, form... | <|body_start_0|>
if dtype:
pyKeOps_Warning('keyword argument dtype in Genred is deprecated ; argument is ignored.')
if cuda_type:
pyKeOps_Warning('keyword argument cuda_type in Genred is deprecated ; argument is ignored.')
self.reduction_op = reduction_op
reductio... | Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handful of strings and integers that sp... | Genred | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Genred:
"""Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handf... | stack_v2_sparse_classes_10k_train_004536 | 29,229 | permissive | [
{
"docstring": "Instantiate a new generic operation. Note: :class:`Genred` relies on C++ or CUDA kernels that are compiled on-the-fly, and stored in a :ref:`cache directory <part.cache>` as shared libraries (\".so\" files) for later use. Args: formula (string): The scalar- or vector-valued expression that shoul... | 2 | stack_v2_sparse_classes_30k_train_005298 | Implement the Python class `Genred` described below.
Class description:
Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tut... | Implement the Python class `Genred` described below.
Class description:
Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tut... | 52ed22a7fbbcf4bd02dbdf5dc2b00bf79cceddf5 | <|skeleton|>
class Genred:
"""Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handf... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Genred:
"""Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handful of strings... | the_stack_v2_python_sparse | pykeops/pykeops/torch/generic/generic_red.py | getkeops/keops | train | 910 |
451111fde2bd7863fdc343a99a8c576fc3342117 | [
"self.insurance_policy_type_velue = insurance_policy_type_velue\nself.fire_insurance_policy_extend_view = fire_insurance_policy_extend_view\nself.fire_insurance_policy_filter = fire_insurance_policy_filter\nself.id = id\nself.selected_insurance_policy_has_been_changed = selected_insurance_policy_has_been_changed\ns... | <|body_start_0|>
self.insurance_policy_type_velue = insurance_policy_type_velue
self.fire_insurance_policy_extend_view = fire_insurance_policy_extend_view
self.fire_insurance_policy_filter = fire_insurance_policy_filter
self.id = id
self.selected_insurance_policy_has_been_changed... | Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExtendView): TODO: type description here. fire_insurance_policy_filter (FireInsurancePolicyFilte... | InsuranceDataFireInsurance | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InsuranceDataFireInsurance:
"""Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExtendView): TODO: type description here. ... | stack_v2_sparse_classes_10k_train_004537 | 9,068 | permissive | [
{
"docstring": "Constructor for the InsuranceDataFireInsurance class",
"name": "__init__",
"signature": "def __init__(self, insurance_policy_type_velue=None, fire_insurance_policy_extend_view=None, fire_insurance_policy_filter=None, id=None, selected_insurance_policy_has_been_changed=None, is_paymented=... | 2 | stack_v2_sparse_classes_30k_train_006251 | Implement the Python class `InsuranceDataFireInsurance` described below.
Class description:
Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExt... | Implement the Python class `InsuranceDataFireInsurance` described below.
Class description:
Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExt... | b574a76a8805b306a423229b572c36dae0159def | <|skeleton|>
class InsuranceDataFireInsurance:
"""Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExtendView): TODO: type description here. ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InsuranceDataFireInsurance:
"""Implementation of the 'InsuranceData FireInsurance' model. TODO: type model description here. Attributes: insurance_policy_type_velue (int): TODO: type description here. fire_insurance_policy_extend_view (FireInsurancePolicyExtendView): TODO: type description here. fire_insuranc... | the_stack_v2_python_sparse | easybimehlanding/models/insurance_data_fire_insurance.py | kmelodi/EasyBimehLanding_Python | train | 0 |
3fbdc4d7d84e152e0a793a7072c55f06037c7743 | [
"pre_node = head\nnode = head\nwhile node:\n cur_node = node\n i = 0\n while cur_node and i < n:\n cur_node = cur_node.next\n i += 1\n if i == n and (not cur_node):\n if pre_node == node and n == 1:\n return None\n elif pre_node == node:\n return head.ne... | <|body_start_0|>
pre_node = head
node = head
while node:
cur_node = node
i = 0
while cur_node and i < n:
cur_node = cur_node.next
i += 1
if i == n and (not cur_node):
if pre_node == node and n == 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:"""
<|body_0|>
def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode:
"""使用dummy,快慢指针,让快指针先走n,然后和慢指针一起遍历,当快指针为None时,慢指针当前节点就是倒... | stack_v2_sparse_classes_10k_train_004538 | 2,264 | no_license | [
{
"docstring": "使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:",
"name": "removeNthFromEnd",
"signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode"
},
{
"docstring": "使用dummy,快慢指针,让快指针先走n,然后和慢指针一起遍历,当快指针为None时,慢指针当前节点就是倒数第N个节点 :param head: :param n: :return:",
... | 2 | stack_v2_sparse_classes_30k_train_001782 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: 使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:
- def removeNthFromEnd1(self, head: ListNode, n: int) -> Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: 使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:
- def removeNthFromEnd1(self, head: ListNode, n: int) -> Li... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:"""
<|body_0|>
def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode:
"""使用dummy,快慢指针,让快指针先走n,然后和慢指针一起遍历,当快指针为None时,慢指针当前节点就是倒... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""使用双指针,判断当前节点是否为倒数第n个节点 :param head: :param n: :return:"""
pre_node = head
node = head
while node:
cur_node = node
i = 0
while cur_node and i < n:
cur... | the_stack_v2_python_sparse | datastructure/linked_list/RemoveNthFromEnd.py | yinhuax/leet_code | train | 0 | |
21c0d4b91d270f66c63a82d1516db505b0292d72 | [
"super().__init__(params=params)\nself.isonline = bool(isonline)\nself.devices = dict()\nself.analysis = dict()\nself.pvs = dict()",
"conn = all([dev.connected for dev in self.devices.values()])\nconn &= all([pv.connected for pv in self.pvs.values()])\nreturn conn",
"obs = list(self.devices.values()) + list(sel... | <|body_start_0|>
super().__init__(params=params)
self.isonline = bool(isonline)
self.devices = dict()
self.analysis = dict()
self.pvs = dict()
<|end_body_0|>
<|body_start_1|>
conn = all([dev.connected for dev in self.devices.values()])
conn &= all([pv.connected f... | . | MeasBaseClass | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeasBaseClass:
"""."""
def __init__(self, params=None, isonline=True):
"""."""
<|body_0|>
def connected(self):
"""."""
<|body_1|>
def wait_for_connection(self, timeout=None):
"""."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_004539 | 5,325 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self, params=None, isonline=True)"
},
{
"docstring": ".",
"name": "connected",
"signature": "def connected(self)"
},
{
"docstring": ".",
"name": "wait_for_connection",
"signature": "def wait_for_connection... | 3 | stack_v2_sparse_classes_30k_train_006327 | Implement the Python class `MeasBaseClass` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self, params=None, isonline=True): .
- def connected(self): .
- def wait_for_connection(self, timeout=None): . | Implement the Python class `MeasBaseClass` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self, params=None, isonline=True): .
- def connected(self): .
- def wait_for_connection(self, timeout=None): .
<|skeleton|>
class MeasBaseClass:
"""."""
def __init__(self, params... | 39644161d98964a3a3d80d63269201f0a1712e82 | <|skeleton|>
class MeasBaseClass:
"""."""
def __init__(self, params=None, isonline=True):
"""."""
<|body_0|>
def connected(self):
"""."""
<|body_1|>
def wait_for_connection(self, timeout=None):
"""."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MeasBaseClass:
"""."""
def __init__(self, params=None, isonline=True):
"""."""
super().__init__(params=params)
self.isonline = bool(isonline)
self.devices = dict()
self.analysis = dict()
self.pvs = dict()
def connected(self):
"""."""
co... | the_stack_v2_python_sparse | apsuite/utils.py | lnls-fac/apsuite | train | 1 |
2dab435c90bc30d395583a87cfe2ea6e6e94cd9a | [
"def recursive(outputlist):\n new_list = [1]\n for i in range(1, len(outputlist)):\n new_list.append(outputlist[i - 1] + outputlist[i])\n new_list.append(1)\n return new_list\nout = [1]\nfor j in range(0, rowIndex):\n out = recursive(out)\nreturn out",
"row = [1]\nfor _ in range(rowIndex):\n... | <|body_start_0|>
def recursive(outputlist):
new_list = [1]
for i in range(1, len(outputlist)):
new_list.append(outputlist[i - 1] + outputlist[i])
new_list.append(1)
return new_list
out = [1]
for j in range(0, rowIndex):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getRow(self, rowIndex):
""":type rowIndex: int :rtype: List[int]"""
<|body_0|>
def getRow_cool(self, rowIndex):
""":type rowIndex: int :rtype: List[int]"""
<|body_1|>
def getRow_1(self, rowIndex):
""":type rowIndex: int :rtype: List... | stack_v2_sparse_classes_10k_train_004540 | 1,680 | no_license | [
{
"docstring": ":type rowIndex: int :rtype: List[int]",
"name": "getRow",
"signature": "def getRow(self, rowIndex)"
},
{
"docstring": ":type rowIndex: int :rtype: List[int]",
"name": "getRow_cool",
"signature": "def getRow_cool(self, rowIndex)"
},
{
"docstring": ":type rowIndex: ... | 3 | stack_v2_sparse_classes_30k_train_000503 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int]
- def getRow_cool(self, rowIndex): :type rowIndex: int :rtype: List[int]
- def getRow_1(self, rowIndex): :type r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getRow(self, rowIndex): :type rowIndex: int :rtype: List[int]
- def getRow_cool(self, rowIndex): :type rowIndex: int :rtype: List[int]
- def getRow_1(self, rowIndex): :type r... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def getRow(self, rowIndex):
""":type rowIndex: int :rtype: List[int]"""
<|body_0|>
def getRow_cool(self, rowIndex):
""":type rowIndex: int :rtype: List[int]"""
<|body_1|>
def getRow_1(self, rowIndex):
""":type rowIndex: int :rtype: List... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def getRow(self, rowIndex):
""":type rowIndex: int :rtype: List[int]"""
def recursive(outputlist):
new_list = [1]
for i in range(1, len(outputlist)):
new_list.append(outputlist[i - 1] + outputlist[i])
new_list.append(1)
... | the_stack_v2_python_sparse | LeetCode/Array/119_Pascal's_triangle_ii.py | XyK0907/for_work | train | 0 | |
2bf4b48e95b8aad94dbdddb99dd565dd390b1d52 | [
"HTTP_IDENTIFIER = 'event_mon'\n_Router.__init__(self)\nself.endpoint = endpoint\nself.try_num = try_num\nself.retry_backoff = retry_backoff\nself._cache = cache\nself._http = infra_libs.InstrumentedHttp(HTTP_IDENTIFIER, timeout=timeout)\nself._dry_run = dry_run\nself._sleep_fn = _sleep_fn\nif self._cache.get('serv... | <|body_start_0|>
HTTP_IDENTIFIER = 'event_mon'
_Router.__init__(self)
self.endpoint = endpoint
self.try_num = try_num
self.retry_backoff = retry_backoff
self._cache = cache
self._http = infra_libs.InstrumentedHttp(HTTP_IDENTIFIER, timeout=timeout)
self._dr... | _HttpRouter | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-unknown",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HttpRouter:
def __init__(self, cache, endpoint, timeout=10, try_num=3, retry_backoff=2.0, dry_run=False, _sleep_fn=time.sleep):
"""Initialize the router. Args: cache(dict): This must be config._cache. Passed as a parameter to avoid a circular import. endpoint(str or None): None means 'd... | stack_v2_sparse_classes_10k_train_004541 | 8,954 | permissive | [
{
"docstring": "Initialize the router. Args: cache(dict): This must be config._cache. Passed as a parameter to avoid a circular import. endpoint(str or None): None means 'dry run'. What would be sent is printed on stdout. If endpoint starts with 'https://' data is POSTed there. Otherwise it is interpreted as a ... | 2 | stack_v2_sparse_classes_30k_train_007207 | Implement the Python class `_HttpRouter` described below.
Class description:
Implement the _HttpRouter class.
Method signatures and docstrings:
- def __init__(self, cache, endpoint, timeout=10, try_num=3, retry_backoff=2.0, dry_run=False, _sleep_fn=time.sleep): Initialize the router. Args: cache(dict): This must be c... | Implement the Python class `_HttpRouter` described below.
Class description:
Implement the _HttpRouter class.
Method signatures and docstrings:
- def __init__(self, cache, endpoint, timeout=10, try_num=3, retry_backoff=2.0, dry_run=False, _sleep_fn=time.sleep): Initialize the router. Args: cache(dict): This must be c... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class _HttpRouter:
def __init__(self, cache, endpoint, timeout=10, try_num=3, retry_backoff=2.0, dry_run=False, _sleep_fn=time.sleep):
"""Initialize the router. Args: cache(dict): This must be config._cache. Passed as a parameter to avoid a circular import. endpoint(str or None): None means 'd... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _HttpRouter:
def __init__(self, cache, endpoint, timeout=10, try_num=3, retry_backoff=2.0, dry_run=False, _sleep_fn=time.sleep):
"""Initialize the router. Args: cache(dict): This must be config._cache. Passed as a parameter to avoid a circular import. endpoint(str or None): None means 'dry run'. What ... | the_stack_v2_python_sparse | tools/swarming_client/third_party/infra_libs/event_mon/router.py | metux/chromium-suckless | train | 5 | |
f5aa867391c66b9237c4972a6eaea6b4f9bf7696 | [
"endpoint = LookupEndpoint.CUSTOMER_ID.value.format(customerId=customer_id)\nquery_parameters = self._copy_query_parameters()\nquery_parameters['fixture'] = fixture\nreturn self._get(url=self._build_url(endpoint), query_parameters=query_parameters)",
"endpoint = LookupEndpoint.SEARCH.value\nquery_parameters = sel... | <|body_start_0|>
endpoint = LookupEndpoint.CUSTOMER_ID.value.format(customerId=customer_id)
query_parameters = self._copy_query_parameters()
query_parameters['fixture'] = fixture
return self._get(url=self._build_url(endpoint), query_parameters=query_parameters)
<|end_body_0|>
<|body_sta... | LookupClient | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: reque... | stack_v2_sparse_classes_10k_train_004542 | 3,190 | permissive | [
{
"docstring": "GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: requests.Response",
"name": "get_customer",
"signature": "def get_custome... | 5 | stack_v2_sparse_classes_30k_train_002682 | Implement the Python class `LookupClient` described below.
Class description:
Implement the LookupClient class.
Method signatures and docstrings:
- def get_customer(self, customer_id, fixture=None): GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query par... | Implement the Python class `LookupClient` described below.
Class description:
Implement the LookupClient class.
Method signatures and docstrings:
- def get_customer(self, customer_id, fixture=None): GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query par... | 4431af164eb4baf52e26e8842e017cad1609a279 | <|skeleton|>
class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: reque... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LookupClient:
def get_customer(self, customer_id, fixture=None):
"""GET /central/lookup/customer/{customerId} :param int customer_id: path parameter :param bool fixture: fixture query parameter (If true, will return hardcoded values and not call HQ) :return: Response object :rtype: requests.Response""... | the_stack_v2_python_sparse | q2_api_client/clients/central/lookup_client.py | jcook00/q2-api-client | train | 0 | |
5c8312e9e7718cbbd74017e1e7eafacbb639016b | [
"fsa_filename = './TestFiles/fsa1'\nwith open(fsa_filename, 'r') as fsa_file:\n fsa_rules = fsa_file.readlines()\nacceptor = FSAAcceptor(fsa_rules)\nself.assertTrue(acceptor.can_accept_string(self.test_string1))\nself.assertTrue(acceptor.can_accept_string(self.test_string2))\nself.assertTrue(acceptor.can_accept_... | <|body_start_0|>
fsa_filename = './TestFiles/fsa1'
with open(fsa_filename, 'r') as fsa_file:
fsa_rules = fsa_file.readlines()
acceptor = FSAAcceptor(fsa_rules)
self.assertTrue(acceptor.can_accept_string(self.test_string1))
self.assertTrue(acceptor.can_accept_string(se... | This class contains tests for the FSAAcceptor class | TestFSAAcceptor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFSAAcceptor:
"""This class contains tests for the FSAAcceptor class"""
def test_fsa1(self):
"""Tests for FSA1 :return: void"""
<|body_0|>
def test_fsa2(self):
"""Tests for FSA2 :return: void"""
<|body_1|>
def test_fsa3(self):
"""Tests for... | stack_v2_sparse_classes_10k_train_004543 | 6,573 | no_license | [
{
"docstring": "Tests for FSA1 :return: void",
"name": "test_fsa1",
"signature": "def test_fsa1(self)"
},
{
"docstring": "Tests for FSA2 :return: void",
"name": "test_fsa2",
"signature": "def test_fsa2(self)"
},
{
"docstring": "Tests for FSA3 :return: void",
"name": "test_fsa... | 4 | stack_v2_sparse_classes_30k_train_004829 | Implement the Python class `TestFSAAcceptor` described below.
Class description:
This class contains tests for the FSAAcceptor class
Method signatures and docstrings:
- def test_fsa1(self): Tests for FSA1 :return: void
- def test_fsa2(self): Tests for FSA2 :return: void
- def test_fsa3(self): Tests for FSA3 :return: ... | Implement the Python class `TestFSAAcceptor` described below.
Class description:
This class contains tests for the FSAAcceptor class
Method signatures and docstrings:
- def test_fsa1(self): Tests for FSA1 :return: void
- def test_fsa2(self): Tests for FSA2 :return: void
- def test_fsa3(self): Tests for FSA3 :return: ... | 7af7b357347ed526de7a3d6f16652843d214dcbf | <|skeleton|>
class TestFSAAcceptor:
"""This class contains tests for the FSAAcceptor class"""
def test_fsa1(self):
"""Tests for FSA1 :return: void"""
<|body_0|>
def test_fsa2(self):
"""Tests for FSA2 :return: void"""
<|body_1|>
def test_fsa3(self):
"""Tests for... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestFSAAcceptor:
"""This class contains tests for the FSAAcceptor class"""
def test_fsa1(self):
"""Tests for FSA1 :return: void"""
fsa_filename = './TestFiles/fsa1'
with open(fsa_filename, 'r') as fsa_file:
fsa_rules = fsa_file.readlines()
acceptor = FSAAccepto... | the_stack_v2_python_sparse | FiniteStateMachines/FSAAcceptor/fsa_acceptor.py | zoew2/Projects | train | 0 |
21a802b48685982220130e6ed33d38d531a9b33e | [
"if not self.VTKObject.GetPoints():\n return None\narray = vtkDataArrayToVTKArray(self.VTKObject.GetPoints().GetData(), self)\narray.Association = ArrayAssociation.POINT\nreturn array",
"from ..vtkCommonCore import vtkPoints\nif isinstance(pts, vtkPoints):\n p = pts\nelse:\n pts = numpyTovtkDataArray(pts... | <|body_start_0|>
if not self.VTKObject.GetPoints():
return None
array = vtkDataArrayToVTKArray(self.VTKObject.GetPoints().GetData(), self)
array.Association = ArrayAssociation.POINT
return array
<|end_body_0|>
<|body_start_1|>
from ..vtkCommonCore import vtkPoints
... | This is a python friendly wrapper of a vtkPointSet that defines a few useful properties. | PointSet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PointSet:
"""This is a python friendly wrapper of a vtkPointSet that defines a few useful properties."""
def GetPoints(self):
"""Returns the points as a VTKArray instance. Returns None if the dataset has implicit points."""
<|body_0|>
def SetPoints(self, pts):
""... | stack_v2_sparse_classes_10k_train_004544 | 47,641 | permissive | [
{
"docstring": "Returns the points as a VTKArray instance. Returns None if the dataset has implicit points.",
"name": "GetPoints",
"signature": "def GetPoints(self)"
},
{
"docstring": "Given a VTKArray instance, sets the points of the dataset.",
"name": "SetPoints",
"signature": "def Set... | 2 | stack_v2_sparse_classes_30k_train_000890 | Implement the Python class `PointSet` described below.
Class description:
This is a python friendly wrapper of a vtkPointSet that defines a few useful properties.
Method signatures and docstrings:
- def GetPoints(self): Returns the points as a VTKArray instance. Returns None if the dataset has implicit points.
- def ... | Implement the Python class `PointSet` described below.
Class description:
This is a python friendly wrapper of a vtkPointSet that defines a few useful properties.
Method signatures and docstrings:
- def GetPoints(self): Returns the points as a VTKArray instance. Returns None if the dataset has implicit points.
- def ... | dd4138e17f1ed5dfe6ef1eab0ff6643fdc07e271 | <|skeleton|>
class PointSet:
"""This is a python friendly wrapper of a vtkPointSet that defines a few useful properties."""
def GetPoints(self):
"""Returns the points as a VTKArray instance. Returns None if the dataset has implicit points."""
<|body_0|>
def SetPoints(self, pts):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PointSet:
"""This is a python friendly wrapper of a vtkPointSet that defines a few useful properties."""
def GetPoints(self):
"""Returns the points as a VTKArray instance. Returns None if the dataset has implicit points."""
if not self.VTKObject.GetPoints():
return None
... | the_stack_v2_python_sparse | Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py | Kitware/VTK | train | 2,253 |
6c003d885c6f3e5640b9007dfd07ad17d5e3461f | [
"field_name, rest = _get_field_name_and_rest(field)\ntry:\n field = model._meta.get_field(field_name)\n if isinstance(field, OneToOneRel):\n return self.is_valid_field(field.related_model, rest)\n if field.rel and rest:\n return self.is_valid_field(field.rel.to, rest)\n return True\nexcept... | <|body_start_0|>
field_name, rest = _get_field_name_and_rest(field)
try:
field = model._meta.get_field(field_name)
if isinstance(field, OneToOneRel):
return self.is_valid_field(field.related_model, rest)
if field.rel and rest:
return se... | Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on rest_framework 3.2.5 because pdc-server is using this ver... | RelatedNestedOrderingFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelatedNestedOrderingFilter:
"""Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on re... | stack_v2_sparse_classes_10k_train_004545 | 4,416 | permissive | [
{
"docstring": "Return true if the field exists within the model (or in the related model specified using the Django ORM __ notation)",
"name": "is_valid_field",
"signature": "def is_valid_field(self, model, field)"
},
{
"docstring": "Rewrite the remove_invalid_fields methods and add the nested ... | 2 | null | Implement the Python class `RelatedNestedOrderingFilter` described below.
Class description:
Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#iss... | Implement the Python class `RelatedNestedOrderingFilter` described below.
Class description:
Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#iss... | af79f73c30fa5f5709ba03d584b7a49b83166b81 | <|skeleton|>
class RelatedNestedOrderingFilter:
"""Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on re... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RelatedNestedOrderingFilter:
"""Extends OrderingFilter to support ordering by fields in related models using Django orm '__'. This class is copied and changed from the patch of the github issue. https://github.com/encode/django-rest-framework/issues/1005#issuecomment-289555282 This is based on rest_framework ... | the_stack_v2_python_sparse | pdc/apps/utils/utils.py | product-definition-center/product-definition-center | train | 19 |
a8ef28be87004bcd6d936df1350d6bbdea4b415c | [
"super(BahdanauAttention, self).__init__()\nself.W1 = tf.keras.layers.Dense(units)\nself.W2 = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)",
"query_with_time_axis = tf.expand_dims(query, 1)\nscore = self.V(tf.nn.tanh(self.W1(query_with_time_axis) + self.W2(values)))\nattention_weights = tf.nn.s... | <|body_start_0|>
super(BahdanauAttention, self).__init__()
self.W1 = tf.keras.layers.Dense(units)
self.W2 = tf.keras.layers.Dense(units)
self.V = tf.keras.layers.Dense(1)
<|end_body_0|>
<|body_start_1|>
query_with_time_axis = tf.expand_dims(query, 1)
score = self.V(tf.nn... | Attention layer used with the gru model. | BahdanauAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
<|body_0|>
def call(self, query, values):
"""Call of the attention layer. Note that the call must be for one caracter/word at a time."""... | stack_v2_sparse_classes_10k_train_004546 | 8,984 | no_license | [
{
"docstring": "Create the attention layer.",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "Call of the attention layer. Note that the call must be for one caracter/word at a time.",
"name": "call",
"signature": "def call(self, query, values)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000289 | Implement the Python class `BahdanauAttention` described below.
Class description:
Attention layer used with the gru model.
Method signatures and docstrings:
- def __init__(self, units): Create the attention layer.
- def call(self, query, values): Call of the attention layer. Note that the call must be for one caract... | Implement the Python class `BahdanauAttention` described below.
Class description:
Attention layer used with the gru model.
Method signatures and docstrings:
- def __init__(self, units): Create the attention layer.
- def call(self, query, values): Call of the attention layer. Note that the call must be for one caract... | 4502d9e7461520664e72165a91bedd8e65464bae | <|skeleton|>
class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
<|body_0|>
def call(self, query, values):
"""Call of the attention layer. Note that the call must be for one caracter/word at a time."""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
super(BahdanauAttention, self).__init__()
self.W1 = tf.keras.layers.Dense(units)
self.W2 = tf.keras.layers.Dense(units)
self.V = tf.keras.... | the_stack_v2_python_sparse | src/model/gru_attention.py | nathanielsimard/Low-Resource-Machine-Translation | train | 0 |
eb998f0229b179b89a7949bf16f72e9f2d1d575e | [
"if p and q:\n return p.val == q.val and self.isSameTree1(p.left, q.left) and self.isSameTree1(p.right, q.right)\nreturn p is q",
"if p and q:\n stack = []\n while p and q or stack:\n while p and q:\n stack.append((p, q))\n p = p.left\n q = q.left\n if (p or... | <|body_start_0|>
if p and q:
return p.val == q.val and self.isSameTree1(p.left, q.left) and self.isSameTree1(p.right, q.right)
return p is q
<|end_body_0|>
<|body_start_1|>
if p and q:
stack = []
while p and q or stack:
while p and q:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool:
"""recursive :param p: :param q: :return:"""
<|body_0|>
def isSameTree2(self, p: TreeNode, q: TreeNode) -> bool:
"""iterative - my version :param p: :param q: :return:"""
<|body_1|>
def i... | stack_v2_sparse_classes_10k_train_004547 | 1,994 | no_license | [
{
"docstring": "recursive :param p: :param q: :return:",
"name": "isSameTree1",
"signature": "def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool"
},
{
"docstring": "iterative - my version :param p: :param q: :return:",
"name": "isSameTree2",
"signature": "def isSameTree2(self, p: Tr... | 3 | stack_v2_sparse_classes_30k_train_006650 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool: recursive :param p: :param q: :return:
- def isSameTree2(self, p: TreeNode, q: TreeNode) -> bool: iterative - my version ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool: recursive :param p: :param q: :return:
- def isSameTree2(self, p: TreeNode, q: TreeNode) -> bool: iterative - my version ... | 25f2795b6e7f9f68833f2fddc6cc4f4d977121a6 | <|skeleton|>
class Solution:
def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool:
"""recursive :param p: :param q: :return:"""
<|body_0|>
def isSameTree2(self, p: TreeNode, q: TreeNode) -> bool:
"""iterative - my version :param p: :param q: :return:"""
<|body_1|>
def i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isSameTree1(self, p: TreeNode, q: TreeNode) -> bool:
"""recursive :param p: :param q: :return:"""
if p and q:
return p.val == q.val and self.isSameTree1(p.left, q.left) and self.isSameTree1(p.right, q.right)
return p is q
def isSameTree2(self, p: TreeNode... | the_stack_v2_python_sparse | 100.py | Darkxiete/leetcode_python | train | 0 | |
eab6719c4140ce06f9b200d99e53a89fd1dc3f26 | [
"super().clean()\nif not self.location:\n raise ValidationError('Affidavit needs a certification location.')",
"if self.location:\n affidavit_string = f'affidavit sworn {self.date_string} at {self.location.string} before {self.certifier}'\nelse:\n affidavit_string = f'affidavit sworn {self.date_string} b... | <|body_start_0|>
super().clean()
if not self.location:
raise ValidationError('Affidavit needs a certification location.')
<|end_body_0|>
<|body_start_1|>
if self.location:
affidavit_string = f'affidavit sworn {self.date_string} at {self.location.string} before {self.cert... | An affidavit. | Affidavit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
<|body_0|>
def __html__(self) -> str:
"""Return the source's HTML representation."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().clean()
if no... | stack_v2_sparse_classes_10k_train_004548 | 1,170 | no_license | [
{
"docstring": "Prepare the source to be saved.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Return the source's HTML representation.",
"name": "__html__",
"signature": "def __html__(self) -> str"
}
] | 2 | null | Implement the Python class `Affidavit` described below.
Class description:
An affidavit.
Method signatures and docstrings:
- def clean(self): Prepare the source to be saved.
- def __html__(self) -> str: Return the source's HTML representation. | Implement the Python class `Affidavit` described below.
Class description:
An affidavit.
Method signatures and docstrings:
- def clean(self): Prepare the source to be saved.
- def __html__(self) -> str: Return the source's HTML representation.
<|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self... | 8bbdc8eec3622af22c17214051c34e36bea8e05a | <|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
<|body_0|>
def __html__(self) -> str:
"""Return the source's HTML representation."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
super().clean()
if not self.location:
raise ValidationError('Affidavit needs a certification location.')
def __html__(self) -> str:
"""Return the source's HTML representa... | the_stack_v2_python_sparse | apps/sources/models/sources/affidavit.py | abdulwahed-mansour/modularhistory | train | 1 |
101eda68574eb2a7bcd72e0282e2a0a74879d1f2 | [
"dist = []\nfor i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n dist.append(abs(nums[i] - nums[j]))\n\ndef quick_select(arr, s, e, k):\n pivot = arr[e]\n i, j = (s, e - 1)\n while i <= j:\n if arr[i] <= pivot:\n i += 1\n elif arr[j] > pivot:\n j -=... | <|body_start_0|>
dist = []
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
dist.append(abs(nums[i] - nums[j]))
def quick_select(arr, s, e, k):
pivot = arr[e]
i, j = (s, e - 1)
while i <= j:
if arr[i] <=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def smallestDistancePair(self, nums: List[int], k: int) -> int:
"""11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)"""
<|body_0|>
def smallestDistancePair(self, nums: List[int], k: int) -> int:
"""11/28/2022 18:31 Time Complexity: O(n*... | stack_v2_sparse_classes_10k_train_004549 | 3,962 | no_license | [
{
"docstring": "11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)",
"name": "smallestDistancePair",
"signature": "def smallestDistancePair(self, nums: List[int], k: int) -> int"
},
{
"docstring": "11/28/2022 18:31 Time Complexity: O(n*logn) + O(n*logm) where m = max(nums)",
... | 2 | stack_v2_sparse_classes_30k_train_003647 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def smallestDistancePair(self, nums: List[int], k: int) -> int: 11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)
- def smallestDistancePair(self, nums: List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def smallestDistancePair(self, nums: List[int], k: int) -> int: 11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)
- def smallestDistancePair(self, nums: List... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def smallestDistancePair(self, nums: List[int], k: int) -> int:
"""11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)"""
<|body_0|>
def smallestDistancePair(self, nums: List[int], k: int) -> int:
"""11/28/2022 18:31 Time Complexity: O(n*... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def smallestDistancePair(self, nums: List[int], k: int) -> int:
"""11/28/2022 18:19, TLE Time Complexity: O(n^2) Space Complexity: O(n^2)"""
dist = []
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
dist.append(abs(nums[i] - nums[j]))
... | the_stack_v2_python_sparse | leetcode/solved/719_Find_K-th_Smallest_Pair_Distance/solution.py | sungminoh/algorithms | train | 0 | |
bbd9d12c80d38497ecdc27c6d45cda2400f2eb61 | [
"target = []\ni = 0\nwhile i < len(nums):\n if index[i] == i:\n target.append(nums[i])\n else:\n self.insert(target, index[i], nums[i])\n i += 1\nreturn target",
"i = 0\nnumInsert = num\nwhile i < len(target) - index:\n temp = target[index + i]\n target[index + i] = numInsert\n num... | <|body_start_0|>
target = []
i = 0
while i < len(nums):
if index[i] == i:
target.append(nums[i])
else:
self.insert(target, index[i], nums[i])
i += 1
return target
<|end_body_0|>
<|body_start_1|>
i = 0
nu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
"""Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)"""
<|body_0|>
def insert(self, target: List[int], index: int, num: int) -> None:
"""Time: O(n), where n = len(... | stack_v2_sparse_classes_10k_train_004550 | 1,002 | no_license | [
{
"docstring": "Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)",
"name": "createTargetArray",
"signature": "def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]"
},
{
"docstring": "Time: O(n), where n = len(nums) Space: O(n), where n = len(nums)",
"... | 2 | stack_v2_sparse_classes_30k_train_007363 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)
- def insert(self, target: List[in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)
- def insert(self, target: List[in... | b68f8a7b3cab871e86e58c7c9b49a7bf74453b53 | <|skeleton|>
class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
"""Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)"""
<|body_0|>
def insert(self, target: List[int], index: int, num: int) -> None:
"""Time: O(n), where n = len(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
"""Time: O(n^2), where n = len(nums) Space: O(n), where n = len(nums)"""
target = []
i = 0
while i < len(nums):
if index[i] == i:
target.append(nums[i])
... | the_stack_v2_python_sparse | Python Solutions/Easy/1389.py | rajpatel5/LeetCode | train | 0 | |
c696f7f5133fcfad1e7b93a9db114b6cd3b75b28 | [
"post = PostFactory(is_active=True)\nReportFactory.create_batch(3, post=post)\nself.assertFalse(post.is_active)",
"user = UserFactory()\npost = PostFactory()\nrequest = MagicMock()\nrequest.user = user\nrequest.method = 'POST'\nrequest.POST = {'reason': Report.HARASSMENT}\nview = ReportCreate()\nview.kwargs = {'p... | <|body_start_0|>
post = PostFactory(is_active=True)
ReportFactory.create_batch(3, post=post)
self.assertFalse(post.is_active)
<|end_body_0|>
<|body_start_1|>
user = UserFactory()
post = PostFactory()
request = MagicMock()
request.user = user
request.metho... | TestReports | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestReports:
def test_post_disable(self, mock):
"""Reports from 3 different user block post"""
<|body_0|>
def test_report_only_once(self):
"""Report can be sent only once"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
post = PostFactory(is_active=T... | stack_v2_sparse_classes_10k_train_004551 | 1,170 | no_license | [
{
"docstring": "Reports from 3 different user block post",
"name": "test_post_disable",
"signature": "def test_post_disable(self, mock)"
},
{
"docstring": "Report can be sent only once",
"name": "test_report_only_once",
"signature": "def test_report_only_once(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006468 | Implement the Python class `TestReports` described below.
Class description:
Implement the TestReports class.
Method signatures and docstrings:
- def test_post_disable(self, mock): Reports from 3 different user block post
- def test_report_only_once(self): Report can be sent only once | Implement the Python class `TestReports` described below.
Class description:
Implement the TestReports class.
Method signatures and docstrings:
- def test_post_disable(self, mock): Reports from 3 different user block post
- def test_report_only_once(self): Report can be sent only once
<|skeleton|>
class TestReports:... | 4089c3f084d7460f64517158eefb54b3b93a01e8 | <|skeleton|>
class TestReports:
def test_post_disable(self, mock):
"""Reports from 3 different user block post"""
<|body_0|>
def test_report_only_once(self):
"""Report can be sent only once"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestReports:
def test_post_disable(self, mock):
"""Reports from 3 different user block post"""
post = PostFactory(is_active=True)
ReportFactory.create_batch(3, post=post)
self.assertFalse(post.is_active)
def test_report_only_once(self):
"""Report can be sent only o... | the_stack_v2_python_sparse | apps/reports/tests.py | maxwell912/social-app | train | 0 | |
58572ad946f99a653257c1c0912d5772a35b60bb | [
"self.kind = 'Cluster'\nself.api_version = 'v3'\nreturn super()._prepare_request(requires_id=requires_id, prepend_key=prepend_key, base_path=base_path)",
"previous_state = self\ntry:\n return super().fetch(session=session, requires_id=requires_id, base_path=base_path, error_message=error_message, **params)\nex... | <|body_start_0|>
self.kind = 'Cluster'
self.api_version = 'v3'
return super()._prepare_request(requires_id=requires_id, prepend_key=prepend_key, base_path=base_path)
<|end_body_0|>
<|body_start_1|>
previous_state = self
try:
return super().fetch(session=session, requ... | Cluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cluster:
def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None):
"""This is a workaround for the non-properly working default value of the resource framework see openstacksdk.compute.v2.server."""
<|body_0|>
def fetch(self, session, requires_id=True, ... | stack_v2_sparse_classes_10k_train_004552 | 4,430 | permissive | [
{
"docstring": "This is a workaround for the non-properly working default value of the resource framework see openstacksdk.compute.v2.server.",
"name": "_prepare_request",
"signature": "def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None)"
},
{
"docstring": "Work around... | 2 | stack_v2_sparse_classes_30k_train_005835 | Implement the Python class `Cluster` described below.
Class description:
Implement the Cluster class.
Method signatures and docstrings:
- def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None): This is a workaround for the non-properly working default value of the resource framework see openst... | Implement the Python class `Cluster` described below.
Class description:
Implement the Cluster class.
Method signatures and docstrings:
- def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None): This is a workaround for the non-properly working default value of the resource framework see openst... | 809f3796dba48ad0535990caf7519bb9afa71d2d | <|skeleton|>
class Cluster:
def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None):
"""This is a workaround for the non-properly working default value of the resource framework see openstacksdk.compute.v2.server."""
<|body_0|>
def fetch(self, session, requires_id=True, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Cluster:
def _prepare_request(self, requires_id=True, prepend_key=True, base_path=None):
"""This is a workaround for the non-properly working default value of the resource framework see openstacksdk.compute.v2.server."""
self.kind = 'Cluster'
self.api_version = 'v3'
return supe... | the_stack_v2_python_sparse | opentelekom/cce/v3/cluster.py | tsdicloud/python-opentelekom-sdk | train | 0 | |
7a0e7fbe18b4ba8923087c5614d4b846b20c62dc | [
"assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types))\nC = self.COEFFS[imt]\nmean = self._compute_mean(C, rup.mag, dists.rjb)\nstddevs = self._compute_stddevs(C, dists.rjb.size, stddev_types)\nmean = clip_mean(imt, mean)\nreturn (mean, stddevs)",
"ffc = self._comp... | <|body_start_0|>
assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types))
C = self.COEFFS[imt]
mean = self._compute_mean(C, rup.mag, dists.rjb)
stddevs = self._compute_stddevs(C, dists.rjb.size, stddev_types)
mean = clip_mean(imt, mea... | Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Research Letters, Volume 68, Number 1, 1997) as utilized by the National Seismic Hazard Mappin... | ToroEtAl1997MblgNSHMP2008 | [
"AGPL-3.0-only",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToroEtAl1997MblgNSHMP2008:
"""Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Research Letters, Volume 68, Number 1, 19... | stack_v2_sparse_classes_10k_train_004553 | 7,600 | permissive | [
{
"docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.",
"name": "get_mean_and_stddevs",
"signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)"
},
{
"docstring": "Compute ground moti... | 4 | null | Implement the Python class `ToroEtAl1997MblgNSHMP2008` described below.
Class description:
Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Re... | Implement the Python class `ToroEtAl1997MblgNSHMP2008` described below.
Class description:
Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Re... | 0da9ba5a575360081715e8b90c71d4b16c6687c8 | <|skeleton|>
class ToroEtAl1997MblgNSHMP2008:
"""Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Research Letters, Volume 68, Number 1, 19... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ToroEtAl1997MblgNSHMP2008:
"""Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Sneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Research Letters, Volume 68, Number 1, 1997) as utiliz... | the_stack_v2_python_sparse | openquake/hazardlib/gsim/toro_1997.py | GFZ-Centre-for-Early-Warning/shakyground | train | 1 |
67f1a218f4bee18184bb8415a298cebed9847800 | [
"snap = super(Action, self).snapshot()\nsnap['text'] = self.text\nsnap['tool_tip'] = self.tool_tip\nsnap['status_tip'] = self.status_tip\nsnap['icon_source'] = self.icon_source\nsnap['checkable'] = self.checkable\nsnap['checked'] = self.checked\nsnap['enabled'] = self.enabled\nsnap['visible'] = self.visible\nsnap['... | <|body_start_0|>
snap = super(Action, self).snapshot()
snap['text'] = self.text
snap['tool_tip'] = self.tool_tip
snap['status_tip'] = self.status_tip
snap['icon_source'] = self.icon_source
snap['checkable'] = self.checkable
snap['checked'] = self.checked
s... | A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used. | Action | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Action:
"""A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used."""
def snapshot(self):
"""Re... | stack_v2_sparse_classes_10k_train_004554 | 3,641 | permissive | [
{
"docstring": "Returns the snapshot dict for the Action.",
"name": "snapshot",
"signature": "def snapshot(self)"
},
{
"docstring": "Binds the change handlers for the Action.",
"name": "bind",
"signature": "def bind(self)"
},
{
"docstring": "Handle the 'triggered' action from the... | 4 | null | Implement the Python class `Action` described below.
Class description:
A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.
M... | Implement the Python class `Action` described below.
Class description:
A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.
M... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class Action:
"""A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used."""
def snapshot(self):
"""Re... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Action:
"""A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used."""
def snapshot(self):
"""Returns the sna... | the_stack_v2_python_sparse | enaml/widgets/action.py | enthought/enaml | train | 17 |
7362bc70d35a5cf0cdeb84ad884fc41a0e1b650f | [
"self.verify_workflow()\nmco = self.create_mco()\nself._initialize_listeners()\nself._deliver_start_event()\ntry:\n mco.run(self.workflow)\nexcept Exception:\n log.exception(\"Method run() of MCO with id '{}' from plugin '{}' raised exception. This might indicate a programming error in the plugin.\".format(mc... | <|body_start_0|>
self.verify_workflow()
mco = self.create_mco()
self._initialize_listeners()
self._deliver_start_event()
try:
mco.run(self.workflow)
except Exception:
log.exception("Method run() of MCO with id '{}' from plugin '{}' raised exception... | Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run. | OptimizeOperation | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the o... | stack_v2_sparse_classes_10k_train_004555 | 2,006 | permissive | [
{
"docstring": "Create and run the optimizer.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Create the MCO from the model's factory.",
"name": "create_mco",
"signature": "def create_mco(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005786 | Implement the Python class `OptimizeOperation` described below.
Class description:
Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run.
Method signatu... | Implement the Python class `OptimizeOperation` described below.
Class description:
Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run.
Method signatu... | 6106bec35d6ad2383138a35205cea44fe529a229 | <|skeleton|>
class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the optimizer."""
... | the_stack_v2_python_sparse | force_bdss/app/optimize_operation.py | force-h2020/force-bdss | train | 2 |
78e10f6bc4b8a3840324f633a5fc7870948f0730 | [
"from sage.matrix.constructor import identity_matrix\nm = identity_matrix(self.base_ring(), self.degree())\nm.set_immutable()\nreturn m",
"from sage.matrix.constructor import identity_matrix\nm = identity_matrix(self.base_ring(), self.degree())\nm.set_immutable()\nreturn m",
"if self._special and x.determinant(... | <|body_start_0|>
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), self.degree())
m.set_immutable()
return m
<|end_body_0|>
<|body_start_1|>
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), ... | OrthogonalMatrixGroup_generic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
... | stack_v2_sparse_classes_10k_train_004556 | 13,931 | no_license | [
{
"docstring": "Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]",
"name": "invariant_bilinear_form",
"signature": "def invariant_bilinear_form(... | 3 | stack_v2_sparse_classes_30k_test_000397 | Implement the Python class `OrthogonalMatrixGroup_generic` described below.
Class description:
Implement the OrthogonalMatrixGroup_generic class.
Method signatures and docstrings:
- def invariant_bilinear_form(self): Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sa... | Implement the Python class `OrthogonalMatrixGroup_generic` described below.
Class description:
Implement the OrthogonalMatrixGroup_generic class.
Method signatures and docstrings:
- def invariant_bilinear_form(self): Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sa... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrthogonalMatrixGroup_generic:
def invariant_bilinear_form(self):
"""Return the symmetric bilinear form preserved by the orthogonal group. OUTPUT: A matrix. EXAMPLES:: sage: GO(2,3,+1).invariant_bilinear_form() [0 1] [1 0] sage: GO(2,3,-1).invariant_bilinear_form() [2 1] [1 1]"""
from sage.mat... | the_stack_v2_python_sparse | sage/src/sage/groups/matrix_gps/orthogonal.py | bopopescu/geosci | train | 0 | |
07b50952865e5d5814311b953089b1ad29ea9ea0 | [
"with Database() as db:\n if id_lane is None and is_active is None:\n data = db.query(Table).all()\n elif id_lane is None:\n data = db.query(Table).filter(Table.is_active == is_active).all()\n else:\n data = db.query(Table).get(id_lane)\nreturn {'data': data}",
"if self.has_permissio... | <|body_start_0|>
with Database() as db:
if id_lane is None and is_active is None:
data = db.query(Table).all()
elif id_lane is None:
data = db.query(Table).filter(Table.is_active == is_active).all()
else:
data = db.query(Table).... | Lane | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lane:
def get(self, id_lane=None, is_active=None):
"""Return all lane information :param id_lane: UUID :param is_active: Boolean"""
<|body_0|>
def create(self, body):
"""Create a new lane :param body: { name: JSON, id_city: UUID }"""
<|body_1|>
def modif... | stack_v2_sparse_classes_10k_train_004557 | 2,668 | no_license | [
{
"docstring": "Return all lane information :param id_lane: UUID :param is_active: Boolean",
"name": "get",
"signature": "def get(self, id_lane=None, is_active=None)"
},
{
"docstring": "Create a new lane :param body: { name: JSON, id_city: UUID }",
"name": "create",
"signature": "def cre... | 4 | stack_v2_sparse_classes_30k_train_001417 | Implement the Python class `Lane` described below.
Class description:
Implement the Lane class.
Method signatures and docstrings:
- def get(self, id_lane=None, is_active=None): Return all lane information :param id_lane: UUID :param is_active: Boolean
- def create(self, body): Create a new lane :param body: { name: J... | Implement the Python class `Lane` described below.
Class description:
Implement the Lane class.
Method signatures and docstrings:
- def get(self, id_lane=None, is_active=None): Return all lane information :param id_lane: UUID :param is_active: Boolean
- def create(self, body): Create a new lane :param body: { name: J... | 43bd57c466a5cd3b133ddc437cb4a6b9f007d267 | <|skeleton|>
class Lane:
def get(self, id_lane=None, is_active=None):
"""Return all lane information :param id_lane: UUID :param is_active: Boolean"""
<|body_0|>
def create(self, body):
"""Create a new lane :param body: { name: JSON, id_city: UUID }"""
<|body_1|>
def modif... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Lane:
def get(self, id_lane=None, is_active=None):
"""Return all lane information :param id_lane: UUID :param is_active: Boolean"""
with Database() as db:
if id_lane is None and is_active is None:
data = db.query(Table).all()
elif id_lane is None:
... | the_stack_v2_python_sparse | resturls/lane.py | CAUCA-9-1-1/survip-api | train | 1 | |
4c58f6ce4f5f92e69fa53334ce11acbf1e113b63 | [
"if not event.collided_entity_id:\n return\nskill = self.entities.find_entity_by_id(event.entity_id)\ntarget = self.entities.find_entity_by_id(event.collided_entity_id)\nskill_damage_component = skill.components.get('damaging_skill', None)\nskill_target_component = skill.components.get('point_ranged_targeted_ski... | <|body_start_0|>
if not event.collided_entity_id:
return
skill = self.entities.find_entity_by_id(event.entity_id)
target = self.entities.find_entity_by_id(event.collided_entity_id)
skill_damage_component = skill.components.get('damaging_skill', None)
skill_target_comp... | Damaging skill system. | DamagingSkillSystem | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DamagingSkillSystem:
"""Damaging skill system."""
def on_entity_collision(self, event):
"""Handle an entity skill usage."""
<|body_0|>
def on_entity_skill_usage(self, event):
"""Handle an entity skill usage."""
<|body_1|>
def perform_damage(self, ent... | stack_v2_sparse_classes_10k_train_004558 | 21,180 | permissive | [
{
"docstring": "Handle an entity skill usage.",
"name": "on_entity_collision",
"signature": "def on_entity_collision(self, event)"
},
{
"docstring": "Handle an entity skill usage.",
"name": "on_entity_skill_usage",
"signature": "def on_entity_skill_usage(self, event)"
},
{
"docst... | 3 | stack_v2_sparse_classes_30k_train_006907 | Implement the Python class `DamagingSkillSystem` described below.
Class description:
Damaging skill system.
Method signatures and docstrings:
- def on_entity_collision(self, event): Handle an entity skill usage.
- def on_entity_skill_usage(self, event): Handle an entity skill usage.
- def perform_damage(self, entity,... | Implement the Python class `DamagingSkillSystem` described below.
Class description:
Damaging skill system.
Method signatures and docstrings:
- def on_entity_collision(self, event): Handle an entity skill usage.
- def on_entity_skill_usage(self, event): Handle an entity skill usage.
- def perform_damage(self, entity,... | 1d84c2869a242a112e57c6cafc6da7329f9d0808 | <|skeleton|>
class DamagingSkillSystem:
"""Damaging skill system."""
def on_entity_collision(self, event):
"""Handle an entity skill usage."""
<|body_0|>
def on_entity_skill_usage(self, event):
"""Handle an entity skill usage."""
<|body_1|>
def perform_damage(self, ent... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DamagingSkillSystem:
"""Damaging skill system."""
def on_entity_collision(self, event):
"""Handle an entity skill usage."""
if not event.collided_entity_id:
return
skill = self.entities.find_entity_by_id(event.entity_id)
target = self.entities.find_entity_by_id... | the_stack_v2_python_sparse | akurra/skills.py | multatronic/akurra | train | 0 |
9d0f70910315893647676aa2ba88d8e3fe8a5d89 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TeamsAppDefinition()",
"from .entity import Entity\nfrom .identity_set import IdentitySet\nfrom .teams_app_authorization import TeamsAppAuthorization\nfrom .teams_app_publishing_state import TeamsAppPublishingState\nfrom .teamwork_bot ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return TeamsAppDefinition()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .identity_set import IdentitySet
from .teams_app_authorization import TeamsAppAuthorization
... | TeamsAppDefinition | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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 obje... | stack_v2_sparse_classes_10k_train_004559 | 5,407 | 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: TeamsAppDefinition",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | stack_v2_sparse_classes_30k_test_000330 | Implement the Python class `TeamsAppDefinition` described below.
Class description:
Implement the TeamsAppDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition: Creates a new instance of the appropriate class based on disc... | Implement the Python class `TeamsAppDefinition` described below.
Class description:
Implement the TeamsAppDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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 obje... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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: Te... | the_stack_v2_python_sparse | msgraph/generated/models/teams_app_definition.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
2adf3f18e606b193ccaafbf7b02ef642c609fc0e | [
"minNumber = 1000000000.0\nfor i in numbers:\n if i < minNumber:\n minNumber = i\nreturn minNumber",
"i, j = (0, len(numbers) - 1)\nwhile i < j:\n m = (i + j) // 2\n if numbers[m] > numbers[j]:\n i = m + 1\n elif numbers[m] < numbers[j]:\n j = m\n else:\n j -= 1\nreturn ... | <|body_start_0|>
minNumber = 1000000000.0
for i in numbers:
if i < minNumber:
minNumber = i
return minNumber
<|end_body_0|>
<|body_start_1|>
i, j = (0, len(numbers) - 1)
while i < j:
m = (i + j) // 2
if numbers[m] > numbers[j]:... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minArray(self, numbers: List[int]) -> int:
"""注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)"""
<... | stack_v2_sparse_classes_10k_train_004560 | 3,169 | no_license | [
{
"docstring": "注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)",
"name": "minArray",
"signature": "def minArray(self, numbers: List[int... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def minArray(self, numbers: List[int]) -> int:
"""注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)"""
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minArray(self, numbers: List[int]) -> int:
"""注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)"""
minNumber = 100... | the_stack_v2_python_sparse | 剑指offer/PythonVersion/11_旋转数组的最小数字.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
3f5a36348a63c253f7eb7da6926877042ff64412 | [
"rr_interval_data = get_datastream(self.CC, stream_identifier, day, user_id, False)\nprint('-' * 20, ' rr interval data ', len(rr_interval_data), '-' * 20)\nif not rr_interval_data:\n return\nfinal_data = []\nfor dp in rr_interval_data:\n if math.isnan(dp.sample[1]):\n continue\n if not list(dp.samp... | <|body_start_0|>
rr_interval_data = get_datastream(self.CC, stream_identifier, day, user_id, False)
print('-' * 20, ' rr interval data ', len(rr_interval_data), '-' * 20)
if not rr_interval_data:
return
final_data = []
for dp in rr_interval_data:
if math.i... | This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds | heart_rate | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class heart_rate:
"""This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds"""
def get_and_save_data(self, streams: dict, day: str, stream_identifier: str, user_id: str, json_path: str):
"""This function ... | stack_v2_sparse_classes_10k_train_004561 | 4,499 | permissive | [
{
"docstring": "This function takes all the streams of a user on a specific day alongwith the rr interval datastream name and extracts the rr interval data for the day. It then unpacks the minute based list of heart rate present in the RR interval data to compute a heart rate timeseries of two second resolution... | 2 | stack_v2_sparse_classes_30k_train_006034 | Implement the Python class `heart_rate` described below.
Class description:
This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds
Method signatures and docstrings:
- def get_and_save_data(self, streams: dict, day: str, stream_ident... | Implement the Python class `heart_rate` described below.
Class description:
This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds
Method signatures and docstrings:
- def get_and_save_data(self, streams: dict, day: str, stream_ident... | 73f5ea2430bc7c23de422dccb7b65ef9f8917595 | <|skeleton|>
class heart_rate:
"""This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds"""
def get_and_save_data(self, streams: dict, day: str, stream_identifier: str, user_id: str, json_path: str):
"""This function ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class heart_rate:
"""This class extracts the pre computed rr interval timeseries and computes a continuous heart rate timeseries with a resolution of two seconds"""
def get_and_save_data(self, streams: dict, day: str, stream_identifier: str, user_id: str, json_path: str):
"""This function takes all the... | the_stack_v2_python_sparse | core/feature/heart_rate/heart_rate.py | MD2Korg/CerebralCortex-DataAnalysis | train | 1 |
438af57cdc2a92318f78f7d747f4864af2953505 | [
"self._ksp = ksp\nself._norm0 = 1.0\nself._norm = 1.0",
"if counter == 0 and norm != 0.0:\n self._norm0 = norm\nself._norm = norm\nksp = self._ksp\nksp.iter_count += 1\nif ksp.options['iprint'] == 2:\n ksp.print_norm(ksp.print_name, ksp.system, ksp.iter_count, norm, self._norm0, indent=1, solver='LN')"
] | <|body_start_0|>
self._ksp = ksp
self._norm0 = 1.0
self._norm = 1.0
<|end_body_0|>
<|body_start_1|>
if counter == 0 and norm != 0.0:
self._norm0 = norm
self._norm = norm
ksp = self._ksp
ksp.iter_count += 1
if ksp.options['iprint'] == 2:
... | Prints output from PETSc's KSP solvers | Monitor | [
"LicenseRef-scancode-other-permissive"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
<|body_0|>
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_10k_train_004562 | 13,096 | permissive | [
{
"docstring": "Stores pointer to the ksp solver",
"name": "__init__",
"signature": "def __init__(self, ksp)"
},
{
"docstring": "Store norm if first iteration, and print norm",
"name": "__call__",
"signature": "def __call__(self, ksp, counter, norm)"
}
] | 2 | null | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers
Method signatures and docstrings:
- def __init__(self, ksp): Stores pointer to the ksp solver
- def __call__(self, ksp, counter, norm): Store norm if first iteration, and print norm | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers
Method signatures and docstrings:
- def __init__(self, ksp): Stores pointer to the ksp solver
- def __call__(self, ksp, counter, norm): Store norm if first iteration, and print norm
<|skeleton|>
class Moni... | bc7a05e04c7901f477fe553c59e478a837116d92 | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
<|body_0|>
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Monitor:
"""Prints output from PETSc's KSP solvers"""
def __init__(self, ksp):
"""Stores pointer to the ksp solver"""
self._ksp = ksp
self._norm0 = 1.0
self._norm = 1.0
def __call__(self, ksp, counter, norm):
"""Store norm if first iteration, and print norm"""... | the_stack_v2_python_sparse | bin/Python27/Lib/site-packages/openmdao/solvers/petsc_ksp.py | metamorph-inc/meta-core | train | 25 |
a86b02581f06d22d5907fefdb2ff7bb64f911b59 | [
"self.func = func\nself.jac = jac\nself.xdata = np.array(xdata)\nself.ydata = np.array(ydata)\nself.curve_fit_kwargs = kwargs\nself.popt, self.pcov = optimize.curve_fit(self.func, self.xdata, self.ydata, **self.curve_fit_kwargs)",
"y = np.array(list(map(lambda _: self.func(_, *self.popt), x)))\nsigma = np.array(l... | <|body_start_0|>
self.func = func
self.jac = jac
self.xdata = np.array(xdata)
self.ydata = np.array(ydata)
self.curve_fit_kwargs = kwargs
self.popt, self.pcov = optimize.curve_fit(self.func, self.xdata, self.ydata, **self.curve_fit_kwargs)
<|end_body_0|>
<|body_start_1|>... | Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit) | CurveFit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CurveFit:
"""Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit)"""
def __init__(self, func, xdata, ydata, jac=None, **kwargs):
"""Fit curve to data points. (see scipy.optimize.curve_fit) Parameters ---------- func : callable ... | stack_v2_sparse_classes_10k_train_004563 | 35,535 | permissive | [
{
"docstring": "Fit curve to data points. (see scipy.optimize.curve_fit) Parameters ---------- func : callable scalar function Model function, f(x, ...), taking the independent variable as the first argument and the parameters to fit as separate remaining arguments. xdata : float array-like x-data to fit. ydata... | 3 | stack_v2_sparse_classes_30k_train_001705 | Implement the Python class `CurveFit` described below.
Class description:
Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit)
Method signatures and docstrings:
- def __init__(self, func, xdata, ydata, jac=None, **kwargs): Fit curve to data points. (see scipy.o... | Implement the Python class `CurveFit` described below.
Class description:
Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit)
Method signatures and docstrings:
- def __init__(self, func, xdata, ydata, jac=None, **kwargs): Fit curve to data points. (see scipy.o... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class CurveFit:
"""Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit)"""
def __init__(self, func, xdata, ydata, jac=None, **kwargs):
"""Fit curve to data points. (see scipy.optimize.curve_fit) Parameters ---------- func : callable ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CurveFit:
"""Fit a 1-variable scalar function to data points and evaluate with uncertainty. (see scipy.optimize.curve_fit)"""
def __init__(self, func, xdata, ydata, jac=None, **kwargs):
"""Fit curve to data points. (see scipy.optimize.curve_fit) Parameters ---------- func : callable scalar functi... | the_stack_v2_python_sparse | maths.py | yketa/active_work | train | 1 |
df5860a482b8baa3ecf2eca97ae0438a3d840ede | [
"post = Post.query.filter_by(id=id).first()\nif post is None:\n return ({'message': 'Post does not exist'}, 404)\nreturn post_schema.dump(post)",
"with db.session.no_autoflush:\n req = api.payload\n post = Post.query.filter_by(id=id).first()\n if post is None:\n return ({'message': 'Post does n... | <|body_start_0|>
post = Post.query.filter_by(id=id).first()
if post is None:
return ({'message': 'Post does not exist'}, 404)
return post_schema.dump(post)
<|end_body_0|>
<|body_start_1|>
with db.session.no_autoflush:
req = api.payload
post = Post.que... | SinglePost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SinglePost:
def get(self, id):
"""Get Post by id"""
<|body_0|>
def patch(self, id):
"""Update a Post"""
<|body_1|>
def delete(self, id):
"""Delete a Post by id"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
post = Post.query.fi... | stack_v2_sparse_classes_10k_train_004564 | 3,474 | no_license | [
{
"docstring": "Get Post by id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Update a Post",
"name": "patch",
"signature": "def patch(self, id)"
},
{
"docstring": "Delete a Post by id",
"name": "delete",
"signature": "def delete(self, id)"
}
] | 3 | stack_v2_sparse_classes_30k_test_000230 | Implement the Python class `SinglePost` described below.
Class description:
Implement the SinglePost class.
Method signatures and docstrings:
- def get(self, id): Get Post by id
- def patch(self, id): Update a Post
- def delete(self, id): Delete a Post by id | Implement the Python class `SinglePost` described below.
Class description:
Implement the SinglePost class.
Method signatures and docstrings:
- def get(self, id): Get Post by id
- def patch(self, id): Update a Post
- def delete(self, id): Delete a Post by id
<|skeleton|>
class SinglePost:
def get(self, id):
... | ae78fff9888b0f68d9403d7f65cba086dabb3802 | <|skeleton|>
class SinglePost:
def get(self, id):
"""Get Post by id"""
<|body_0|>
def patch(self, id):
"""Update a Post"""
<|body_1|>
def delete(self, id):
"""Delete a Post by id"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SinglePost:
def get(self, id):
"""Get Post by id"""
post = Post.query.filter_by(id=id).first()
if post is None:
return ({'message': 'Post does not exist'}, 404)
return post_schema.dump(post)
def patch(self, id):
"""Update a Post"""
with db.sessi... | the_stack_v2_python_sparse | api/v1/posts.py | mythril-io/flask-api | train | 0 | |
e9332f48244bacb6546fe3ced15adacce9086bf6 | [
"if not inode and (not location) or not parent:\n raise ValueError('Missing inode and location, or parent value.')\nsuper(XFSPathSpec, self).__init__(parent=parent, **kwargs)\nself.inode = inode\nself.location = location",
"string_parts = []\nif self.inode is not None:\n string_parts.append(f'inode: {self.i... | <|body_start_0|>
if not inode and (not location) or not parent:
raise ValueError('Missing inode and location, or parent value.')
super(XFSPathSpec, self).__init__(parent=parent, **kwargs)
self.inode = inode
self.location = location
<|end_body_0|>
<|body_start_1|>
str... | XFS path specification implementation. Attributes: inode (int): inode. location (str): location. | XFSPathSpec | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XFSPathSpec:
"""XFS path specification implementation. Attributes: inode (int): inode. location (str): location."""
def __init__(self, inode=None, location=None, parent=None, **kwargs):
"""Initializes a path specification. Note that an XFS path specification must have a parent. Args:... | stack_v2_sparse_classes_10k_train_004565 | 1,475 | permissive | [
{
"docstring": "Initializes a path specification. Note that an XFS path specification must have a parent. Args: inode (Optional[int]): inode. location (Optional[str]): location. parent (Optional[PathSpec]): parent path specification. Raises: ValueError: when parent or both inode and location are not set.",
... | 2 | stack_v2_sparse_classes_30k_train_004980 | Implement the Python class `XFSPathSpec` described below.
Class description:
XFS path specification implementation. Attributes: inode (int): inode. location (str): location.
Method signatures and docstrings:
- def __init__(self, inode=None, location=None, parent=None, **kwargs): Initializes a path specification. Note... | Implement the Python class `XFSPathSpec` described below.
Class description:
XFS path specification implementation. Attributes: inode (int): inode. location (str): location.
Method signatures and docstrings:
- def __init__(self, inode=None, location=None, parent=None, **kwargs): Initializes a path specification. Note... | 28756d910e951a22c5f0b2bcf5184f055a19d544 | <|skeleton|>
class XFSPathSpec:
"""XFS path specification implementation. Attributes: inode (int): inode. location (str): location."""
def __init__(self, inode=None, location=None, parent=None, **kwargs):
"""Initializes a path specification. Note that an XFS path specification must have a parent. Args:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XFSPathSpec:
"""XFS path specification implementation. Attributes: inode (int): inode. location (str): location."""
def __init__(self, inode=None, location=None, parent=None, **kwargs):
"""Initializes a path specification. Note that an XFS path specification must have a parent. Args: inode (Optio... | the_stack_v2_python_sparse | dfvfs/path/xfs_path_spec.py | log2timeline/dfvfs | train | 197 |
95cd12e8e35bc21dae0b08d8dcac3c00c5e00970 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsAppXAppAssignmentSettings()",
"from .mobile_app_assignment_settings import MobileAppAssignmentSettings\nfrom .mobile_app_assignment_settings import MobileAppAssignmentSettings\nfields: Dict[str, Callable[[Any], None]] = {'useDev... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WindowsAppXAppAssignmentSettings()
<|end_body_0|>
<|body_start_1|>
from .mobile_app_assignment_settings import MobileAppAssignmentSettings
from .mobile_app_assignment_settings import Mob... | Contains properties used when assigning a Windows AppX mobile app to a group. | WindowsAppXAppAssignmentSettings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsAppXAppAssignmentSettings:
"""Contains properties used when assigning a Windows AppX mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAppXAppAssignmentSettings:
"""Creates a new instance of the appropriate class base... | stack_v2_sparse_classes_10k_train_004566 | 2,660 | 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: WindowsAppXAppAssignmentSettings",
"name": "create_from_discriminator_value",
"signature": "def create_from_... | 3 | null | Implement the Python class `WindowsAppXAppAssignmentSettings` described below.
Class description:
Contains properties used when assigning a Windows AppX mobile app to a group.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAppXAppAssignmentSetti... | Implement the Python class `WindowsAppXAppAssignmentSettings` described below.
Class description:
Contains properties used when assigning a Windows AppX mobile app to a group.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAppXAppAssignmentSetti... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WindowsAppXAppAssignmentSettings:
"""Contains properties used when assigning a Windows AppX mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAppXAppAssignmentSettings:
"""Creates a new instance of the appropriate class base... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WindowsAppXAppAssignmentSettings:
"""Contains properties used when assigning a Windows AppX mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAppXAppAssignmentSettings:
"""Creates a new instance of the appropriate class based on discrimi... | the_stack_v2_python_sparse | msgraph/generated/models/windows_app_x_app_assignment_settings.py | microsoftgraph/msgraph-sdk-python | train | 135 |
af9a7d269cd5f5586ca02f0f256eb254c56bfce7 | [
"if not self.is_visible(source, overrides):\n return\ntag = self.get_property('tag', source, overrides)\nshow_line = self.get_property('show_line', source, overrides)\nshow_labels = self.get_property('show_labels', source, overrides)\nshow_major_ticks = self.get_property('show_major_ticks', source, overrides)\ns... | <|body_start_0|>
if not self.is_visible(source, overrides):
return
tag = self.get_property('tag', source, overrides)
show_line = self.get_property('show_line', source, overrides)
show_labels = self.get_property('show_labels', source, overrides)
show_major_ticks = self... | Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'units' property. Properties: radius: int, float or callable Specifies the axis... | RadialAxis | [
"LicenseRef-scancode-philippe-de-muyter",
"LicenseRef-scancode-commercial-license",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadialAxis:
"""Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'units' property. Properties: radius: int... | stack_v2_sparse_classes_10k_train_004567 | 29,078 | permissive | [
{
"docstring": "Uses given canvas to draw the axis.",
"name": "draw",
"signature": "def draw(self, canvas, source=UNDEF, **overrides)"
},
{
"docstring": "Draws axis major ticks.",
"name": "_draw_major_ticks",
"signature": "def _draw_major_ticks(self, canvas, source, overrides)"
},
{
... | 6 | stack_v2_sparse_classes_30k_train_003951 | Implement the Python class `RadialAxis` described below.
Class description:
Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'u... | Implement the Python class `RadialAxis` described below.
Class description:
Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'u... | d59b1bc056f3037b7b7ab635b6deb41120612965 | <|skeleton|>
class RadialAxis:
"""Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'units' property. Properties: radius: int... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RadialAxis:
"""Radial axis is a standard type of axis used for polar plots. By default the axis is drawn as a circle or arc line with ticks and labels facing out. The ticks are expected to be provided as absolute angle values in the units specified by the 'units' property. Properties: radius: int, float or ca... | the_stack_v2_python_sparse | pero/glyphs/axes.py | xxao/pero | train | 31 |
dde744716a950b843b40130d30136c03deff475a | [
"self._executable = executable\nself._command = command\nself._args = args",
"subproc = Popen([self._executable, self._command] + self._args, stderr=PIPE)\nerr = ''\nwhile subproc.poll() is None:\n line = subproc.stderr.readline().decode('utf-8')\n err += line\n sys.stderr.write(line)\n sys.stderr.flu... | <|body_start_0|>
self._executable = executable
self._command = command
self._args = args
<|end_body_0|>
<|body_start_1|>
subproc = Popen([self._executable, self._command] + self._args, stderr=PIPE)
err = ''
while subproc.poll() is None:
line = subproc.stderr.... | SubcommandProcess | [
"Apache-2.0",
"BSD-3-Clause",
"Python-2.0",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubcommandProcess:
def __init__(self, executable, command, args):
"""Representes a subcommand running by a forked process :param executable: executable to run :type executable: executable :param command: command to run by executable :type command: str :param args: arguments for command :... | stack_v2_sparse_classes_10k_train_004568 | 19,291 | permissive | [
{
"docstring": "Representes a subcommand running by a forked process :param executable: executable to run :type executable: executable :param command: command to run by executable :type command: str :param args: arguments for command :type args: [str]",
"name": "__init__",
"signature": "def __init__(sel... | 2 | stack_v2_sparse_classes_30k_val_000188 | Implement the Python class `SubcommandProcess` described below.
Class description:
Implement the SubcommandProcess class.
Method signatures and docstrings:
- def __init__(self, executable, command, args): Representes a subcommand running by a forked process :param executable: executable to run :type executable: execu... | Implement the Python class `SubcommandProcess` described below.
Class description:
Implement the SubcommandProcess class.
Method signatures and docstrings:
- def __init__(self, executable, command, args): Representes a subcommand running by a forked process :param executable: executable to run :type executable: execu... | 7da04b533fa77a04a3b05fe55a9fec13715a2e1e | <|skeleton|>
class SubcommandProcess:
def __init__(self, executable, command, args):
"""Representes a subcommand running by a forked process :param executable: executable to run :type executable: executable :param command: command to run by executable :type command: str :param args: arguments for command :... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubcommandProcess:
def __init__(self, executable, command, args):
"""Representes a subcommand running by a forked process :param executable: executable to run :type executable: executable :param command: command to run by executable :type command: str :param args: arguments for command :type args: [st... | the_stack_v2_python_sparse | docker/jenkins-executor/bin/dcos-cli/dcos/subcommand.py | softonic/deploy-marathon-bluegreen | train | 2 | |
71ac6e9debfe67d31456d98c384332719e0bc816 | [
"if additional_help is not None:\n self._help = additional_help\nelse:\n self._help = ''",
"width = 80\nlog_message = 'CLI: {}'.format(' '.join(sys.argv))\nlog.log2info(20043, log_message)\nparser = _Parser(description=self._help, formatter_class=argparse.RawTextHelpFormatter)\nsubparsers = parser.add_subpa... | <|body_start_0|>
if additional_help is not None:
self._help = additional_help
else:
self._help = ''
<|end_body_0|>
<|body_start_1|>
width = 80
log_message = 'CLI: {}'.format(' '.join(sys.argv))
log.log2info(20043, log_message)
parser = _Parser(des... | Class gathers all CLI information. | Parser | [
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser:
"""Class gathers all CLI information."""
def __init__(self, additional_help=None):
"""Intialize the class."""
<|body_0|>
def args(self):
"""Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -... | stack_v2_sparse_classes_10k_train_004569 | 14,703 | permissive | [
{
"docstring": "Intialize the class.",
"name": "__init__",
"signature": "def __init__(self, additional_help=None)"
},
{
"docstring": "Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects - filename: Path to the configuration file",
... | 2 | stack_v2_sparse_classes_30k_train_004488 | Implement the Python class `Parser` described below.
Class description:
Class gathers all CLI information.
Method signatures and docstrings:
- def __init__(self, additional_help=None): Intialize the class.
- def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a... | Implement the Python class `Parser` described below.
Class description:
Class gathers all CLI information.
Method signatures and docstrings:
- def __init__(self, additional_help=None): Intialize the class.
- def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a... | 57bd3e82e49d51e3426b13ad53ed8326a735ce29 | <|skeleton|>
class Parser:
"""Class gathers all CLI information."""
def __init__(self, additional_help=None):
"""Intialize the class."""
<|body_0|>
def args(self):
"""Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Parser:
"""Class gathers all CLI information."""
def __init__(self, additional_help=None):
"""Intialize the class."""
if additional_help is not None:
self._help = additional_help
else:
self._help = ''
def args(self):
"""Return all the CLI optio... | the_stack_v2_python_sparse | pattoo/cli/cli.py | palisadoes/pattoo | train | 0 |
f0fdc703bec438b7888bd3eda6197aa328da1791 | [
"props = registry.properties()\nserializer = PropertySerializer(props)\nreturn Response(serializer.data)",
"props = registry.properties(model=pk)\nif not props:\n raise Http404\nserializer = PropertySerializer(props)\nreturn Response(serializer.data)"
] | <|body_start_0|>
props = registry.properties()
serializer = PropertySerializer(props)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
props = registry.properties(model=pk)
if not props:
raise Http404
serializer = PropertySerializer(props)
... | Viewset around model properties. | PropertyViewSet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
<|body_0|>
def retrieve(self, request, pk=None):
"""List all properties for a specific model."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_10k_train_004570 | 9,625 | permissive | [
{
"docstring": "List all properties models.",
"name": "list",
"signature": "def list(self, request, model=None)"
},
{
"docstring": "List all properties for a specific model.",
"name": "retrieve",
"signature": "def retrieve(self, request, pk=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006219 | Implement the Python class `PropertyViewSet` described below.
Class description:
Viewset around model properties.
Method signatures and docstrings:
- def list(self, request, model=None): List all properties models.
- def retrieve(self, request, pk=None): List all properties for a specific model. | Implement the Python class `PropertyViewSet` described below.
Class description:
Viewset around model properties.
Method signatures and docstrings:
- def list(self, request, model=None): List all properties models.
- def retrieve(self, request, pk=None): List all properties for a specific model.
<|skeleton|>
class P... | aaab76706c8268d3ff3e87c275baee9dd4714314 | <|skeleton|>
class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
<|body_0|>
def retrieve(self, request, pk=None):
"""List all properties for a specific model."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
props = registry.properties()
serializer = PropertySerializer(props)
return Response(serializer.data)
def retrieve(self, request, pk=None):
... | the_stack_v2_python_sparse | web/api/views.py | rcbops/FleetDeploymentReporting | train | 1 |
a7596482fd636fb08ad508e926899fd4c82e1eaa | [
"super().__init__(settings, ui_id, job_id)\nself.local_template = 'settings/bilby_local.sh'\nself.job_parameter_file = os.path.join(self.get_working_directory(), 'json_params.json')\nself.job_output_directory = os.path.join(self.get_working_directory(), 'output')",
"params = super().generate_template_dict()\npara... | <|body_start_0|>
super().__init__(settings, ui_id, job_id)
self.local_template = 'settings/bilby_local.sh'
self.job_parameter_file = os.path.join(self.get_working_directory(), 'json_params.json')
self.job_output_directory = os.path.join(self.get_working_directory(), 'output')
<|end_body_... | Bilby | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bilby:
def __init__(self, settings, ui_id, job_id):
"""Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param job_id: The Slurm id of the Job"""
<|body_0|>
def generate_template_dict(self):
... | stack_v2_sparse_classes_10k_train_004571 | 2,162 | permissive | [
{
"docstring": "Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param job_id: The Slurm id of the Job",
"name": "__init__",
"signature": "def __init__(self, settings, ui_id, job_id)"
},
{
"docstring": "Called befo... | 3 | stack_v2_sparse_classes_30k_train_001954 | Implement the Python class `Bilby` described below.
Class description:
Implement the Bilby class.
Method signatures and docstrings:
- def __init__(self, settings, ui_id, job_id): Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param jo... | Implement the Python class `Bilby` described below.
Class description:
Implement the Bilby class.
Method signatures and docstrings:
- def __init__(self, settings, ui_id, job_id): Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param jo... | 68ebdec8dd2fe7a4d1c6ad07783e86ea2056ae67 | <|skeleton|>
class Bilby:
def __init__(self, settings, ui_id, job_id):
"""Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param job_id: The Slurm id of the Job"""
<|body_0|>
def generate_template_dict(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Bilby:
def __init__(self, settings, ui_id, job_id):
"""Initialises the local scheduler class for Bilby :param settings: The settings from settings.py :param ui_id: The UI id of the job :param job_id: The Slurm id of the Job"""
super().__init__(settings, ui_id, job_id)
self.local_templa... | the_stack_v2_python_sparse | misc/job_controller_scripts/local/bilby_local.py | ADACS-Australia/SS18B-PLasky | train | 1 | |
b9d93247cd4223fc41da7f47e4cf7f1c4c0dd489 | [
"f = open(datapath + '/Data/companylist.csv', 'r')\nfor line in f:\n reg = line.split(',')\n if reg[0] != 'Symbol':\n if reg[0] not in self.cnames:\n self.cnames[reg[0]] = [reg[1], reg[2], reg[3], reg[4].strip()]\n elif reg[4].strip() != 'ASX':\n self.cnames[reg[0]] = [reg[... | <|body_start_0|>
f = open(datapath + '/Data/companylist.csv', 'r')
for line in f:
reg = line.split(',')
if reg[0] != 'Symbol':
if reg[0] not in self.cnames:
self.cnames[reg[0]] = [reg[1], reg[2], reg[3], reg[4].strip()]
elif reg... | Company | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Company:
def __init__(self):
"""Reads the companies from a file and stores it in a dictionary"""
<|body_0|>
def get_company(self, cmp):
"""Returns the data for the company :param cmp: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
f = open... | stack_v2_sparse_classes_10k_train_004572 | 1,156 | no_license | [
{
"docstring": "Reads the companies from a file and stores it in a dictionary",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns the data for the company :param cmp: :return:",
"name": "get_company",
"signature": "def get_company(self, cmp)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003386 | Implement the Python class `Company` described below.
Class description:
Implement the Company class.
Method signatures and docstrings:
- def __init__(self): Reads the companies from a file and stores it in a dictionary
- def get_company(self, cmp): Returns the data for the company :param cmp: :return: | Implement the Python class `Company` described below.
Class description:
Implement the Company class.
Method signatures and docstrings:
- def __init__(self): Reads the companies from a file and stores it in a dictionary
- def get_company(self, cmp): Returns the data for the company :param cmp: :return:
<|skeleton|>
... | 3abf7e00848cbff8be33f051a5fb65bd889f1110 | <|skeleton|>
class Company:
def __init__(self):
"""Reads the companies from a file and stores it in a dictionary"""
<|body_0|>
def get_company(self, cmp):
"""Returns the data for the company :param cmp: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Company:
def __init__(self):
"""Reads the companies from a file and stores it in a dictionary"""
f = open(datapath + '/Data/companylist.csv', 'r')
for line in f:
reg = line.split(',')
if reg[0] != 'Symbol':
if reg[0] not in self.cnames:
... | the_stack_v2_python_sparse | FSociety/Data/Company.py | bejar/FSociety | train | 3 | |
9a9b3b6e75c5379104796177250babb3ee1953a5 | [
"self._gsg_pos_g = np.matrix(np.reshape(gsg_pos_g, (3, 1)))\nself._length = tether_params['length'] + bridle_radius\nself._weight = tether_params['length'] * tether_params['linear_density'] * g\nself._section_drag_coeff = tether_params['section_drag_coeff']\nself._outer_diameter = tether_params['outer_diameter']\ns... | <|body_start_0|>
self._gsg_pos_g = np.matrix(np.reshape(gsg_pos_g, (3, 1)))
self._length = tether_params['length'] + bridle_radius
self._weight = tether_params['length'] * tether_params['linear_density'] * g
self._section_drag_coeff = tether_params['section_drag_coeff']
self._out... | Model of tether force using catenary tension and rigid-rod drag. | CatenaryTetherForceModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CatenaryTetherForceModel:
"""Model of tether force using catenary tension and rigid-rod drag."""
def __init__(self, tether_params, gsg_pos_g, bridle_radius, g, air_density):
"""Create a catenary tether force model. Args: tether_params: TetherParams dictionary. gsg_pos_g: Position [m]... | stack_v2_sparse_classes_10k_train_004573 | 28,331 | permissive | [
{
"docstring": "Create a catenary tether force model. Args: tether_params: TetherParams dictionary. gsg_pos_g: Position [m] of the GSG in the g-frame. bridle_radius: Bridle radius [m] of the kite. g: Gravitational acceleration [m/s^2]. air_density: Air density [kg/m^3].",
"name": "__init__",
"signature"... | 2 | null | Implement the Python class `CatenaryTetherForceModel` described below.
Class description:
Model of tether force using catenary tension and rigid-rod drag.
Method signatures and docstrings:
- def __init__(self, tether_params, gsg_pos_g, bridle_radius, g, air_density): Create a catenary tether force model. Args: tether... | Implement the Python class `CatenaryTetherForceModel` described below.
Class description:
Model of tether force using catenary tension and rigid-rod drag.
Method signatures and docstrings:
- def __init__(self, tether_params, gsg_pos_g, bridle_radius, g, air_density): Create a catenary tether force model. Args: tether... | 818ae8b7119b200a28af6b3669a3045f30e0dc64 | <|skeleton|>
class CatenaryTetherForceModel:
"""Model of tether force using catenary tension and rigid-rod drag."""
def __init__(self, tether_params, gsg_pos_g, bridle_radius, g, air_density):
"""Create a catenary tether force model. Args: tether_params: TetherParams dictionary. gsg_pos_g: Position [m]... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CatenaryTetherForceModel:
"""Model of tether force using catenary tension and rigid-rod drag."""
def __init__(self, tether_params, gsg_pos_g, bridle_radius, g, air_density):
"""Create a catenary tether force model. Args: tether_params: TetherParams dictionary. gsg_pos_g: Position [m] of the GSG i... | the_stack_v2_python_sparse | analysis/control/dynamics.py | ghomsy/makani | train | 0 |
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b | [
"response = self.client.get(reverse('education:states'))\nself.assertEqual(response.status_code, 200)\nself.assertEqual(response.context.get('states').count(), 0)\nself.assertContains(response, 'No Data Available')\nself.assertNotContains(response, 'Number of Public High Schools')",
"create_states()\nresponse = s... | <|body_start_0|>
response = self.client.get(reverse('education:states'))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context.get('states').count(), 0)
self.assertContains(response, 'No Data Available')
self.assertNotContains(response, 'Number of Public H... | EducationStatesViewTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationStatesViewTest:
def test_no_data(self):
"""Make sure the page renders and gives an error message if no data is available."""
<|body_0|>
def test_with_data(self):
"""Make sure page renders when state database is filled."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_10k_train_004574 | 9,266 | no_license | [
{
"docstring": "Make sure the page renders and gives an error message if no data is available.",
"name": "test_no_data",
"signature": "def test_no_data(self)"
},
{
"docstring": "Make sure page renders when state database is filled.",
"name": "test_with_data",
"signature": "def test_with_... | 2 | stack_v2_sparse_classes_30k_test_000389 | Implement the Python class `EducationStatesViewTest` described below.
Class description:
Implement the EducationStatesViewTest class.
Method signatures and docstrings:
- def test_no_data(self): Make sure the page renders and gives an error message if no data is available.
- def test_with_data(self): Make sure page re... | Implement the Python class `EducationStatesViewTest` described below.
Class description:
Implement the EducationStatesViewTest class.
Method signatures and docstrings:
- def test_no_data(self): Make sure the page renders and gives an error message if no data is available.
- def test_with_data(self): Make sure page re... | 2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f | <|skeleton|>
class EducationStatesViewTest:
def test_no_data(self):
"""Make sure the page renders and gives an error message if no data is available."""
<|body_0|>
def test_with_data(self):
"""Make sure page renders when state database is filled."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EducationStatesViewTest:
def test_no_data(self):
"""Make sure the page renders and gives an error message if no data is available."""
response = self.client.get(reverse('education:states'))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context.get('state... | the_stack_v2_python_sparse | education/tests.py | smeds1/mysite | train | 1 | |
eb8696ec4c2a4408cbe2e773de8e8b03a4a6b8fe | [
"def _dfs(rest, wallet_id):\n if rest == 0:\n return 1\n res = 0\n for idx in range(wallet_id, len(coins)):\n if rest >= coins[idx]:\n res += _dfs(rest - coins[idx], idx)\n return res\nreturn _dfs(amount, 0)",
"dp = [0] * (amount + 1)\ndp[0] = 1\nfor idx in range(1, amount + 1... | <|body_start_0|>
def _dfs(rest, wallet_id):
if rest == 0:
return 1
res = 0
for idx in range(wallet_id, len(coins)):
if rest >= coins[idx]:
res += _dfs(rest - coins[idx], idx)
return res
return _dfs(amount... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int"""
<|body_0|>
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_004575 | 2,720 | no_license | [
{
"docstring": ":type amount: int :type coins: List[int] :rtype: int",
"name": "change",
"signature": "def change(self, amount, coins)"
},
{
"docstring": ":type amount: int :type coins: List[int] :rtype: int",
"name": "change",
"signature": "def change(self, amount, coins)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004364 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
- def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
<|s... | 085b8dfa8e12f7c39107bab60110cd3b182f0c13 | <|skeleton|>
class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int"""
<|body_0|>
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def change(self, amount, coins):
""":type amount: int :type coins: List[int] :rtype: int"""
def _dfs(rest, wallet_id):
if rest == 0:
return 1
res = 0
for idx in range(wallet_id, len(coins)):
if rest >= coins[idx]:
... | the_stack_v2_python_sparse | eet/Coin_Change_2.py | wangyunge/algorithmpractice | train | 0 | |
898cd9b4302787c91ff2a1e0a2233aafc65e601e | [
"maxNum = n + 1\ndp = [maxNum] * maxNum\ndp[0] = 0\nfor i in range(1, maxNum):\n dp[i] = min([dp[i - j * j] for j in range(1, int(i ** 0.5) + 1)]) + 1\nreturn dp[-1]",
"squares = [i * i for i in range(1, int(n ** 0.5) + 1)]\nd, q, nq = (1, {n}, set())\nwhile q:\n for node in q:\n for square in square... | <|body_start_0|>
maxNum = n + 1
dp = [maxNum] * maxNum
dp[0] = 0
for i in range(1, maxNum):
dp[i] = min([dp[i - j * j] for j in range(1, int(i ** 0.5) + 1)]) + 1
return dp[-1]
<|end_body_0|>
<|body_start_1|>
squares = [i * i for i in range(1, int(n ** 0.5) + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . .... | stack_v2_sparse_classes_10k_train_004576 | 1,727 | no_license | [
{
"docstring": "Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . . . dp[13] = Min{ dp[13-1*1]+1, dp[13-2*2]+1, dp[13-3*3]+1 ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . .... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . . . dp[13] = Mi... | the_stack_v2_python_sparse | 2020/perfect_squares.py | eronekogin/leetcode | train | 0 | |
0240f446b4530d7523fe7206109111eba4654ccf | [
"password = self.cleaned_data.get('password')\npassword_confirm = self.cleaned_data.get('password_confirm')\nprint('-----' + str(password))\nprint('-----' + str(password_confirm))\nif password and password_confirm and (password != password_confirm):\n raise forms.ValidationError(\"Passwords don't match\")\nretur... | <|body_start_0|>
password = self.cleaned_data.get('password')
password_confirm = self.cleaned_data.get('password_confirm')
print('-----' + str(password))
print('-----' + str(password_confirm))
if password and password_confirm and (password != password_confirm):
raise ... | A form for creating new users. Includes all the required fields, plus a repeated password. | UserCreateForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserCreateForm:
"""A form for creating new users. Includes all the required fields, plus a repeated password."""
def clean_password_confirm(self):
"""Validate password confirm Returns:"""
<|body_0|>
def save(self, commit=True):
"""Save changes to user info Args: ... | stack_v2_sparse_classes_10k_train_004577 | 2,266 | no_license | [
{
"docstring": "Validate password confirm Returns:",
"name": "clean_password_confirm",
"signature": "def clean_password_confirm(self)"
},
{
"docstring": "Save changes to user info Args: commit: Returns:",
"name": "save",
"signature": "def save(self, commit=True)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000581 | Implement the Python class `UserCreateForm` described below.
Class description:
A form for creating new users. Includes all the required fields, plus a repeated password.
Method signatures and docstrings:
- def clean_password_confirm(self): Validate password confirm Returns:
- def save(self, commit=True): Save change... | Implement the Python class `UserCreateForm` described below.
Class description:
A form for creating new users. Includes all the required fields, plus a repeated password.
Method signatures and docstrings:
- def clean_password_confirm(self): Validate password confirm Returns:
- def save(self, commit=True): Save change... | c76ffcb530ccf95ecacfd448c600eb207c9152f7 | <|skeleton|>
class UserCreateForm:
"""A form for creating new users. Includes all the required fields, plus a repeated password."""
def clean_password_confirm(self):
"""Validate password confirm Returns:"""
<|body_0|>
def save(self, commit=True):
"""Save changes to user info Args: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserCreateForm:
"""A form for creating new users. Includes all the required fields, plus a repeated password."""
def clean_password_confirm(self):
"""Validate password confirm Returns:"""
password = self.cleaned_data.get('password')
password_confirm = self.cleaned_data.get('passwo... | the_stack_v2_python_sparse | db-demo/manage_user/forms.py | nmrenyi/CodeDancePedia | train | 3 |
2ea15cf44b4fd5622fc0e931fe4ed287652c1b6c | [
"super().__init__(task_data)\nself.src_splitter = src_splitter\nself.tgt_splitter = tgt_splitter",
"if batched:\n src_sents = [src for src, tgt in self.task_data]\n chunked_sents = list(chunks(src_sents, batched))\n predictions = [prediction_fn(sents) for sents in tqdm.tqdm(chunked_sents, desc='predictin... | <|body_start_0|>
super().__init__(task_data)
self.src_splitter = src_splitter
self.tgt_splitter = tgt_splitter
<|end_body_0|>
<|body_start_1|>
if batched:
src_sents = [src for src, tgt in self.task_data]
chunked_sents = list(chunks(src_sents, batched))
... | TranslationExperiment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validat... | stack_v2_sparse_classes_10k_train_004578 | 13,210 | no_license | [
{
"docstring": "task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validation_pairs) >>> def simple_translate(src): >>> return \"return output\" >>> translation_experiment.evaluate(simple_translate) ... | 2 | stack_v2_sparse_classes_30k_train_004555 | Implement the Python class `TranslationExperiment` described below.
Class description:
Implement the TranslationExperiment class.
Method signatures and docstrings:
- def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1): task_data: [(str, str)]: this is the expected data format. >>... | Implement the Python class `TranslationExperiment` described below.
Class description:
Implement the TranslationExperiment class.
Method signatures and docstrings:
- def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1): task_data: [(str, str)]: this is the expected data format. >>... | 92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db | <|skeleton|>
class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validation_pairs) >>>... | the_stack_v2_python_sparse | notebooks/src/Experiments.py | carlos-gemmell/Glasgow-NLP | train | 0 | |
227d3b2c5ec60b422a3a2448e92725b3408b44e0 | [
"if isinstance(obs, np.ndarray) and obs.ndim == 2:\n obs = [obs[:, i] for i in range(obs.shape[1])]\nif isinstance(sigs, np.ndarray) and sigs.ndim == 2:\n sigs = [sigs[:, i] for i in range(sigs.shape[1])]\nif (ms_obs or ms_feat) and ms_warn:\n PE.warn(PE.PyAValError(f'Be aware: Mean will be subtracted from... | <|body_start_0|>
if isinstance(obs, np.ndarray) and obs.ndim == 2:
obs = [obs[:, i] for i in range(obs.shape[1])]
if isinstance(sigs, np.ndarray) and sigs.ndim == 2:
sigs = [sigs[:, i] for i in range(sigs.shape[1])]
if (ms_obs or ms_feat) and ms_warn:
PE.warn(... | SysRem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SysRem:
def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True):
"""Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correctin... | stack_v2_sparse_classes_10k_train_004579 | 11,569 | permissive | [
{
"docstring": "Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correcting systematic effects in samples of light curves, but has been applied in other areas such as planetar... | 4 | stack_v2_sparse_classes_30k_train_002669 | Implement the Python class `SysRem` described below.
Class description:
Implement the SysRem class.
Method signatures and docstrings:
- def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466)... | Implement the Python class `SysRem` described below.
Class description:
Implement the SysRem class.
Method signatures and docstrings:
- def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466)... | e85314678882624baf870443c670b4f5abb70e7d | <|skeleton|>
class SysRem:
def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True):
"""Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correctin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SysRem:
def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True):
"""Implementation of the SysRem algorithm. SysRem was described by `Tamuz et al. 2005 (MNRAS 356, 1466) <https://ui.adsabs.harvard.edu/abs/2005MNRAS.356.1466T/abstract>`_ in the context of correcting systematic e... | the_stack_v2_python_sparse | src/pyasl/asl/aslExt_1/sysrem.py | sczesla/PyAstronomy | train | 129 | |
0ab782a5ca06f415ab037667a11af8bb8a59443c | [
"M, N = (len(string), len(target))\ndp = [0 for _ in range(N)]\nfor i in range(M - 1, -1, -1):\n prev = 1\n for j in range(N - 1, -1, -1):\n dp_old = dp[j]\n if string[i] == target[j]:\n dp[j] += prev\n prev = dp_old\nreturn dp[0]",
"M, N = (len(string), len(target))\ndp = [[... | <|body_start_0|>
M, N = (len(string), len(target))
dp = [0 for _ in range(N)]
for i in range(M - 1, -1, -1):
prev = 1
for j in range(N - 1, -1, -1):
dp_old = dp[j]
if string[i] == target[j]:
dp[j] += prev
... | Subsequence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subsequence:
def get_distinct_subsequence(self, string: str, target: str) -> int:
"""Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:"""
<|body_0|>
def get_distinct_subsequence_(self, string: str, target: str) -> int:
... | stack_v2_sparse_classes_10k_train_004580 | 2,461 | no_license | [
{
"docstring": "Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:",
"name": "get_distinct_subsequence",
"signature": "def get_distinct_subsequence(self, string: str, target: str) -> int"
},
{
"docstring": "Approach: DP 2-D Time Complexity: O(MN)... | 3 | stack_v2_sparse_classes_30k_train_005390 | Implement the Python class `Subsequence` described below.
Class description:
Implement the Subsequence class.
Method signatures and docstrings:
- def get_distinct_subsequence(self, string: str, target: str) -> int: Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:
- ... | Implement the Python class `Subsequence` described below.
Class description:
Implement the Subsequence class.
Method signatures and docstrings:
- def get_distinct_subsequence(self, string: str, target: str) -> int: Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:
- ... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Subsequence:
def get_distinct_subsequence(self, string: str, target: str) -> int:
"""Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:"""
<|body_0|>
def get_distinct_subsequence_(self, string: str, target: str) -> int:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Subsequence:
def get_distinct_subsequence(self, string: str, target: str) -> int:
"""Approach: DP 1D Time Complexity: O(MN) Space Complexity: O(N) :param string: :param target: :return:"""
M, N = (len(string), len(target))
dp = [0 for _ in range(N)]
for i in range(M - 1, -1, -1... | the_stack_v2_python_sparse | data_structures/recurrsion_dp/distinct_subsequence.py | Shiv2157k/leet_code | train | 1 | |
1b3bb40606ed4163316e6a35418de901600f559f | [
"ret = 0\nnums.sort()\nn = len(nums)\nfor k in range(n - 1, 1, -1):\n i = 0\n j = k - 1\n while i < j:\n if nums[i] + nums[j] > nums[k]:\n ret += j - i\n j -= 1\n else:\n i += 1\nreturn ret",
"ret = 0\nnums.sort()\nn = len(nums)\nfor i in range(n - 2):\n ... | <|body_start_0|>
ret = 0
nums.sort()
n = len(nums)
for k in range(n - 1, 1, -1):
i = 0
j = k - 1
while i < j:
if nums[i] + nums[j] > nums[k]:
ret += j - i
j -= 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def triangleNumber(self, nums: List[int]) -> int:
"""b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)"""
<|body_0|>
def triangleNumber_error(self, nums: List[int]) -> int:
"""b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)... | stack_v2_sparse_classes_10k_train_004581 | 2,446 | no_license | [
{
"docstring": "b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)",
"name": "triangleNumber",
"signature": "def triangleNumber(self, nums: List[int]) -> int"
},
{
"docstring": "b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)",
"name": "triangleNumber_error",... | 3 | stack_v2_sparse_classes_30k_train_003323 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def triangleNumber(self, nums: List[int]) -> int: b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)
- def triangleNumber_error(self, nums: List[int]) -> int: b - ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def triangleNumber(self, nums: List[int]) -> int: b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)
- def triangleNumber_error(self, nums: List[int]) -> int: b - ... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def triangleNumber(self, nums: List[int]) -> int:
"""b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)"""
<|body_0|>
def triangleNumber_error(self, nums: List[int]) -> int:
"""b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def triangleNumber(self, nums: List[int]) -> int:
"""b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)"""
ret = 0
nums.sort()
n = len(nums)
for k in range(n - 1, 1, -1):
i = 0
j = k - 1
while i < j:
... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/611 Valid Triangle Number.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
2fb55ae891a3283b6d3496650dbcfb99c13e84f4 | [
"dtype = np.float32\ntrue_mean = dtype([0, 0, 0])\ntrue_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])\nchol = tf.linalg.cholesky(true_cov)\ntarget = mvn_tril.MultivariateNormalTriL(loc=true_mean, scale_tril=chol)\n\ndef target_fn(x, y):\n z = tf.concat([x, y], axis=-1) - true_mean\n return ... | <|body_start_0|>
dtype = np.float32
true_mean = dtype([0, 0, 0])
true_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])
chol = tf.linalg.cholesky(true_cov)
target = mvn_tril.MultivariateNormalTriL(loc=true_mean, scale_tril=chol)
def target_fn(x, y):
... | JacobianTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_0|>
def testJacobianDiagonal4D(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_004582 | 4,890 | permissive | [
{
"docstring": "Tests that the diagonal of the Jacobian matrix computes correctly.",
"name": "testJacobianDiagonal3DListInput",
"signature": "def testJacobianDiagonal3DListInput(self)"
},
{
"docstring": "Tests that the diagonal of the Jacobian matrix computes correctly.",
"name": "testJacobi... | 2 | stack_v2_sparse_classes_30k_train_007168 | Implement the Python class `JacobianTest` described below.
Class description:
Implement the JacobianTest class.
Method signatures and docstrings:
- def testJacobianDiagonal3DListInput(self): Tests that the diagonal of the Jacobian matrix computes correctly.
- def testJacobianDiagonal4D(self): Tests that the diagonal ... | Implement the Python class `JacobianTest` described below.
Class description:
Implement the JacobianTest class.
Method signatures and docstrings:
- def testJacobianDiagonal3DListInput(self): Tests that the diagonal of the Jacobian matrix computes correctly.
- def testJacobianDiagonal4D(self): Tests that the diagonal ... | 42a64ba0d9e0973b1707fcd9b8bd8d14b2d4e3e5 | <|skeleton|>
class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_0|>
def testJacobianDiagonal4D(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JacobianTest:
def testJacobianDiagonal3DListInput(self):
"""Tests that the diagonal of the Jacobian matrix computes correctly."""
dtype = np.float32
true_mean = dtype([0, 0, 0])
true_cov = dtype([[1, 0.25, 0.25], [0.25, 2, 0.25], [0.25, 0.25, 3]])
chol = tf.linalg.chole... | the_stack_v2_python_sparse | tensorflow_probability/python/math/diag_jacobian_test.py | tensorflow/probability | train | 4,055 | |
509d14ccce49086d167a85c7e2e2c37960668e60 | [
"if v and isinstance(v, dict):\n return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': values.get('context')})})\nretu... | <|body_start_0|>
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': valu... | Args passed to image.push. | ImagePushArgs | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of ``rep... | stack_v2_sparse_classes_10k_train_004583 | 3,744 | permissive | [
{
"docstring": "Set the value of ``ecr_repo``.",
"name": "_set_ecr_repo",
"signature": "def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any"
},
{
"docstring": "Set the value of ``repo``.",
"name": "_set_repo",
"signature": "def _set_repo(cls, v: Optional[str], values: Dict[str,... | 3 | null | Implement the Python class `ImagePushArgs` described below.
Class description:
Args passed to image.push.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]: S... | Implement the Python class `ImagePushArgs` described below.
Class description:
Args passed to image.push.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]: S... | 0763b06aee07d2cf3f037a49ca0cb81a048c5deb | <|skeleton|>
class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of ``rep... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': E... | the_stack_v2_python_sparse | runway/cfngin/hooks/docker/image/_push.py | onicagroup/runway | train | 156 |
6d6a172d2c448439d52eff39bafe0238b3987da4 | [
"refs = MetricModel.objects.filter(project_id=project_id).order_by('-updated')\ndata = [i.to_json() for i in refs]\nperm_can_use = request.GET.get('perm_can_use')\nif perm_can_use == '1':\n perm_can_use = True\nelse:\n perm_can_use = False\nperm = bcs_perm.Metric(request, project_id, bcs_perm.NO_RES)\ndata = ... | <|body_start_0|>
refs = MetricModel.objects.filter(project_id=project_id).order_by('-updated')
data = [i.to_json() for i in refs]
perm_can_use = request.GET.get('perm_can_use')
if perm_can_use == '1':
perm_can_use = True
else:
perm_can_use = False
... | metric列表 | Metric | [
"BSD-3-Clause",
"LicenseRef-scancode-unicode",
"ICU",
"LicenseRef-scancode-unknown-license-reference",
"Artistic-2.0",
"Zlib",
"LicenseRef-scancode-openssl",
"NAIST-2003",
"ISC",
"NTP",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Metric:
"""metric列表"""
def list(self, request, project_id):
"""获取metric列表"""
<|body_0|>
def create(self, request, project_id):
"""创建metric"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
refs = MetricModel.objects.filter(project_id=project_id).o... | stack_v2_sparse_classes_10k_train_004584 | 10,522 | permissive | [
{
"docstring": "获取metric列表",
"name": "list",
"signature": "def list(self, request, project_id)"
},
{
"docstring": "创建metric",
"name": "create",
"signature": "def create(self, request, project_id)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000166 | Implement the Python class `Metric` described below.
Class description:
metric列表
Method signatures and docstrings:
- def list(self, request, project_id): 获取metric列表
- def create(self, request, project_id): 创建metric | Implement the Python class `Metric` described below.
Class description:
metric列表
Method signatures and docstrings:
- def list(self, request, project_id): 获取metric列表
- def create(self, request, project_id): 创建metric
<|skeleton|>
class Metric:
"""metric列表"""
def list(self, request, project_id):
"""获取m... | 96373cda9d87038aceb0b4858ce89e7873c8e149 | <|skeleton|>
class Metric:
"""metric列表"""
def list(self, request, project_id):
"""获取metric列表"""
<|body_0|>
def create(self, request, project_id):
"""创建metric"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Metric:
"""metric列表"""
def list(self, request, project_id):
"""获取metric列表"""
refs = MetricModel.objects.filter(project_id=project_id).order_by('-updated')
data = [i.to_json() for i in refs]
perm_can_use = request.GET.get('perm_can_use')
if perm_can_use == '1':
... | the_stack_v2_python_sparse | bcs-app/backend/apps/metric/views.py | freyzheng/bk-bcs-saas | train | 0 |
76c6f16aa84d897cb725dfded456fc9a9f473b0c | [
"mid = 0\nwhile low < high:\n mid = low + int((high - low) / 2)\n if nums[mid] < target:\n low = mid + 1\n else:\n high = mid\nreturn low",
"res = []\nfor i in range(N):\n if not res or treasures[i] > res[-1]:\n res.append(treasures[i])\n else:\n idx = self.binary_search... | <|body_start_0|>
mid = 0
while low < high:
mid = low + int((high - low) / 2)
if nums[mid] < target:
low = mid + 1
else:
high = mid
return low
<|end_body_0|>
<|body_start_1|>
res = []
for i in range(N):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def binary_search(self, nums, low, high, target):
"""根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target"""
<|body_0|>
def LIS(self, N, treasures):
"""最长上升子序列 @param: N @param: treasures"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_10k_train_004585 | 2,565 | no_license | [
{
"docstring": "根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target",
"name": "binary_search",
"signature": "def binary_search(self, nums, low, high, target)"
},
{
"docstring": "最长上升子序列 @param: N @param: treasures",
"name": "LIS",
"signature": "def LIS(self, N, treasures)... | 2 | stack_v2_sparse_classes_30k_train_002855 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binary_search(self, nums, low, high, target): 根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target
- def LIS(self, N, treasures): 最长上升子序列 @param: N @param: tre... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binary_search(self, nums, low, high, target): 根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target
- def LIS(self, N, treasures): 最长上升子序列 @param: N @param: tre... | 32941ee052d0985a9569441d314378700ff4d225 | <|skeleton|>
class Solution:
def binary_search(self, nums, low, high, target):
"""根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target"""
<|body_0|>
def LIS(self, N, treasures):
"""最长上升子序列 @param: N @param: treasures"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def binary_search(self, nums, low, high, target):
"""根据指定的数据寻找相应的位置 @param: nums @param: low @param: high @param: target"""
mid = 0
while low < high:
mid = low + int((high - low) / 2)
if nums[mid] < target:
low = mid + 1
els... | the_stack_v2_python_sparse | cecilia-python/company-title/xiaohongshu/ResellingLoot.py | Cecilia520/algorithmic-learning-leetcode | train | 7 | |
b132281c8fcdec7fd36eca56e90b26ebcdedf406 | [
"Logger.debug('cmd is get model attribute, method is post.')\nresponse_data = self.query_data()\nreturn Response(json.dumps(response_data), status.HTTP_200_OK)",
"Logger.debug('cmd is get model attribute, method is get.')\nresponse_data = self.query_data()\nreturn Response(json.dumps(response_data), status.HTTP_2... | <|body_start_0|>
Logger.debug('cmd is get model attribute, method is post.')
response_data = self.query_data()
return Response(json.dumps(response_data), status.HTTP_200_OK)
<|end_body_0|>
<|body_start_1|>
Logger.debug('cmd is get model attribute, method is get.')
response_data ... | 获取模型属性接口 | ModelAttributeViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelAttributeViewSet:
"""获取模型属性接口"""
def create(self, request):
""":param request: :return:"""
<|body_0|>
def list(self, request):
""":param request: :return:"""
<|body_1|>
def query_data(self):
""":return:"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k_train_004586 | 2,633 | no_license | [
{
"docstring": ":param request: :return:",
"name": "create",
"signature": "def create(self, request)"
},
{
"docstring": ":param request: :return:",
"name": "list",
"signature": "def list(self, request)"
},
{
"docstring": ":return:",
"name": "query_data",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_002312 | Implement the Python class `ModelAttributeViewSet` described below.
Class description:
获取模型属性接口
Method signatures and docstrings:
- def create(self, request): :param request: :return:
- def list(self, request): :param request: :return:
- def query_data(self): :return: | Implement the Python class `ModelAttributeViewSet` described below.
Class description:
获取模型属性接口
Method signatures and docstrings:
- def create(self, request): :param request: :return:
- def list(self, request): :param request: :return:
- def query_data(self): :return:
<|skeleton|>
class ModelAttributeViewSet:
""... | bdc4b0289b520f433fa9f436067b9f355ac132a0 | <|skeleton|>
class ModelAttributeViewSet:
"""获取模型属性接口"""
def create(self, request):
""":param request: :return:"""
<|body_0|>
def list(self, request):
""":param request: :return:"""
<|body_1|>
def query_data(self):
""":return:"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModelAttributeViewSet:
"""获取模型属性接口"""
def create(self, request):
""":param request: :return:"""
Logger.debug('cmd is get model attribute, method is post.')
response_data = self.query_data()
return Response(json.dumps(response_data), status.HTTP_200_OK)
def list(self, ... | the_stack_v2_python_sparse | gezusercenter/sdk/modelattr_views.py | jiangbingo/usercenter | train | 0 |
33f54f850971a6e9051b931026ab1d7da71d4623 | [
"assert isinstance(model, torch.nn.Module)\nassert str(optimizer_type) in ['Adam', 'Adadelta', 'Adagrad', 'AdamW', 'SparseAdam', 'RMSprop', 'Rprop', 'LBFGS', 'ASGD', 'Adamax']\nself.model_type = model_type\nself.model = model\nself.optimizer_type = optimizer_type\nself.classify = classify\nself.optimizers = {}\nsel... | <|body_start_0|>
assert isinstance(model, torch.nn.Module)
assert str(optimizer_type) in ['Adam', 'Adadelta', 'Adagrad', 'AdamW', 'SparseAdam', 'RMSprop', 'Rprop', 'LBFGS', 'ASGD', 'Adamax']
self.model_type = model_type
self.model = model
self.optimizer_type = optimizer_type
... | Optimizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, ... | stack_v2_sparse_classes_10k_train_004587 | 5,226 | permissive | [
{
"docstring": "Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, latent and classifier. In case of 'lstm', var optimizers is an optimizer for lstm and TimeDis... | 3 | stack_v2_sparse_classes_30k_train_004898 | Implement the Python class `Optimizer` described below.
Class description:
Implement the Optimizer class.
Method signatures and docstrings:
- def __init__(self, model_type, model, optimizer_type, classify=False): Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the mode... | Implement the Python class `Optimizer` described below.
Class description:
Implement the Optimizer class.
Method signatures and docstrings:
- def __init__(self, model_type, model, optimizer_type, classify=False): Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the mode... | d4c5ff32ebdb9ee99a564e61a65dfd2443974a04 | <|skeleton|>
class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, latent and cla... | the_stack_v2_python_sparse | traja/models/optimizers.py | traja-team/traja | train | 73 | |
482bc9c172c73af0f8c321e43a6db2aa9427cdc3 | [
"super(DartsCodec, self).__init__(search_space, **kwargs)\nself.darts_cfg = copy.deepcopy(search_space)\nself.super_net = {'normal': self.darts_cfg.super_network.normal.genotype, 'reduce': self.darts_cfg.super_network.reduce.genotype}\nself.super_net = Config(self.super_net)\nself.steps = self.darts_cfg.super_netwo... | <|body_start_0|>
super(DartsCodec, self).__init__(search_space, **kwargs)
self.darts_cfg = copy.deepcopy(search_space)
self.super_net = {'normal': self.darts_cfg.super_network.normal.genotype, 'reduce': self.darts_cfg.super_network.reduce.genotype}
self.super_net = Config(self.super_net)... | Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace | DartsCodec | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DartsCodec:
"""Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace"""
def __init__(self, search_space=None, **kwargs):
"""Init DartsCodec."""
<|body_0|>
def decode(self, code):
... | stack_v2_sparse_classes_10k_train_004588 | 3,854 | permissive | [
{
"docstring": "Init DartsCodec.",
"name": "__init__",
"signature": "def __init__(self, search_space=None, **kwargs)"
},
{
"docstring": "Decode the code to Network Desc. :param code: input code :type code: 2D array of float :return: network desc :rtype: NetworkDesc",
"name": "decode",
"s... | 3 | stack_v2_sparse_classes_30k_train_006433 | Implement the Python class `DartsCodec` described below.
Class description:
Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init DartsCo... | Implement the Python class `DartsCodec` described below.
Class description:
Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init DartsCo... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class DartsCodec:
"""Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace"""
def __init__(self, search_space=None, **kwargs):
"""Init DartsCodec."""
<|body_0|>
def decode(self, code):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DartsCodec:
"""Class of DARTS codec. :param codec_name: this codec name :type codec_name: str :param search_space: search space :type search_space: SearchSpace"""
def __init__(self, search_space=None, **kwargs):
"""Init DartsCodec."""
super(DartsCodec, self).__init__(search_space, **kwarg... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/darts_cnn/darts_codec.py | Huawei-Ascend/modelzoo | train | 1 |
7e9afd3c65cf321a79d63318681df430ffadeab2 | [
"last_call = last_call or ['', '']\nopts, args = self.parse_options(parameter_s, 'prn:')\ntry:\n filename, lineno, _ = CodeMagics._find_edit_target(self.shell, args, opts, last_call)\nexcept MacroToEdit:\n print('Macro editing not yet implemented in 2-process model.')\n return\nfilename = os.path.abspath(f... | <|body_start_0|>
last_call = last_call or ['', '']
opts, args = self.parse_options(parameter_s, 'prn:')
try:
filename, lineno, _ = CodeMagics._find_edit_target(self.shell, args, opts, last_call)
except MacroToEdit:
print('Macro editing not yet implemented in 2-pro... | Kernel magics. | KernelMagics | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KernelMagics:
"""Kernel magics."""
def edit(self, parameter_s='', last_call=None):
"""Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the command for this editor via the ``TerminalInteractiveShe... | stack_v2_sparse_classes_10k_train_004589 | 24,015 | permissive | [
{
"docstring": "Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the command for this editor via the ``TerminalInteractiveShell.editor`` option in your configuration file before it will work. This command allows you to conv... | 6 | null | Implement the Python class `KernelMagics` described below.
Class description:
Kernel magics.
Method signatures and docstrings:
- def edit(self, parameter_s='', last_call=None): Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the... | Implement the Python class `KernelMagics` described below.
Class description:
Kernel magics.
Method signatures and docstrings:
- def edit(self, parameter_s='', last_call=None): Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class KernelMagics:
"""Kernel magics."""
def edit(self, parameter_s='', last_call=None):
"""Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the command for this editor via the ``TerminalInteractiveShe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KernelMagics:
"""Kernel magics."""
def edit(self, parameter_s='', last_call=None):
"""Bring up an editor and execute the resulting code. Usage: %edit [options] [args] %edit runs an external text editor. You will need to set the command for this editor via the ``TerminalInteractiveShell.editor`` o... | the_stack_v2_python_sparse | contrib/python/ipykernel/py3/ipykernel/zmqshell.py | catboost/catboost | train | 8,012 |
0b32d1905a2ab4c74ce78c77a7fa7f90a4140f32 | [
"if Capability.SHELL not in capability:\n return\nfor fact in pwncat.victim.enumerate.iter(typ='system.user.password'):\n progress.update(task, step=str(fact.data))\n yield Technique(fact.data.user.name, self, fact.data, Capability.SHELL)",
"try:\n pwncat.victim.su(technique.user, technique.ident.pass... | <|body_start_0|>
if Capability.SHELL not in capability:
return
for fact in pwncat.victim.enumerate.iter(typ='system.user.password'):
progress.update(task, step=str(fact.data))
yield Technique(fact.data.user.name, self, fact.data, Capability.SHELL)
<|end_body_0|>
<|bo... | Enumerate passwords seen in the pam_sneaky log | Method | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Method:
"""Enumerate passwords seen in the pam_sneaky log"""
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Enumerate capabilities for this method. :param capability: the requested capabilities :return: a list of techniques implemented by t... | stack_v2_sparse_classes_10k_train_004590 | 1,460 | no_license | [
{
"docstring": "Enumerate capabilities for this method. :param capability: the requested capabilities :return: a list of techniques implemented by this method",
"name": "enumerate",
"signature": "def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]"
},
{
"docstr... | 2 | stack_v2_sparse_classes_30k_train_002879 | Implement the Python class `Method` described below.
Class description:
Enumerate passwords seen in the pam_sneaky log
Method signatures and docstrings:
- def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Enumerate capabilities for this method. :param capability: the requested ca... | Implement the Python class `Method` described below.
Class description:
Enumerate passwords seen in the pam_sneaky log
Method signatures and docstrings:
- def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Enumerate capabilities for this method. :param capability: the requested ca... | 30e084ab6e8c41fa2f0a43b557b308599eb0bdf3 | <|skeleton|>
class Method:
"""Enumerate passwords seen in the pam_sneaky log"""
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Enumerate capabilities for this method. :param capability: the requested capabilities :return: a list of techniques implemented by t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Method:
"""Enumerate passwords seen in the pam_sneaky log"""
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Enumerate capabilities for this method. :param capability: the requested capabilities :return: a list of techniques implemented by this method"""... | the_stack_v2_python_sparse | pwncat/privesc/facts/password.py | tilt41/pwncat | train | 1 |
773807d27a30e542bed433a5aebb0f31ce7e9e22 | [
"if game.num_players() != 2:\n raise ValueError('Game {} does not have {} players.'.format(game, 2))\nassert game.get_type().dynamics == pyspiel.GameType.Dynamics.SEQUENTIAL, \"CFR requires sequential games. If you're trying to run it \" + 'on a simultaneous (or normal-form) game, please first transform it ' + '... | <|body_start_0|>
if game.num_players() != 2:
raise ValueError('Game {} does not have {} players.'.format(game, 2))
assert game.get_type().dynamics == pyspiel.GameType.Dynamics.SEQUENTIAL, "CFR requires sequential games. If you're trying to run it " + 'on a simultaneous (or normal-form) game,... | Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI12-cfrbr.pdf). The algorithm computes an... | CFRBRSolver | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CFRBRSolver:
"""Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI1... | stack_v2_sparse_classes_10k_train_004591 | 5,293 | permissive | [
{
"docstring": "Initializer. Args: game: The `pyspiel.Game` to run on. linear_averaging: Whether to use linear averaging, i.e. cumulative_policy[info_state][action] += ( iteration_number * reach_prob * action_prob) or not: cumulative_policy[info_state][action] += reach_prob * action_prob regret_matching_plus: W... | 3 | null | Implement the Python class `CFRBRSolver` described below.
Class description:
Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://... | Implement the Python class `CFRBRSolver` described below.
Class description:
Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://... | 6f3551fd990053cf2287b380fb9ad0b2a2607c18 | <|skeleton|>
class CFRBRSolver:
"""Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CFRBRSolver:
"""Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI12-cfrbr.pdf).... | the_stack_v2_python_sparse | open_spiel/python/algorithms/cfr_br.py | sarahperrin/open_spiel | train | 3 |
9b8820eec4dbf8634650d9bed86640a09eddf1cc | [
"if word not in before.wv.vocab or word not in after.wv.vocab:\n return 0\nvec1 = before.wv[word] / np.linalg.norm(before.wv[word])\nvec2 = after.wv[word] / np.linalg.norm(after.wv[word])\nsim = vec1.dot(vec2)\nreturn 1 - sim",
"if word not in before.wv.vocab or word not in after.wv.vocab:\n return 0\nnn1 =... | <|body_start_0|>
if word not in before.wv.vocab or word not in after.wv.vocab:
return 0
vec1 = before.wv[word] / np.linalg.norm(before.wv[word])
vec2 = after.wv[word] / np.linalg.norm(after.wv[word])
sim = vec1.dot(vec2)
return 1 - sim
<|end_body_0|>
<|body_start_1|>... | HamiltonMeasures | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :af... | stack_v2_sparse_classes_10k_train_004592 | 2,166 | permissive | [
{
"docstring": "Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :after: gensim.models.Word2Vec embeddings model :word: str word for which t... | 2 | stack_v2_sparse_classes_30k_train_005486 | Implement the Python class `HamiltonMeasures` described below.
Class description:
Implement the HamiltonMeasures class.
Method signatures and docstrings:
- def linguistic_drift(before, after, word): Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddi... | Implement the Python class `HamiltonMeasures` described below.
Class description:
Implement the HamiltonMeasures class.
Method signatures and docstrings:
- def linguistic_drift(before, after, word): Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddi... | 824079b388d0eebc92b2197805b27ed320353f8f | <|skeleton|>
class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :af... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :after: gensim.mo... | the_stack_v2_python_sparse | modules/semshift/measures.py | petershan1119/semantic-progressiveness | train | 0 | |
08e2e20e7b3fa046fc9d926ccfe1d9e4cc8322cb | [
"self.chassis_id = chassis_id\nself.chassis_name = chassis_name\nself.chassis_serial = chassis_serial\nself.location = location\nself.rack_id = rack_id",
"if dictionary is None:\n return None\nchassis_id = dictionary.get('chassisId')\nchassis_name = dictionary.get('chassisName')\nchassis_serial = dictionary.ge... | <|body_start_0|>
self.chassis_id = chassis_id
self.chassis_name = chassis_name
self.chassis_serial = chassis_serial
self.location = location
self.rack_id = rack_id
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
chassis_id = diction... | Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by default. chassis_serial (string): Chassis s... | ChassisInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChassisInfo:
"""Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by defa... | stack_v2_sparse_classes_10k_train_004593 | 2,429 | permissive | [
{
"docstring": "Constructor for the ChassisInfo class",
"name": "__init__",
"signature": "def __init__(self, chassis_id=None, chassis_name=None, chassis_serial=None, location=None, rack_id=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)... | 2 | null | Implement the Python class `ChassisInfo` described below.
Class description:
Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This cou... | Implement the Python class `ChassisInfo` described below.
Class description:
Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This cou... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ChassisInfo:
"""Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by defa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChassisInfo:
"""Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by default. chassis_... | the_stack_v2_python_sparse | cohesity_management_sdk/models/chassis_info.py | cohesity/management-sdk-python | train | 24 |
ed40160de2d4691aa03da5fb8555fa307cb94c40 | [
"menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('Classroom Management')\nself.menu_item_button['command'] = self.get_classroom_challenge_window",
"self.gui.active_window.hide()\nself.associated_window = classroom_management_window.ClassroomManagementWindow(self.gui)\nself.gui.ac... | <|body_start_0|>
menu_item.MenuItem.__init__(self, main_menu, frame)
self.create_menu_item_button('Classroom Management')
self.menu_item_button['command'] = self.get_classroom_challenge_window
<|end_body_0|>
<|body_start_1|>
self.gui.active_window.hide()
self.associated_window =... | This class is used to create a button that will bring the user to the classroom management menu. | ClassroomManagementMenuItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassroomManagementMenuItem:
"""This class is used to create a button that will bring the user to the classroom management menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to a... | stack_v2_sparse_classes_10k_train_004594 | 1,134 | no_license | [
{
"docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window",
"name": "__init__",
"signature": "def __init__(self, main_menu, frame)"
},
{
"docstring": "This function will hide everything on the activ... | 2 | stack_v2_sparse_classes_30k_train_000247 | Implement the Python class `ClassroomManagementMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the classroom management menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the m... | Implement the Python class `ClassroomManagementMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the classroom management menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the m... | e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e | <|skeleton|>
class ClassroomManagementMenuItem:
"""This class is used to create a button that will bring the user to the classroom management menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ClassroomManagementMenuItem:
"""This class is used to create a button that will bring the user to the classroom management menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI'... | the_stack_v2_python_sparse | user_interface/menu_items/classroom_management_menu_item.py | pucheng-tan/WordFlow | train | 0 |
a45bd42e3b29a6af758443782d1d7d411982823b | [
"super(Transformer, self).__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)",
"enc_output = self.encoder(inputs, training, encoder_mask)\n... | <|body_start_0|>
super(Transformer, self).__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)
self.linear = tf.keras.layers.Dense(target_vocab)
<|end_body_0|>
<|body_... | [summary] Args: tf ([type]): [description] | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type... | stack_v2_sparse_classes_10k_train_004595 | 12,086 | no_license | [
{
"docstring": "[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] input_vocab ([type]): [description] target_vocab ([type]): [description] max_seq_input ([type]): [description] max_seq_target ([type]): [description] drop_rate (float, op... | 2 | stack_v2_sparse_classes_30k_train_005743 | Implement the Python class `Transformer` described below.
Class description:
[summary] Args: tf ([type]): [description]
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type... | Implement the Python class `Transformer` described below.
Class description:
[summary] Args: tf ([type]): [description]
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type... | 5f86dee95f4d1c32014d0d74a368f342ff3ce6f7 | <|skeleton|>
class Transformer:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Transformer:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [descript... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer.py | d1sd41n/holbertonschool-machine_learning | train | 0 |
98591d4e7d02f8819aa4aa546c686af5b7beca18 | [
"head, tail = ntpath.split(source)\n\ndef remove_ending(file):\n return os.path.splitext(file)[0]\nreturn remove_ending(tail) or remove_ending(ntpath.basename(head))",
"with open(source) as data_file:\n data = json.load(data_file, encoding='utf-8', object_pairs_hook=OrderedDict)\n events = []\n metada... | <|body_start_0|>
head, tail = ntpath.split(source)
def remove_ending(file):
return os.path.splitext(file)[0]
return remove_ending(tail) or remove_ending(ntpath.basename(head))
<|end_body_0|>
<|body_start_1|>
with open(source) as data_file:
data = json.load(data_... | Converts event data provided by Facebook's Graph API into CSV format | EventJsonToCsv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventJsonToCsv:
"""Converts event data provided by Facebook's Graph API into CSV format"""
def strip_file(self, source):
"""Removes the path and file extension from a given filepath :param source: The path of the file :return: The filename without any path info or file extension"""
... | stack_v2_sparse_classes_10k_train_004596 | 2,947 | no_license | [
{
"docstring": "Removes the path and file extension from a given filepath :param source: The path of the file :return: The filename without any path info or file extension",
"name": "strip_file",
"signature": "def strip_file(self, source)"
},
{
"docstring": "Does the actual conversion Takes a .j... | 2 | stack_v2_sparse_classes_30k_train_003713 | Implement the Python class `EventJsonToCsv` described below.
Class description:
Converts event data provided by Facebook's Graph API into CSV format
Method signatures and docstrings:
- def strip_file(self, source): Removes the path and file extension from a given filepath :param source: The path of the file :return: ... | Implement the Python class `EventJsonToCsv` described below.
Class description:
Converts event data provided by Facebook's Graph API into CSV format
Method signatures and docstrings:
- def strip_file(self, source): Removes the path and file extension from a given filepath :param source: The path of the file :return: ... | 8bfd6ce8e27d61f429955614dbbdccf93f9dc817 | <|skeleton|>
class EventJsonToCsv:
"""Converts event data provided by Facebook's Graph API into CSV format"""
def strip_file(self, source):
"""Removes the path and file extension from a given filepath :param source: The path of the file :return: The filename without any path info or file extension"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EventJsonToCsv:
"""Converts event data provided by Facebook's Graph API into CSV format"""
def strip_file(self, source):
"""Removes the path and file extension from a given filepath :param source: The path of the file :return: The filename without any path info or file extension"""
head, ... | the_stack_v2_python_sparse | Social/facebookCrawler/EventJsonToCsv.py | CUTLER-H2020/DataCrawlers | train | 3 |
ad43de3c5a81158d7d4c73d6f0fd37f197c70c2f | [
"df = df.reset_index(drop=True)\nfor i in range(len(df)):\n feature = df.loc[i, 'column_name']\n df.loc[i, 'original_name'] = '_'.join(str(feature).split('_')[:-1])\n df.loc[i, 'binning_method'] = 'ChiMerge' if 'ChiMerge' in feature.split('_')[-1] else 'DecisionTree'\n df.loc[i, 'binning_number'] = feat... | <|body_start_0|>
df = df.reset_index(drop=True)
for i in range(len(df)):
feature = df.loc[i, 'column_name']
df.loc[i, 'original_name'] = '_'.join(str(feature).split('_')[:-1])
df.loc[i, 'binning_method'] = 'ChiMerge' if 'ChiMerge' in feature.split('_')[-1] else 'Decis... | 功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集 | FeatureSelectionByMonotonicityRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureSelectionByMonotonicityRule:
"""功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集"""
def _filter_data(self, df):
"""保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则"""
<|body_0|>
def fit(self, df):
"""单调性判断服务 :param df: 单... | stack_v2_sparse_classes_10k_train_004597 | 32,082 | no_license | [
{
"docstring": "保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则",
"name": "_filter_data",
"signature": "def _filter_data(self, df)"
},
{
"docstring": "单调性判断服务 :param df: 单调性判断输入数据 :return: 具有单调性的编码规则",
"name": "fit",
"signature": "def fit(self, df)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002660 | Implement the Python class `FeatureSelectionByMonotonicityRule` described below.
Class description:
功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集
Method signatures and docstrings:
- def _filter_data(self, df): 保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则
- def fit(self, df):... | Implement the Python class `FeatureSelectionByMonotonicityRule` described below.
Class description:
功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集
Method signatures and docstrings:
- def _filter_data(self, df): 保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则
- def fit(self, df):... | 47c95814d2bfcaf1f30cb892db0d09c8c88901e7 | <|skeleton|>
class FeatureSelectionByMonotonicityRule:
"""功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集"""
def _filter_data(self, df):
"""保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则"""
<|body_0|>
def fit(self, df):
"""单调性判断服务 :param df: 单... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FeatureSelectionByMonotonicityRule:
"""功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集"""
def _filter_data(self, df):
"""保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则"""
df = df.reset_index(drop=True)
for i in range(len(df)):
fea... | the_stack_v2_python_sparse | mldesigntoolkit/mldesigntoolkit/modules/feature_engineering/_feature_select.py | Stormzqz/py | train | 0 |
16235eb9555ab1833087ca6d9798d2f0cca5f3ef | [
"logging.debug('get sensor: %d' % id)\nbuffer = self._app.getSensor(id)\nreturn str('return from get id=%d: %s' % (id, buffer))",
"if type != None:\n logging.info('set type: %s on id: %d' % (type, id))\n self._app.setSensorType(id, int(type))\nelse:\n type = request.args.get('type')\n if type == None:... | <|body_start_0|>
logging.debug('get sensor: %d' % id)
buffer = self._app.getSensor(id)
return str('return from get id=%d: %s' % (id, buffer))
<|end_body_0|>
<|body_start_1|>
if type != None:
logging.info('set type: %s on id: %d' % (type, id))
self._app.setSensorT... | Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type | SensorsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SensorsView:
"""Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type"""
def get(self, id):
"""Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str"""
<|body_0|>
def put(self, id, type=None):
... | stack_v2_sparse_classes_10k_train_004598 | 7,133 | permissive | [
{
"docstring": "Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Change a sensor type. ** PUT ** to change the sensors type. Give type in url or as query_string. :param int id: n... | 2 | stack_v2_sparse_classes_30k_train_002706 | Implement the Python class `SensorsView` described below.
Class description:
Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type
Method signatures and docstrings:
- def get(self, id): Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str
- def ... | Implement the Python class `SensorsView` described below.
Class description:
Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type
Method signatures and docstrings:
- def get(self, id): Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str
- def ... | f661c8767f819490e170a2cd80f82716301cec65 | <|skeleton|>
class SensorsView:
"""Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type"""
def get(self, id):
"""Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str"""
<|body_0|>
def put(self, id, type=None):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SensorsView:
"""Sensor class. ** GET ** to read the sensor state ** PUT ** change the sensor type"""
def get(self, id):
"""Read a sensor. ** GET ** to read the sensors value. :param int id: number of channel returns: str"""
logging.debug('get sensor: %d' % id)
buffer = self._app.g... | the_stack_v2_python_sparse | RaspberryPi/scripts/WebService.py | janhieber/WaterCtrl | train | 6 |
f369361458e8d09d77cb6de7e00b2c3fa21f10c7 | [
"def doneTryingToConnect(success, callID):\n if success:\n callID.cancel()\n q = cls.q = queue.AsynchronousQueue()\n q.startup()\n cls.fpCommand = cls.factory.p.command\n cls.checkers = []\n else:\n cls.factory.stopTrying()\n return success\nif not isinstance(secre... | <|body_start_0|>
def doneTryingToConnect(success, callID):
if success:
callID.cancel()
q = cls.q = queue.AsynchronousQueue()
q.startup()
cls.fpCommand = cls.factory.p.command
cls.checkers = []
else:
... | I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances. | Client | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
"""I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances."""
def startup(cls, host, port, secret, timeout=10, SSL=False):
"""Starts up an authenticated network connection to the server at I{host:por... | stack_v2_sparse_classes_10k_train_004599 | 8,584 | no_license | [
{
"docstring": "Starts up an authenticated network connection to the server at I{host:port}, using the specified shared I{secret}. The I{secret} must be a string, the longer and more implausible (i.e., higher entropy) the better. If there are security concerns about transmitting the shared secret and data in th... | 3 | null | Implement the Python class `Client` described below.
Class description:
I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances.
Method signatures and docstrings:
- def startup(cls, host, port, secret, timeout=10, SSL=False): Starts up an aut... | Implement the Python class `Client` described below.
Class description:
I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances.
Method signatures and docstrings:
- def startup(cls, host, port, secret, timeout=10, SSL=False): Starts up an aut... | b93e3e957ff1da5b020075574942913c8822d12a | <|skeleton|>
class Client:
"""I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances."""
def startup(cls, host, port, secret, timeout=10, SSL=False):
"""Starts up an authenticated network connection to the server at I{host:por... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Client:
"""I am a base class that manages a single TCP or SSL connection to a remote data source. The connection serves all subclass instances."""
def startup(cls, host, port, secret, timeout=10, SSL=False):
"""Starts up an authenticated network connection to the server at I{host:port}, using the... | the_stack_v2_python_sparse | tums/trunk/etch-release/sasync/datacator/client.py | calston/tums | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.