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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dcad37a8101e1054ceb0404e5dcec42041a1f2a3 | [
"BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)\nself.veh_id = veh_id\nself.v_max = v_max\nself.alpha = alpha\nself.beta = beta\nself.h_st = h_st\nself.h_go = h_go",
"lead_id = env.k.vehicle.get_leader(self.veh_id)\nif not lead_id:\n return self.... | <|body_start_0|>
BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)
self.veh_id = veh_id
self.v_max = v_max
self.alpha = alpha
self.beta = beta
self.h_st = h_st
self.h_go = h_go
<|end_body_0|>
<|body_st... | Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha : float gain on desired velocity to current velocity difference (default: 0.6) b... | OVMController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OVMController:
"""Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha : float gain on desired velocity to cur... | stack_v2_sparse_classes_10k_train_000300 | 17,548 | permissive | [
{
"docstring": "Instantiate an Optimal Vehicle Model controller.",
"name": "__init__",
"signature": "def __init__(self, veh_id, car_following_params, alpha=1, beta=1, h_st=2, h_go=15, v_max=30, time_delay=0, noise=0, fail_safe=None)"
},
{
"docstring": "See parent class.",
"name": "get_accel"... | 2 | stack_v2_sparse_classes_30k_train_003480 | Implement the Python class `OVMController` described below.
Class description:
Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha ... | Implement the Python class `OVMController` described below.
Class description:
Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha ... | badac3da17f04d8d8ae5691ee8ba2af9d56fac35 | <|skeleton|>
class OVMController:
"""Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha : float gain on desired velocity to cur... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OVMController:
"""Optimal Vehicle Model controller. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class alpha : float gain on desired velocity to current velocity... | the_stack_v2_python_sparse | flow/controllers/car_following_models.py | parthjaggi/flow | train | 6 |
60a8bfa46dba2751843c39ddb6b0856a402f1309 | [
"result = python_print(3)\nself.assertEquals(result, '123')\nreturn",
"result = python_print(5)\nself.assertEquals(result, '12345')\nreturn"
] | <|body_start_0|>
result = python_print(3)
self.assertEquals(result, '123')
return
<|end_body_0|>
<|body_start_1|>
result = python_print(5)
self.assertEquals(result, '12345')
return
<|end_body_1|>
| Description | TestPythonPrint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPythonPrint:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
<|body_0|>
def test_hackerrank_sample2(self):
"""Verify provided test case."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = python_pr... | stack_v2_sparse_classes_10k_train_000301 | 570 | no_license | [
{
"docstring": "Verify provided test case.",
"name": "test_hackerrank_sample1",
"signature": "def test_hackerrank_sample1(self)"
},
{
"docstring": "Verify provided test case.",
"name": "test_hackerrank_sample2",
"signature": "def test_hackerrank_sample2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000835 | Implement the Python class `TestPythonPrint` described below.
Class description:
Description
Method signatures and docstrings:
- def test_hackerrank_sample1(self): Verify provided test case.
- def test_hackerrank_sample2(self): Verify provided test case. | Implement the Python class `TestPythonPrint` described below.
Class description:
Description
Method signatures and docstrings:
- def test_hackerrank_sample1(self): Verify provided test case.
- def test_hackerrank_sample2(self): Verify provided test case.
<|skeleton|>
class TestPythonPrint:
"""Description"""
... | fcf3755b62fe0644af763875e3a00be962941a6d | <|skeleton|>
class TestPythonPrint:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
<|body_0|>
def test_hackerrank_sample2(self):
"""Verify provided test case."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPythonPrint:
"""Description"""
def test_hackerrank_sample1(self):
"""Verify provided test case."""
result = python_print(3)
self.assertEquals(result, '123')
return
def test_hackerrank_sample2(self):
"""Verify provided test case."""
result = python_... | the_stack_v2_python_sparse | python3/python_print/test_python_print.py | ayazhemani/hackerrank-py | train | 0 |
1eb76ce3da77c8d9e57f2a7dee93307b98ed617d | [
"if not nums:\n return 1\nn = len(nums)\nprint(n)\nfor i, num in enumerate(nums):\n while 0 < nums[i] <= n and nums[i] != nums[nums[i] - 1]:\n nums[nums[i] - 1], nums[i] = (nums[i], nums[nums[i] - 1])\n print(nums)\nfor i, num in enumerate(nums):\n if num != i + 1:\n return i + 1\nreturn n... | <|body_start_0|>
if not nums:
return 1
n = len(nums)
print(n)
for i, num in enumerate(nums):
while 0 < nums[i] <= n and nums[i] != nums[nums[i] - 1]:
nums[nums[i] - 1], nums[i] = (nums[i], nums[nums[i] - 1])
print(nums)
for i, n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def firstMissingPositiveEasyUnderstand(self, nums):
""":type nums: List[int] :rtype: int 1. for any array whose length is l, the first missing positive must be in range... | stack_v2_sparse_classes_10k_train_000302 | 2,537 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "firstMissingPositive",
"signature": "def firstMissingPositive(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int 1. for any array whose length is l, the first missing positive must be in range [1,...,l+1], so we only hav... | 2 | stack_v2_sparse_classes_30k_val_000200 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def firstMissingPositiveEasyUnderstand(self, nums): :type nums: List[int] :rtype: int 1. for any array w... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def firstMissingPositiveEasyUnderstand(self, nums): :type nums: List[int] :rtype: int 1. for any array w... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def firstMissingPositiveEasyUnderstand(self, nums):
""":type nums: List[int] :rtype: int 1. for any array whose length is l, the first missing positive must be in range... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 1
n = len(nums)
print(n)
for i, num in enumerate(nums):
while 0 < nums[i] <= n and nums[i] != nums[nums[i] - 1]:
nums[nums... | the_stack_v2_python_sparse | F/FirstMissingPositive.py | bssrdf/pyleet | train | 2 | |
cd6b3db956ce3f23bb665fe90e3dcccc7a8b1fc9 | [
"data = []\nif not root:\n return data\ncur = [root]\nwhile cur:\n next = []\n for node in cur:\n if node:\n data.append(node.val)\n next.append(node.left)\n next.append(node.right)\n else:\n data.append(None)\n cur = next\nreturn data",
"if no... | <|body_start_0|>
data = []
if not root:
return data
cur = [root]
while cur:
next = []
for node in cur:
if node:
data.append(node.val)
next.append(node.left)
next.append(node.ri... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_000303 | 2,776 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 2df1a58aa9474f2ecec2ee7c45ebf12466181391 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
data = []
if not root:
return data
cur = [root]
while cur:
next = []
for node in cur:
if node:
... | the_stack_v2_python_sparse | SerializeAndDeserializeBinaryTree.py | zjuzpz/Algorithms | train | 2 | |
5e487f6d77b5629efb1084439719aca626b42be6 | [
"self.profiling_parameters = {}\nself._use_default_metrics_configs = False\nself._use_one_config_for_all_metrics = False\nself._use_custom_metrics_configs = False\nself._process_trace_file_parameters(local_path, file_max_size, file_close_interval, file_open_fail_threshold)\nuse_custom_metrics_configs = self._proces... | <|body_start_0|>
self.profiling_parameters = {}
self._use_default_metrics_configs = False
self._use_one_config_for_all_metrics = False
self._use_custom_metrics_configs = False
self._process_trace_file_parameters(local_path, file_max_size, file_close_interval, file_open_fail_thres... | Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig`, :class:`~sagemaker.debugger.metrics_config.DataloaderProfiling... | FrameworkProfile | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrameworkProfile:
"""Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig`, :class:`~sagemaker... | stack_v2_sparse_classes_10k_train_000304 | 12,642 | permissive | [
{
"docstring": "Initialize the FrameworkProfile class object. Args: detailed_profiling_config (DetailedProfilingConfig): The configuration for detailed profiling. Configure it using the :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig` class. Pass ``DetailedProfilingConfig()`` to use the defau... | 5 | stack_v2_sparse_classes_30k_train_000481 | Implement the Python class `FrameworkProfile` described below.
Class description:
Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.Detai... | Implement the Python class `FrameworkProfile` described below.
Class description:
Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.Detai... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class FrameworkProfile:
"""Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig`, :class:`~sagemaker... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrameworkProfile:
"""Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: :class:`~sagemaker.debugger.metrics_config.DetailedProfilingConfig`, :class:`~sagemaker.debugger.met... | the_stack_v2_python_sparse | src/sagemaker/debugger/framework_profile.py | aws/sagemaker-python-sdk | train | 2,050 |
fc6bd61e293ec0c389a6b1539fe2afc611cf4f9f | [
"super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'], 'MadSpin', 'madspin')\nself.add_keyword('alphaem_inv')\nself.add_keyword('alphaqcd')\nself.add_keyword('BR_t_to_Wb')\nself.add_keyword('BR_t_to_Wd')\nself.add_keyword('BR_t_to_Ws')\nself.add_keyword('BR_W_to_hadrons')\nself.add_keyword('BR_W_t... | <|body_start_0|>
super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'], 'MadSpin', 'madspin')
self.add_keyword('alphaem_inv')
self.add_keyword('alphaqcd')
self.add_keyword('BR_t_to_Wb')
self.add_keyword('BR_t_to_Wd')
self.add_keyword('BR_t_to_Ws')
... | ! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch> | ExternalMadSpin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalMadSpin:
"""! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>"""
def __init__(self, process):
"""! Constructor. @param process MadSpin process description string."""
<|body_0|>
def needs_scheduling(self, process):
... | stack_v2_sparse_classes_10k_train_000305 | 3,129 | no_license | [
{
"docstring": "! Constructor. @param process MadSpin process description string.",
"name": "__init__",
"signature": "def __init__(self, process)"
},
{
"docstring": "! Report whether the MadSpin process should be scheduled. @param process PowhegBox process.",
"name": "needs_scheduling",
... | 2 | null | Implement the Python class `ExternalMadSpin` described below.
Class description:
! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>
Method signatures and docstrings:
- def __init__(self, process): ! Constructor. @param process MadSpin process description string.
- def needs_... | Implement the Python class `ExternalMadSpin` described below.
Class description:
! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>
Method signatures and docstrings:
- def __init__(self, process): ! Constructor. @param process MadSpin process description string.
- def needs_... | 22df23187ef85e9c3120122c8375ea0e7d8ea440 | <|skeleton|>
class ExternalMadSpin:
"""! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>"""
def __init__(self, process):
"""! Constructor. @param process MadSpin process description string."""
<|body_0|>
def needs_scheduling(self, process):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExternalMadSpin:
"""! Class for running external MadSpin process. @author James Robinson <james.robinson@cern.ch>"""
def __init__(self, process):
"""! Constructor. @param process MadSpin process description string."""
super(ExternalMadSpin, self).__init__('MadSpin', os.environ['MADPATH'],... | the_stack_v2_python_sparse | athena/Generators/PowhegControl/python/processes/external/external_madspin.py | rushioda/PIXELVALID_athena | train | 1 |
5f0ff1eaf11698158d404e3a5d1565c841b9709f | [
"nums = sorted(nums)\nresult = []\nfor i in range(len(nums)):\n current = nums[i]\n two_sum = self.twoSum(nums, 0 - current, i)\n if two_sum:\n for ts in two_sum:\n ans = sorted([current] + ts)\n if ans not in result:\n result.append(ans)\nreturn sorted(result)",... | <|body_start_0|>
nums = sorted(nums)
result = []
for i in range(len(nums)):
current = nums[i]
two_sum = self.twoSum(nums, 0 - current, i)
if two_sum:
for ts in two_sum:
ans = sorted([current] + ts)
if ans... | Solution_E | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_E:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
<|body_0|>
def twoSum(self, numbers: List[int], target: int, jump: in... | stack_v2_sparse_classes_10k_train_000306 | 8,683 | permissive | [
{
"docstring": "Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded",
"name": "threeSum",
"signature": "def threeSum(self, nums: List[int]) -> List[List[int]]"
},
{
"docstring": "Helper E # 提取LC167 two sum II 中的头尾缩进法... | 2 | null | Implement the Python class `Solution_E` described below.
Class description:
Implement the Solution_E class.
Method signatures and docstrings:
- def threeSum(self, nums: List[int]) -> List[List[int]]: Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time l... | Implement the Python class `Solution_E` described below.
Class description:
Implement the Solution_E class.
Method signatures and docstrings:
- def threeSum(self, nums: List[int]) -> List[List[int]]: Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time l... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution_E:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
<|body_0|>
def twoSum(self, numbers: List[int], target: int, jump: in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution_E:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Use modified method of two_sum with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
nums = sorted(nums)
result = []
for i in range(len(nums)):
c... | the_stack_v2_python_sparse | LeetCode/LC015_3sum.py | jxie0755/Learning_Python | train | 0 | |
f427e5f233acc3fcffc6a443685c0fa49495051c | [
"self._generator = generator\nself._node = node\nself._input_port = input_port\nself._output_port = output_port",
"chunk_size = chunk_size or len(self._generator._data)\nend_of_data = False\noutput_data = []\noutput_meta = []\nwhile not end_of_data:\n self._node.clear()\n chunk = self._generator.next(chunk_... | <|body_start_0|>
self._generator = generator
self._node = node
self._input_port = input_port
self._output_port = output_port
<|end_body_0|>
<|body_start_1|>
chunk_size = chunk_size or len(self._generator._data)
end_of_data = False
output_data = []
output_... | Mimics the scheduler behavior to allow testing the output of a node offline. | Looper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a ... | stack_v2_sparse_classes_10k_train_000307 | 5,655 | permissive | [
{
"docstring": "Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a method `next` and `reset`",
"name": "__init__",
"signature": "def __init__(self, generator, node, input_port='i', output_port='o')"
},
{
"docstring": "Loop acro... | 2 | stack_v2_sparse_classes_30k_train_002152 | Implement the Python class `Looper` described below.
Class description:
Mimics the scheduler behavior to allow testing the output of a node offline.
Method signatures and docstrings:
- def __init__(self, generator, node, input_port='i', output_port='o'): Initialize the helper :param generator (Node): timeflux node to... | Implement the Python class `Looper` described below.
Class description:
Mimics the scheduler behavior to allow testing the output of a node offline.
Method signatures and docstrings:
- def __init__(self, generator, node, input_port='i', output_port='o'): Initialize the helper :param generator (Node): timeflux node to... | 55ccae74b5eb99504b3aa715ffa394b7716884b2 | <|skeleton|>
class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Looper:
"""Mimics the scheduler behavior to allow testing the output of a node offline."""
def __init__(self, generator, node, input_port='i', output_port='o'):
"""Initialize the helper :param generator (Node): timeflux node to test :param data (Object): data generator object with a method `next`... | the_stack_v2_python_sparse | timeflux/helpers/testing.py | timeflux/timeflux | train | 163 |
f9039aad991f10d03b78309a8bed6716e981be46 | [
"this_mask_matrix, this_heating_rate_matrix_k_day01 = heating_rate_interp._find_local_maxima(orig_heating_rate_matrix_k_day01=ORIG_HEATING_RATE_MATRIX_K_DAY01, orig_heights_m_agl=ORIG_HEIGHTS_METRES, new_heights_m_agl=FIRST_NEW_HEIGHTS_METRES, half_window_size_px=HALF_WINDOW_SIZE_PX)\nself.assertTrue(numpy.array_eq... | <|body_start_0|>
this_mask_matrix, this_heating_rate_matrix_k_day01 = heating_rate_interp._find_local_maxima(orig_heating_rate_matrix_k_day01=ORIG_HEATING_RATE_MATRIX_K_DAY01, orig_heights_m_agl=ORIG_HEIGHTS_METRES, new_heights_m_agl=FIRST_NEW_HEIGHTS_METRES, half_window_size_px=HALF_WINDOW_SIZE_PX)
sel... | Each method is a unit test for heating_rate_interp.py. | HeatingRateInterpTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HeatingRateInterpTests:
"""Each method is a unit test for heating_rate_interp.py."""
def test_find_local_maxima_first(self):
"""Ensures correct output from _find_local_maxima. In this case, using first set of inputs."""
<|body_0|>
def test_find_local_maxima_second(self):... | stack_v2_sparse_classes_10k_train_000308 | 3,349 | no_license | [
{
"docstring": "Ensures correct output from _find_local_maxima. In this case, using first set of inputs.",
"name": "test_find_local_maxima_first",
"signature": "def test_find_local_maxima_first(self)"
},
{
"docstring": "Ensures correct output from _find_local_maxima. In this case, using second s... | 2 | stack_v2_sparse_classes_30k_train_005693 | Implement the Python class `HeatingRateInterpTests` described below.
Class description:
Each method is a unit test for heating_rate_interp.py.
Method signatures and docstrings:
- def test_find_local_maxima_first(self): Ensures correct output from _find_local_maxima. In this case, using first set of inputs.
- def test... | Implement the Python class `HeatingRateInterpTests` described below.
Class description:
Each method is a unit test for heating_rate_interp.py.
Method signatures and docstrings:
- def test_find_local_maxima_first(self): Ensures correct output from _find_local_maxima. In this case, using first set of inputs.
- def test... | 517d7cb2008a0ff06014c81e158c13bf8e17590a | <|skeleton|>
class HeatingRateInterpTests:
"""Each method is a unit test for heating_rate_interp.py."""
def test_find_local_maxima_first(self):
"""Ensures correct output from _find_local_maxima. In this case, using first set of inputs."""
<|body_0|>
def test_find_local_maxima_second(self):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HeatingRateInterpTests:
"""Each method is a unit test for heating_rate_interp.py."""
def test_find_local_maxima_first(self):
"""Ensures correct output from _find_local_maxima. In this case, using first set of inputs."""
this_mask_matrix, this_heating_rate_matrix_k_day01 = heating_rate_int... | the_stack_v2_python_sparse | ml4rt/utils/heating_rate_interp_test.py | thunderhoser/ml4rt | train | 4 |
32c1f8165b7b3bf2fdca7817fafe338859533daa | [
"@lru_cache(None)\ndef dp(i, j):\n if i == len(text1) or j == len(text2):\n return 0\n if text1[i] == text2[j]:\n return 1 + dp(i + 1, j + 1)\n return max(dp(i + 1, j), dp(i, j + 1))\nreturn dp(0, 0)",
"pre = [0] * (len(text2) + 1)\nfor i in range(len(text1)):\n cur = [0] * (len(text2) +... | <|body_start_0|>
@lru_cache(None)
def dp(i, j):
if i == len(text1) or j == len(text2):
return 0
if text1[i] == text2[j]:
return 1 + dp(i + 1, j + 1)
return max(dp(i + 1, j), dp(i, j + 1))
return dp(0, 0)
<|end_body_0|>
<|body_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
"""Oct 11, 2021 09:07"""
<|body_0|>
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
"""Oct 11, 2021 09:15"""
<|body_1|>
def longestCommonSubsequence(self, tex... | stack_v2_sparse_classes_10k_train_000309 | 2,702 | no_license | [
{
"docstring": "Oct 11, 2021 09:07",
"name": "longestCommonSubsequence",
"signature": "def longestCommonSubsequence(self, text1: str, text2: str) -> int"
},
{
"docstring": "Oct 11, 2021 09:15",
"name": "longestCommonSubsequence",
"signature": "def longestCommonSubsequence(self, text1: st... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonSubsequence(self, text1: str, text2: str) -> int: Oct 11, 2021 09:07
- def longestCommonSubsequence(self, text1: str, text2: str) -> int: Oct 11, 2021 09:15
- de... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonSubsequence(self, text1: str, text2: str) -> int: Oct 11, 2021 09:07
- def longestCommonSubsequence(self, text1: str, text2: str) -> int: Oct 11, 2021 09:15
- de... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
"""Oct 11, 2021 09:07"""
<|body_0|>
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
"""Oct 11, 2021 09:15"""
<|body_1|>
def longestCommonSubsequence(self, tex... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
"""Oct 11, 2021 09:07"""
@lru_cache(None)
def dp(i, j):
if i == len(text1) or j == len(text2):
return 0
if text1[i] == text2[j]:
return 1 + dp(i + 1, j +... | the_stack_v2_python_sparse | leetcode/solved/1250_Longest_Common_Subsequence/solution.py | sungminoh/algorithms | train | 0 | |
909682b53f3183c561aa0ced34e09240014b39fb | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Task()",
"from ..entity import Entity\nfrom ..key_value_pair import KeyValuePair\nfrom .lifecycle_task_category import LifecycleTaskCategory\nfrom .task_processing_result import TaskProcessingResult\nfrom ..entity import Entity\nfrom .... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Task()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from ..key_value_pair import KeyValuePair
from .lifecycle_task_category import LifecycleTaskCategory
fr... | Task | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Task:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task:
"""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: Task"""
... | stack_v2_sparse_classes_10k_train_000310 | 5,225 | 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: Task",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(parse_no... | 3 | null | Implement the Python class `Task` described below.
Class description:
Implement the Task class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | Implement the Python class `Task` described below.
Class description:
Implement the Task class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Task:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task:
"""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: Task"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Task:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Task:
"""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: Task"""
if not parse_n... | the_stack_v2_python_sparse | msgraph/generated/models/identity_governance/task.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
31d65fcd7da6bc1410e551274af92dd77be12504 | [
"if not v.exists():\n raise ValueError(f'Path object not found in filesystem : {v}')\nreturn v",
"configs = [c.config for c in values.get('configs')]\nfor test in values.get('tests'):\n if test.config not in configs:\n raise ValueError(f\"Test '{test.test}' gave the config '{test.config}', but this c... | <|body_start_0|>
if not v.exists():
raise ValueError(f'Path object not found in filesystem : {v}')
return v
<|end_body_0|>
<|body_start_1|>
configs = [c.config for c in values.get('configs')]
for test in values.get('tests'):
if test.config not in configs:
... | Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk representation of this file is slightly-different to the validation schema defined h... | DirectedTestsYaml | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DirectedTestsYaml:
"""Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk representation of this file is slightly... | stack_v2_sparse_classes_10k_train_000311 | 7,812 | permissive | [
{
"docstring": "Check that the yaml file exists on disk. This field needs its own validator, as other files are checked relative to the yaml file.",
"name": "yaml_file_must_exist",
"signature": "def yaml_file_must_exist(cls, v: pathlib.Path)"
},
{
"docstring": "Check that if a test specifies a c... | 3 | stack_v2_sparse_classes_30k_train_003855 | Implement the Python class `DirectedTestsYaml` described below.
Class description:
Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk ... | Implement the Python class `DirectedTestsYaml` described below.
Class description:
Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk ... | 51f6017b8425b14d5a4aa9abace8fe5a25ef08c8 | <|skeleton|>
class DirectedTestsYaml:
"""Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk representation of this file is slightly... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DirectedTestsYaml:
"""Represent the schema for the <directed-tests>.yaml file. The file on-disk should be of the form... - A flat list of both DConfig and DTest items - Each DTest must specify an existing DConfig item with the key 'config' Note that on-disk representation of this file is slightly-different to... | the_stack_v2_python_sparse | hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/scripts/directed_test_schema.py | lowRISC/opentitan | train | 2,077 |
b09f5b6ac8541bdbcf6f101213fc90d4c782f7b1 | [
"self.root = rootnode\nself.disable = 0\nself.emittedNoHandlerWarning = 0\nself.loggerDict = {}",
"rv = None\nif name in self.loggerDict:\n rv = self.loggerDict[name]\n if isinstance(rv, PlaceHolder):\n ph = rv\n rv = Logger(name)\n rv.manager = self\n self.loggerDict[name] = rv\... | <|body_start_0|>
self.root = rootnode
self.disable = 0
self.emittedNoHandlerWarning = 0
self.loggerDict = {}
<|end_body_0|>
<|body_start_1|>
rv = None
if name in self.loggerDict:
rv = self.loggerDict[name]
if isinstance(rv, PlaceHolder):
... | Manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
<|body_0|>
def getLogger(self, name):
"""Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separ... | stack_v2_sparse_classes_10k_train_000312 | 9,892 | no_license | [
{
"docstring": "Initialize the manager with the root node of the logger hierarchy.",
"name": "__init__",
"signature": "def __init__(self, rootnode)"
},
{
"docstring": "Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separated hierarchi... | 4 | stack_v2_sparse_classes_30k_train_001253 | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, rootnode): Initialize the manager with the root node of the logger hierarchy.
- def getLogger(self, name): Get a logger with the specified name (channel name), c... | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, rootnode): Initialize the manager with the root node of the logger hierarchy.
- def getLogger(self, name): Get a logger with the specified name (channel name), c... | 0d4f142e72238c7919e665f071536990d820c7c3 | <|skeleton|>
class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
<|body_0|>
def getLogger(self, name):
"""Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
self.root = rootnode
self.disable = 0
self.emittedNoHandlerWarning = 0
self.loggerDict = {}
def getLogger(self, name):
"""Get a logger with the s... | the_stack_v2_python_sparse | OOP-pattern/behavior.py | huxt2014/python-examples | train | 0 | |
744b85f377a0d84048fbf5c614a594194706623f | [
"processed = 0\nfor net in queryset:\n net.AddDomains(1)\n processed += 1\nself.message_user(request, '%s added.' % GetMessageBit(processed))",
"processed = 0\nfor net in queryset:\n net.AddDomains()\n processed += 1\nself.message_user(request, '%s processed.' % GetMessageBit(processed))",
"processe... | <|body_start_0|>
processed = 0
for net in queryset:
net.AddDomains(1)
processed += 1
self.message_user(request, '%s added.' % GetMessageBit(processed))
<|end_body_0|>
<|body_start_1|>
processed = 0
for net in queryset:
net.AddDomains()
... | NetAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetAdmin:
def AddDomains(self, request, queryset):
"""Добавляем в сеть один домен"""
<|body_0|>
def AddDomainsAll(self, request, queryset):
"""Добавляем в сеть один домен"""
<|body_1|>
def GenerateDoorways(self, request, queryset):
"""Генерируем ... | stack_v2_sparse_classes_10k_train_000313 | 29,849 | no_license | [
{
"docstring": "Добавляем в сеть один домен",
"name": "AddDomains",
"signature": "def AddDomains(self, request, queryset)"
},
{
"docstring": "Добавляем в сеть один домен",
"name": "AddDomainsAll",
"signature": "def AddDomainsAll(self, request, queryset)"
},
{
"docstring": "Генери... | 6 | stack_v2_sparse_classes_30k_train_001176 | Implement the Python class `NetAdmin` described below.
Class description:
Implement the NetAdmin class.
Method signatures and docstrings:
- def AddDomains(self, request, queryset): Добавляем в сеть один домен
- def AddDomainsAll(self, request, queryset): Добавляем в сеть один домен
- def GenerateDoorways(self, reques... | Implement the Python class `NetAdmin` described below.
Class description:
Implement the NetAdmin class.
Method signatures and docstrings:
- def AddDomains(self, request, queryset): Добавляем в сеть один домен
- def AddDomainsAll(self, request, queryset): Добавляем в сеть один домен
- def GenerateDoorways(self, reques... | d2771bf04aa187dda6d468883a5a167237589369 | <|skeleton|>
class NetAdmin:
def AddDomains(self, request, queryset):
"""Добавляем в сеть один домен"""
<|body_0|>
def AddDomainsAll(self, request, queryset):
"""Добавляем в сеть один домен"""
<|body_1|>
def GenerateDoorways(self, request, queryset):
"""Генерируем ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NetAdmin:
def AddDomains(self, request, queryset):
"""Добавляем в сеть один домен"""
processed = 0
for net in queryset:
net.AddDomains(1)
processed += 1
self.message_user(request, '%s added.' % GetMessageBit(processed))
def AddDomainsAll(self, reque... | the_stack_v2_python_sparse | doorsadmin/admin.py | cash2one/doorscenter | train | 0 | |
ba27a28459cec5d4cb0e1625216740d6beb93efb | [
"body = request.json\ncalendar_type = body['type']\napi_key = body['api_key']\nurl = body['calendar_url']\nresult = calendar_service.set_configuration(calendar_type, api_key, url)\nif result is not False:\n return {'error': 'Success'}\nreturn {'error': 'Unable to set calendar configuration'}",
"config = calend... | <|body_start_0|>
body = request.json
calendar_type = body['type']
api_key = body['api_key']
url = body['calendar_url']
result = calendar_service.set_configuration(calendar_type, api_key, url)
if result is not False:
return {'error': 'Success'}
return {... | CalendarConfigResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalendarConfigResource:
def post(self):
"""Set the active calendar configuration."""
<|body_0|>
def get(self):
"""Get the active calendar configuration"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
body = request.json
calendar_type = body[... | stack_v2_sparse_classes_10k_train_000314 | 2,090 | no_license | [
{
"docstring": "Set the active calendar configuration.",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Get the active calendar configuration",
"name": "get",
"signature": "def get(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003940 | Implement the Python class `CalendarConfigResource` described below.
Class description:
Implement the CalendarConfigResource class.
Method signatures and docstrings:
- def post(self): Set the active calendar configuration.
- def get(self): Get the active calendar configuration | Implement the Python class `CalendarConfigResource` described below.
Class description:
Implement the CalendarConfigResource class.
Method signatures and docstrings:
- def post(self): Set the active calendar configuration.
- def get(self): Get the active calendar configuration
<|skeleton|>
class CalendarConfigResour... | 0b760c062275e4d265cfbd8caacd23c36042f8d3 | <|skeleton|>
class CalendarConfigResource:
def post(self):
"""Set the active calendar configuration."""
<|body_0|>
def get(self):
"""Get the active calendar configuration"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CalendarConfigResource:
def post(self):
"""Set the active calendar configuration."""
body = request.json
calendar_type = body['type']
api_key = body['api_key']
url = body['calendar_url']
result = calendar_service.set_configuration(calendar_type, api_key, url)
... | the_stack_v2_python_sparse | api/controllers/calendar.py | otter-pond/backend | train | 0 | |
d1f6321444eebb293c4c5b7e242eeb6170c23217 | [
"response = self.client.get(reverse('polls:index'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No polls are available.')",
"create_question(question_text='Past Question Text', days=-30)\nresponse = self.client.get(reverse('polls:index'))\nself.assertQuerysetEqual(response.context... | <|body_start_0|>
response = self.client.get(reverse('polls:index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No polls are available.')
<|end_body_0|>
<|body_start_1|>
create_question(question_text='Past Question Text', days=-30)
response = self.... | QuestionIndexViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionIndexViewTests:
def test_index_view_with_no_questions(self):
"""If no questions exist, an appropriate message should be displayed."""
<|body_0|>
def test_index_view_with_a_past_question(self):
"""Qustions with a pub_date in the past should be displayed on the... | stack_v2_sparse_classes_10k_train_000315 | 7,438 | no_license | [
{
"docstring": "If no questions exist, an appropriate message should be displayed.",
"name": "test_index_view_with_no_questions",
"signature": "def test_index_view_with_no_questions(self)"
},
{
"docstring": "Qustions with a pub_date in the past should be displayed on the index page.",
"name"... | 5 | stack_v2_sparse_classes_30k_train_004707 | Implement the Python class `QuestionIndexViewTests` described below.
Class description:
Implement the QuestionIndexViewTests class.
Method signatures and docstrings:
- def test_index_view_with_no_questions(self): If no questions exist, an appropriate message should be displayed.
- def test_index_view_with_a_past_ques... | Implement the Python class `QuestionIndexViewTests` described below.
Class description:
Implement the QuestionIndexViewTests class.
Method signatures and docstrings:
- def test_index_view_with_no_questions(self): If no questions exist, an appropriate message should be displayed.
- def test_index_view_with_a_past_ques... | a7e7fc72abe357172f5aa49b03c5b9298d92d6e8 | <|skeleton|>
class QuestionIndexViewTests:
def test_index_view_with_no_questions(self):
"""If no questions exist, an appropriate message should be displayed."""
<|body_0|>
def test_index_view_with_a_past_question(self):
"""Qustions with a pub_date in the past should be displayed on the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionIndexViewTests:
def test_index_view_with_no_questions(self):
"""If no questions exist, an appropriate message should be displayed."""
response = self.client.get(reverse('polls:index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No polls a... | the_stack_v2_python_sparse | firstdjango/polls/tests.py | thewritingstew/lpthw | train | 0 | |
3636341c233339424441796f61c66b741e349e81 | [
"body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'}\na = api_v1_analysis_channel_sec_peak(body1)\ndict_data = json.loads(a)\nself.assertLessEqual(11542, dict_data['results'][1]['num'])",
"body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A',... | <|body_start_0|>
body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'}
a = api_v1_analysis_channel_sec_peak(body1)
dict_data = json.loads(a)
self.assertLessEqual(11542, dict_data['results'][1]['num'])
<|end_body_0|>
... | 2.4.9.2安检口人数峰值分析 | TestApiAnalysisChannelSecPeak | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestApiAnalysisChannelSecPeak:
"""2.4.9.2安检口人数峰值分析"""
def test_01(self):
"""验证正确传入参数时能返回安检口人数峰值数据"""
<|body_0|>
def test_02(self):
"""验证查询非有效时间内不能查询到安检口人数峰值数据"""
<|body_1|>
def test_03(self):
"""验证区域通道不存在时,不能查到安检口人数峰值数据"""
<|body_2|>
... | stack_v2_sparse_classes_10k_train_000316 | 2,805 | no_license | [
{
"docstring": "验证正确传入参数时能返回安检口人数峰值数据",
"name": "test_01",
"signature": "def test_01(self)"
},
{
"docstring": "验证查询非有效时间内不能查询到安检口人数峰值数据",
"name": "test_02",
"signature": "def test_02(self)"
},
{
"docstring": "验证区域通道不存在时,不能查到安检口人数峰值数据",
"name": "test_03",
"signature": "def... | 5 | stack_v2_sparse_classes_30k_train_000728 | Implement the Python class `TestApiAnalysisChannelSecPeak` described below.
Class description:
2.4.9.2安检口人数峰值分析
Method signatures and docstrings:
- def test_01(self): 验证正确传入参数时能返回安检口人数峰值数据
- def test_02(self): 验证查询非有效时间内不能查询到安检口人数峰值数据
- def test_03(self): 验证区域通道不存在时,不能查到安检口人数峰值数据
- def test_04(self): 验证startTime大于end... | Implement the Python class `TestApiAnalysisChannelSecPeak` described below.
Class description:
2.4.9.2安检口人数峰值分析
Method signatures and docstrings:
- def test_01(self): 验证正确传入参数时能返回安检口人数峰值数据
- def test_02(self): 验证查询非有效时间内不能查询到安检口人数峰值数据
- def test_03(self): 验证区域通道不存在时,不能查到安检口人数峰值数据
- def test_04(self): 验证startTime大于end... | aa0749f4a237ee76a61579dc5984635a7127a631 | <|skeleton|>
class TestApiAnalysisChannelSecPeak:
"""2.4.9.2安检口人数峰值分析"""
def test_01(self):
"""验证正确传入参数时能返回安检口人数峰值数据"""
<|body_0|>
def test_02(self):
"""验证查询非有效时间内不能查询到安检口人数峰值数据"""
<|body_1|>
def test_03(self):
"""验证区域通道不存在时,不能查到安检口人数峰值数据"""
<|body_2|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestApiAnalysisChannelSecPeak:
"""2.4.9.2安检口人数峰值分析"""
def test_01(self):
"""验证正确传入参数时能返回安检口人数峰值数据"""
body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'}
a = api_v1_analysis_channel_sec_peak(body1)
di... | the_stack_v2_python_sparse | Airport/Auto_return/TestCase/test_data_platform_092.py | jingshiyue/zhongkeyuan_workspace | train | 0 |
507f3aacc54f026643bb024751df7217ba49a7db | [
"self.cluster_id = cluster_id\nself.cluster_name = cluster_name\nself.cluster_sw_version = cluster_sw_version\nself.healthy_nodes = healthy_nodes\nself.incarnation_id = incarnation_id\nself.message = message\nself.unhealthy_nodes = unhealthy_nodes",
"if dictionary is None:\n return None\ncluster_id = dictionar... | <|body_start_0|>
self.cluster_id = cluster_id
self.cluster_name = cluster_name
self.cluster_sw_version = cluster_sw_version
self.healthy_nodes = healthy_nodes
self.incarnation_id = incarnation_id
self.message = message
self.unhealthy_nodes = unhealthy_nodes
<|end_... | Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. Attributes: cluster_id (long|int): Specifies the... | CreateClusterResult | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateClusterResult:
"""Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. A... | stack_v2_sparse_classes_10k_train_000317 | 4,007 | permissive | [
{
"docstring": "Constructor for the CreateClusterResult class",
"name": "__init__",
"signature": "def __init__(self, cluster_id=None, cluster_name=None, cluster_sw_version=None, healthy_nodes=None, incarnation_id=None, message=None, unhealthy_nodes=None)"
},
{
"docstring": "Creates an instance o... | 2 | null | Implement the Python class `CreateClusterResult` described below.
Class description:
Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup op... | Implement the Python class `CreateClusterResult` described below.
Class description:
Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup op... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class CreateClusterResult:
"""Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. A... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CreateClusterResult:
"""Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. Attributes: cl... | the_stack_v2_python_sparse | cohesity_management_sdk/models/create_cluster_result.py | cohesity/management-sdk-python | train | 24 |
850fe38158bbbc1431e7caffced93164aeeb79d6 | [
"for command in ServerCommands.commands:\n if command_name == command.get_command_name():\n return command\nreturn None",
"if not isinstance(command_processor, CommandProcessor):\n raise TypeError('command_processor must be an instance of CommandProcessor, but got {}'.format(type(command_processor)))... | <|body_start_0|>
for command in ServerCommands.commands:
if command_name == command.get_command_name():
return command
return None
<|end_body_0|>
<|body_start_1|>
if not isinstance(command_processor, CommandProcessor):
raise TypeError('command_processor m... | AdminCommands contains all the commands for processing the commands from the parent process. | ServerCommands | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServerCommands:
"""AdminCommands contains all the commands for processing the commands from the parent process."""
def get_command(command_name):
"""Call to return the AdminCommand object. Args: command_name: AdminCommand name Returns: AdminCommand object"""
<|body_0|>
d... | stack_v2_sparse_classes_10k_train_000318 | 13,913 | permissive | [
{
"docstring": "Call to return the AdminCommand object. Args: command_name: AdminCommand name Returns: AdminCommand object",
"name": "get_command",
"signature": "def get_command(command_name)"
},
{
"docstring": "Call to register the AdminCommand processor. Args: command_processor: AdminCommand p... | 2 | stack_v2_sparse_classes_30k_train_001281 | Implement the Python class `ServerCommands` described below.
Class description:
AdminCommands contains all the commands for processing the commands from the parent process.
Method signatures and docstrings:
- def get_command(command_name): Call to return the AdminCommand object. Args: command_name: AdminCommand name ... | Implement the Python class `ServerCommands` described below.
Class description:
AdminCommands contains all the commands for processing the commands from the parent process.
Method signatures and docstrings:
- def get_command(command_name): Call to return the AdminCommand object. Args: command_name: AdminCommand name ... | 1433290c203bd23f34c29e11795ce592bc067888 | <|skeleton|>
class ServerCommands:
"""AdminCommands contains all the commands for processing the commands from the parent process."""
def get_command(command_name):
"""Call to return the AdminCommand object. Args: command_name: AdminCommand name Returns: AdminCommand object"""
<|body_0|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ServerCommands:
"""AdminCommands contains all the commands for processing the commands from the parent process."""
def get_command(command_name):
"""Call to return the AdminCommand object. Args: command_name: AdminCommand name Returns: AdminCommand object"""
for command in ServerCommands.... | the_stack_v2_python_sparse | nvflare/private/fed/server/server_commands.py | NVIDIA/NVFlare | train | 442 |
679907b3f6ce26210793a204bcf396f0834bc00b | [
"self._width = width\nself._height = height\nself._images = {}\nreturn",
"bmp = self._images.get(filename)\nif bmp is None:\n image = wx.Image(filename, wx.BITMAP_TYPE_ANY)\n self._scale(image)\n bmp = image.ConvertToBitmap()\n self._images[filename] = bmp\nreturn bmp",
"if image.GetWidth() != self.... | <|body_start_0|>
self._width = width
self._height = height
self._images = {}
return
<|end_body_0|>
<|body_start_1|>
bmp = self._images.get(filename)
if bmp is None:
image = wx.Image(filename, wx.BITMAP_TYPE_ANY)
self._scale(image)
bmp ... | An image cache. | ImageCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageCache:
"""An image cache."""
def __init__(self, width, height):
"""Creates a new image cache."""
<|body_0|>
def get_image(self, filename):
"""Returns the specified image (currently as a bitmap)."""
<|body_1|>
def _scale(self, image):
"""... | stack_v2_sparse_classes_10k_train_000319 | 2,463 | no_license | [
{
"docstring": "Creates a new image cache.",
"name": "__init__",
"signature": "def __init__(self, width, height)"
},
{
"docstring": "Returns the specified image (currently as a bitmap).",
"name": "get_image",
"signature": "def get_image(self, filename)"
},
{
"docstring": "Scales ... | 3 | stack_v2_sparse_classes_30k_train_003005 | Implement the Python class `ImageCache` described below.
Class description:
An image cache.
Method signatures and docstrings:
- def __init__(self, width, height): Creates a new image cache.
- def get_image(self, filename): Returns the specified image (currently as a bitmap).
- def _scale(self, image): Scales the spec... | Implement the Python class `ImageCache` described below.
Class description:
An image cache.
Method signatures and docstrings:
- def __init__(self, width, height): Creates a new image cache.
- def get_image(self, filename): Returns the specified image (currently as a bitmap).
- def _scale(self, image): Scales the spec... | 5466f5858dbd2f1f082fa0d7417b57c8fb068fad | <|skeleton|>
class ImageCache:
"""An image cache."""
def __init__(self, width, height):
"""Creates a new image cache."""
<|body_0|>
def get_image(self, filename):
"""Returns the specified image (currently as a bitmap)."""
<|body_1|>
def _scale(self, image):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImageCache:
"""An image cache."""
def __init__(self, width, height):
"""Creates a new image cache."""
self._width = width
self._height = height
self._images = {}
return
def get_image(self, filename):
"""Returns the specified image (currently as a bitma... | the_stack_v2_python_sparse | maps/build/EnthoughtBase/enthought/util/wx/image_cache.py | m-elhussieny/code | train | 0 |
a626a9a56a02f87d97b7dc242bbcc957c99f69ad | [
"all_candidate_embs = [item.vectors for item in prf_candidates]\nnew_emb_qs = np.mean(np.vstack((emb_qs, all_candidate_embs)), axis=0)\nreturn new_emb_qs",
"qids = list()\nnew_emb_qs = list()\nfor index, topic_id in enumerate(topic_ids):\n qids.append(topic_id)\n new_emb_qs.append(self.get_prf_q_emb(emb_qs[... | <|body_start_0|>
all_candidate_embs = [item.vectors for item in prf_candidates]
new_emb_qs = np.mean(np.vstack((emb_qs, all_candidate_embs)), axis=0)
return new_emb_qs
<|end_body_0|>
<|body_start_1|>
qids = list()
new_emb_qs = list()
for index, topic_id in enumerate(topi... | DenseVectorAveragePrf | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DenseVectorAveragePrf:
def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None):
"""Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearch... | stack_v2_sparse_classes_10k_train_000320 | 7,539 | permissive | [
{
"docstring": "Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearchResult, contains document embeddings. Returns ------- np.ndarray return new query embeddings",
"name": "get_prf_q_emb",
"sign... | 2 | stack_v2_sparse_classes_30k_train_006042 | Implement the Python class `DenseVectorAveragePrf` described below.
Class description:
Implement the DenseVectorAveragePrf class.
Method signatures and docstrings:
- def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): Perform Average PRF with Dense Vectors Parameters ---... | Implement the Python class `DenseVectorAveragePrf` described below.
Class description:
Implement the DenseVectorAveragePrf class.
Method signatures and docstrings:
- def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): Perform Average PRF with Dense Vectors Parameters ---... | 42b354914b230880c91b2e4e70605b472441a9a1 | <|skeleton|>
class DenseVectorAveragePrf:
def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None):
"""Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearch... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DenseVectorAveragePrf:
def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None):
"""Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearchResult, contai... | the_stack_v2_python_sparse | pyserini/search/faiss/_prf.py | castorini/pyserini | train | 1,070 | |
ff9ddca5f5fcae922243d5a07ca737197b28eb38 | [
"self.horizontalAdvanceX = float(xmlElement.attributeDictionary['horiz-adv-x'])\nself.loops = []\nself.unitsPerEM = unitsPerEM\nxmlElement.attributeDictionary['fill'] = ''\nif 'd' not in xmlElement.attributeDictionary:\n return\nPathReader(self.loops, xmlElement, yAxisPointingUpward)",
"multiplierX = fontSize ... | <|body_start_0|>
self.horizontalAdvanceX = float(xmlElement.attributeDictionary['horiz-adv-x'])
self.loops = []
self.unitsPerEM = unitsPerEM
xmlElement.attributeDictionary['fill'] = ''
if 'd' not in xmlElement.attributeDictionary:
return
PathReader(self.loops,... | Class to handle a glyph. | Glyph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Glyph:
"""Class to handle a glyph."""
def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward):
"""Initialize."""
<|body_0|>
def getSizedAdvancedLoops(self, fontSize, horizontalAdvanceX, yAxisPointingUpward=True):
"""Get loops for font size, advanced horiz... | stack_v2_sparse_classes_10k_train_000321 | 39,231 | no_license | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward)"
},
{
"docstring": "Get loops for font size, advanced horizontally.",
"name": "getSizedAdvancedLoops",
"signature": "def getSizedAdvancedLoops(self, fontSize, h... | 2 | stack_v2_sparse_classes_30k_train_000064 | Implement the Python class `Glyph` described below.
Class description:
Class to handle a glyph.
Method signatures and docstrings:
- def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward): Initialize.
- def getSizedAdvancedLoops(self, fontSize, horizontalAdvanceX, yAxisPointingUpward=True): Get loops for font... | Implement the Python class `Glyph` described below.
Class description:
Class to handle a glyph.
Method signatures and docstrings:
- def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward): Initialize.
- def getSizedAdvancedLoops(self, fontSize, horizontalAdvanceX, yAxisPointingUpward=True): Get loops for font... | c1b00a76f1550df2cbb457248205159e51fd4308 | <|skeleton|>
class Glyph:
"""Class to handle a glyph."""
def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward):
"""Initialize."""
<|body_0|>
def getSizedAdvancedLoops(self, fontSize, horizontalAdvanceX, yAxisPointingUpward=True):
"""Get loops for font size, advanced horiz... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Glyph:
"""Class to handle a glyph."""
def __init__(self, unitsPerEM, xmlElement, yAxisPointingUpward):
"""Initialize."""
self.horizontalAdvanceX = float(xmlElement.attributeDictionary['horiz-adv-x'])
self.loops = []
self.unitsPerEM = unitsPerEM
xmlElement.attribute... | the_stack_v2_python_sparse | fabmetheus_utilities/svg_reader.py | amsler/skeinforge | train | 10 |
e449e7d1c34871c58ccdbb9e7564c4d0e664f25d | [
"if x == 0:\n return 0\nleft = 1\nright = x // 2\nwhile left < right:\n mid = left + right + 1 >> 1\n square = mid * mid\n if square > x:\n right = mid - 1\n else:\n left = mid\nreturn left",
"if x == 0:\n return 0\ncur = 1\nwhile True:\n pre = cur\n cur = (cur + x / cur) / 2... | <|body_start_0|>
if x == 0:
return 0
left = 1
right = x // 2
while left < right:
mid = left + right + 1 >> 1
square = mid * mid
if square > x:
right = mid - 1
else:
left = mid
return left
... | # 二分法 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x == 0:
return 0
left = 1
right... | stack_v2_sparse_classes_10k_train_000322 | 1,468 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt1",
"signature": "def mySqrt1(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
# 二分法
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
# 二分法
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: in... | f831fd9603592ae5bee3679924f962a3ebce381c | <|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
if x == 0:
return 0
left = 1
right = x // 2
while left < right:
mid = left + right + 1 >> 1
square = mid * mid
if square > x:
... | the_stack_v2_python_sparse | old/t20190918_mySqrt/mySqrt.py | GongFuXiong/leetcode | train | 0 |
50ec17c31cc9d79049bb914aa03aa6c82686af80 | [
"super(Tacotron2Loss, self).__init__()\nassert use_masking != use_weighted_masking or not use_masking\nself.use_masking = use_masking\nself.use_weighted_masking = use_weighted_masking\nreduction = 'none' if self.use_weighted_masking else 'mean'\nself.l1_criterion = torch.nn.L1Loss(reduction=reduction)\nself.mse_cri... | <|body_start_0|>
super(Tacotron2Loss, self).__init__()
assert use_masking != use_weighted_masking or not use_masking
self.use_masking = use_masking
self.use_weighted_masking = use_weighted_masking
reduction = 'none' if self.use_weighted_masking else 'mean'
self.l1_criteri... | Loss function module for Tacotron2. | Tacotron2Loss | [
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tacotron2Loss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0):
"""Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_ma... | stack_v2_sparse_classes_10k_train_000323 | 18,153 | permissive | [
{
"docstring": "Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool): Whether to apply weighted masking in loss calculation. bce_pos_weight (float): Weight of positive sample of stop token.",
"name": "__init__",... | 3 | null | Implement the Python class `Tacotron2Loss` described below.
Class description:
Loss function module for Tacotron2.
Method signatures and docstrings:
- def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply mas... | Implement the Python class `Tacotron2Loss` described below.
Class description:
Loss function module for Tacotron2.
Method signatures and docstrings:
- def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0): Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply mas... | b60c741f746877293bb85eed6806736fc8fa0ffd | <|skeleton|>
class Tacotron2Loss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0):
"""Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_ma... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Tacotron2Loss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0):
"""Initialize Tactoron2 loss module. Args: use_masking (bool): Whether to apply masking for padded part in loss calculation. use_weighted_masking (bool):... | the_stack_v2_python_sparse | speecht5/speecht5/criterions/text_to_speech_loss.py | microsoft/unilm | train | 15,313 |
fa9ecb79eaa4d0c628c6e72fd3c6744e7d1b0eca | [
"super().__init__(visible=False)\nself.speed(0)\nself.penup()\nself.color('white')\nself.p1 = player_1\nself.p2 = player2\nself.font_size = field.height // 15\nself.spacing = field.width / 10\nself.goto(-self.spacing, field.height / 2 - field.score_height)\nself.write(self.p2.score, font=('Monospace', self.font_siz... | <|body_start_0|>
super().__init__(visible=False)
self.speed(0)
self.penup()
self.color('white')
self.p1 = player_1
self.p2 = player2
self.font_size = field.height // 15
self.spacing = field.width / 10
self.goto(-self.spacing, field.height / 2 - fie... | Score | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Score:
def __init__(self, player_1, player_2):
"""Initialize player score"""
<|body_0|>
def update(self):
"""Update player score"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__(visible=False)
self.speed(0)
self.penup... | stack_v2_sparse_classes_10k_train_000324 | 21,836 | no_license | [
{
"docstring": "Initialize player score",
"name": "__init__",
"signature": "def __init__(self, player_1, player_2)"
},
{
"docstring": "Update player score",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000578 | Implement the Python class `Score` described below.
Class description:
Implement the Score class.
Method signatures and docstrings:
- def __init__(self, player_1, player_2): Initialize player score
- def update(self): Update player score | Implement the Python class `Score` described below.
Class description:
Implement the Score class.
Method signatures and docstrings:
- def __init__(self, player_1, player_2): Initialize player score
- def update(self): Update player score
<|skeleton|>
class Score:
def __init__(self, player_1, player_2):
... | 982fb820257a425422305e076dbc4523f591dedb | <|skeleton|>
class Score:
def __init__(self, player_1, player_2):
"""Initialize player score"""
<|body_0|>
def update(self):
"""Update player score"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Score:
def __init__(self, player_1, player_2):
"""Initialize player score"""
super().__init__(visible=False)
self.speed(0)
self.penup()
self.color('white')
self.p1 = player_1
self.p2 = player2
self.font_size = field.height // 15
self.spac... | the_stack_v2_python_sparse | 07. Turtles/PongGame.py | pBogey/hello-world | train | 0 | |
62b278e698dcc63d35fb6278c98efd01e123734b | [
"exit_flag = False\nwhile not exit_flag:\n try:\n first_name, middle_name, last_name = fake.name().split(' ')\n exit_flag = True\n except ValueError:\n continue\nreturn (first_name, middle_name, last_name)",
"result = ''\nfor _ in range(n):\n result += str(random.choice(range(10)))\n... | <|body_start_0|>
exit_flag = False
while not exit_flag:
try:
first_name, middle_name, last_name = fake.name().split(' ')
exit_flag = True
except ValueError:
continue
return (first_name, middle_name, last_name)
<|end_body_0|>... | Класс утилит с доп методами | Util | [
"WTFPL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Util:
"""Класс утилит с доп методами"""
def gen_name(fake: Faker):
"""Генерация имени пользователя"""
<|body_0|>
def get_number_range(n) -> str:
"""Отдает n рандомных цифр"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
exit_flag = False
... | stack_v2_sparse_classes_10k_train_000325 | 11,458 | permissive | [
{
"docstring": "Генерация имени пользователя",
"name": "gen_name",
"signature": "def gen_name(fake: Faker)"
},
{
"docstring": "Отдает n рандомных цифр",
"name": "get_number_range",
"signature": "def get_number_range(n) -> str"
}
] | 2 | null | Implement the Python class `Util` described below.
Class description:
Класс утилит с доп методами
Method signatures and docstrings:
- def gen_name(fake: Faker): Генерация имени пользователя
- def get_number_range(n) -> str: Отдает n рандомных цифр | Implement the Python class `Util` described below.
Class description:
Класс утилит с доп методами
Method signatures and docstrings:
- def gen_name(fake: Faker): Генерация имени пользователя
- def get_number_range(n) -> str: Отдает n рандомных цифр
<|skeleton|>
class Util:
"""Класс утилит с доп методами"""
d... | 9575c43fa01c261ea1ed573df9b5686b5a6f4211 | <|skeleton|>
class Util:
"""Класс утилит с доп методами"""
def gen_name(fake: Faker):
"""Генерация имени пользователя"""
<|body_0|>
def get_number_range(n) -> str:
"""Отдает n рандомных цифр"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Util:
"""Класс утилит с доп методами"""
def gen_name(fake: Faker):
"""Генерация имени пользователя"""
exit_flag = False
while not exit_flag:
try:
first_name, middle_name, last_name = fake.name().split(' ')
exit_flag = True
ex... | the_stack_v2_python_sparse | Course_II/Python_SQL/pract/pract3/control/control.py | GeorgiyDemo/FA | train | 46 |
584268f75e9ca287fcc298e53a60aeddde4726ac | [
"m, n = (len(board), len(board[0]))\nfor i, j in product(range(m), range(n)):\n cnt = 0\n for di, dj in product(range(-1, 2), repeat=2):\n if di != 0 or dj != 0:\n ii, jj = (i + di, j + dj)\n if 0 <= ii < m and 0 <= jj < n:\n cnt += board[ii][jj] & 1\n if cnt == ... | <|body_start_0|>
m, n = (len(board), len(board[0]))
for i, j in product(range(m), range(n)):
cnt = 0
for di, dj in product(range(-1, 2), repeat=2):
if di != 0 or dj != 0:
ii, jj = (i + di, j + dj)
if 0 <= ii < m and 0 <= jj ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def gameOfLifeBit(self, board):
""":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead."""
<|body_0|>
def gameOfLife(self, board):
""":type board: List[List[int]] :rtype: None Do not return anything, modify board ... | stack_v2_sparse_classes_10k_train_000326 | 4,934 | no_license | [
{
"docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.",
"name": "gameOfLifeBit",
"signature": "def gameOfLifeBit(self, board)"
},
{
"docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place ins... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def gameOfLifeBit(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.
- def gameOfLife(self, board): :type board: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def gameOfLifeBit(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.
- def gameOfLife(self, board): :type board: List[... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def gameOfLifeBit(self, board):
""":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead."""
<|body_0|>
def gameOfLife(self, board):
""":type board: List[List[int]] :rtype: None Do not return anything, modify board ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def gameOfLifeBit(self, board):
""":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead."""
m, n = (len(board), len(board[0]))
for i, j in product(range(m), range(n)):
cnt = 0
for di, dj in product(range(-1, 2... | the_stack_v2_python_sparse | G/GameOfLife.py | bssrdf/pyleet | train | 2 | |
e725164a00aec9092d9529d696a3b55ed3a5b6fa | [
"channel_options = self.declaration.recipe_options or {}\ntask_recipe_options = task_recipe_options or {}\nself.check_conflicting_options(channel_options, task_recipe_options)\nrecipe_options = {**task_recipe_options, **channel_options}\nreturn recipe_options",
"double_specified_options = set(task_recipe_options.... | <|body_start_0|>
channel_options = self.declaration.recipe_options or {}
task_recipe_options = task_recipe_options or {}
self.check_conflicting_options(channel_options, task_recipe_options)
recipe_options = {**task_recipe_options, **channel_options}
return recipe_options
<|end_bo... | A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration | ChannelConfig | [
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelConfig:
"""A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration"""
def merge_recipe_options(self, task_recipe_options):
"""Merge t... | stack_v2_sparse_classes_10k_train_000327 | 28,418 | permissive | [
{
"docstring": "Merge the recipe options from the channel declaration with those from the task config",
"name": "merge_recipe_options",
"signature": "def merge_recipe_options(self, task_recipe_options)"
},
{
"docstring": "Check that options do not conflict",
"name": "check_conflicting_option... | 2 | stack_v2_sparse_classes_30k_train_002747 | Implement the Python class `ChannelConfig` described below.
Class description:
A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration
Method signatures and docstrings:
- def... | Implement the Python class `ChannelConfig` described below.
Class description:
A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration
Method signatures and docstrings:
- def... | 9ccf3c9566f78c6e9102ac214db30470cef660c1 | <|skeleton|>
class ChannelConfig:
"""A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration"""
def merge_recipe_options(self, task_recipe_options):
"""Merge t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChannelConfig:
"""A channel represents a connection to Salesforce via a username. It can also have recipe options and other documented properties. https://github.com/SFDO-Tooling/Snowfakery/search?q=ChannelDeclaration"""
def merge_recipe_options(self, task_recipe_options):
"""Merge the recipe opt... | the_stack_v2_python_sparse | cumulusci/tasks/bulkdata/snowfakery.py | SFDO-Tooling/CumulusCI | train | 226 |
24d99b982df99c152a9ed5d84e90ac2bf5da5892 | [
"exprval = self.term()\nwhile self._accept('PLUS') or self._accept('MINUS'):\n op = self.tok.type\n right = self.term()\n if op == 'PLUS':\n exprval = ('+', exprval, right)\n elif op == 'MINUS':\n exprval = ('-', exprval, right)\nreturn exprval",
"termval = self.factor()\nwhile self._acc... | <|body_start_0|>
exprval = self.term()
while self._accept('PLUS') or self._accept('MINUS'):
op = self.tok.type
right = self.term()
if op == 'PLUS':
exprval = ('+', exprval, right)
elif op == 'MINUS':
exprval = ('-', exprval,... | ExpressionTreeBuilder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpressionTreeBuilder:
def expr(self):
"""expression ::= term { ('+'|'-') term }"""
<|body_0|>
def term(self):
"""term ::= factor { ('*'|'/') factor }"""
<|body_1|>
def factor(self):
"""factor ::= NUM | ( expr )"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k_train_000328 | 26,002 | no_license | [
{
"docstring": "expression ::= term { ('+'|'-') term }",
"name": "expr",
"signature": "def expr(self)"
},
{
"docstring": "term ::= factor { ('*'|'/') factor }",
"name": "term",
"signature": "def term(self)"
},
{
"docstring": "factor ::= NUM | ( expr )",
"name": "factor",
... | 3 | stack_v2_sparse_classes_30k_train_001972 | Implement the Python class `ExpressionTreeBuilder` described below.
Class description:
Implement the ExpressionTreeBuilder class.
Method signatures and docstrings:
- def expr(self): expression ::= term { ('+'|'-') term }
- def term(self): term ::= factor { ('*'|'/') factor }
- def factor(self): factor ::= NUM | ( exp... | Implement the Python class `ExpressionTreeBuilder` described below.
Class description:
Implement the ExpressionTreeBuilder class.
Method signatures and docstrings:
- def expr(self): expression ::= term { ('+'|'-') term }
- def term(self): term ::= factor { ('*'|'/') factor }
- def factor(self): factor ::= NUM | ( exp... | cdca17e9734479c760bef188dcb0e183edf8564a | <|skeleton|>
class ExpressionTreeBuilder:
def expr(self):
"""expression ::= term { ('+'|'-') term }"""
<|body_0|>
def term(self):
"""term ::= factor { ('*'|'/') factor }"""
<|body_1|>
def factor(self):
"""factor ::= NUM | ( expr )"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExpressionTreeBuilder:
def expr(self):
"""expression ::= term { ('+'|'-') term }"""
exprval = self.term()
while self._accept('PLUS') or self._accept('MINUS'):
op = self.tok.type
right = self.term()
if op == 'PLUS':
exprval = ('+', exp... | the_stack_v2_python_sparse | p02_personal_summary/p04_kil_yong_hyun/p02_week/p01_tuesday/s02_week_tuesday_summary.py | python-cookbook/PythonStudy | train | 2 | |
239f3dd4cded374620e23801d32532ace7dca3f5 | [
"super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(... | <|body_start_0|>
super(EncoderBlock, self).__init__()
self.mha = MultiHeadAttention(dm, h)
self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')
self.dense_output = tf.keras.layers.Dense(dm)
self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)
... | Class EncoderBlock | EncoderBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderBlock:
"""Class EncoderBlock"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""Class constructor"""
<|body_0|>
def call(self, x, training, mask=None):
"""Public instance method that returns a tersor of shape (batch, input_seq_len, dm) containing the ... | stack_v2_sparse_classes_10k_train_000329 | 1,500 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)"
},
{
"docstring": "Public instance method that returns a tersor of shape (batch, input_seq_len, dm) containing the block’s output",
"name": "call",
"signature": "def ca... | 2 | stack_v2_sparse_classes_30k_train_006513 | Implement the Python class `EncoderBlock` described below.
Class description:
Class EncoderBlock
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor
- def call(self, x, training, mask=None): Public instance method that returns a tersor of shape (batch, input_seq_len... | Implement the Python class `EncoderBlock` described below.
Class description:
Class EncoderBlock
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor
- def call(self, x, training, mask=None): Public instance method that returns a tersor of shape (batch, input_seq_len... | b1d0995023630f2a2b7ed953983c405077c0d5a8 | <|skeleton|>
class EncoderBlock:
"""Class EncoderBlock"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""Class constructor"""
<|body_0|>
def call(self, x, training, mask=None):
"""Public instance method that returns a tersor of shape (batch, input_seq_len, dm) containing the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EncoderBlock:
"""Class EncoderBlock"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""Class constructor"""
super(EncoderBlock, self).__init__()
self.mha = MultiHeadAttention(dm, h)
self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')
self.dens... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/7-transformer_encoder_block.py | oscarmrt/holbertonschool-machine_learning | train | 1 |
f3d5e02e3b1495802676d437489cb6b72669c48f | [
"self._disk_data = disk_data\nself._serial_data = serial_data\nself._usb_devices = usb_data",
"disk_data = self._disk_data.get_disk_information(usb_id.uid)\nserial_data = self._serial_data.get_serial_port_information(usb_id)\nusb_data = self._usb_devices.get_usb_devices(usb_id)\naggregated_data = AggregatedUsbDat... | <|body_start_0|>
self._disk_data = disk_data
self._serial_data = serial_data
self._usb_devices = usb_data
<|end_body_0|>
<|body_start_1|>
disk_data = self._disk_data.get_disk_information(usb_id.uid)
serial_data = self._serial_data.get_serial_port_information(usb_id)
usb_... | Aggregator of all data related to a USB device. | UsbDataAggregator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsbDataAggregator:
"""Aggregator of all data related to a USB device."""
def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None:
"""Initialiser."""
<|body_0|>
def aggregate(self, usb_id... | stack_v2_sparse_classes_10k_train_000330 | 3,936 | permissive | [
{
"docstring": "Initialiser.",
"name": "__init__",
"signature": "def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None"
},
{
"docstring": "Aggregates data about a USB device from different sources.",
"name... | 2 | stack_v2_sparse_classes_30k_train_003000 | Implement the Python class `UsbDataAggregator` described below.
Class description:
Aggregator of all data related to a USB device.
Method signatures and docstrings:
- def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None: Initialis... | Implement the Python class `UsbDataAggregator` described below.
Class description:
Aggregator of all data related to a USB device.
Method signatures and docstrings:
- def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None: Initialis... | 7ff8ed4d57857805bbf9f2b79486fdc3440dee9f | <|skeleton|>
class UsbDataAggregator:
"""Aggregator of all data related to a USB device."""
def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None:
"""Initialiser."""
<|body_0|>
def aggregate(self, usb_id... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UsbDataAggregator:
"""Aggregator of all data related to a USB device."""
def __init__(self, disk_data: SystemDiskInformation, serial_data: SystemSerialPortInformation, usb_data: SystemUsbDeviceInformation) -> None:
"""Initialiser."""
self._disk_data = disk_data
self._serial_data =... | the_stack_v2_python_sparse | src/mbed_tools/devices/_internal/windows/usb_data_aggregation.py | ARMmbed/mbed-tools | train | 48 |
da9db3325f7188be0893a669adc8e558f411835e | [
"super().setUp()\nself.client = Client()\nself.ping_url = reverse('status.service.celery.ping')",
"response = self.client.get(self.ping_url)\nassert response.status_code == 200\nresult_dict = json.loads(response.content.decode('utf-8'))\nassert result_dict['success']\nassert result_dict['value'] == 'pong'\nassert... | <|body_start_0|>
super().setUp()
self.client = Client()
self.ping_url = reverse('status.service.celery.ping')
<|end_body_0|>
<|body_start_1|>
response = self.client.get(self.ping_url)
assert response.status_code == 200
result_dict = json.loads(response.content.decode('ut... | Test that we can get a response from Celery | CeleryConfigTest | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CeleryConfigTest:
"""Test that we can get a response from Celery"""
def setUp(self):
"""Create a django test client"""
<|body_0|>
def test_ping(self):
"""Try to ping celery."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().setUp()
... | stack_v2_sparse_classes_10k_train_000331 | 1,342 | permissive | [
{
"docstring": "Create a django test client",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Try to ping celery.",
"name": "test_ping",
"signature": "def test_ping(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000621 | Implement the Python class `CeleryConfigTest` described below.
Class description:
Test that we can get a response from Celery
Method signatures and docstrings:
- def setUp(self): Create a django test client
- def test_ping(self): Try to ping celery. | Implement the Python class `CeleryConfigTest` described below.
Class description:
Test that we can get a response from Celery
Method signatures and docstrings:
- def setUp(self): Create a django test client
- def test_ping(self): Try to ping celery.
<|skeleton|>
class CeleryConfigTest:
"""Test that we can get a ... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class CeleryConfigTest:
"""Test that we can get a response from Celery"""
def setUp(self):
"""Create a django test client"""
<|body_0|>
def test_ping(self):
"""Try to ping celery."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CeleryConfigTest:
"""Test that we can get a response from Celery"""
def setUp(self):
"""Create a django test client"""
super().setUp()
self.client = Client()
self.ping_url = reverse('status.service.celery.ping')
def test_ping(self):
"""Try to ping celery."""
... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/service_status/test.py | luque/better-ways-of-thinking-about-software | train | 3 |
bb7ad01f63b2f8f23c7c17604d95e1e2f8433b64 | [
"k = k % len(nums)\nfor _ in range(k):\n nums.insert(0, nums.pop())",
"k = k % len(nums)\nfor _ in range(k):\n l = nums[-1]\n for i in range(len(nums) - 1, 0, -1):\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])\n nums[0] = l",
"k = k % len(nums)\nif not k:\n return\nns = (nums * 2)[len(nu... | <|body_start_0|>
k = k % len(nums)
for _ in range(k):
nums.insert(0, nums.pop())
<|end_body_0|>
<|body_start_1|>
k = k % len(nums)
for _ in range(k):
l = nums[-1]
for i in range(len(nums) - 1, 0, -1):
nums[i], nums[i - 1] = (nums[i - 1... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead."""
<|body_0|>
def __rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: None Do not return anything, modify... | stack_v2_sparse_classes_10k_train_000332 | 2,129 | permissive | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.",
"name": "_rotate",
"signature": "def _rotate(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place ins... | 3 | stack_v2_sparse_classes_30k_test_000040 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.
- def __rotate(self, nums, k): :type nums: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.
- def __rotate(self, nums, k): :type nums: List[... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead."""
<|body_0|>
def __rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: None Do not return anything, modify... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead."""
k = k % len(nums)
for _ in range(k):
nums.insert(0, nums.pop())
def __rotate(self, nums, k):
""":type nums: List[in... | the_stack_v2_python_sparse | 189.rotate-array.py | windard/leeeeee | train | 0 | |
16735da1a755908f562d3d59cf5ed009f837f213 | [
"cpu = os.popen('top -bi -n 2 -d 0.02').read().split('\\n\\n\\n')[1].split('\\n')[2]\nwith sjapi.connection() as db:\n csxx = {'id': get_uuid(), 'ssdxid': self.dxid, 'nr': cpu, 'jlsj': get_strftime2(), 'cjpzid': self.cjpzid, 'ip': self.zjip, 'cjmc': 'cpu', 'zbbm': 'get_cpu()'}\n ModSql.yw_jkgl_001.execute_sql... | <|body_start_0|>
cpu = os.popen('top -bi -n 2 -d 0.02').read().split('\n\n\n')[1].split('\n')[2]
with sjapi.connection() as db:
csxx = {'id': get_uuid(), 'ssdxid': self.dxid, 'nr': cpu, 'jlsj': get_strftime2(), 'cjpzid': self.cjpzid, 'ip': self.zjip, 'cjmc': 'cpu', 'zbbm': 'get_cpu()'}
... | Computer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Computer:
def get_cpu(self):
"""获取CPU使用情况"""
<|body_0|>
def get_ram(self):
"""获取内存使用情况"""
<|body_1|>
def get_io(self):
"""获取磁盘I/O繁忙率"""
<|body_2|>
def get_filesystem(self):
"""获取文件系统使用率"""
<|body_3|>
def get_virt... | stack_v2_sparse_classes_10k_train_000333 | 16,132 | no_license | [
{
"docstring": "获取CPU使用情况",
"name": "get_cpu",
"signature": "def get_cpu(self)"
},
{
"docstring": "获取内存使用情况",
"name": "get_ram",
"signature": "def get_ram(self)"
},
{
"docstring": "获取磁盘I/O繁忙率",
"name": "get_io",
"signature": "def get_io(self)"
},
{
"docstring": "获... | 6 | stack_v2_sparse_classes_30k_train_003525 | Implement the Python class `Computer` described below.
Class description:
Implement the Computer class.
Method signatures and docstrings:
- def get_cpu(self): 获取CPU使用情况
- def get_ram(self): 获取内存使用情况
- def get_io(self): 获取磁盘I/O繁忙率
- def get_filesystem(self): 获取文件系统使用率
- def get_virtual(self): 获取虚拟内存使用情况
- def get_proc... | Implement the Python class `Computer` described below.
Class description:
Implement the Computer class.
Method signatures and docstrings:
- def get_cpu(self): 获取CPU使用情况
- def get_ram(self): 获取内存使用情况
- def get_io(self): 获取磁盘I/O繁忙率
- def get_filesystem(self): 获取文件系统使用率
- def get_virtual(self): 获取虚拟内存使用情况
- def get_proc... | 68ddf3df6d2cd731e6634b09d27aff4c22debd8e | <|skeleton|>
class Computer:
def get_cpu(self):
"""获取CPU使用情况"""
<|body_0|>
def get_ram(self):
"""获取内存使用情况"""
<|body_1|>
def get_io(self):
"""获取磁盘I/O繁忙率"""
<|body_2|>
def get_filesystem(self):
"""获取文件系统使用率"""
<|body_3|>
def get_virt... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Computer:
def get_cpu(self):
"""获取CPU使用情况"""
cpu = os.popen('top -bi -n 2 -d 0.02').read().split('\n\n\n')[1].split('\n')[2]
with sjapi.connection() as db:
csxx = {'id': get_uuid(), 'ssdxid': self.dxid, 'nr': cpu, 'jlsj': get_strftime2(), 'cjpzid': self.cjpzid, 'ip': self.z... | the_stack_v2_python_sparse | zh_manage/apps/_init/oa/yw_jkgl/yw_jkgl_001/yw_jkgl_001.py | yizhong120110/CPOS | train | 0 | |
1055097283243bc9b7a09da6f2b6822ae7491a64 | [
"if genre == 'data':\n graph = dot_data.split('\\n')\nelif genre == 'file':\n graph = []\n with open(dot_file, 'r') as f:\n graph = f.readlines()\nelse:\n raise TypeError('Invalid File Type!')\ngraph_ = []\nfor i in graph:\n graph_.append(i.split(';'))\nself.raw_graph = graph_",
"graph__ = {... | <|body_start_0|>
if genre == 'data':
graph = dot_data.split('\n')
elif genre == 'file':
graph = []
with open(dot_file, 'r') as f:
graph = f.readlines()
else:
raise TypeError('Invalid File Type!')
graph_ = []
for i in... | Graph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def __init__(self, dot_data, genre='data'):
"""store the dot data."""
<|body_0|>
def get_graph(self):
"""Construct trees fromdot file in human-readable structure. Output: a dictionary of the format: {parenr node : [left child node, right child node, splitting ... | stack_v2_sparse_classes_10k_train_000334 | 34,353 | permissive | [
{
"docstring": "store the dot data.",
"name": "__init__",
"signature": "def __init__(self, dot_data, genre='data')"
},
{
"docstring": "Construct trees fromdot file in human-readable structure. Output: a dictionary of the format: {parenr node : [left child node, right child node, splitting variab... | 6 | stack_v2_sparse_classes_30k_train_000995 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, dot_data, genre='data'): store the dot data.
- def get_graph(self): Construct trees fromdot file in human-readable structure. Output: a dictionary of the format: {pa... | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, dot_data, genre='data'): store the dot data.
- def get_graph(self): Construct trees fromdot file in human-readable structure. Output: a dictionary of the format: {pa... | a2dfea516ebc7cabef31a5169533b6da352e7ccb | <|skeleton|>
class Graph:
def __init__(self, dot_data, genre='data'):
"""store the dot data."""
<|body_0|>
def get_graph(self):
"""Construct trees fromdot file in human-readable structure. Output: a dictionary of the format: {parenr node : [left child node, right child node, splitting ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Graph:
def __init__(self, dot_data, genre='data'):
"""store the dot data."""
if genre == 'data':
graph = dot_data.split('\n')
elif genre == 'file':
graph = []
with open(dot_file, 'r') as f:
graph = f.readlines()
else:
... | the_stack_v2_python_sparse | .ipynb_checkpoints/RFTools-checkpoint.py | Yutong-Dai/codes-for-courses | train | 0 | |
b8d01ef9c917a4f50163b659102df051f85ec217 | [
"self._host = None\nself._port = None\nself._servers = []",
"self._servers = await discover(self.hass)\nif self._servers:\n return await self.async_step_link()\nreturn await self.async_step_fallback()",
"errors = {}\nif user_input is not None:\n self._host = user_input['host']\n self._port = user_input... | <|body_start_0|>
self._host = None
self._port = None
self._servers = []
<|end_body_0|>
<|body_start_1|>
self._servers = await discover(self.hass)
if self._servers:
return await self.async_step_link()
return await self.async_step_fallback()
<|end_body_1|>
<|b... | Handle a config flow for roon. | ConfigFlow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigFlow:
"""Handle a config flow for roon."""
def __init__(self):
"""Initialize the Roon flow."""
<|body_0|>
async def async_step_user(self, user_input=None):
"""Get roon core details via discovery."""
<|body_1|>
async def async_step_fallback(self... | stack_v2_sparse_classes_10k_train_000335 | 5,124 | permissive | [
{
"docstring": "Initialize the Roon flow.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get roon core details via discovery.",
"name": "async_step_user",
"signature": "async def async_step_user(self, user_input=None)"
},
{
"docstring": "Get host and p... | 4 | stack_v2_sparse_classes_30k_train_004189 | Implement the Python class `ConfigFlow` described below.
Class description:
Handle a config flow for roon.
Method signatures and docstrings:
- def __init__(self): Initialize the Roon flow.
- async def async_step_user(self, user_input=None): Get roon core details via discovery.
- async def async_step_fallback(self, us... | Implement the Python class `ConfigFlow` described below.
Class description:
Handle a config flow for roon.
Method signatures and docstrings:
- def __init__(self): Initialize the Roon flow.
- async def async_step_user(self, user_input=None): Get roon core details via discovery.
- async def async_step_fallback(self, us... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ConfigFlow:
"""Handle a config flow for roon."""
def __init__(self):
"""Initialize the Roon flow."""
<|body_0|>
async def async_step_user(self, user_input=None):
"""Get roon core details via discovery."""
<|body_1|>
async def async_step_fallback(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfigFlow:
"""Handle a config flow for roon."""
def __init__(self):
"""Initialize the Roon flow."""
self._host = None
self._port = None
self._servers = []
async def async_step_user(self, user_input=None):
"""Get roon core details via discovery."""
sel... | the_stack_v2_python_sparse | homeassistant/components/roon/config_flow.py | home-assistant/core | train | 35,501 |
aaad78e3221c86b992e1b2de9dffcde636c1b8db | [
"for pos, assertions in other.failed.items():\n self.failed[pos].update(assertions)\nfor pos, assertions in other.error.items():\n self.error[pos].update(assertions)",
"if stmt_idx in self.failed and assertion_idx in self.failed[stmt_idx]:\n return True\nif stmt_idx in self.error and assertion_idx in sel... | <|body_start_0|>
for pos, assertions in other.failed.items():
self.failed[pos].update(assertions)
for pos, assertions in other.error.items():
self.error[pos].update(assertions)
<|end_body_0|>
<|body_start_1|>
if stmt_idx in self.failed and assertion_idx in self.failed[st... | Trace for assertion verification. | AssertionVerificationTrace | [
"CC-BY-4.0",
"LGPL-2.1-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssertionVerificationTrace:
"""Trace for assertion verification."""
def merge(self, other: AssertionVerificationTrace) -> None:
"""Merge another trace into this trace. Args: other: The other trace"""
<|body_0|>
def was_violated(self, stmt_idx: int, assertion_idx: int) ->... | stack_v2_sparse_classes_10k_train_000336 | 3,855 | permissive | [
{
"docstring": "Merge another trace into this trace. Args: other: The other trace",
"name": "merge",
"signature": "def merge(self, other: AssertionVerificationTrace) -> None"
},
{
"docstring": "Was the assertion at the given position violated? This may happen because the assertion failed or anot... | 2 | stack_v2_sparse_classes_30k_train_006174 | Implement the Python class `AssertionVerificationTrace` described below.
Class description:
Trace for assertion verification.
Method signatures and docstrings:
- def merge(self, other: AssertionVerificationTrace) -> None: Merge another trace into this trace. Args: other: The other trace
- def was_violated(self, stmt_... | Implement the Python class `AssertionVerificationTrace` described below.
Class description:
Trace for assertion verification.
Method signatures and docstrings:
- def merge(self, other: AssertionVerificationTrace) -> None: Merge another trace into this trace. Args: other: The other trace
- def was_violated(self, stmt_... | cc083252c7054824bfaf200533a8b7ad45f7c4fb | <|skeleton|>
class AssertionVerificationTrace:
"""Trace for assertion verification."""
def merge(self, other: AssertionVerificationTrace) -> None:
"""Merge another trace into this trace. Args: other: The other trace"""
<|body_0|>
def was_violated(self, stmt_idx: int, assertion_idx: int) ->... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AssertionVerificationTrace:
"""Trace for assertion verification."""
def merge(self, other: AssertionVerificationTrace) -> None:
"""Merge another trace into this trace. Args: other: The other trace"""
for pos, assertions in other.failed.items():
self.failed[pos].update(assertio... | the_stack_v2_python_sparse | src/pynguin/assertion/assertion_trace.py | se2p/pynguin | train | 1,223 |
aa9d56bc710b5079229c14ed8db5ca34a28e85b1 | [
"node = TreeNode(5)\nleftNode = TreeNode(4)\nrightNode = TreeNode(5)\nnode.left = leftNode\nnode.right = rightNode\nthirdLevelLeftNode1 = TreeNode(1)\nthirdLevelLeftNode2 = TreeNode(1)\nthirdLevelRightNode1 = TreeNode(5)\nleftNode.left = thirdLevelLeftNode1\nleftNode.right = thirdLevelLeftNode2\nrightNode.right = t... | <|body_start_0|>
node = TreeNode(5)
leftNode = TreeNode(4)
rightNode = TreeNode(5)
node.left = leftNode
node.right = rightNode
thirdLevelLeftNode1 = TreeNode(1)
thirdLevelLeftNode2 = TreeNode(1)
thirdLevelRightNode1 = TreeNode(5)
leftNode.left = th... | TestSolution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSolution:
def test_LongestUnivalueCase1(self):
"""5 / 4 5 / \\ / 1 1 5"""
<|body_0|>
def test_LongestUnivalueCase2(self):
"""1 / 4 5 / \\ / 4 4 5"""
<|body_1|>
def test_LongestUnivalueCase3(self):
"""5 / 5 5 / \\ / 5 4 5"""
<|body_2|>... | stack_v2_sparse_classes_10k_train_000337 | 2,303 | no_license | [
{
"docstring": "5 / 4 5 / \\\\ / 1 1 5",
"name": "test_LongestUnivalueCase1",
"signature": "def test_LongestUnivalueCase1(self)"
},
{
"docstring": "1 / 4 5 / \\\\ / 4 4 5",
"name": "test_LongestUnivalueCase2",
"signature": "def test_LongestUnivalueCase2(self)"
},
{
"docstring": "... | 3 | null | Implement the Python class `TestSolution` described below.
Class description:
Implement the TestSolution class.
Method signatures and docstrings:
- def test_LongestUnivalueCase1(self): 5 / 4 5 / \\ / 1 1 5
- def test_LongestUnivalueCase2(self): 1 / 4 5 / \\ / 4 4 5
- def test_LongestUnivalueCase3(self): 5 / 5 5 / \\ ... | Implement the Python class `TestSolution` described below.
Class description:
Implement the TestSolution class.
Method signatures and docstrings:
- def test_LongestUnivalueCase1(self): 5 / 4 5 / \\ / 1 1 5
- def test_LongestUnivalueCase2(self): 1 / 4 5 / \\ / 4 4 5
- def test_LongestUnivalueCase3(self): 5 / 5 5 / \\ ... | 7fa160362ebb58e7286b490012542baa2d51e5c9 | <|skeleton|>
class TestSolution:
def test_LongestUnivalueCase1(self):
"""5 / 4 5 / \\ / 1 1 5"""
<|body_0|>
def test_LongestUnivalueCase2(self):
"""1 / 4 5 / \\ / 4 4 5"""
<|body_1|>
def test_LongestUnivalueCase3(self):
"""5 / 5 5 / \\ / 5 4 5"""
<|body_2|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestSolution:
def test_LongestUnivalueCase1(self):
"""5 / 4 5 / \\ / 1 1 5"""
node = TreeNode(5)
leftNode = TreeNode(4)
rightNode = TreeNode(5)
node.left = leftNode
node.right = rightNode
thirdLevelLeftNode1 = TreeNode(1)
thirdLevelLeftNode2 = Tr... | the_stack_v2_python_sparse | tree/test_longestUnivaluePath.py | gerrycfchang/leetcode-python | train | 2 | |
4e5119d478c0cb1a90ab8b6f9dfb91c4aa6b1792 | [
"if root is None:\n return True\nreturn self.is_same(root.left, root.right)",
"if p is None and q is None:\n return True\nif p is None or q is None:\n return False\nreturn p.val == q.val and self.is_same(p.left, q.right) and self.is_same(p.right, q.left)"
] | <|body_start_0|>
if root is None:
return True
return self.is_same(root.left, root.right)
<|end_body_0|>
<|body_start_1|>
if p is None and q is None:
return True
if p is None or q is None:
return False
return p.val == q.val and self.is_same(p.l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def is_same(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
retur... | stack_v2_sparse_classes_10k_train_000338 | 753 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
},
{
"docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool",
"name": "is_same",
"signature": "def is_same(self, p, q)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006917 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def is_same(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def is_same(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
<|skeleton|>
class Solution:
def ... | 772e047c4e1e9abf0d74b7dd539d684f216799b9 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def is_same(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
if root is None:
return True
return self.is_same(root.left, root.right)
def is_same(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
if p is None and q is ... | the_stack_v2_python_sparse | code/SymmetricTree.py | crl0636/Python | train | 1 | |
f0e00689b0b336d446f081adff6fe29f2df2d1e3 | [
"self.state.hist_count = 0\nself.state.history_paths = []\nif self.args.history_path:\n self.state.history_paths.append(self.args.history_path)\nif not self.state.history_paths:\n self.state.history_paths = self.GuessHistoryPaths(self.args.username)\nif not self.state.history_paths:\n raise flow_base.FlowE... | <|body_start_0|>
self.state.hist_count = 0
self.state.history_paths = []
if self.args.history_path:
self.state.history_paths.append(self.args.history_path)
if not self.state.history_paths:
self.state.history_paths = self.GuessHistoryPaths(self.args.username)
... | Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User Data\\\\Default Windows 7 or Vista c:\\\\... | ChromeHistory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User ... | stack_v2_sparse_classes_10k_train_000339 | 15,367 | permissive | [
{
"docstring": "Determine the Chrome directory.",
"name": "Start",
"signature": "def Start(self)"
},
{
"docstring": "Take each file we retrieved and get the history from it.",
"name": "ParseFiles",
"signature": "def ParseFiles(self, responses)"
},
{
"docstring": "Take a user and ... | 3 | stack_v2_sparse_classes_30k_train_004878 | Implement the Python class `ChromeHistory` described below.
Class description:
Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Applica... | Implement the Python class `ChromeHistory` described below.
Class description:
Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Applica... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User Data\\\\Defau... | the_stack_v2_python_sparse | grr/server/grr_response_server/flows/general/webhistory.py | google/grr | train | 4,683 |
21bbcf03a738abc709bbc3e54ed0c46b913fbe44 | [
"super(ObservationPadEnv, self).__init__(env)\nself._padded_shape = padded_shape\nself._center = center\nold_space = self.observation_space\nself.observation_space = gym.spaces.Box(low=self.observation(old_space.low), high=self.observation(old_space.high), dtype=old_space.dtype)",
"total_pads = tuple((target - cu... | <|body_start_0|>
super(ObservationPadEnv, self).__init__(env)
self._padded_shape = padded_shape
self._center = center
old_space = self.observation_space
self.observation_space = gym.spaces.Box(low=self.observation(old_space.low), high=self.observation(old_space.high), dtype=old_s... | An environment that zero-pads the observation. Supports any Box observation space. | ObservationPadEnv | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObservationPadEnv:
"""An environment that zero-pads the observation. Supports any Box observation space."""
def __init__(self, env, padded_shape, center=True):
"""Create a padded environment. Args: env: the environment to wrap. padded_shape: the shape after padding. center: if True, ... | stack_v2_sparse_classes_10k_train_000340 | 2,666 | permissive | [
{
"docstring": "Create a padded environment. Args: env: the environment to wrap. padded_shape: the shape after padding. center: if True, attempt to center the original observation in the padded one. Otherwise, put the original image at the beginning of the padded image (e.g. the top-left corner).",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_007153 | Implement the Python class `ObservationPadEnv` described below.
Class description:
An environment that zero-pads the observation. Supports any Box observation space.
Method signatures and docstrings:
- def __init__(self, env, padded_shape, center=True): Create a padded environment. Args: env: the environment to wrap.... | Implement the Python class `ObservationPadEnv` described below.
Class description:
An environment that zero-pads the observation. Supports any Box observation space.
Method signatures and docstrings:
- def __init__(self, env, padded_shape, center=True): Create a padded environment. Args: env: the environment to wrap.... | bba80d7049fc1586a42c05905bae75c271657761 | <|skeleton|>
class ObservationPadEnv:
"""An environment that zero-pads the observation. Supports any Box observation space."""
def __init__(self, env, padded_shape, center=True):
"""Create a padded environment. Args: env: the environment to wrap. padded_shape: the shape after padding. center: if True, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObservationPadEnv:
"""An environment that zero-pads the observation. Supports any Box observation space."""
def __init__(self, env, padded_shape, center=True):
"""Create a padded environment. Args: env: the environment to wrap. padded_shape: the shape after padding. center: if True, attempt to ce... | the_stack_v2_python_sparse | anyrl-py/anyrl/envs/wrappers/padding.py | onursahin93/sonic_contest | train | 0 |
0d029d5518c5ac0e841e06652afe17273784ff6e | [
"if not isinstance(bag, Bag):\n raise XacmlContextTypeError('Expecting %r derived type for \"bag\"; got %r' % (Bag, type(bag)))\nif bag.elementType != self.__class__.BAG_TYPE:\n raise XacmlContextTypeError('Expecting %r type elements for \"bag\"; got %r' % (self.__class__.BAG_TYPE, bag.elementType))\nnBagElem... | <|body_start_0|>
if not isinstance(bag, Bag):
raise XacmlContextTypeError('Expecting %r derived type for "bag"; got %r' % (Bag, type(bag)))
if bag.elementType != self.__class__.BAG_TYPE:
raise XacmlContextTypeError('Expecting %r type elements for "bag"; got %r' % (self.__class__.... | Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE: | And | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class And:
"""Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:"""
def evaluate(self, bag):
"""perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-o... | stack_v2_sparse_classes_10k_train_000341 | 3,368 | no_license | [
{
"docstring": "perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-os, Fe 2005 - A.3.5 Logical functions @param bag: bag containing elements to be AND'ed @type bag: ndg.xacml.utils.TypedList @return: result of AND operation on the inputs @rtype: bool",
"name": "evaluate"... | 2 | stack_v2_sparse_classes_30k_train_004273 | Implement the Python class `And` described below.
Class description:
Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:
Method signatures and docstrings:
- def evaluate(self, bag): perform AND function on the elem... | Implement the Python class `And` described below.
Class description:
Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:
Method signatures and docstrings:
- def evaluate(self, bag): perform AND function on the elem... | 737b82c7238ecb755f1b9e455048319a58f06412 | <|skeleton|>
class And:
"""Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:"""
def evaluate(self, bag):
"""perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class And:
"""Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:"""
def evaluate(self, bag):
"""perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-os, Fe 2005 - ... | the_stack_v2_python_sparse | pyon/core/governance/policy/xacml/and_function.py | ooici-dm/pyon | train | 3 |
7da043b6c9f50050315a84a9df3f27ed613581ce | [
"for module in self.register_module():\n sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module)))\n module_name = module.__name__\n for sig in sig_env:\n setattr(self, '{}_{}'.format(module_name, sig), module.__dict__[sig])",
"from ... | <|body_start_0|>
for module in self.register_module():
sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module)))
module_name = module.__name__
for sig in sig_env:
setattr(self, '{}_{}'.format(mod... | 多任务主进程内存设置拷贝执行者类 | AbuEnvProcess | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbuEnvProcess:
"""多任务主进程内存设置拷贝执行者类"""
def __init__(self):
"""迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量"""
<|body_0|>
def register_module(self):
"""注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:"""
<|body_1|>
def copy_pr... | stack_v2_sparse_classes_10k_train_000342 | 6,236 | permissive | [
{
"docstring": "迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:",
"name": "register_module",
"signature": "def register_module(self)"
},
... | 4 | null | Implement the Python class `AbuEnvProcess` described below.
Class description:
多任务主进程内存设置拷贝执行者类
Method signatures and docstrings:
- def __init__(self): 迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量
- def register_module(self): 注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:
- def copy_proces... | Implement the Python class `AbuEnvProcess` described below.
Class description:
多任务主进程内存设置拷贝执行者类
Method signatures and docstrings:
- def __init__(self): 迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量
- def register_module(self): 注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:
- def copy_proces... | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | <|skeleton|>
class AbuEnvProcess:
"""多任务主进程内存设置拷贝执行者类"""
def __init__(self):
"""迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量"""
<|body_0|>
def register_module(self):
"""注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:"""
<|body_1|>
def copy_pr... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AbuEnvProcess:
"""多任务主进程内存设置拷贝执行者类"""
def __init__(self):
"""迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量"""
for module in self.register_module():
sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module)))... | the_stack_v2_python_sparse | abupy/CoreBu/ABuEnvProcess.py | luqin/firefly | train | 1 |
2fff44aeceecc4448a2cc5c15d2a44f1a1e5be9d | [
"produto = get_a_product('id', id)\nif not produto:\n api.abort(404)\nelse:\n return produto",
"produto = get_a_product('id', id)\ndata = request.json\nif not produto:\n api.abort(404, 'Produto não Encontrado.')\nif not data:\n api.abort(400, 'Payload vazio.')\nif data.get('fornecedor_id', 0) != 0:\n ... | <|body_start_0|>
produto = get_a_product('id', id)
if not produto:
api.abort(404)
else:
return produto
<|end_body_0|>
<|body_start_1|>
produto = get_a_product('id', id)
data = request.json
if not produto:
api.abort(404, 'Produto não En... | ProdutoID | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProdutoID:
def get(self, id):
"""Obtem informações de um produto com base no seu id"""
<|body_0|>
def patch(self, id):
"""Atualiza um produto Obs: para inativar, coloque 'ativo': false"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
produto = get_a_... | stack_v2_sparse_classes_10k_train_000343 | 3,686 | no_license | [
{
"docstring": "Obtem informações de um produto com base no seu id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Atualiza um produto Obs: para inativar, coloque 'ativo': false",
"name": "patch",
"signature": "def patch(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005255 | Implement the Python class `ProdutoID` described below.
Class description:
Implement the ProdutoID class.
Method signatures and docstrings:
- def get(self, id): Obtem informações de um produto com base no seu id
- def patch(self, id): Atualiza um produto Obs: para inativar, coloque 'ativo': false | Implement the Python class `ProdutoID` described below.
Class description:
Implement the ProdutoID class.
Method signatures and docstrings:
- def get(self, id): Obtem informações de um produto com base no seu id
- def patch(self, id): Atualiza um produto Obs: para inativar, coloque 'ativo': false
<|skeleton|>
class ... | a86fcb085af8567a661d47876f8b9f13d7b062a9 | <|skeleton|>
class ProdutoID:
def get(self, id):
"""Obtem informações de um produto com base no seu id"""
<|body_0|>
def patch(self, id):
"""Atualiza um produto Obs: para inativar, coloque 'ativo': false"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProdutoID:
def get(self, id):
"""Obtem informações de um produto com base no seu id"""
produto = get_a_product('id', id)
if not produto:
api.abort(404)
else:
return produto
def patch(self, id):
"""Atualiza um produto Obs: para inativar, colo... | the_stack_v2_python_sparse | backend/app/main/controller/produto_controller.py | AnderSilva/ozomali | train | 1 | |
83c0b70fcf56401f49bfb8cc4801d338245a861e | [
"collaboration = db.Collaboration.get(id)\nif not collaboration:\n return ({'msg': 'collaboration having collaboration_id={} can not be found'.format(id)}, HTTPStatus.NOT_FOUND)\nreturn (self.node_schema.dump(collaboration.nodes, many=True).data, HTTPStatus.OK)",
"collaboration = db.Collaboration.get(id)\nif n... | <|body_start_0|>
collaboration = db.Collaboration.get(id)
if not collaboration:
return ({'msg': 'collaboration having collaboration_id={} can not be found'.format(id)}, HTTPStatus.NOT_FOUND)
return (self.node_schema.dump(collaboration.nodes, many=True).data, HTTPStatus.OK)
<|end_body... | Resource for /api/collaboration/<int:id>/node. | CollaborationNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CollaborationNode:
"""Resource for /api/collaboration/<int:id>/node."""
def get(self, id):
""""Return a list of nodes that belong to the collaboration."""
<|body_0|>
def post(self, id):
"""Add an node to a specific collaboration."""
<|body_1|>
def de... | stack_v2_sparse_classes_10k_train_000344 | 14,133 | permissive | [
{
"docstring": "\"Return a list of nodes that belong to the collaboration.",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Add an node to a specific collaboration.",
"name": "post",
"signature": "def post(self, id)"
},
{
"docstring": "Remove node from collabo... | 3 | stack_v2_sparse_classes_30k_train_005002 | Implement the Python class `CollaborationNode` described below.
Class description:
Resource for /api/collaboration/<int:id>/node.
Method signatures and docstrings:
- def get(self, id): "Return a list of nodes that belong to the collaboration.
- def post(self, id): Add an node to a specific collaboration.
- def delete... | Implement the Python class `CollaborationNode` described below.
Class description:
Resource for /api/collaboration/<int:id>/node.
Method signatures and docstrings:
- def get(self, id): "Return a list of nodes that belong to the collaboration.
- def post(self, id): Add an node to a specific collaboration.
- def delete... | a64827981db26b34dd1dcea1cb2282d03dd4545d | <|skeleton|>
class CollaborationNode:
"""Resource for /api/collaboration/<int:id>/node."""
def get(self, id):
""""Return a list of nodes that belong to the collaboration."""
<|body_0|>
def post(self, id):
"""Add an node to a specific collaboration."""
<|body_1|>
def de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CollaborationNode:
"""Resource for /api/collaboration/<int:id>/node."""
def get(self, id):
""""Return a list of nodes that belong to the collaboration."""
collaboration = db.Collaboration.get(id)
if not collaboration:
return ({'msg': 'collaboration having collaboration... | the_stack_v2_python_sparse | vantage6/server/resource/collaboration.py | mindrenee/vantage6-server | train | 0 |
0c54f863cc3b64768c2083b234c2e8d933142fc7 | [
"new_head = ListNode(None)\npointer = new_head\nwhile True:\n if l1 == None and l2 == None:\n break\n elif l1 == None:\n pointer.next = l2\n break\n elif l2 == None:\n pointer.next = l1\n break\n else:\n if l1.val < l2.val:\n pointer.next = l1\n ... | <|body_start_0|>
new_head = ListNode(None)
pointer = new_head
while True:
if l1 == None and l2 == None:
break
elif l1 == None:
pointer.next = l2
break
elif l2 == None:
pointer.next = l1
... | Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNo... | stack_v2_sparse_classes_10k_train_000345 | 2,452 | 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",
"signature": "def mergeTwoLists(self, l1, ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists.
Method signatures and docstr... | Implement the Python class `Solution` described below.
Class description:
Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists.
Method signatures and docstr... | 844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4 | <|skeleton|>
class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""Iterative Solution Runtime: Runtime: 20 ms, faster than 95.09% of Python online submissions for Merge Two Sorted Lists. Memory Usage: 12.7 MB, less than 5.75% of Python online submissions for Merge Two Sorted Lists."""
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ... | the_stack_v2_python_sparse | 21-merge_two_linked_lists.py | stevestar888/leetcode-problems | train | 2 |
d3076f357c7ba8fa3d1d33199cbb74411a6e5590 | [
"assert isinstance(response, scrapy.http.response.html.HtmlResponse)\nBOARDS = ['charterboatuk boats']\nURLS = ['http://www.charterboats-uk.co.uk/england']\nPAGES = [18]\nassert len(BOARDS) == len(URLS) == len(PAGES), 'Setup list lengths DO NOT match'\nfor i, root_url in enumerate(URLS):\n curboard = BOARDS[i]\n... | <|body_start_0|>
assert isinstance(response, scrapy.http.response.html.HtmlResponse)
BOARDS = ['charterboatuk boats']
URLS = ['http://www.charterboats-uk.co.uk/england']
PAGES = [18]
assert len(BOARDS) == len(URLS) == len(PAGES), 'Setup list lengths DO NOT match'
for i, r... | scrape all the text in on the boat details tab to write to ugc | CharterBoatUKBoatTextSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
<|body_0|>
def crawl_boats(self, response):
"""each page with links to 10 boats details"""
... | stack_v2_sparse_classes_10k_train_000346 | 17,953 | no_license | [
{
"docstring": "generate links to pages in a board",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "each page with links to 10 boats details",
"name": "crawl_boats",
"signature": "def crawl_boats(self, response)"
},
{
"docstring": "crawl",
"name"... | 3 | null | Implement the Python class `CharterBoatUKBoatTextSpider` described below.
Class description:
scrape all the text in on the boat details tab to write to ugc
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board
- def crawl_boats(self, response): each page with links to 10 bo... | Implement the Python class `CharterBoatUKBoatTextSpider` described below.
Class description:
scrape all the text in on the boat details tab to write to ugc
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board
- def crawl_boats(self, response): each page with links to 10 bo... | 9123aa6baf538b662143b9098d963d55165e8409 | <|skeleton|>
class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
<|body_0|>
def crawl_boats(self, response):
"""each page with links to 10 boats details"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CharterBoatUKBoatTextSpider:
"""scrape all the text in on the boat details tab to write to ugc"""
def parse(self, response):
"""generate links to pages in a board"""
assert isinstance(response, scrapy.http.response.html.HtmlResponse)
BOARDS = ['charterboatuk boats']
URLS =... | the_stack_v2_python_sparse | imgscrape/spiders/charterboatuk.py | gmonkman/python | train | 0 |
62faaccf74199d4800fa9dd50b65ab42be2e855f | [
"self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)\nself.coord_feed = coord_feed\nself.dim_feed = self.coord_feed.feed.map(self.correct_dims, num_parallel_calls=self.num_parallel_calls)\nself.feed = self.dim_feed",
"N = tf.shape(X)[0]\nN_slice = tf.reduce_prod(self.coord_feed.dims[1:])\... | <|body_start_0|>
self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)
self.coord_feed = coord_feed
self.dim_feed = self.coord_feed.feed.map(self.correct_dims, num_parallel_calls=self.num_parallel_calls)
self.feed = self.dim_feed
<|end_body_0|>
<|body_start_1|>
... | CoordinateDimFeed | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoordinateDimFeed:
def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10):
"""Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int"""
<|body_0|>
def correct_dims(self, ... | stack_v2_sparse_classes_10k_train_000347 | 18,860 | permissive | [
{
"docstring": "Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int",
"name": "__init__",
"signature": "def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10)"
},
{
"docstring": "Correct f... | 2 | stack_v2_sparse_classes_30k_train_005350 | Implement the Python class `CoordinateDimFeed` described below.
Class description:
Implement the CoordinateDimFeed class.
Method signatures and docstrings:
- def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): Create a coordinate dimension feed that correctly incorperates partial batches. :param co... | Implement the Python class `CoordinateDimFeed` described below.
Class description:
Implement the CoordinateDimFeed class.
Method signatures and docstrings:
- def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10): Create a coordinate dimension feed that correctly incorperates partial batches. :param co... | 2997d60d8cf07f875e42c0b5f07944e9ab7e9d33 | <|skeleton|>
class CoordinateDimFeed:
def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10):
"""Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int"""
<|body_0|>
def correct_dims(self, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CoordinateDimFeed:
def __init__(self, coord_feed: CoordinateFeed, num_parallel_calls=10):
"""Create a coordinate dimension feed that correctly incorperates partial batches. :param coord_feed: CoordinateFeed :param num_parallel_calls: int"""
self.num_parallel_calls = tf.convert_to_tensor(num_pa... | the_stack_v2_python_sparse | bayes_filter/feeds.py | Joshuaalbert/bayes_filter | train | 0 | |
69d4e6d61421f973d9a8e275417f3fad82825188 | [
"self.readm_batchsize = readm_batchsize\nself.cooccur_batchsize = readm_batchsize * batchsize_ratio\nself.batchsize_ratio = batchsize_ratio\nself.outcome = outcome\nself.cooccur_df = cooccur_df\nself.readm_df = readm_df\nself.shuffle = shuffle\nself.__scaling_factor = scaling_factor\nself.__count_cap = count_cap\ns... | <|body_start_0|>
self.readm_batchsize = readm_batchsize
self.cooccur_batchsize = readm_batchsize * batchsize_ratio
self.batchsize_ratio = batchsize_ratio
self.outcome = outcome
self.cooccur_df = cooccur_df
self.readm_df = readm_df
self.shuffle = shuffle
se... | Generates data from two datasets | DoubleBatchGenerator | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoubleBatchGenerator:
"""Generates data from two datasets"""
def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, count_cap=20):
"""Initialization Here coocur_df and readm_df need to have integer ind... | stack_v2_sparse_classes_10k_train_000348 | 3,175 | permissive | [
{
"docstring": "Initialization Here coocur_df and readm_df need to have integer index from 0, i.e. they need to reset_index()",
"name": "__init__",
"signature": "def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, coun... | 4 | stack_v2_sparse_classes_30k_train_002867 | Implement the Python class `DoubleBatchGenerator` described below.
Class description:
Generates data from two datasets
Method signatures and docstrings:
- def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, count_cap=20): Initializa... | Implement the Python class `DoubleBatchGenerator` described below.
Class description:
Generates data from two datasets
Method signatures and docstrings:
- def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, count_cap=20): Initializa... | 09e365614b8409e54aaad53d397552bf4227e95f | <|skeleton|>
class DoubleBatchGenerator:
"""Generates data from two datasets"""
def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, count_cap=20):
"""Initialization Here coocur_df and readm_df need to have integer ind... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DoubleBatchGenerator:
"""Generates data from two datasets"""
def __init__(self, cooccur_df, readm_df, readm_batchsize=512, batchsize_ratio=16, outcome='MOT_1year', shuffle=True, scaling_factor=0.75, count_cap=20):
"""Initialization Here coocur_df and readm_df need to have integer index from 0, i.... | the_stack_v2_python_sparse | Wenyi/hypertune/doublebatch.py | bnallamo/Readmissions-Deep-Learning-Project-PLOS-One | train | 0 |
7dc1b20df4dca4564bb41dbcb40015a1b00a8cce | [
"glFrontFace(GL_CW)\ntry:\n if not self.solid:\n glutWireTeapot(self.size)\n else:\n glutSolidTeapot(self.size)\nfinally:\n glFrontFace(GL_CCW)",
"from OpenGLContext.scenegraph import boundingvolume\ncurrent = boundingvolume.getCachedVolume(self)\nif current:\n return current\nreturn bou... | <|body_start_0|>
glFrontFace(GL_CW)
try:
if not self.solid:
glutWireTeapot(self.size)
else:
glutSolidTeapot(self.size)
finally:
glFrontFace(GL_CCW)
<|end_body_0|>
<|body_start_1|>
from OpenGLContext.scenegraph import bo... | Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame! | Teapot | [
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Teapot:
"""Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame!"""
def render(self, visible=1, lit=1, textured=1, transparent=0, mode=None):
"""Render the Teapot"""
... | stack_v2_sparse_classes_10k_train_000349 | 1,836 | permissive | [
{
"docstring": "Render the Teapot",
"name": "render",
"signature": "def render(self, visible=1, lit=1, textured=1, transparent=0, mode=None)"
},
{
"docstring": "Create a bounding-volume object for this node",
"name": "boundingVolume",
"signature": "def boundingVolume(self, mode)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001966 | Implement the Python class `Teapot` described below.
Class description:
Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame!
Method signatures and docstrings:
- def render(self, visible=1, lit=1, texture... | Implement the Python class `Teapot` described below.
Class description:
Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame!
Method signatures and docstrings:
- def render(self, visible=1, lit=1, texture... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class Teapot:
"""Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame!"""
def render(self, visible=1, lit=1, textured=1, transparent=0, mode=None):
"""Render the Teapot"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Teapot:
"""Simple Teapot geometry (glutSolidTeapot) Note: this teapot is *not* optimized with display-lists, the raw glutSolidTeapot/glutWireTeapot calls are used for each frame!"""
def render(self, visible=1, lit=1, textured=1, transparent=0, mode=None):
"""Render the Teapot"""
glFrontFa... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/teapot.py | alexus37/AugmentedRealityChess | train | 1 |
e90e6b59c375a549e966ac042c2d453f7a6fe462 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | USIServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetInterface(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_10k_train_000350 | 6,848 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetPower",
"signature": "def GetPower(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetInterface",
"signature": "def GetInterface(self, re... | 4 | stack_v2_sparse_classes_30k_train_006602 | Implement the Python class `USIServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetPower(self, request, context): Missing associated documentation comment in .proto file.
- def GetInterface(self, request, context): Mi... | Implement the Python class `USIServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetPower(self, request, context): Missing associated documentation comment in .proto file.
- def GetInterface(self, request, context): Mi... | 8d279c468486e06f24715a66385e02efaddb7f01 | <|skeleton|>
class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetInterface(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | daq/proto/usi_pb2_grpc.py | faucetsdn/daq | train | 47 |
9649de1fa39eeba6ff22ee66fe7f8285b650c110 | [
"self._K_P = K_P\nself._K_D = K_D\nself._K_I = K_I\nself._e_buffer = deque(maxlen=10)\nself.error = 0.0\nself.error_integral = 0.0\nself.error_derivative = 0.0",
"v_begin = current_pose.position\nquaternion = (current_pose.orientation.w, current_pose.orientation.x, current_pose.orientation.y, current_pose.orienta... | <|body_start_0|>
self._K_P = K_P
self._K_D = K_D
self._K_I = K_I
self._e_buffer = deque(maxlen=10)
self.error = 0.0
self.error_integral = 0.0
self.error_derivative = 0.0
<|end_body_0|>
<|body_start_1|>
v_begin = current_pose.position
quaternion = ... | PIDLateralController implements lateral control using a PID. | PIDLateralController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDLateralController:
"""PIDLateralController implements lateral control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":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"... | stack_v2_sparse_classes_10k_train_000351 | 6,324 | permissive | [
{
"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",
"name": "__init__",
"signature": "def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0)"
},
{
"docstring": "Estimate the steering angle of th... | 2 | stack_v2_sparse_classes_30k_train_007029 | Implement the Python class `PIDLateralController` described below.
Class description:
PIDLateralController implements lateral control using a PID.
Method signatures and docstrings:
- def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term... | Implement the Python class `PIDLateralController` described below.
Class description:
PIDLateralController implements lateral control using a PID.
Method signatures and docstrings:
- def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term... | e9063d97ff5a724f76adbb1b852dc71da1dcfeec | <|skeleton|>
class PIDLateralController:
"""PIDLateralController implements lateral control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":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"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PIDLateralController:
"""PIDLateralController implements lateral control using a PID."""
def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0):
""":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"""
se... | the_stack_v2_python_sparse | carla_ad_agent/src/carla_ad_agent/vehicle_pid_controller.py | carla-simulator/ros-bridge | train | 448 |
96a1a64ef9d8864a4b7bbb557df22bb22fff5521 | [
"example_1 = 'COM)B\\nB)C\\nC)D\\nD)E\\nE)F\\nB)G\\nG)H\\nD)I\\nE)J\\nJ)K\\nK)L'\nself.assertEqual(day_6.part1(example_1), 42)\nself.assertEqual(day_6.part1(), 270768)",
"example_1 = 'COM)B\\nB)C\\nC)D\\nD)E\\nE)F\\nB)G\\nG)H\\nD)I\\nE)J\\nJ)K\\nK)L\\nK)YOU\\nI)SAN'\nself.assertEqual(day_6.part2(example_1), 4)\ns... | <|body_start_0|>
example_1 = 'COM)B\nB)C\nC)D\nD)E\nE)F\nB)G\nG)H\nD)I\nE)J\nJ)K\nK)L'
self.assertEqual(day_6.part1(example_1), 42)
self.assertEqual(day_6.part1(), 270768)
<|end_body_0|>
<|body_start_1|>
example_1 = 'COM)B\nB)C\nC)D\nD)E\nE)F\nB)G\nG)H\nD)I\nE)J\nJ)K\nK)L\nK)YOU\nI)SAN'... | TestDay6 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDay6:
def test_part1(self):
"""Finds the total number of direct and indirect orbits in the orbit map"""
<|body_0|>
def test_part2(self):
"""Finds the minimum number of orbital transfers needed to move from you to santa"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_10k_train_000352 | 942 | permissive | [
{
"docstring": "Finds the total number of direct and indirect orbits in the orbit map",
"name": "test_part1",
"signature": "def test_part1(self)"
},
{
"docstring": "Finds the minimum number of orbital transfers needed to move from you to santa",
"name": "test_part2",
"signature": "def te... | 2 | stack_v2_sparse_classes_30k_train_004631 | Implement the Python class `TestDay6` described below.
Class description:
Implement the TestDay6 class.
Method signatures and docstrings:
- def test_part1(self): Finds the total number of direct and indirect orbits in the orbit map
- def test_part2(self): Finds the minimum number of orbital transfers needed to move f... | Implement the Python class `TestDay6` described below.
Class description:
Implement the TestDay6 class.
Method signatures and docstrings:
- def test_part1(self): Finds the total number of direct and indirect orbits in the orbit map
- def test_part2(self): Finds the minimum number of orbital transfers needed to move f... | d9e0b55daefdc8439e70ce4c17e88e4efddf4b33 | <|skeleton|>
class TestDay6:
def test_part1(self):
"""Finds the total number of direct and indirect orbits in the orbit map"""
<|body_0|>
def test_part2(self):
"""Finds the minimum number of orbital transfers needed to move from you to santa"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestDay6:
def test_part1(self):
"""Finds the total number of direct and indirect orbits in the orbit map"""
example_1 = 'COM)B\nB)C\nC)D\nD)E\nE)F\nB)G\nG)H\nD)I\nE)J\nJ)K\nK)L'
self.assertEqual(day_6.part1(example_1), 42)
self.assertEqual(day_6.part1(), 270768)
def test_p... | the_stack_v2_python_sparse | 2019/6/test.py | agarun/adventofcode | train | 1 | |
72bf3ca78c47c383c695c4644f4b366813895f9d | [
"if isinstance(dictionary['quantiles'], abc.Mapping):\n quantiles = [(float(key), value) for key, value in dictionary['quantiles'].items()]\n quantiles.sort(key=lambda x: x[0])\nelse:\n quantiles = [tuple(pair) for pair in dictionary['quantiles']]\nreturn cls(count=dictionary['count'], min=dictionary['min'... | <|body_start_0|>
if isinstance(dictionary['quantiles'], abc.Mapping):
quantiles = [(float(key), value) for key, value in dictionary['quantiles'].items()]
quantiles.sort(key=lambda x: x[0])
else:
quantiles = [tuple(pair) for pair in dictionary['quantiles']]
ret... | Summary statistics for a set of numbers. | SummaryStatistics | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SummaryStatistics:
"""Summary statistics for a set of numbers."""
def from_dict(cls, dictionary):
"""Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummaryStatistics.from_dict(attr.asdict(stats))` should equal `sta... | stack_v2_sparse_classes_10k_train_000353 | 24,441 | permissive | [
{
"docstring": "Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummaryStatistics.from_dict(attr.asdict(stats))` should equal `stats`. Args: dictionary: Dictionary resulting from `stats.to_dict_for_json()` or `attr.asdict(stats)` for some `Sum... | 2 | stack_v2_sparse_classes_30k_train_000045 | Implement the Python class `SummaryStatistics` described below.
Class description:
Summary statistics for a set of numbers.
Method signatures and docstrings:
- def from_dict(cls, dictionary): Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummarySt... | Implement the Python class `SummaryStatistics` described below.
Class description:
Summary statistics for a set of numbers.
Method signatures and docstrings:
- def from_dict(cls, dictionary): Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummarySt... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class SummaryStatistics:
"""Summary statistics for a set of numbers."""
def from_dict(cls, dictionary):
"""Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummaryStatistics.from_dict(attr.asdict(stats))` should equal `sta... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SummaryStatistics:
"""Summary statistics for a set of numbers."""
def from_dict(cls, dictionary):
"""Constructs a `SummaryStatistics` object from a Python dictionary. If `stats` is an instance of `SummaryStatistics`, `SummaryStatistics.from_dict(attr.asdict(stats))` should equal `stats`. Args: di... | the_stack_v2_python_sparse | readtwice/data_utils/beam_utils.py | Jimmy-INL/google-research | train | 1 |
13b415dc74c0558e659d576898ed8b3206940733 | [
"super().__init__()\nassert isinstance(torch_feature, torch.Tensor), f'torch_feature in TorchBasedFeature must be torch.Tensor, but got {type(torch_feature)}.'\nself._tensor = torch_feature",
"if ids is None:\n return self._tensor\nreturn self._tensor[ids]",
"if ids is None:\n assert self._tensor.shape ==... | <|body_start_0|>
super().__init__()
assert isinstance(torch_feature, torch.Tensor), f'torch_feature in TorchBasedFeature must be torch.Tensor, but got {type(torch_feature)}.'
self._tensor = torch_feature
<|end_body_0|>
<|body_start_1|>
if ids is None:
return self._tensor
... | Torch based feature. | TorchBasedFeature | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TorchBasedFeature:
"""Torch based feature."""
def __init__(self, torch_feature: torch.Tensor):
"""Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature.... | stack_v2_sparse_classes_10k_train_000354 | 6,169 | permissive | [
{
"docstring": "Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature. Examples -------- >>> import torch >>> torch_feat = torch.arange(0, 5) >>> feature_store = TorchBasedFeature(... | 3 | null | Implement the Python class `TorchBasedFeature` described below.
Class description:
Torch based feature.
Method signatures and docstrings:
- def __init__(self, torch_feature: torch.Tensor): Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters -... | Implement the Python class `TorchBasedFeature` described below.
Class description:
Torch based feature.
Method signatures and docstrings:
- def __init__(self, torch_feature: torch.Tensor): Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters -... | bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1 | <|skeleton|>
class TorchBasedFeature:
"""Torch based feature."""
def __init__(self, torch_feature: torch.Tensor):
"""Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TorchBasedFeature:
"""Torch based feature."""
def __init__(self, torch_feature: torch.Tensor):
"""Initialize a torch based feature store by a torch feature. Note that the feature can be either in memory or on disk. Parameters ---------- torch_feature : torch.Tensor The torch feature. Examples ---... | the_stack_v2_python_sparse | python/dgl/graphbolt/impl/torch_based_feature_store.py | dmlc/dgl | train | 12,631 |
eee63d2f4aba5b57e557cab0ffb52af98669bc6a | [
"if len(s) != len(t):\n return False\ncache = {}\nresult = [0] * len(s)\ncounter = 0\nfor i in range(len(s)):\n if s[i] not in cache:\n cache[s[i]] = counter\n counter += 1\n result[i] = cache[s[i]]\ncache = {}\ncounter = 0\nfor j in range(len(t)):\n if t[j] not in cache:\n cache[t[... | <|body_start_0|>
if len(s) != len(t):
return False
cache = {}
result = [0] * len(s)
counter = 0
for i in range(len(s)):
if s[i] not in cache:
cache[s[i]] = counter
counter += 1
result[i] = cache[s[i]]
cac... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) != len(t):
... | stack_v2_sparse_classes_10k_train_000355 | 1,393 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
<|skeleton|>
class Solution:
def... | d75876ae96bcd85c67bbfbf91bbc0f0bc773e97c | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
if len(s) != len(t):
return False
cache = {}
result = [0] * len(s)
counter = 0
for i in range(len(s)):
if s[i] not in cache:
cache[s[i]] ... | the_stack_v2_python_sparse | 205. Isomorphic Strings.py | samir-0711/Leetcode-Python | train | 0 | |
63a92be1d7d4fab2c907c4b75b552e7a33d2d229 | [
"slow = 0\nfor fast in range(len(nums)):\n if nums[fast] != val:\n nums[slow] = nums[fast]\n slow += 1\nreturn slow",
"i = 0\nn = len(nums)\nwhile i < n:\n if nums[i] == val:\n nums[i] = nums[n - 1]\n n -= 1\n else:\n i += 1\nreturn n"
] | <|body_start_0|>
slow = 0
for fast in range(len(nums)):
if nums[fast] != val:
nums[slow] = nums[fast]
slow += 1
return slow
<|end_body_0|>
<|body_start_1|>
i = 0
n = len(nums)
while i < n:
if nums[i] == val:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeElement_1(self, nums: List[int], val: int) -> int:
"""双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:"""
<|body_0|>
def removeElement_2(self, nums: List[int], val: int) -> int:
"""双指针2 时间复杂度:O(n), i 和 ... | stack_v2_sparse_classes_10k_train_000356 | 2,796 | no_license | [
{
"docstring": "双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:",
"name": "removeElement_1",
"signature": "def removeElement_1(self, nums: List[int], val: int) -> int"
},
{
"docstring": "双指针2 时间复杂度:O(n), i 和 n 最多遍历 nn 步。在这个方法中,赋值操作的次数等于要删除的元素的数量。因此,如... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeElement_1(self, nums: List[int], val: int) -> int: 双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:
- def removeElement_2(s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeElement_1(self, nums: List[int], val: int) -> int: 双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:
- def removeElement_2(s... | 62419b49000e79962bcdc99cd98afd2fb82ea345 | <|skeleton|>
class Solution:
def removeElement_1(self, nums: List[int], val: int) -> int:
"""双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:"""
<|body_0|>
def removeElement_2(self, nums: List[int], val: int) -> int:
"""双指针2 时间复杂度:O(n), i 和 ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeElement_1(self, nums: List[int], val: int) -> int:
"""双指针1 时间复杂度:O(n), 假设数组总共有 n 个元素,i 和 j 至多遍历 2n 步。 空间复杂度:O(1)。 :param nums: :param val: :return:"""
slow = 0
for fast in range(len(nums)):
if nums[fast] != val:
nums[slow] = nums[fast]
... | the_stack_v2_python_sparse | 软件开发岗刷题(华为笔试准备)/数组和字符串/removeElement.py | MaoningGuan/LeetCode | train | 3 | |
e145001fb24506444cc0f7841d2bbe0bb9e78171 | [
"self.orgnr_field = orgnr_field\nself.intern_ref_field = intern_ref_field\nself.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None\nself.navn_field = navn_field\nself.postnr_field = postnr_field\nself.poststed_field = poststed_field\nself.eierandel_field = eierandel_field\nsel... | <|body_start_0|>
self.orgnr_field = orgnr_field
self.intern_ref_field = intern_ref_field
self.fodt_dato_field = APIHelper.RFC3339DateTime(fodt_dato_field) if fodt_dato_field else None
self.navn_field = navn_field
self.postnr_field = postnr_field
self.poststed_field = post... | Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type description here. postnr_field (int): ... | Aksjonar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type de... | stack_v2_sparse_classes_10k_train_000357 | 3,698 | permissive | [
{
"docstring": "Constructor for the Aksjonar class",
"name": "__init__",
"signature": "def __init__(self, orgnr_field=None, intern_ref_field=None, fodt_dato_field=None, navn_field=None, postnr_field=None, poststed_field=None, eierandel_field=None, additional_properties={})"
},
{
"docstring": "Cr... | 2 | stack_v2_sparse_classes_30k_train_001114 | Implement the Python class `Aksjonar` described below.
Class description:
Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description h... | Implement the Python class `Aksjonar` described below.
Class description:
Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description h... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Aksjonar:
"""Implementation of the 'Aksjonar' model. TODO: type model description here. Attributes: orgnr_field (int): TODO: type description here. intern_ref_field (long|int): TODO: type description here. fodt_dato_field (datetime): TODO: type description here. navn_field (string): TODO: type description her... | the_stack_v2_python_sparse | idfy_rest_client/models/aksjonar.py | dealflowteam/Idfy | train | 0 |
c507992cb6ca25f4ca944f6988d0a8c37cb4ba84 | [
"self.size = size\nself.len = 0\nself.data = []",
"self.data.append(val)\nself.len += 1\nif self.len > self.size:\n del self.data[0]\n self.len -= 1\nprint(self.data)\nreturn 1.0 * sum(self.data) / self.len"
] | <|body_start_0|>
self.size = size
self.len = 0
self.data = []
<|end_body_0|>
<|body_start_1|>
self.data.append(val)
self.len += 1
if self.len > self.size:
del self.data[0]
self.len -= 1
print(self.data)
return 1.0 * sum(self.data) ... | MovingAverage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.size = size
self.len = 0... | stack_v2_sparse_classes_10k_train_000358 | 999 | permissive | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | null | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 24cf8d5f1831e838ea99f50ce4d8f048bd46c136 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.size = size
self.len = 0
self.data = []
def next(self, val):
""":type val: int :rtype: float"""
self.data.append(val)
self.len += 1
if s... | the_stack_v2_python_sparse | python/346_moving_average_from_data_stream.py | jixinfeng/leetcode-soln | train | 0 | |
ad1eb218fbcc53177f2804fdd0dcd615b10debc5 | [
"for child in sorted(self.OpenChildren(), key=lambda x: x.PRIORITY):\n if not allow_external and child.EXTERNAL:\n continue\n if child.Get(child.Schema.ACTIVE):\n yield child",
"hashes = set(hashes)\nfor child in self.GetChildrenByPriority(allow_external=external):\n for urn, digest in chil... | <|body_start_0|>
for child in sorted(self.OpenChildren(), key=lambda x: x.PRIORITY):
if not allow_external and child.EXTERNAL:
continue
if child.Get(child.Schema.ACTIVE):
yield child
<|end_body_0|>
<|body_start_1|>
hashes = set(hashes)
for... | Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on according to their PRIORITY value, lowest ... | FileStore | [
"Apache-2.0",
"DOC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on accor... | stack_v2_sparse_classes_10k_train_000359 | 24,878 | permissive | [
{
"docstring": "Generator that yields active filestore children in priority order.",
"name": "GetChildrenByPriority",
"signature": "def GetChildrenByPriority(self, allow_external=True)"
},
{
"docstring": "Checks a list of hashes for presence in the store. Sub stores need to pass back the origina... | 4 | stack_v2_sparse_classes_30k_train_006733 | Implement the Python class `FileStore` described below.
Class description:
Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_manage... | Implement the Python class `FileStore` described below.
Class description:
Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_manage... | ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e | <|skeleton|>
class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on accor... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on according to their... | the_stack_v2_python_sparse | lib/aff4_objects/filestore.py | defaultnamehere/grr | train | 3 |
c6e00b1d7380f2e8ce71fa3ab97973e5f7708d16 | [
"if not head or not head.next:\n return False\nid_set = set()\nwhile head:\n if id(head) in id_set:\n return True\n else:\n id_set.add(id(head))\n head = head.next\nreturn False",
"if not head or not head.next:\n return False\nslow = fast = head\nwhile fast and fast.next:\n fast = ... | <|body_start_0|>
if not head or not head.next:
return False
id_set = set()
while head:
if id(head) in id_set:
return True
else:
id_set.add(id(head))
head = head.next
return False
<|end_body_0|>
<|body_start_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle_v1(self, head: ListNode) -> bool:
"""使用哈希表存储已经访问过的结点地址"""
<|body_0|>
def hasCycle_v2(self, head: ListNode) -> bool:
"""快慢指针法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head or not head.next:
return Fals... | stack_v2_sparse_classes_10k_train_000360 | 1,263 | no_license | [
{
"docstring": "使用哈希表存储已经访问过的结点地址",
"name": "hasCycle_v1",
"signature": "def hasCycle_v1(self, head: ListNode) -> bool"
},
{
"docstring": "快慢指针法",
"name": "hasCycle_v2",
"signature": "def hasCycle_v2(self, head: ListNode) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_001273 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle_v1(self, head: ListNode) -> bool: 使用哈希表存储已经访问过的结点地址
- def hasCycle_v2(self, head: ListNode) -> bool: 快慢指针法 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle_v1(self, head: ListNode) -> bool: 使用哈希表存储已经访问过的结点地址
- def hasCycle_v2(self, head: ListNode) -> bool: 快慢指针法
<|skeleton|>
class Solution:
def hasCycle_v1(self, h... | 7bf9b992acb5c3db22b52f1ee70816296a41af9d | <|skeleton|>
class Solution:
def hasCycle_v1(self, head: ListNode) -> bool:
"""使用哈希表存储已经访问过的结点地址"""
<|body_0|>
def hasCycle_v2(self, head: ListNode) -> bool:
"""快慢指针法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def hasCycle_v1(self, head: ListNode) -> bool:
"""使用哈希表存储已经访问过的结点地址"""
if not head or not head.next:
return False
id_set = set()
while head:
if id(head) in id_set:
return True
else:
id_set.add(id(head... | the_stack_v2_python_sparse | 141cycleLinkedList.py | slsefe/leetcode | train | 0 | |
da02f35c07e6566291951aa312cd7c96632a59d6 | [
"end_date = dateutil.get_today()\nstart_date = dateutil.get_previous_date(end_date, 6)\nc = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(request), 'second_nav_name': export.STATS_SALES_SECOND_NAV, 'third_nav_name': export.PRODUCT_SUMMARY_NAV,... | <|body_start_0|>
end_date = dateutil.get_today()
start_date = dateutil.get_previous_date(end_date, 6)
c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(request), 'second_nav_name': export.STATS_SALES_SECOND_NAV, 'third_nav_... | 商品概况 | ProductSummary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductSummary:
"""商品概况"""
def get(request):
"""显示商品概况页面"""
<|body_0|>
def api_get(request):
"""商品概况数据"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
end_date = dateutil.get_today()
start_date = dateutil.get_previous_date(end_date, 6)
... | stack_v2_sparse_classes_10k_train_000361 | 3,724 | no_license | [
{
"docstring": "显示商品概况页面",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "商品概况数据",
"name": "api_get",
"signature": "def api_get(request)"
}
] | 2 | null | Implement the Python class `ProductSummary` described below.
Class description:
商品概况
Method signatures and docstrings:
- def get(request): 显示商品概况页面
- def api_get(request): 商品概况数据 | Implement the Python class `ProductSummary` described below.
Class description:
商品概况
Method signatures and docstrings:
- def get(request): 显示商品概况页面
- def api_get(request): 商品概况数据
<|skeleton|>
class ProductSummary:
"""商品概况"""
def get(request):
"""显示商品概况页面"""
<|body_0|>
def api_get(reques... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class ProductSummary:
"""商品概况"""
def get(request):
"""显示商品概况页面"""
<|body_0|>
def api_get(request):
"""商品概况数据"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProductSummary:
"""商品概况"""
def get(request):
"""显示商品概况页面"""
end_date = dateutil.get_today()
start_date = dateutil.get_previous_date(end_date, 6)
c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(reque... | the_stack_v2_python_sparse | weapp/stats/sales/product_summary.py | chengdg/weizoom | train | 1 |
6c1da9345165ade720dcbaeb60ed5621c82b38ec | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SubjectRightsRequestHistory()",
"from .identity_set import IdentitySet\nfrom .subject_rights_request_stage import SubjectRightsRequestStage\nfrom .subject_rights_request_stage_status import SubjectRightsRequestStageStatus\nfrom .identi... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return SubjectRightsRequestHistory()
<|end_body_0|>
<|body_start_1|>
from .identity_set import IdentitySet
from .subject_rights_request_stage import SubjectRightsRequestStage
from .subj... | SubjectRightsRequestHistory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubjectRightsRequestHistory:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubjectRightsRequestHistory:
"""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 a... | stack_v2_sparse_classes_10k_train_000362 | 4,440 | 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: SubjectRightsRequestHistory",
"name": "create_from_discriminator_value",
"signature": "def create_from_discr... | 3 | null | Implement the Python class `SubjectRightsRequestHistory` described below.
Class description:
Implement the SubjectRightsRequestHistory class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubjectRightsRequestHistory: Creates a new instance of the appr... | Implement the Python class `SubjectRightsRequestHistory` described below.
Class description:
Implement the SubjectRightsRequestHistory class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubjectRightsRequestHistory: Creates a new instance of the appr... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class SubjectRightsRequestHistory:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubjectRightsRequestHistory:
"""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 a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubjectRightsRequestHistory:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubjectRightsRequestHistory:
"""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 ... | the_stack_v2_python_sparse | msgraph/generated/models/subject_rights_request_history.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
9ee4d1db58379165f03abebc0be7773a761e1afe | [
"if not l1:\n return l2\nif not l2:\n return l1\nif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2",
"pre_node = dummy_node = ListNode(-1)\nwhile l1 and l2:\n if l1.val < l2.val:\n pre_node.next = ... | <|body_start_0|>
if not l1:
return l2
if not l2:
return l1
if l1.val < l2.val:
l1.next = self.mergeTwoLists(l1.next, l2)
return l1
else:
l2.next = self.mergeTwoLists(l1, l2.next)
return l2
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
<|body_0|>
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""遍历链表"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not l1:
return l2... | stack_v2_sparse_classes_10k_train_000363 | 1,408 | no_license | [
{
"docstring": "递归",
"name": "mergeTwoLists2",
"signature": "def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "遍历链表",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_005418 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历链表 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历链表
<|skeleton|>
class Solution:
de... | c0dd577481b46129d950354d567d332a4d091137 | <|skeleton|>
class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
<|body_0|>
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""遍历链表"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
if not l1:
return l2
if not l2:
return l1
if l1.val < l2.val:
l1.next = self.mergeTwoLists(l1.next, l2)
return l1
else:
l2.ne... | the_stack_v2_python_sparse | leetcode/剑指offer/剑指 Offer 25. 合并两个排序的链表.py | tenqaz/crazy_arithmetic | train | 0 | |
df950e94fce7fb25dacd5b2153c85d514654b546 | [
"value = attrs[source]\nif value.upper() not in (QuestionCatalogue.SEEVCAM_SCOPE, QuestionCatalogue.PRIVATE_SCOPE):\n raise serializers.ValidationError('Invalid catalogue scope specified')\nreturn attrs",
"value = attrs[source]\nif QuestionCatalogue.objects.filter(catalogue_name=value).count() > 0:\n raise ... | <|body_start_0|>
value = attrs[source]
if value.upper() not in (QuestionCatalogue.SEEVCAM_SCOPE, QuestionCatalogue.PRIVATE_SCOPE):
raise serializers.ValidationError('Invalid catalogue scope specified')
return attrs
<|end_body_0|>
<|body_start_1|>
value = attrs[source]
... | QuestionCatalogueSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionCatalogueSerializer:
def validate_catalogue_scope(attrs, source):
"""Check that the scope specified is one of the two values allowed"""
<|body_0|>
def validate_catalogue_name(attrs, source):
"""Check that a catalogue with that name already exist"""
<|... | stack_v2_sparse_classes_10k_train_000364 | 1,270 | no_license | [
{
"docstring": "Check that the scope specified is one of the two values allowed",
"name": "validate_catalogue_scope",
"signature": "def validate_catalogue_scope(attrs, source)"
},
{
"docstring": "Check that a catalogue with that name already exist",
"name": "validate_catalogue_name",
"si... | 2 | stack_v2_sparse_classes_30k_test_000175 | Implement the Python class `QuestionCatalogueSerializer` described below.
Class description:
Implement the QuestionCatalogueSerializer class.
Method signatures and docstrings:
- def validate_catalogue_scope(attrs, source): Check that the scope specified is one of the two values allowed
- def validate_catalogue_name(a... | Implement the Python class `QuestionCatalogueSerializer` described below.
Class description:
Implement the QuestionCatalogueSerializer class.
Method signatures and docstrings:
- def validate_catalogue_scope(attrs, source): Check that the scope specified is one of the two values allowed
- def validate_catalogue_name(a... | e060f294fccc49e289dd5fdcd1cc85ab53e8b679 | <|skeleton|>
class QuestionCatalogueSerializer:
def validate_catalogue_scope(attrs, source):
"""Check that the scope specified is one of the two values allowed"""
<|body_0|>
def validate_catalogue_name(attrs, source):
"""Check that a catalogue with that name already exist"""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionCatalogueSerializer:
def validate_catalogue_scope(attrs, source):
"""Check that the scope specified is one of the two values allowed"""
value = attrs[source]
if value.upper() not in (QuestionCatalogue.SEEVCAM_SCOPE, QuestionCatalogue.PRIVATE_SCOPE):
raise serializer... | the_stack_v2_python_sparse | seeVcam/questions/serializers.py | giuse88/seevcam | train | 0 | |
e6e4825bfcdf41cab7b1d126b7980034a3b1e714 | [
"m = n = -1\nfor i in range(len(nums) - 2, -1, -1):\n if nums[i] < nums[i + 1]:\n m = i\n break\nif m == -1:\n nums.reverse()\n return\nfor i in range(len(nums) - 1, m, -1):\n if nums[i] > nums[m]:\n n = i\n break\nnums[m], nums[n] = (nums[n], nums[m])\nnums[m + 1:] = nums[:m... | <|body_start_0|>
m = n = -1
for i in range(len(nums) - 2, -1, -1):
if nums[i] < nums[i + 1]:
m = i
break
if m == -1:
nums.reverse()
return
for i in range(len(nums) - 1, m, -1):
if nums[i] > nums[m]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def nextPermutation_verbose(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-... | stack_v2_sparse_classes_10k_train_000365 | 3,233 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "nextPermutation",
"signature": "def nextPermutation(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"... | 2 | stack_v2_sparse_classes_30k_train_002056 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def nextPermutation_verbose(self, nums): :type nums: L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def nextPermutation_verbose(self, nums): :type nums: L... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def nextPermutation_verbose(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
m = n = -1
for i in range(len(nums) - 2, -1, -1):
if nums[i] < nums[i + 1]:
m = i
break
if m == ... | the_stack_v2_python_sparse | src/lt_31.py | oxhead/CodingYourWay | train | 0 | |
ad3e822a848fb09cb289c5f4a5df3359ac7a962e | [
"if self.request.method == 'GET':\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveRequest())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH'):\n return (permissions.IsAuthenticated(), IsInActiveCommu... | <|body_start_0|>
if self.request.method == 'GET':
return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveRequest())
elif self.request.method == 'POST':
return (permissions.IsAuthenticated(),)
elif self.request.method in ('PUT', 'PATCH'):
... | Request view set | RequestViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequestViewSet:
"""Request view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"""List requests"""
<|b... | stack_v2_sparse_classes_10k_train_000366 | 27,778 | permissive | [
{
"docstring": "Get permissions",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Get serializer class",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "List requests",
"name": "list",
... | 5 | stack_v2_sparse_classes_30k_train_003631 | Implement the Python class `RequestViewSet` described below.
Class description:
Request view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List requests
- def create(self, request, *... | Implement the Python class `RequestViewSet` described below.
Class description:
Request view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List requests
- def create(self, request, *... | cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8 | <|skeleton|>
class RequestViewSet:
"""Request view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"""List requests"""
<|b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RequestViewSet:
"""Request view set"""
def get_permissions(self):
"""Get permissions"""
if self.request.method == 'GET':
return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveRequest())
elif self.request.method == 'POST':
return (per... | the_stack_v2_python_sparse | membership/views.py | 810Teams/clubs-and-events-backend | train | 3 |
51f7d1491ec980694a6aec59dedcc9565886492e | [
"run_config = test_helpers.create_run_config(**config_kwargs)\nfilestore_impl = filestore_utils.get_filestore(run_config)\nself.assertIsInstance(filestore_impl, filestore_cls)",
"run_config = test_helpers.create_run_config()\nwith self.assertRaises(filestore.FilestoreError):\n filestore_utils.get_filestore(run... | <|body_start_0|>
run_config = test_helpers.create_run_config(**config_kwargs)
filestore_impl = filestore_utils.get_filestore(run_config)
self.assertIsInstance(filestore_impl, filestore_cls)
<|end_body_0|>
<|body_start_1|>
run_config = test_helpers.create_run_config()
with self.a... | Tests for get_filestore. | GetFilestoreTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetFilestoreTest:
"""Tests for get_filestore."""
def test_get_filestore(self, config_kwargs, filestore_cls):
"""Tests that get_filestore returns the right filestore given a certain platform."""
<|body_0|>
def test_get_filestore_unsupported_platform(self, _, __):
... | stack_v2_sparse_classes_10k_train_000367 | 1,839 | permissive | [
{
"docstring": "Tests that get_filestore returns the right filestore given a certain platform.",
"name": "test_get_filestore",
"signature": "def test_get_filestore(self, config_kwargs, filestore_cls)"
},
{
"docstring": "Tests that get_filestore exceptions given a platform it doesn't support.",
... | 2 | null | Implement the Python class `GetFilestoreTest` described below.
Class description:
Tests for get_filestore.
Method signatures and docstrings:
- def test_get_filestore(self, config_kwargs, filestore_cls): Tests that get_filestore returns the right filestore given a certain platform.
- def test_get_filestore_unsupported... | Implement the Python class `GetFilestoreTest` described below.
Class description:
Tests for get_filestore.
Method signatures and docstrings:
- def test_get_filestore(self, config_kwargs, filestore_cls): Tests that get_filestore returns the right filestore given a certain platform.
- def test_get_filestore_unsupported... | f0275421f84b8f80ee767fb9230134ac97cb687b | <|skeleton|>
class GetFilestoreTest:
"""Tests for get_filestore."""
def test_get_filestore(self, config_kwargs, filestore_cls):
"""Tests that get_filestore returns the right filestore given a certain platform."""
<|body_0|>
def test_get_filestore_unsupported_platform(self, _, __):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GetFilestoreTest:
"""Tests for get_filestore."""
def test_get_filestore(self, config_kwargs, filestore_cls):
"""Tests that get_filestore returns the right filestore given a certain platform."""
run_config = test_helpers.create_run_config(**config_kwargs)
filestore_impl = filestore... | the_stack_v2_python_sparse | infra/cifuzz/filestore_utils_test.py | google/oss-fuzz | train | 9,438 |
20e7991f4068a4b7c31b61b3a22a35b4a3a510be | [
"super().__init__()\nself.n_layers = n_layers\nif residuals is not None:\n residuals = residuals.lower()\nself.residuals = residuals\nself.layers = nn.ModuleList()\nfor _ in range(n_layers - 1):\n self.layers.append(MLPBlock(features_in=features_in, features_out=n_features, activation_factory=activation_facto... | <|body_start_0|>
super().__init__()
self.n_layers = n_layers
if residuals is not None:
residuals = residuals.lower()
self.residuals = residuals
self.layers = nn.ModuleList()
for _ in range(n_layers - 1):
self.layers.append(MLPBlock(features_in=feat... | A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension of the input tensor. | MLP | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MLP:
"""A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension of the input tensor."""
def __init... | stack_v2_sparse_classes_10k_train_000368 | 9,125 | permissive | [
{
"docstring": "Create MLP module. Args: features_in: Number of features in the input. n_features: Number of features of the hidden layers. features_out: Number of features of the output. n_layers: The number of layers. residuals: The type of residual connections in the MLP: None, 'simple', or 'hyper'. activati... | 2 | stack_v2_sparse_classes_30k_train_006564 | Implement the Python class `MLP` described below.
Class description:
A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension ... | Implement the Python class `MLP` described below.
Class description:
A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension ... | a27e329cd30337995c359160a0d878bf331c13fb | <|skeleton|>
class MLP:
"""A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension of the input tensor."""
def __init... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MLP:
"""A fully-connected feed-forward neural network. The MLP can be used both as a fully-connected on 2D data as well as a module in a CNN. When used with 4D output the input is automatically permuted so that features are oriented along the last dimension of the input tensor."""
def __init__(self, feat... | the_stack_v2_python_sparse | quantnn/models/pytorch/fully_connected.py | simonpf/quantnn | train | 7 |
41aaae5ee3126bc70ade81013bb220fbe4e5356e | [
"super(DialogTestProcess, self).__init__(parent)\nself.setupUi(self)\nself.result = 'fail'",
"initialize()\nsys_entry = get_sys_entry()\nself.result = start_test(sys_entry)\nif self.result == 'pass':\n self.test_result['IP数据加解密'] = '正常'\nelse:\n self.test_result['IP数据加解密'] = '不正常'\nshutdown()\nself._signalF... | <|body_start_0|>
super(DialogTestProcess, self).__init__(parent)
self.setupUi(self)
self.result = 'fail'
<|end_body_0|>
<|body_start_1|>
initialize()
sys_entry = get_sys_entry()
self.result = start_test(sys_entry)
if self.result == 'pass':
self.test_r... | Class documentation goes here. | DialogTestProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogTestProcess:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
<|body_0|>
def on_pushButton_clicked(self):
"""Slot documentation goes here."""
<|body_1|... | stack_v2_sparse_classes_10k_train_000369 | 1,987 | no_license | [
{
"docstring": "Constructor @param parent reference to the parent widget @type QWidget",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Slot documentation goes here.",
"name": "on_pushButton_clicked",
"signature": "def on_pushButton_clicked(self)"
... | 3 | stack_v2_sparse_classes_30k_train_000847 | Implement the Python class `DialogTestProcess` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor @param parent reference to the parent widget @type QWidget
- def on_pushButton_clicked(self): Slot documentation goes here.... | Implement the Python class `DialogTestProcess` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor @param parent reference to the parent widget @type QWidget
- def on_pushButton_clicked(self): Slot documentation goes here.... | 57dd2197e7d91b8ad8fb2bd0e3503f10afa08544 | <|skeleton|>
class DialogTestProcess:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
<|body_0|>
def on_pushButton_clicked(self):
"""Slot documentation goes here."""
<|body_1|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DialogTestProcess:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor @param parent reference to the parent widget @type QWidget"""
super(DialogTestProcess, self).__init__(parent)
self.setupUi(self)
self.result = 'fail'
def on_pushBut... | the_stack_v2_python_sparse | modules/security_machine/TestProcess.py | gaoxingyu-hub/54testframework-master-e284 | train | 0 |
924c9ee167da3a5c3b6b52216960a97fd5d7a697 | [
"self.dag_info = dag_info\nself.application_server_info = application_server_info\nself.dag_database_copy_info = dag_database_copy_info\nself.dag_database_info = dag_database_info\nself.name = name\nself.owner_id = owner_id\nself.standalone_database_copy_info = standalone_database_copy_info\nself.mtype = mtype\nsel... | <|body_start_0|>
self.dag_info = dag_info
self.application_server_info = application_server_info
self.dag_database_copy_info = dag_database_copy_info
self.dag_database_info = dag_database_info
self.name = name
self.owner_id = owner_id
self.standalone_database_copy... | Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProtectionSourceType is 'kExchangeDAG'. application_server_info (ApplicationServerInfo): Specif... | ExchangeProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExchangeProtectionSource:
"""Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProtectionSourceType is 'kExchangeDAG'. app... | stack_v2_sparse_classes_10k_train_000370 | 5,196 | permissive | [
{
"docstring": "Constructor for the ExchangeProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, dag_info=None, application_server_info=None, dag_database_copy_info=None, dag_database_info=None, name=None, owner_id=None, standalone_database_copy_info=None, mtype=None, uuid=None)... | 2 | stack_v2_sparse_classes_30k_train_000806 | Implement the Python class `ExchangeProtectionSource` described below.
Class description:
Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProt... | Implement the Python class `ExchangeProtectionSource` described below.
Class description:
Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProt... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ExchangeProtectionSource:
"""Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProtectionSourceType is 'kExchangeDAG'. app... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExchangeProtectionSource:
"""Implementation of the 'ExchangeProtectionSource' model. Specifies an object representing an Exchange entity. DAG - Database availability group Attributes: dag_info (DagInfo): Specifies the Exchange DAG information if ExchangeProtectionSourceType is 'kExchangeDAG'. application_serv... | the_stack_v2_python_sparse | cohesity_management_sdk/models/exchange_protection_source.py | cohesity/management-sdk-python | train | 24 |
961223936b42c3d4950ffe18ab4b01f9f82fc440 | [
"LcgCrypto.__init__(self, the_rnt, n_prngs, integer_width, vector_depth, paranoia_level)\nself.bit_selection_mask = integer_width - 1\nself.next_hash = 0\nself.total_cycles = 0\nself.hash_function_vector = []\nself.the_fold = FoldInteger()\nself.rnt_index = 0\nthe_hashes = HASHES(the_rnt, integer_width, vector_dept... | <|body_start_0|>
LcgCrypto.__init__(self, the_rnt, n_prngs, integer_width, vector_depth, paranoia_level)
self.bit_selection_mask = integer_width - 1
self.next_hash = 0
self.total_cycles = 0
self.hash_function_vector = []
self.the_fold = FoldInteger()
self.rnt_inde... | Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong when considered as an ensemble. Data structure is the vector of instantiated h... | HashCrypto | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashCrypto:
"""Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong when considered as an ensemble. Data str... | stack_v2_sparse_classes_10k_train_000371 | 47,334 | no_license | [
{
"docstring": "initializes n_prngs with integers, then another n_prngs with hashes?",
"name": "__init__",
"signature": "def __init__(self, the_rnt, n_prngs, integer_width, vector_depth, paranoia_level)"
},
{
"docstring": "The previous next() produced lousy random streams by my tests, this will ... | 2 | stack_v2_sparse_classes_30k_train_001493 | Implement the Python class `HashCrypto` described below.
Class description:
Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong w... | Implement the Python class `HashCrypto` described below.
Class description:
Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong w... | 8425cfc9756eab4c8d090c14a11bfe91b0a17271 | <|skeleton|>
class HashCrypto:
"""Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong when considered as an ensemble. Data str... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HashCrypto:
"""Uses the set of hashes to produce a crypto-quality pseudo-random number. The data structure is a vector of hash instantiations. Individual hash functions may be relatively weak wrt dieharder (but not the functions I provide), but very strong when considered as an ensemble. Data structure is the... | the_stack_v2_python_sparse | evocprngs.py | lew128/evocrypt | train | 0 |
1f1767f70b8fc5fb4f5bf2a925a98dadd3df7ed0 | [
"if len(chars) == 1:\n return 1\nstart = 0\ncount = 1\ni = 1\nwhile i < len(chars):\n if chars[i] != chars[i - 1]:\n if count > 1:\n temp = list(str(count))\n for el in temp:\n chars[start + 1] = el\n start += 1\n del chars[start + 1:i]\n ... | <|body_start_0|>
if len(chars) == 1:
return 1
start = 0
count = 1
i = 1
while i < len(chars):
if chars[i] != chars[i - 1]:
if count > 1:
temp = list(str(count))
for el in temp:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def compress(self, chars):
""":type chars: List[str] :rtype: int"""
<|body_0|>
def compress2(self, chars):
""":type chars: List[str] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(chars) == 1:
return 1
... | stack_v2_sparse_classes_10k_train_000372 | 1,940 | no_license | [
{
"docstring": ":type chars: List[str] :rtype: int",
"name": "compress",
"signature": "def compress(self, chars)"
},
{
"docstring": ":type chars: List[str] :rtype: int",
"name": "compress2",
"signature": "def compress2(self, chars)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002960 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compress(self, chars): :type chars: List[str] :rtype: int
- def compress2(self, chars): :type chars: List[str] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compress(self, chars): :type chars: List[str] :rtype: int
- def compress2(self, chars): :type chars: List[str] :rtype: int
<|skeleton|>
class Solution:
def compress(sel... | 131aae52be6a62b284aee686dcb17ff85809a416 | <|skeleton|>
class Solution:
def compress(self, chars):
""":type chars: List[str] :rtype: int"""
<|body_0|>
def compress2(self, chars):
""":type chars: List[str] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def compress(self, chars):
""":type chars: List[str] :rtype: int"""
if len(chars) == 1:
return 1
start = 0
count = 1
i = 1
while i < len(chars):
if chars[i] != chars[i - 1]:
if count > 1:
temp... | the_stack_v2_python_sparse | string/443.py | zxmeng/LeetCode | train | 0 | |
54d84764b1124c5e03849ccd88b5c172ae192aac | [
"self._host = host\nself._username = username\nself._shell_client = ShellClientFactory.create(host, username)",
"parent_dest_dir = os.path.dirname(dest_dir)\nself._shell_client.exec_command('rm -rf {0}; mkdir -p {0}'.format(dest_dir), error_on_failure=True)\nself._shell_client.copy(source_tar, '{}/clusterrunner.t... | <|body_start_0|>
self._host = host
self._username = username
self._shell_client = ShellClientFactory.create(host, username)
<|end_body_0|>
<|body_start_1|>
parent_dest_dir = os.path.dirname(dest_dir)
self._shell_client.exec_command('rm -rf {0}; mkdir -p {0}'.format(dest_dir), er... | A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services. | DeployTarget | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeployTarget:
"""A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services."""
def __init__(self, hos... | stack_v2_sparse_classes_10k_train_000373 | 2,695 | permissive | [
{
"docstring": ":param host: the fully qualified hostname of the host to deploy to :type host: str :param username: the user who is executing this process and whose ssh credentials will be used :type username: str",
"name": "__init__",
"signature": "def __init__(self, host, username)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_001216 | Implement the Python class `DeployTarget` described below.
Class description:
A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting s... | Implement the Python class `DeployTarget` described below.
Class description:
A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting s... | 55d18016f2c7d2dbb8aec5879459cae654edb045 | <|skeleton|>
class DeployTarget:
"""A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services."""
def __init__(self, hos... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeployTarget:
"""A "deploy target" is the host to which clusterrunner will be deployed to. Deployment entails putting in place the clusterrunner binaries and configuration only. This class is not responsible for manipulating processes and stopping/starting services."""
def __init__(self, host, username):... | the_stack_v2_python_sparse | app/deployment/deploy_target.py | box/ClusterRunner | train | 168 |
ac80d0fb8db7912b1ab79e8838a1b257a2b8ac03 | [
"m1, m2 = (sys.maxsize, sys.maxsize)\nfor i in nums:\n if m1 >= i:\n m1 = i\n elif m2 >= i:\n m2 = i\n else:\n return True\nreturn False",
"n = len(nums)\nif n < 3:\n return False\nf = [nums[0]] * n\nb = [nums[-1]] * n\nfor i in range(1, n):\n f[i] = min(f[i - 1], nums[i])\nfor... | <|body_start_0|>
m1, m2 = (sys.maxsize, sys.maxsize)
for i in nums:
if m1 >= i:
m1 = i
elif m2 >= i:
m2 = i
else:
return True
return False
<|end_body_0|>
<|body_start_1|>
n = len(nums)
if n < 3:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def increasingTripletO1Space(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m1, m2 = (sys.maxsize, s... | stack_v2_sparse_classes_10k_train_000374 | 1,715 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "increasingTriplet",
"signature": "def increasingTriplet(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "increasingTripletO1Space",
"signature": "def increasingTripletO1Space(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006472 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
- def increasingTripletO1Space(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
- def increasingTripletO1Space(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def increasingTripletO1Space(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool"""
m1, m2 = (sys.maxsize, sys.maxsize)
for i in nums:
if m1 >= i:
m1 = i
elif m2 >= i:
m2 = i
else:
return True
... | the_stack_v2_python_sparse | I/IncreasingTripletSubsequence.py | bssrdf/pyleet | train | 2 | |
82ae17cdc5863bf5bf0f52f8fd4bc6763614ff28 | [
"self.parent = parent\nself.press = None\nself.background = None\nself.x = x\nself.line = axes.axvline(x)\nself.connect()\nif len(self.parent.line_list) == 1:\n self.BOX = axes.axvspan(self.parent.line_list[0].x, self.x, alpha=0.15)",
"self.cidpress1 = self.line.figure.canvas.mpl_connect('button_press_event', ... | <|body_start_0|>
self.parent = parent
self.press = None
self.background = None
self.x = x
self.line = axes.axvline(x)
self.connect()
if len(self.parent.line_list) == 1:
self.BOX = axes.axvspan(self.parent.line_list[0].x, self.x, alpha=0.15)
<|end_body_... | This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot is gridded into. press : This attribute... | VerticalDraggableLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotl... | stack_v2_sparse_classes_10k_train_000375 | 32,818 | no_license | [
{
"docstring": "The constructor for the HorizontalDraggableLine Class. Parameters: parent : tkinter Frame object where the object is placed in. y : Initial position of your horizontal line on the y axis Axis : axis of your pyplot graphic that will contain this line.",
"name": "__init__",
"signature": "d... | 6 | stack_v2_sparse_classes_30k_train_003979 | Implement the Python class `VerticalDraggableLine` described below.
Class description:
This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: paren... | Implement the Python class `VerticalDraggableLine` described below.
Class description:
This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: paren... | 6e479850a21c337c0c47379538f002bca97e03f1 | <|skeleton|>
class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot is ... | the_stack_v2_python_sparse | Labo_Env/ultrafastGUI/Graphic.py | UltraFastQ/femtoQ-Intruments | train | 2 |
61f0d8573d7f88a1d0e9de91def9a8c9adaeecf3 | [
"self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.bullet_width = 15\nself.bullet_height = 3\nself.bullet_color = (60, 60, 60)\nself.bullets_limit = 3\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()",
"self.ship_speed_factor = 1.5\nself.bullet_speed_factor = 5... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.bullet_width = 15
self.bullet_height = 3
self.bullet_color = (60, 60, 60)
self.bullets_limit = 3
self.speedup_scale = 1.1
self.initialize_dynami... | 存储游戏中的所有设置的类 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储游戏中的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_000376 | 1,233 | no_license | [
{
"docstring": "初始化游戏的设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置",
"name": "increase_speed",
"signatur... | 3 | stack_v2_sparse_classes_30k_train_001365 | Implement the Python class `Settings` described below.
Class description:
存储游戏中的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置 | Implement the Python class `Settings` described below.
Class description:
存储游戏中的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置
<|skeleton|>
class Settings:
"""存储游戏中的所有设置的类"""
def __init__(self... | 9dc8ddd440e56a9961b118813162323fdfd4f16e | <|skeleton|>
class Settings:
"""存储游戏中的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Settings:
"""存储游戏中的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.bullet_width = 15
self.bullet_height = 3
self.bullet_color = (60, 60, 60)
self.bullets_lim... | the_stack_v2_python_sparse | python编程从入门到实践/第十四章/14-3/settings_class.py | huanglun1994/learn | train | 0 |
0a6f27ff0884cfe3fa3210adc5d6a3db4eb50b21 | [
"ls_lines = FileUtil.ReadLines(ENF_file)\nls_record = []\nfor line in ls_lines:\n ls_record.append(line[:-1].split(';'))\nls_ENF = []\nfor record in ls_record:\n ls_ENF.append(format(float(record[0]), '.2f'))\njson_ENF = {}\njson_ENF['id'] = ENF_file\njson_ENF['ENF'] = ls_ENF\nreturn json_ENF",
"ls_time_exe... | <|body_start_0|>
ls_lines = FileUtil.ReadLines(ENF_file)
ls_record = []
for line in ls_lines:
ls_record.append(line[:-1].split(';'))
ls_ENF = []
for record in ls_record:
ls_ENF.append(format(float(record[0]), '.2f'))
json_ENF = {}
json_ENF[... | TenderUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenderUtils:
def load_ENF(ENF_file):
"""Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data"""
<|body_0|>
def verify_ENF(ENF_file):
"""Verify ENF value by querying from blockchain Args: ENF_name: ENF file name Returns: Ve... | stack_v2_sparse_classes_10k_train_000377 | 9,913 | no_license | [
{
"docstring": "Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data",
"name": "load_ENF",
"signature": "def load_ENF(ENF_file)"
},
{
"docstring": "Verify ENF value by querying from blockchain Args: ENF_name: ENF file name Returns: Verified result: Tr... | 3 | stack_v2_sparse_classes_30k_train_007220 | Implement the Python class `TenderUtils` described below.
Class description:
Implement the TenderUtils class.
Method signatures and docstrings:
- def load_ENF(ENF_file): Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data
- def verify_ENF(ENF_file): Verify ENF value by qu... | Implement the Python class `TenderUtils` described below.
Class description:
Implement the TenderUtils class.
Method signatures and docstrings:
- def load_ENF(ENF_file): Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data
- def verify_ENF(ENF_file): Verify ENF value by qu... | 03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad | <|skeleton|>
class TenderUtils:
def load_ENF(ENF_file):
"""Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data"""
<|body_0|>
def verify_ENF(ENF_file):
"""Verify ENF value by querying from blockchain Args: ENF_name: ENF file name Returns: Ve... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TenderUtils:
def load_ENF(ENF_file):
"""Load ENF data from ENF_file Args: ENF_name: ENF file name Returns: json_ENF: json format ENF data"""
ls_lines = FileUtil.ReadLines(ENF_file)
ls_record = []
for line in ls_lines:
ls_record.append(line[:-1].split(';'))
l... | the_stack_v2_python_sparse | Security/py_dev/BlendSPS/src/service_utils.py | samuelxu999/Research | train | 1 | |
cc3be8d2a9ea2dca8a18b73e2bc5a7ad924053cd | [
"self.se = None\nself.angle = angle\nse = np.zeros((m, n), dtype=int)\nxc, yc = (n // 2, m // 2)\nif angle >= 0 and angle < 45:\n b = np.tan(np.deg2rad(angle))\nelif angle >= 45 and angle < 90:\n b = np.tan(np.deg2rad(90 - angle))\nelif angle >= 90 and angle < 135:\n b = np.tan(np.deg2rad(angle - 90))\neli... | <|body_start_0|>
self.se = None
self.angle = angle
se = np.zeros((m, n), dtype=int)
xc, yc = (n // 2, m // 2)
if angle >= 0 and angle < 45:
b = np.tan(np.deg2rad(angle))
elif angle >= 45 and angle < 90:
b = np.tan(np.deg2rad(90 - angle))
el... | Define a selection element for morphological binary image processing. | LinearSelectionElement | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearSelectionElement:
"""Define a selection element for morphological binary image processing."""
def __init__(self, n, m, angle):
"""This will produce an n x m selection element with a line going through the center according to some angle. Parameters ---------- n : int Number of r... | stack_v2_sparse_classes_10k_train_000378 | 10,228 | permissive | [
{
"docstring": "This will produce an n x m selection element with a line going through the center according to some angle. Parameters ---------- n : int Number of rows in selection element. m : int Number of columns in selection element. angle : float Angle of line through center, in deg [0,180].",
"name": ... | 2 | null | Implement the Python class `LinearSelectionElement` described below.
Class description:
Define a selection element for morphological binary image processing.
Method signatures and docstrings:
- def __init__(self, n, m, angle): This will produce an n x m selection element with a line going through the center according... | Implement the Python class `LinearSelectionElement` described below.
Class description:
Define a selection element for morphological binary image processing.
Method signatures and docstrings:
- def __init__(self, n, m, angle): This will produce an n x m selection element with a line going through the center according... | d75d0540cd07df1bf46130338a33c2ced51fbead | <|skeleton|>
class LinearSelectionElement:
"""Define a selection element for morphological binary image processing."""
def __init__(self, n, m, angle):
"""This will produce an n x m selection element with a line going through the center according to some angle. Parameters ---------- n : int Number of r... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LinearSelectionElement:
"""Define a selection element for morphological binary image processing."""
def __init__(self, n, m, angle):
"""This will produce an n x m selection element with a line going through the center according to some angle. Parameters ---------- n : int Number of rows in select... | the_stack_v2_python_sparse | py/desispec/joincosmics.py | desihub/desispec | train | 33 |
461a3e101962bf0a72ae45eb440c488237e1b07e | [
"if not matrix:\n self.matrix = []\n return\nn = len(matrix)\nm = len(matrix[0])\nfor i in range(n):\n for j in range(m):\n if i == 0 and j == 0:\n continue\n elif i == 0:\n matrix[i][j] += matrix[i][j - 1]\n elif j == 0:\n matrix[i][j] += matrix[i - 1]... | <|body_start_0|>
if not matrix:
self.matrix = []
return
n = len(matrix)
m = len(matrix[0])
for i in range(n):
for j in range(m):
if i == 0 and j == 0:
continue
elif i == 0:
matrix[... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_10k_train_000379 | 1,688 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp... | 2 | stack_v2_sparse_classes_30k_train_004023 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | b6328e726c8d986d6b85e2d41c7e678e29dc1153 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
if not matrix:
self.matrix = []
return
n = len(matrix)
m = len(matrix[0])
for i in range(n):
for j in range(m):
... | the_stack_v2_python_sparse | Range Sum Query 2D - Immutable.py | dragonlee8/leetcode | train | 0 | |
1aabea4bbeffa20e752861b2516e713c805247f1 | [
"\"\"\" Take parameters, and Sprite Constants \"\"\"\nsuper(EagleSprite, self).__init__(world_map, EagleSprite.IMAGE, GRID_LOCK, EagleSprite.HEALTH_BAR, EagleSprite.AVG_SPEED, EagleSprite.VISION, coordinates)\nself.type = 'eagle'\nself.prey = ['fish']\nself.movable_terrain = world_map.tile_types\nself.shadow = self... | <|body_start_0|>
""" Take parameters, and Sprite Constants """
super(EagleSprite, self).__init__(world_map, EagleSprite.IMAGE, GRID_LOCK, EagleSprite.HEALTH_BAR, EagleSprite.AVG_SPEED, EagleSprite.VISION, coordinates)
self.type = 'eagle'
self.prey = ['fish']
self.movable_terrain ... | EagleSprite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EagleSprite:
def __init__(self, world_map, GRID_LOCK, coordinates=None):
"""Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)"""
<|body_0|>
def move(self, target=None... | stack_v2_sparse_classes_10k_train_000380 | 3,211 | no_license | [
{
"docstring": "Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)",
"name": "__init__",
"signature": "def __init__(self, world_map, GRID_LOCK, coordinates=None)"
},
{
"docstring": "@Overr... | 3 | stack_v2_sparse_classes_30k_train_003992 | Implement the Python class `EagleSprite` described below.
Class description:
Implement the EagleSprite class.
Method signatures and docstrings:
- def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :pa... | Implement the Python class `EagleSprite` described below.
Class description:
Implement the EagleSprite class.
Method signatures and docstrings:
- def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :pa... | 8995bd57ae0faaf7420c74e1a7b2c091c64d6942 | <|skeleton|>
class EagleSprite:
def __init__(self, world_map, GRID_LOCK, coordinates=None):
"""Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)"""
<|body_0|>
def move(self, target=None... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EagleSprite:
def __init__(self, world_map, GRID_LOCK, coordinates=None):
"""Create a EagleSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)"""
""" Take parameters, and Sprite Constants """
su... | the_stack_v2_python_sparse | sprites/sprite____eagle.py | EcoSimulator/EcoSim2.0 | train | 0 | |
669ba5d3ddcb833f1e01465ccec198b7daee4b80 | [
"super(MaskInvalidPos, self).__init__()\nself.squeeze = P.Squeeze(2)\nself.sub = P.Sub()\nself.mul = P.Mul()",
"output = self.squeeze(pos_pred)\ninvalid_pos_mask = self.mul(self.sub(1.0, context_mask), 1e+30)\noutput = self.sub(output, invalid_pos_mask)\nreturn output"
] | <|body_start_0|>
super(MaskInvalidPos, self).__init__()
self.squeeze = P.Squeeze(2)
self.sub = P.Sub()
self.mul = P.Mul()
<|end_body_0|>
<|body_start_1|>
output = self.squeeze(pos_pred)
invalid_pos_mask = self.mul(self.sub(1.0, context_mask), 1e+30)
output = self... | module of reader downstream | MaskInvalidPos | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaskInvalidPos:
"""module of reader downstream"""
def __init__(self):
"""init function"""
<|body_0|>
def construct(self, pos_pred, context_mask):
"""construct function"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MaskInvalidPos, self)._... | stack_v2_sparse_classes_10k_train_000381 | 9,011 | permissive | [
{
"docstring": "init function",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "construct function",
"name": "construct",
"signature": "def construct(self, pos_pred, context_mask)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000807 | Implement the Python class `MaskInvalidPos` described below.
Class description:
module of reader downstream
Method signatures and docstrings:
- def __init__(self): init function
- def construct(self, pos_pred, context_mask): construct function | Implement the Python class `MaskInvalidPos` described below.
Class description:
module of reader downstream
Method signatures and docstrings:
- def __init__(self): init function
- def construct(self, pos_pred, context_mask): construct function
<|skeleton|>
class MaskInvalidPos:
"""module of reader downstream"""
... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class MaskInvalidPos:
"""module of reader downstream"""
def __init__(self):
"""init function"""
<|body_0|>
def construct(self, pos_pred, context_mask):
"""construct function"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MaskInvalidPos:
"""module of reader downstream"""
def __init__(self):
"""init function"""
super(MaskInvalidPos, self).__init__()
self.squeeze = P.Squeeze(2)
self.sub = P.Sub()
self.mul = P.Mul()
def construct(self, pos_pred, context_mask):
"""construct... | the_stack_v2_python_sparse | research/nlp/tprr/src/reader_downstream.py | mindspore-ai/models | train | 301 |
6d02a4f74e409d9bc94b26f07bd76be3fd4ded51 | [
"self._dependency_fetcher = ChromeDependencyFetcher(get_repository)\nself._get_repository = get_repository\nself._top_n_frames = top_n_frames\nself._top_n_suspects = top_n_suspects\nself._model = UnnormalizedLogLinearModel(meta_feature, meta_weight)",
"suspects = self.GenerateSuspects(report)\nif not suspects:\n ... | <|body_start_0|>
self._dependency_fetcher = ChromeDependencyFetcher(get_repository)
self._get_repository = get_repository
self._top_n_frames = top_n_frames
self._top_n_suspects = top_n_suspects
self._model = UnnormalizedLogLinearModel(meta_feature, meta_weight)
<|end_body_0|>
<|... | A ``LogLinearModel``-based implementation of CL classification. | ChangelistClassifier | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangelistClassifier:
"""A ``LogLinearModel``-based implementation of CL classification."""
def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3):
"""Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we c... | stack_v2_sparse_classes_10k_train_000382 | 6,856 | permissive | [
{
"docstring": "Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we can get changelogs and blame for each dep. Notably, to keep the code here generic, we make no assumptions about which subclass of ``Repository`` this function returns. Thus, it is up to the caller to decid... | 5 | stack_v2_sparse_classes_30k_train_000182 | Implement the Python class `ChangelistClassifier` described below.
Class description:
A ``LogLinearModel``-based implementation of CL classification.
Method signatures and docstrings:
- def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): Args: get_repository (callable): a ... | Implement the Python class `ChangelistClassifier` described below.
Class description:
A ``LogLinearModel``-based implementation of CL classification.
Method signatures and docstrings:
- def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): Args: get_repository (callable): a ... | 09064105713603f7bf75c772e8354800a1bfa256 | <|skeleton|>
class ChangelistClassifier:
"""A ``LogLinearModel``-based implementation of CL classification."""
def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3):
"""Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we c... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChangelistClassifier:
"""A ``LogLinearModel``-based implementation of CL classification."""
def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3):
"""Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we can get change... | the_stack_v2_python_sparse | appengine/predator/analysis/changelist_classifier.py | mcgreevy/chromium-infra | train | 1 |
70e6aa40625d1c5e50f4500565e4491ca859ddc7 | [
"super(State, self).__init__(methodName)\nskip = ['test_load_state_no_gui']\nif wx.version() == '2.9.4.1 gtk2 (classic)' and methodName in skip:\n status.skipped_tests.append([methodName, 'wxPython 2.9.4.1 gtk2 bugs', self._skip_type])",
"file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + ... | <|body_start_0|>
super(State, self).__init__(methodName)
skip = ['test_load_state_no_gui']
if wx.version() == '2.9.4.1 gtk2 (classic)' and methodName in skip:
status.skipped_tests.append([methodName, 'wxPython 2.9.4.1 gtk2 bugs', self._skip_type])
<|end_body_0|>
<|body_start_1|>
... | Class for testing various aspects specific to saved states. | State | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class State:
"""Class for testing various aspects specific to saved states."""
def __init__(self, methodName='runTest'):
"""Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str"""
<|body_0|>
def test_bug_20480(self):
... | stack_v2_sparse_classes_10k_train_000383 | 7,570 | no_license | [
{
"docstring": "Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str",
"name": "__init__",
"signature": "def __init__(self, methodName='runTest')"
},
{
"docstring": "Catch U{bug #20480<https://gna.org/bugs/?20480>}, the failure to load a relax... | 4 | null | Implement the Python class `State` described below.
Class description:
Class for testing various aspects specific to saved states.
Method signatures and docstrings:
- def __init__(self, methodName='runTest'): Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str
- d... | Implement the Python class `State` described below.
Class description:
Class for testing various aspects specific to saved states.
Method signatures and docstrings:
- def __init__(self, methodName='runTest'): Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str
- d... | c317326ddeacd1a1c608128769676899daeae531 | <|skeleton|>
class State:
"""Class for testing various aspects specific to saved states."""
def __init__(self, methodName='runTest'):
"""Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str"""
<|body_0|>
def test_bug_20480(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class State:
"""Class for testing various aspects specific to saved states."""
def __init__(self, methodName='runTest'):
"""Skip certain tests due to wxPython bugs. @keyword methodName: The name of the test. @type methodName: str"""
super(State, self).__init__(methodName)
skip = ['test_... | the_stack_v2_python_sparse | test_suite/gui_tests/state.py | jlec/relax | train | 4 |
b429ee539123e79bbbf54940a4fe9da8af128628 | [
"request = pecan.request\ncontext = request.environ['context']\nrecord = self.central_api.get_record(context, zone_id, recordset_id, record_id)\nreturn self._view.show(context, request, record)",
"request = pecan.request\ncontext = request.environ['context']\nmarker, limit, sort_key, sort_dir = self._get_paging_p... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
record = self.central_api.get_record(context, zone_id, recordset_id, record_id)
return self._view.show(context, request, record)
<|end_body_0|>
<|body_start_1|>
request = pecan.request
context ... | RecordsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
<|body_0|>
def get_all(self, zone_id, recordset_id, **params):
"""List Records"""
<|body_1|>
def post_all(self, zone_id, recordset_id):
"""Create Record"""
... | stack_v2_sparse_classes_10k_train_000384 | 5,837 | permissive | [
{
"docstring": "Get Record",
"name": "get_one",
"signature": "def get_one(self, zone_id, recordset_id, record_id)"
},
{
"docstring": "List Records",
"name": "get_all",
"signature": "def get_all(self, zone_id, recordset_id, **params)"
},
{
"docstring": "Create Record",
"name":... | 5 | stack_v2_sparse_classes_30k_train_002438 | Implement the Python class `RecordsController` described below.
Class description:
Implement the RecordsController class.
Method signatures and docstrings:
- def get_one(self, zone_id, recordset_id, record_id): Get Record
- def get_all(self, zone_id, recordset_id, **params): List Records
- def post_all(self, zone_id,... | Implement the Python class `RecordsController` described below.
Class description:
Implement the RecordsController class.
Method signatures and docstrings:
- def get_one(self, zone_id, recordset_id, record_id): Get Record
- def get_all(self, zone_id, recordset_id, **params): List Records
- def post_all(self, zone_id,... | 331ee1958271990ae383203e7f7970f8f41ca003 | <|skeleton|>
class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
<|body_0|>
def get_all(self, zone_id, recordset_id, **params):
"""List Records"""
<|body_1|>
def post_all(self, zone_id, recordset_id):
"""Create Record"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RecordsController:
def get_one(self, zone_id, recordset_id, record_id):
"""Get Record"""
request = pecan.request
context = request.environ['context']
record = self.central_api.get_record(context, zone_id, recordset_id, record_id)
return self._view.show(context, request,... | the_stack_v2_python_sparse | designate/api/v2/controllers/records.py | NeCTAR-RC/designate | train | 1 | |
842008ecb8fd17b3f1189ffe2782722c8e3440c2 | [
"self.hass = hass\nself.config_entry: ConfigEntry = config_entry\nself.cam = cam\nsuper().__init__(self.hass, _LOGGER, name=f'{DOMAIN} {config_entry.data[CONF_HOST]}', update_interval=timedelta(seconds=10))",
"try:\n await self.cam.update()\nexcept PyDroidIPCamException as err:\n raise UpdateFailed(err) fro... | <|body_start_0|>
self.hass = hass
self.config_entry: ConfigEntry = config_entry
self.cam = cam
super().__init__(self.hass, _LOGGER, name=f'{DOMAIN} {config_entry.data[CONF_HOST]}', update_interval=timedelta(seconds=10))
<|end_body_0|>
<|body_start_1|>
try:
await self... | Coordinator class for the Android IP Webcam. | AndroidIPCamDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AndroidIPCamDataUpdateCoordinator:
"""Coordinator class for the Android IP Webcam."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None:
"""Initialize the Android IP Webcam."""
<|body_0|>
async def _async_update_data(self) -> N... | stack_v2_sparse_classes_10k_train_000385 | 1,351 | permissive | [
{
"docstring": "Initialize the Android IP Webcam.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None"
},
{
"docstring": "Update Android IP Webcam entities.",
"name": "_async_update_data",
"signature": "async d... | 2 | null | Implement the Python class `AndroidIPCamDataUpdateCoordinator` described below.
Class description:
Coordinator class for the Android IP Webcam.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: Initialize the Android IP Webcam.
- async d... | Implement the Python class `AndroidIPCamDataUpdateCoordinator` described below.
Class description:
Coordinator class for the Android IP Webcam.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None: Initialize the Android IP Webcam.
- async d... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class AndroidIPCamDataUpdateCoordinator:
"""Coordinator class for the Android IP Webcam."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None:
"""Initialize the Android IP Webcam."""
<|body_0|>
async def _async_update_data(self) -> N... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AndroidIPCamDataUpdateCoordinator:
"""Coordinator class for the Android IP Webcam."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, cam: PyDroidIPCam) -> None:
"""Initialize the Android IP Webcam."""
self.hass = hass
self.config_entry: ConfigEntry = config_ent... | the_stack_v2_python_sparse | homeassistant/components/android_ip_webcam/coordinator.py | home-assistant/core | train | 35,501 |
6efed2722f0b9444ccefa3dd504c482354827a0b | [
"self.root_dir = Path('{root}/{year}'.format(root=root_dir, year=year))\nself.annotations_zip_path = Path('{root}/annotations_trainval{year}.zip'.format(root=self.root_dir, year=year))\nself.train_zip_path = Path('{root}/train{year}.zip'.format(root=self.root_dir, year=year))\nself.val_zip_path = Path('{root}/val{y... | <|body_start_0|>
self.root_dir = Path('{root}/{year}'.format(root=root_dir, year=year))
self.annotations_zip_path = Path('{root}/annotations_trainval{year}.zip'.format(root=self.root_dir, year=year))
self.train_zip_path = Path('{root}/train{year}.zip'.format(root=self.root_dir, year=year))
... | COCOBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class COCOBase:
def __init__(self, root_dir: str='../../data/coco/', download_dataset: bool=False, year: Literal['2014', '2017']='2017', split: Literal['train', 'val', 'test']='train') -> None:
"""An abstract class for COCO based datasets Args: root_dir: The path to the COCO images and annotat... | stack_v2_sparse_classes_10k_train_000386 | 4,069 | permissive | [
{
"docstring": "An abstract class for COCO based datasets Args: root_dir: The path to the COCO images and annotations download_dataset: Specify whether to download the dataset if not present year: The year of the COCO dataset to use (2014, 2017) split: The split of the data to be used (train, val, test)",
"... | 2 | stack_v2_sparse_classes_30k_train_002631 | Implement the Python class `COCOBase` described below.
Class description:
Implement the COCOBase class.
Method signatures and docstrings:
- def __init__(self, root_dir: str='../../data/coco/', download_dataset: bool=False, year: Literal['2014', '2017']='2017', split: Literal['train', 'val', 'test']='train') -> None: ... | Implement the Python class `COCOBase` described below.
Class description:
Implement the COCOBase class.
Method signatures and docstrings:
- def __init__(self, root_dir: str='../../data/coco/', download_dataset: bool=False, year: Literal['2014', '2017']='2017', split: Literal['train', 'val', 'test']='train') -> None: ... | b436fbd95cbb62f6c58d2233d7affa0f62cb1817 | <|skeleton|>
class COCOBase:
def __init__(self, root_dir: str='../../data/coco/', download_dataset: bool=False, year: Literal['2014', '2017']='2017', split: Literal['train', 'val', 'test']='train') -> None:
"""An abstract class for COCO based datasets Args: root_dir: The path to the COCO images and annotat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class COCOBase:
def __init__(self, root_dir: str='../../data/coco/', download_dataset: bool=False, year: Literal['2014', '2017']='2017', split: Literal['train', 'val', 'test']='train') -> None:
"""An abstract class for COCO based datasets Args: root_dir: The path to the COCO images and annotations download_... | the_stack_v2_python_sparse | python/app/fedcv/image_segmentation/data/coco/coco_base.py | FedML-AI/FedML | train | 3,197 | |
ff7dd86d50971ddd6dc7a4305177f33ff11dfe35 | [
"self._app_process = None\nself._lib_directories = None\nself.lib_directory = None\nself.lib_major_version = 'lib_{}'.format(sys.version_info.major)\nself.lib_minor_version = '{}.{}'.format(self.lib_major_version, sys.version_info.minor)\nself.lib_micro_version = '{}.{}'.format(self.lib_minor_version, sys.version_i... | <|body_start_0|>
self._app_process = None
self._lib_directories = None
self.lib_directory = None
self.lib_major_version = 'lib_{}'.format(sys.version_info.major)
self.lib_minor_version = '{}.{}'.format(self.lib_major_version, sys.version_info.minor)
self.lib_micro_version... | Set App Lib Directory | AppLib | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppLib:
"""Set App Lib Directory"""
def __init__(self):
"""Initialize App properties."""
<|body_0|>
def find_lib_directory(self):
"""Find the optimal lib directory."""
<|body_1|>
def lib_directories(self):
"""Get all "lib" directories."""
... | stack_v2_sparse_classes_10k_train_000387 | 4,138 | permissive | [
{
"docstring": "Initialize App properties.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Find the optimal lib directory.",
"name": "find_lib_directory",
"signature": "def find_lib_directory(self)"
},
{
"docstring": "Get all \"lib\" directories.",
... | 5 | stack_v2_sparse_classes_30k_train_000218 | Implement the Python class `AppLib` described below.
Class description:
Set App Lib Directory
Method signatures and docstrings:
- def __init__(self): Initialize App properties.
- def find_lib_directory(self): Find the optimal lib directory.
- def lib_directories(self): Get all "lib" directories.
- def run_app(self): ... | Implement the Python class `AppLib` described below.
Class description:
Set App Lib Directory
Method signatures and docstrings:
- def __init__(self): Initialize App properties.
- def find_lib_directory(self): Find the optimal lib directory.
- def lib_directories(self): Get all "lib" directories.
- def run_app(self): ... | 0f2e6a2d1c71f104b1522fd68ec01b9f9f3b92f9 | <|skeleton|>
class AppLib:
"""Set App Lib Directory"""
def __init__(self):
"""Initialize App properties."""
<|body_0|>
def find_lib_directory(self):
"""Find the optimal lib directory."""
<|body_1|>
def lib_directories(self):
"""Get all "lib" directories."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AppLib:
"""Set App Lib Directory"""
def __init__(self):
"""Initialize App properties."""
self._app_process = None
self._lib_directories = None
self.lib_directory = None
self.lib_major_version = 'lib_{}'.format(sys.version_info.major)
self.lib_minor_version ... | the_stack_v2_python_sparse | apps/TCPB_-_Disposable_Email_Address_Identifier/__main__.py | ThreatConnect-Inc/threatconnect-playbooks | train | 76 |
6fadbdb7d59da050da98b6ebfaa1449f04b33e5f | [
"result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json(force=True)\nflag, error = CtrlUserGroup().update_manager_member(data_json)\nif flag:\n result['result'] = 'OK'\nelse:\n result['error'] = error\nreturn result",
"result = {'result': 'NG', 'error': ''}\nflag, error = CtrlUserGroup().delet... | <|body_start_0|>
result = {'result': 'NG', 'error': ''}
data_json = request.get_json(force=True)
flag, error = CtrlUserGroup().update_manager_member(data_json)
if flag:
result['result'] = 'OK'
else:
result['error'] = error
return result
<|end_body_... | 项目体制增加组员 | ApiManagerMemeber | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|body_0|>
def delete(self, proj_id, group_id, user_id, commit_user):
"""删除"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'error': ''}
data_json = req... | stack_v2_sparse_classes_10k_train_000388 | 3,031 | no_license | [
{
"docstring": "更新",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "删除",
"name": "delete",
"signature": "def delete(self, proj_id, group_id, user_id, commit_user)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001019 | Implement the Python class `ApiManagerMemeber` described below.
Class description:
项目体制增加组员
Method signatures and docstrings:
- def post(self): 更新
- def delete(self, proj_id, group_id, user_id, commit_user): 删除 | Implement the Python class `ApiManagerMemeber` described below.
Class description:
项目体制增加组员
Method signatures and docstrings:
- def post(self): 更新
- def delete(self, proj_id, group_id, user_id, commit_user): 删除
<|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|b... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
<|body_0|>
def delete(self, proj_id, group_id, user_id, commit_user):
"""删除"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ApiManagerMemeber:
"""项目体制增加组员"""
def post(self):
"""更新"""
result = {'result': 'NG', 'error': ''}
data_json = request.get_json(force=True)
flag, error = CtrlUserGroup().update_manager_member(data_json)
if flag:
result['result'] = 'OK'
else:
... | the_stack_v2_python_sparse | koala/koala_server/app/api_1_0/api_user_group.py | lsn1183/web_project | train | 0 |
82ba59cb5ccc331af05d3cf2014a300eebea8f3e | [
"if not (obj and len(TestCase.objects.filter(application=obj)) and len(Variable.objects.filter(application=obj))):\n return admin.ModelAdmin.get_fieldsets(self, request, obj=obj)\nelse:\n return ((None, {'fields': ('name', 'linkedApplication'), 'description': '<div style=\"font-size: 16px;color: red;\">All te... | <|body_start_0|>
if not (obj and len(TestCase.objects.filter(application=obj)) and len(Variable.objects.filter(application=obj))):
return admin.ModelAdmin.get_fieldsets(self, request, obj=obj)
else:
return ((None, {'fields': ('name', 'linkedApplication'), 'description': '<div sty... | ApplicationAdmin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplicationAdmin:
def get_fieldsets(self, request, obj=None):
"""Display error message when it's impossible to delete the application"""
<|body_0|>
def has_delete_permission(self, request, obj=None):
"""Do not display delete button if some tests / variables are linke... | stack_v2_sparse_classes_10k_train_000389 | 21,881 | permissive | [
{
"docstring": "Display error message when it's impossible to delete the application",
"name": "get_fieldsets",
"signature": "def get_fieldsets(self, request, obj=None)"
},
{
"docstring": "Do not display delete button if some tests / variables are linked to this application",
"name": "has_de... | 2 | stack_v2_sparse_classes_30k_train_007270 | Implement the Python class `ApplicationAdmin` described below.
Class description:
Implement the ApplicationAdmin class.
Method signatures and docstrings:
- def get_fieldsets(self, request, obj=None): Display error message when it's impossible to delete the application
- def has_delete_permission(self, request, obj=No... | Implement the Python class `ApplicationAdmin` described below.
Class description:
Implement the ApplicationAdmin class.
Method signatures and docstrings:
- def get_fieldsets(self, request, obj=None): Display error message when it's impossible to delete the application
- def has_delete_permission(self, request, obj=No... | 590c84d5078fee4021fa23956390eb612b5f123d | <|skeleton|>
class ApplicationAdmin:
def get_fieldsets(self, request, obj=None):
"""Display error message when it's impossible to delete the application"""
<|body_0|>
def has_delete_permission(self, request, obj=None):
"""Do not display delete button if some tests / variables are linke... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ApplicationAdmin:
def get_fieldsets(self, request, obj=None):
"""Display error message when it's impossible to delete the application"""
if not (obj and len(TestCase.objects.filter(application=obj)) and len(Variable.objects.filter(application=obj))):
return admin.ModelAdmin.get_fie... | the_stack_v2_python_sparse | variableServer/admin.py | bhecquet/seleniumRobot-server | train | 0 | |
9b94e0d2934d8de56d5f1ffe11aad42d5a41cc0d | [
"GObject.GObject.__init__(self)\nself.set_transient_for(parent)\nself.set_modal(True)\nself.set_name(PROGRAM_NAME)\nself.set_version(VERSION)\nself.set_copyright(COPYRIGHT_MSG)\nself.set_artists([_(\"Much of Gramps' artwork is either from\\nthe Tango Project or derived from the Tango\\nProject. This artwork is rele... | <|body_start_0|>
GObject.GObject.__init__(self)
self.set_transient_for(parent)
self.set_modal(True)
self.set_name(PROGRAM_NAME)
self.set_version(VERSION)
self.set_copyright(COPYRIGHT_MSG)
self.set_artists([_("Much of Gramps' artwork is either from\nthe Tango Proje... | Create an About dialog with all fields set. | GrampsAboutDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GrampsAboutDialog:
"""Create an About dialog with all fields set."""
def __init__(self, parent):
"""Setup all the fields shown in the About dialog."""
<|body_0|>
def get_versions(self):
"""Obtain version information of core dependencies"""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k_train_000390 | 8,673 | no_license | [
{
"docstring": "Setup all the fields shown in the About dialog.",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Obtain version information of core dependencies",
"name": "get_versions",
"signature": "def get_versions(self)"
}
] | 2 | null | Implement the Python class `GrampsAboutDialog` described below.
Class description:
Create an About dialog with all fields set.
Method signatures and docstrings:
- def __init__(self, parent): Setup all the fields shown in the About dialog.
- def get_versions(self): Obtain version information of core dependencies | Implement the Python class `GrampsAboutDialog` described below.
Class description:
Create an About dialog with all fields set.
Method signatures and docstrings:
- def __init__(self, parent): Setup all the fields shown in the About dialog.
- def get_versions(self): Obtain version information of core dependencies
<|sk... | 0c79561bed7ff42c88714edbc85197fa9235e188 | <|skeleton|>
class GrampsAboutDialog:
"""Create an About dialog with all fields set."""
def __init__(self, parent):
"""Setup all the fields shown in the About dialog."""
<|body_0|>
def get_versions(self):
"""Obtain version information of core dependencies"""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GrampsAboutDialog:
"""Create an About dialog with all fields set."""
def __init__(self, parent):
"""Setup all the fields shown in the About dialog."""
GObject.GObject.__init__(self)
self.set_transient_for(parent)
self.set_modal(True)
self.set_name(PROGRAM_NAME)
... | the_stack_v2_python_sparse | gui/aboutdialog.py | balrok/gramps_addon | train | 2 |
8e43b38f3de0f04edfb7c836634d04ff97584180 | [
"result = 0\nfor i in range(len(points)):\n group = collections.defaultdict(int)\n for j in range(len(points)):\n if j == i:\n continue\n dx, dy = (points[i][0] - points[j][0], points[i][1] - points[j][1])\n group[dx ** 2 + dy ** 2] += 1\n for _, v in group.items():\n ... | <|body_start_0|>
result = 0
for i in range(len(points)):
group = collections.defaultdict(int)
for j in range(len(points)):
if j == i:
continue
dx, dy = (points[i][0] - points[j][0], points[i][1] - points[j][1])
g... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numberOfBoomerangs(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def numberOfBoomerangs2(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = 0... | stack_v2_sparse_classes_10k_train_000391 | 4,025 | no_license | [
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "numberOfBoomerangs",
"signature": "def numberOfBoomerangs(self, points)"
},
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "numberOfBoomerangs2",
"signature": "def numberOfBoomerangs2(self, points)"... | 2 | stack_v2_sparse_classes_30k_train_006190 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfBoomerangs(self, points): :type points: List[List[int]] :rtype: int
- def numberOfBoomerangs2(self, points): :type points: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfBoomerangs(self, points): :type points: List[List[int]] :rtype: int
- def numberOfBoomerangs2(self, points): :type points: List[List[int]] :rtype: int
<|skeleton|>
c... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def numberOfBoomerangs(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def numberOfBoomerangs2(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numberOfBoomerangs(self, points):
""":type points: List[List[int]] :rtype: int"""
result = 0
for i in range(len(points)):
group = collections.defaultdict(int)
for j in range(len(points)):
if j == i:
continue
... | the_stack_v2_python_sparse | leetcode_python/Hash_table/number-of-boomerangs.py | yennanliu/CS_basics | train | 64 | |
8574490d445dad691dc8876ff62e146d544c468d | [
"def Node():\n return defaultdict(Node)\nself.root = Node()",
"self.dict = dict\nfor word in dict:\n cur = self.root\n for w in word:\n cur = cur[w]\n cur['#'] = True",
"def f(d, wd, modified):\n if len(wd) == 0 and d.get('#') and modified:\n return True\n for i, s in enumerate(w... | <|body_start_0|>
def Node():
return defaultdict(Node)
self.root = Node()
<|end_body_0|>
<|body_start_1|>
self.dict = dict
for word in dict:
cur = self.root
for w in word:
cur = cur[w]
cur['#'] = True
<|end_body_1|>
<|body_... | MagicDictionary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dict):
"""Build a dictionary through a list of words :type dict: List[str] :rtype: None"""
<|body_1|>
def search(self, word):
"""Return... | stack_v2_sparse_classes_10k_train_000392 | 2,930 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Build a dictionary through a list of words :type dict: List[str] :rtype: None",
"name": "buildDict",
"signature": "def buildDict(self, dict)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_006964 | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None
... | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None
... | 69cf9087d5ef48aef9126c8279502488e36f97e3 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dict):
"""Build a dictionary through a list of words :type dict: List[str] :rtype: None"""
<|body_1|>
def search(self, word):
"""Return... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
def Node():
return defaultdict(Node)
self.root = Node()
def buildDict(self, dict):
"""Build a dictionary through a list of words :type dict: List[str] :rtype: None"""
self.d... | the_stack_v2_python_sparse | 676.实现一个魔法字典.py | kailunfan/lcode | train | 0 | |
f3dd2e79750c40052cf9ddf066582925d1b60d3f | [
"if hasattr(self, 'title'):\n return self.title\nelse:\n return ''",
"if self.comment_name[:1] in ['a', 'e', 'h', 'i', 'o', 'u']:\n return 'an %s' % self.comment_name\nelse:\n return 'a %s' % self.comment_name"
] | <|body_start_0|>
if hasattr(self, 'title'):
return self.title
else:
return ''
<|end_body_0|>
<|body_start_1|>
if self.comment_name[:1] in ['a', 'e', 'h', 'i', 'o', 'u']:
return 'an %s' % self.comment_name
else:
return 'a %s' % self.comment... | All other Models should inherit this. | PepysModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PepysModel:
"""All other Models should inherit this."""
def short_title(self):
"""Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title."""
<|body_0|>
def get_a_comment_name(self):
"""If we want to... | stack_v2_sparse_classes_10k_train_000393 | 1,000 | no_license | [
{
"docstring": "Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title.",
"name": "short_title",
"signature": "def short_title(self)"
},
{
"docstring": "If we want to print something like \"an annotation\" or \"a comment\", then ca... | 2 | stack_v2_sparse_classes_30k_train_006051 | Implement the Python class `PepysModel` described below.
Class description:
All other Models should inherit this.
Method signatures and docstrings:
- def short_title(self): Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title.
- def get_a_comment_name... | Implement the Python class `PepysModel` described below.
Class description:
All other Models should inherit this.
Method signatures and docstrings:
- def short_title(self): Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title.
- def get_a_comment_name... | c6d99f39046eb5309f3292bfb4edb8b008f37aeb | <|skeleton|>
class PepysModel:
"""All other Models should inherit this."""
def short_title(self):
"""Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title."""
<|body_0|>
def get_a_comment_name(self):
"""If we want to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PepysModel:
"""All other Models should inherit this."""
def short_title(self):
"""Child models (eg, Diary Entries) might override this with a more bespoke way of generating a short version of its title."""
if hasattr(self, 'title'):
return self.title
else:
... | the_stack_v2_python_sparse | pepysdiary/common/models/abstract.py | philgyford/pepysdiary | train | 16 |
a99c82ac9b46f807d05726af9da6f60d30967800 | [
"input_email = self.driver.find_element(*LoginPageLocators.EMAIL_INPUT_FIELD)\ninput_email.send_keys('oleksandr.makar.ol@gmail.com')\nreturn self",
"input_password = self.driver.find_element(*LoginPageLocators.PASSWORD_INPUT_FIELD)\ninput_password.send_keys('saxon123')\nreturn self",
"login = self.driver.find_e... | <|body_start_0|>
input_email = self.driver.find_element(*LoginPageLocators.EMAIL_INPUT_FIELD)
input_email.send_keys('oleksandr.makar.ol@gmail.com')
return self
<|end_body_0|>
<|body_start_1|>
input_password = self.driver.find_element(*LoginPageLocators.PASSWORD_INPUT_FIELD)
inpu... | Login Page Object Model | LoginPage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginPage:
"""Login Page Object Model"""
def input_email(self):
"""Make webdriver set 'E-Mail' value."""
<|body_0|>
def input_password(self):
"""Make webdriver set 'Password' value."""
<|body_1|>
def login(self):
"""Make webdriver initiate lo... | stack_v2_sparse_classes_10k_train_000394 | 869 | permissive | [
{
"docstring": "Make webdriver set 'E-Mail' value.",
"name": "input_email",
"signature": "def input_email(self)"
},
{
"docstring": "Make webdriver set 'Password' value.",
"name": "input_password",
"signature": "def input_password(self)"
},
{
"docstring": "Make webdriver initiate ... | 3 | stack_v2_sparse_classes_30k_train_006480 | Implement the Python class `LoginPage` described below.
Class description:
Login Page Object Model
Method signatures and docstrings:
- def input_email(self): Make webdriver set 'E-Mail' value.
- def input_password(self): Make webdriver set 'Password' value.
- def login(self): Make webdriver initiate login by click 'L... | Implement the Python class `LoginPage` described below.
Class description:
Login Page Object Model
Method signatures and docstrings:
- def input_email(self): Make webdriver set 'E-Mail' value.
- def input_password(self): Make webdriver set 'Password' value.
- def login(self): Make webdriver initiate login by click 'L... | bcb10ac460b5acef3eeaee6ad7e72ba9933b6708 | <|skeleton|>
class LoginPage:
"""Login Page Object Model"""
def input_email(self):
"""Make webdriver set 'E-Mail' value."""
<|body_0|>
def input_password(self):
"""Make webdriver set 'Password' value."""
<|body_1|>
def login(self):
"""Make webdriver initiate lo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoginPage:
"""Login Page Object Model"""
def input_email(self):
"""Make webdriver set 'E-Mail' value."""
input_email = self.driver.find_element(*LoginPageLocators.EMAIL_INPUT_FIELD)
input_email.send_keys('oleksandr.makar.ol@gmail.com')
return self
def input_password(s... | the_stack_v2_python_sparse | pages/login.py | testsibirtsv/opncrt_courses_version | train | 0 |
f97d89b1feb547da59ea5e9d91a5d623d89fc423 | [
"self.traclist = traclist\nassert order in {1, 2, 3, 4, 5}\nself.order = order\ndiffusion = len(diff_coef) > 0\nself.diffusion = diffusion\nif diffusion:\n self.ids2 = grid.ids2\n self.diff_coef = diff_coef\nself.i0 = {}\nself.i1 = {}\nngbs = param['neighbours']\nfor d in 'ijk':\n i0 = 0\n i1 = 0\n i... | <|body_start_0|>
self.traclist = traclist
assert order in {1, 2, 3, 4, 5}
self.order = order
diffusion = len(diff_coef) > 0
self.diffusion = diffusion
if diffusion:
self.ids2 = grid.ids2
self.diff_coef = diff_coef
self.i0 = {}
self.... | Tracer_numerics | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tracer_numerics:
def __init__(self, param, grid, traclist, order, diff_coef=[]):
"""- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection... | stack_v2_sparse_classes_10k_train_000395 | 3,260 | permissive | [
{
"docstring": "- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection of the tracer - diffcoef is a dictionnary with diffusion coefficient for each variable",
... | 2 | stack_v2_sparse_classes_30k_train_005376 | Implement the Python class `Tracer_numerics` described below.
Class description:
Implement the Tracer_numerics class.
Method signatures and docstrings:
- def __init__(self, param, grid, traclist, order, diff_coef=[]): - grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist... | Implement the Python class `Tracer_numerics` described below.
Class description:
Implement the Tracer_numerics class.
Method signatures and docstrings:
- def __init__(self, param, grid, traclist, order, diff_coef=[]): - grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist... | 8d5989699127f4897c3591f01f218b2f796ba938 | <|skeleton|>
class Tracer_numerics:
def __init__(self, param, grid, traclist, order, diff_coef=[]):
"""- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Tracer_numerics:
def __init__(self, param, grid, traclist, order, diff_coef=[]):
"""- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection of the tracer... | the_stack_v2_python_sparse | core/tracer.py | pvthinker/Nyles | train | 19 | |
c487812957807152cdb3705ed0a56a3d1169edb6 | [
"project = ProjectPermissionsMixin.get_object(self)\nobject_list = project.jobs.all()\nobject_list = self._get_status({}, object_list)\nobject_list = self._get_method({}, object_list)\nobject_list = self._get_users({}, project, object_list)\nreturn object_list.order_by('-id')",
"context = super().get_context_data... | <|body_start_0|>
project = ProjectPermissionsMixin.get_object(self)
object_list = project.jobs.all()
object_list = self._get_status({}, object_list)
object_list = self._get_method({}, object_list)
object_list = self._get_users({}, project, object_list)
return object_list.... | Display job list for a project to the user. | JobListView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobListView:
"""Display job list for a project to the user."""
def get_queryset(self):
"""Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and will raise `PermissionDenied` if not."""
<|body_0|... | stack_v2_sparse_classes_10k_train_000396 | 6,467 | permissive | [
{
"docstring": "Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and will raise `PermissionDenied` if not.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Update context to suppl... | 6 | stack_v2_sparse_classes_30k_train_002833 | Implement the Python class `JobListView` described below.
Class description:
Display job list for a project to the user.
Method signatures and docstrings:
- def get_queryset(self): Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and w... | Implement the Python class `JobListView` described below.
Class description:
Display job list for a project to the user.
Method signatures and docstrings:
- def get_queryset(self): Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and w... | 47c6377ccbfe8576b35854053d726537e533e78c | <|skeleton|>
class JobListView:
"""Display job list for a project to the user."""
def get_queryset(self):
"""Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and will raise `PermissionDenied` if not."""
<|body_0|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JobListView:
"""Display job list for a project to the user."""
def get_queryset(self):
"""Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and will raise `PermissionDenied` if not."""
project = ProjectPermi... | the_stack_v2_python_sparse | director/jobs/ui/views.py | gxf1986/hub | train | 0 |
3571fe525cc229d60ac2beecc85b12280658eea6 | [
"site = models.SiteSettings.objects.get()\ndata = {'site_form': forms.SiteForm(instance=site)}\nreturn TemplateResponse(request, 'settings/site.html', data)",
"site = models.SiteSettings.objects.get()\nform = forms.SiteForm(request.POST, request.FILES, instance=site)\nif not form.is_valid():\n data = {'site_fo... | <|body_start_0|>
site = models.SiteSettings.objects.get()
data = {'site_form': forms.SiteForm(instance=site)}
return TemplateResponse(request, 'settings/site.html', data)
<|end_body_0|>
<|body_start_1|>
site = models.SiteSettings.objects.get()
form = forms.SiteForm(request.POST,... | manage things like the instance name | Site | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Site:
"""manage things like the instance name"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
site = models.SiteSettings.objects.get()
... | stack_v2_sparse_classes_10k_train_000397 | 3,435 | no_license | [
{
"docstring": "edit form",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "edit the site settings",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001670 | Implement the Python class `Site` described below.
Class description:
manage things like the instance name
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings | Implement the Python class `Site` described below.
Class description:
manage things like the instance name
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings
<|skeleton|>
class Site:
"""manage things like the instance name"""
def get(self,... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class Site:
"""manage things like the instance name"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Site:
"""manage things like the instance name"""
def get(self, request):
"""edit form"""
site = models.SiteSettings.objects.get()
data = {'site_form': forms.SiteForm(instance=site)}
return TemplateResponse(request, 'settings/site.html', data)
def post(self, request):
... | the_stack_v2_python_sparse | bookwyrm/views/admin/site.py | bookwyrm-social/bookwyrm | train | 1,398 |
558a0153cc127a1e24d017c22e9d8f437bcee1a2 | [
"if head is None:\n return None\nif head.next is None:\n return head\np1, c1 = (ListNode(-1), head)\np2, c2 = (head, head.next)\nhead = c2\nwhile True:\n p1.next = c2\n p2.next = c1\n temp = c1.next\n c1.next = c2.next\n c2.next = temp\n if c1.next and c1.next.next:\n p1, c1 = (c1, c1... | <|body_start_0|>
if head is None:
return None
if head.next is None:
return head
p1, c1 = (ListNode(-1), head)
p2, c2 = (head, head.next)
head = c2
while True:
p1.next = c2
p2.next = c1
temp = c1.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def print_list(self, head):
""":type head: ListNode :rtype: None"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if head is None:
return None
... | stack_v2_sparse_classes_10k_train_000398 | 3,198 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "swapPairs",
"signature": "def swapPairs(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: None",
"name": "print_list",
"signature": "def print_list(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004879 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def swapPairs(self, head): :type head: ListNode :rtype: ListNode
- def print_list(self, head): :type head: ListNode :rtype: None | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def swapPairs(self, head): :type head: ListNode :rtype: ListNode
- def print_list(self, head): :type head: ListNode :rtype: None
<|skeleton|>
class Solution:
def swapPairs(... | b155895c90169ec97372b2517f556fd50deac2bc | <|skeleton|>
class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def print_list(self, head):
""":type head: ListNode :rtype: None"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
if head is None:
return None
if head.next is None:
return head
p1, c1 = (ListNode(-1), head)
p2, c2 = (head, head.next)
head = c2
while True:
... | the_stack_v2_python_sparse | linked_list_swap_node_pairs.py | claytonjwong/Sandbox-Python | train | 0 | |
6f115dbfeaec3b7fe6b6c51d0a278f094c8096f9 | [
"super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)\nself.parent_screen = parent_screen\nself.main_app = main_app\nself.question_list = self.main_app.question_list\nself.questionsArray = []\nself.main_app.user_answers = []\nself.set_questions(self.question_list)\nstore = Jso... | <|body_start_0|>
super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)
self.parent_screen = parent_screen
self.main_app = main_app
self.question_list = self.main_app.question_list
self.questionsArray = []
self.main_app.user_answers = ... | QuestionnaireWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
<|body_0|>
def submit_action(self, instance):
"""Called when the user presses the ... | stack_v2_sparse_classes_10k_train_000399 | 4,800 | no_license | [
{
"docstring": ":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers",
"name": "__init__",
"signature": "def __init__(self, parent_screen, main_app)"
},
{
"docstring": "Called when the user presses the submit button. Saves the user's an... | 3 | stack_v2_sparse_classes_30k_train_003913 | Implement the Python class `QuestionnaireWidget` described below.
Class description:
Implement the QuestionnaireWidget class.
Method signatures and docstrings:
- def __init__(self, parent_screen, main_app): :param main_app: The main app that runs the program. We use it to pass on the question list and the user answer... | Implement the Python class `QuestionnaireWidget` described below.
Class description:
Implement the QuestionnaireWidget class.
Method signatures and docstrings:
- def __init__(self, parent_screen, main_app): :param main_app: The main app that runs the program. We use it to pass on the question list and the user answer... | d276e3d1bd4ee690c995915f99dbda2729fba213 | <|skeleton|>
class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
<|body_0|>
def submit_action(self, instance):
"""Called when the user presses the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)
self.pare... | the_stack_v2_python_sparse | KivyFiles/Questions/QuestionsDisplay.py | CuriosityLabTAU/graph_game_app | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.