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
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
be98776bc6c7991ac324b0ab9a2be00934290481
[ "self.windFarmModel = windFarmModel\nself.n_cpu = n_cpu\n\ndef aep(**kwargs):\n try:\n return self.windFarmModel.aep(x=kwargs[topfarm.x_key], y=kwargs[topfarm.y_key], h=kwargs.get(topfarm.z_key, None), type=kwargs.get(topfarm.type_key, 0), wd=wd, ws=ws, n_cpu=n_cpu)\n except ValueError as e:\n i...
<|body_start_0|> self.windFarmModel = windFarmModel self.n_cpu = n_cpu def aep(**kwargs): try: return self.windFarmModel.aep(x=kwargs[topfarm.x_key], y=kwargs[topfarm.y_key], h=kwargs.get(topfarm.z_key, None), type=kwargs.get(topfarm.type_key, 0), wd=wd, ws=ws, n_cpu...
TOPFARM wrapper for PyWake AEP calculator
PyWakeAEPCostModelComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyWakeAEPCostModelComponent: """TOPFARM wrapper for PyWake AEP calculator""" def __init__(self, windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=autograd, n_cpu=1, **kwargs): """Initialize wrapper for PyWake AEP calculator Parameters ---------- windFarmModel : Defici...
stack_v2_sparse_classes_75kplus_train_002800
6,554
permissive
[ { "docstring": "Initialize wrapper for PyWake AEP calculator Parameters ---------- windFarmModel : DeficitModel Wake deficit model used n_wt : int Number of wind turbines wd : array_like Wind directions to study ws : array_like Wind speeds to study max_eval : int Maximum number of function evaluations grad_meth...
2
stack_v2_sparse_classes_30k_train_044774
Implement the Python class `PyWakeAEPCostModelComponent` described below. Class description: TOPFARM wrapper for PyWake AEP calculator Method signatures and docstrings: - def __init__(self, windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=autograd, n_cpu=1, **kwargs): Initialize wrapper for PyWake AE...
Implement the Python class `PyWakeAEPCostModelComponent` described below. Class description: TOPFARM wrapper for PyWake AEP calculator Method signatures and docstrings: - def __init__(self, windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=autograd, n_cpu=1, **kwargs): Initialize wrapper for PyWake AE...
9657dc9943e9542fcfd3aee5fd9958977cd883ac
<|skeleton|> class PyWakeAEPCostModelComponent: """TOPFARM wrapper for PyWake AEP calculator""" def __init__(self, windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=autograd, n_cpu=1, **kwargs): """Initialize wrapper for PyWake AEP calculator Parameters ---------- windFarmModel : Defici...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PyWakeAEPCostModelComponent: """TOPFARM wrapper for PyWake AEP calculator""" def __init__(self, windFarmModel, n_wt, wd=None, ws=None, max_eval=None, grad_method=autograd, n_cpu=1, **kwargs): """Initialize wrapper for PyWake AEP calculator Parameters ---------- windFarmModel : DeficitModel Wake d...
the_stack_v2_python_sparse
topfarm/cost_models/py_wake_wrapper.py
DTUWindEnergy/TopFarm2
train
10
a43f8eaa4a9d29af119112e32cfd0a20815b4fa5
[ "try:\n self.conf_file = conf_file\n self.port_details = port_details\n self.ports = []\n self.hostname = socket.gethostbyname(socket.gethostname())\nexcept Exception as e:\n print(e)\n sys.exit(1)", "try:\n infile = open(self.conf_file)\n infile_content = infile.readlines()\n infile.cl...
<|body_start_0|> try: self.conf_file = conf_file self.port_details = port_details self.ports = [] self.hostname = socket.gethostbyname(socket.gethostname()) except Exception as e: print(e) sys.exit(1) <|end_body_0|> <|body_start_1|...
.
Ports
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ports: """.""" def __init__(self, conf_file, port_details): """.""" <|body_0|> def get_ports_from_conf_to_port_details(self): """.""" <|body_1|> def get_port_details_from_port_details_file(line): """.""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_002801
12,520
no_license
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self, conf_file, port_details)" }, { "docstring": ".", "name": "get_ports_from_conf_to_port_details", "signature": "def get_ports_from_conf_to_port_details(self)" }, { "docstring": ".", "name": "get_port_detai...
3
stack_v2_sparse_classes_30k_train_007988
Implement the Python class `Ports` described below. Class description: . Method signatures and docstrings: - def __init__(self, conf_file, port_details): . - def get_ports_from_conf_to_port_details(self): . - def get_port_details_from_port_details_file(line): .
Implement the Python class `Ports` described below. Class description: . Method signatures and docstrings: - def __init__(self, conf_file, port_details): . - def get_ports_from_conf_to_port_details(self): . - def get_port_details_from_port_details_file(line): . <|skeleton|> class Ports: """.""" def __init__...
e513224364dce05ea4d17ac25ecfa981238b1311
<|skeleton|> class Ports: """.""" def __init__(self, conf_file, port_details): """.""" <|body_0|> def get_ports_from_conf_to_port_details(self): """.""" <|body_1|> def get_port_details_from_port_details_file(line): """.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ports: """.""" def __init__(self, conf_file, port_details): """.""" try: self.conf_file = conf_file self.port_details = port_details self.ports = [] self.hostname = socket.gethostbyname(socket.gethostname()) except Exception as e: ...
the_stack_v2_python_sparse
scripts_avx/scripts/scripts/Commons/appviewx_firewall_config.py
Poonammahunta/Integration
train
0
d2a18d48e90917d8a2cc883f89c1da85c320e7c1
[ "upload.upload_tsv(EXAMS_SFTP_FILENAME)\nftp_mock = connection_mock.return_value.__enter__.return_value\nftp_mock.cd.assert_called_once_with(EXAMS_SFTP_UPLOAD_DIR)\nftp_mock.put.assert_called_once_with(EXAMS_SFTP_FILENAME)", "connection_mock.side_effect = expected_exc\nwith self.assertRaises(RetryableSFTPExceptio...
<|body_start_0|> upload.upload_tsv(EXAMS_SFTP_FILENAME) ftp_mock = connection_mock.return_value.__enter__.return_value ftp_mock.cd.assert_called_once_with(EXAMS_SFTP_UPLOAD_DIR) ftp_mock.put.assert_called_once_with(EXAMS_SFTP_FILENAME) <|end_body_0|> <|body_start_1|> connection_...
Tests for Pearson upload_tsv
PeasonUploadTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeasonUploadTest: """Tests for Pearson upload_tsv""" def test_upload_tsv(self, connection_mock): """Tests that upload uses the correct settings values""" <|body_0|> def test_retryable_exceptions(self, expected_exc, connection_mock): """Test that if {exc_cls} is r...
stack_v2_sparse_classes_75kplus_train_002802
1,565
no_license
[ { "docstring": "Tests that upload uses the correct settings values", "name": "test_upload_tsv", "signature": "def test_upload_tsv(self, connection_mock)" }, { "docstring": "Test that if {exc_cls} is raised that it results in a RetryableSFTPException", "name": "test_retryable_exceptions", ...
2
null
Implement the Python class `PeasonUploadTest` described below. Class description: Tests for Pearson upload_tsv Method signatures and docstrings: - def test_upload_tsv(self, connection_mock): Tests that upload uses the correct settings values - def test_retryable_exceptions(self, expected_exc, connection_mock): Test t...
Implement the Python class `PeasonUploadTest` described below. Class description: Tests for Pearson upload_tsv Method signatures and docstrings: - def test_upload_tsv(self, connection_mock): Tests that upload uses the correct settings values - def test_retryable_exceptions(self, expected_exc, connection_mock): Test t...
1df800eda5f827c012881e569629a29b660c7c25
<|skeleton|> class PeasonUploadTest: """Tests for Pearson upload_tsv""" def test_upload_tsv(self, connection_mock): """Tests that upload uses the correct settings values""" <|body_0|> def test_retryable_exceptions(self, expected_exc, connection_mock): """Test that if {exc_cls} is r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PeasonUploadTest: """Tests for Pearson upload_tsv""" def test_upload_tsv(self, connection_mock): """Tests that upload uses the correct settings values""" upload.upload_tsv(EXAMS_SFTP_FILENAME) ftp_mock = connection_mock.return_value.__enter__.return_value ftp_mock.cd.asser...
the_stack_v2_python_sparse
exams/pearson/upload_test.py
johnfelipe/micromasters
train
0
b801d3f8a9b5b59a66cbcef893fde2d3bc81db8a
[ "N = len(num)\nif k >= N:\n return str(0)\nk = N - k\nres = list()\nindex = 0\nwhile k > 0:\n pre_min = min(num[index:N - k + 1])\n slice_index = num[index:N - k + 1].index(pre_min)\n index = index + slice_index + 1\n res.append(pre_min)\n k -= 1\nreturn str(int(''.join(res)))", "N = len(num)\ni...
<|body_start_0|> N = len(num) if k >= N: return str(0) k = N - k res = list() index = 0 while k > 0: pre_min = min(num[index:N - k + 1]) slice_index = num[index:N - k + 1].index(pre_min) index = index + slice_index + 1 ...
删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0.""" def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def removeKdigitsAdvance(self, num, k): """:type num: str :type k: int :rtype: str""" <|body...
stack_v2_sparse_classes_75kplus_train_002803
1,320
no_license
[ { "docstring": ":type num: str :type k: int :rtype: str", "name": "removeKdigits", "signature": "def removeKdigits(self, num, k)" }, { "docstring": ":type num: str :type k: int :rtype: str", "name": "removeKdigitsAdvance", "signature": "def removeKdigitsAdvance(self, num, k)" } ]
2
stack_v2_sparse_classes_30k_train_014679
Implement the Python class `Solution` described below. Class description: 删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0. Method signatures and docstrings: - def removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigitsAdvance(self, num, k): :type num: str :type k: int :rtype: ...
Implement the Python class `Solution` described below. Class description: 删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0. Method signatures and docstrings: - def removeKdigits(self, num, k): :type num: str :type k: int :rtype: str - def removeKdigitsAdvance(self, num, k): :type num: str :type k: int :rtype: ...
c247295eeeec74b82fbfbb15d05c4053ecef0838
<|skeleton|> class Solution: """删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0.""" def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" <|body_0|> def removeKdigitsAdvance(self, num, k): """:type num: str :type k: int :rtype: str""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """删除数字字符串中指定的字符个数,使留下的数字值最小,并以数字形式的字符串显示,即除非本身是0,否则开头不能是0.""" def removeKdigits(self, num, k): """:type num: str :type k: int :rtype: str""" N = len(num) if k >= N: return str(0) k = N - k res = list() index = 0 while k > 0: ...
the_stack_v2_python_sparse
Remove_K_Digits/Remove_K_Digits.py
JaneyJiang/LeetCode
train
0
9f277681c969a6a57ee001160c0f309b27c82601
[ "total = 0\nsums = [0]\nfor i in nums:\n total += i\n sums.append(total)\ncount = 0\nfor i in range(len(nums)):\n for j in range(i, len(nums)):\n if sums[j + 1] - sums[i] == k:\n count += 1\nreturn count", "count = 0\nsum_ = 0\nmap_ = {}\nmap_[0] = 1\nfor i in nums:\n sum_ += i\n ...
<|body_start_0|> total = 0 sums = [0] for i in nums: total += i sums.append(total) count = 0 for i in range(len(nums)): for j in range(i, len(nums)): if sums[j + 1] - sums[i] == k: count += 1 return c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> total = 0 ...
stack_v2_sparse_classes_75kplus_train_002804
884
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySum", "signature": "def subarraySum(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySum", "signature": "def subarraySum(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_011408
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|> clas...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" total = 0 sums = [0] for i in nums: total += i sums.append(total) count = 0 for i in range(len(nums)): for j in range(i, len(nums))...
the_stack_v2_python_sparse
subarray-sum-equals-k/solution.py
uxlsl/leetcode_practice
train
0
55b2901645c279e53bb670e00116acf907cccd87
[ "initial_groups = util.setNoneList(initial_groups)\nsuper(self.__class__, self).__init__(initial_groups=initial_groups)\nif is_set_group_label:\n self.setGroupLabels(prefix=prefix)\nself._is_plot = is_plot", "num_permute = util.nCr(num_isolates, num_occurrences)\ndenom = num_permute ** num_mutations\nreturn 1....
<|body_start_0|> initial_groups = util.setNoneList(initial_groups) super(self.__class__, self).__init__(initial_groups=initial_groups) if is_set_group_label: self.setGroupLabels(prefix=prefix) self._is_plot = is_plot <|end_body_0|> <|body_start_1|> num_permute = util...
MutationCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_002805
4,729
permissive
[ { "docstring": "If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True", "name": "__init__", "signature": "def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True)" }, {...
5
stack_v2_sparse_classes_30k_train_007127
Implement the Python class `MutationCollection` described below. Class description: Implement the MutationCollection class. Method signatures and docstrings: - def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): If no mutation_source is specified, then calculates a default Mutat...
Implement the Python class `MutationCollection` described below. Class description: Implement the MutationCollection class. Method signatures and docstrings: - def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): If no mutation_source is specified, then calculates a default Mutat...
704435e66c58677bab24f27820458870092924e2
<|skeleton|> class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MutationCollection: def __init__(self, initial_groups=None, prefix='', is_set_group_label=True, is_plot=True): """If no mutation_source is specified, then calculates a default MutationDifferential. :param list-Group initial_groups: :param bool is_plot: plots if True""" initial_groups = util.se...
the_stack_v2_python_sparse
microbepy/correlation/mutation_collection.py
ScienceStacks/microbepy
train
1
bae78ab33726e914ded362670fb4a2f24c8da2f7
[ "self.input = inputList\nself.nodes = dict()\nself.edges = dict()\nself.topOrder = []\nself.nodesCopy = dict()\nself.startNode = -1\nself.endNode = -1\nself.path = []", "for line in range(0, len(self.input)):\n if line == 0:\n self.startNode = self.input[line]\n elif line == 1:\n self.endNode ...
<|body_start_0|> self.input = inputList self.nodes = dict() self.edges = dict() self.topOrder = [] self.nodesCopy = dict() self.startNode = -1 self.endNode = -1 self.path = [] <|end_body_0|> <|body_start_1|> for line in range(0, len(self.input)): ...
A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath()
DAG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DAG: """A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath()""" def __init__(self, inputList): """Constructs all the necessary at...
stack_v2_sparse_classes_75kplus_train_002806
11,112
no_license
[ { "docstring": "Constructs all the necessary attributes for the DAG object. Parameters ---------- :param inputList: list of strings contains the start node, end node, and all edges with their weights Attributes ---------- input : list assigned to inputList nodes : dict contains all of the nodes in the DAG (keys...
6
stack_v2_sparse_classes_30k_train_037906
Implement the Python class `DAG` described below. Class description: A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath() Method signatures and docstrings: - def _...
Implement the Python class `DAG` described below. Class description: A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath() Method signatures and docstrings: - def _...
205e38dccf95d4be43ed542e46c2265689ca2cdf
<|skeleton|> class DAG: """A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath()""" def __init__(self, inputList): """Constructs all the necessary at...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DAG: """A class to represent a directed acyclic graph (DAG). Contains the methods that construct the longest path and its score. Methods ------- parseInput() topOrdering() maxPredecessor() longestPath() outputPath()""" def __init__(self, inputList): """Constructs all the necessary attributes for ...
the_stack_v2_python_sparse
problem18.py
tianap/bme-205
train
0
b18cb7257fdbe56ffa350f031633452a4354cc28
[ "headers = self._get_default_headers()\ntry:\n if self.request_validator.client_authentication_required(request):\n log.debug('Authenticating client, %r.', request)\n if not self.request_validator.authenticate_client(request):\n log.debug('Client authentication failed, %r.', request)\n ...
<|body_start_0|> headers = self._get_default_headers() try: if self.request_validator.client_authentication_required(request): log.debug('Authenticating client, %r.', request) if not self.request_validator.authenticate_client(request): log....
`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application. The authorization server should take special care when enabling ...
ResourceOwnerPasswordCredentialsGrant
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application....
stack_v2_sparse_classes_75kplus_train_002807
8,484
permissive
[ { "docstring": "Return token or error in json format. :param request: OAuthlib request. :type request: oauthlib.common.Request :param token_handler: A token handler instance, for example of type oauthlib.oauth2.BearerToken. If the access token request is valid and authorized, the authorization server issues an ...
2
stack_v2_sparse_classes_30k_train_020689
Implement the Python class `ResourceOwnerPasswordCredentialsGrant` described below. Class description: `Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating sys...
Implement the Python class `ResourceOwnerPasswordCredentialsGrant` described below. Class description: `Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating sys...
00f9a212004a80df790ed071a59af53a05f5e3f2
<|skeleton|> class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application. The authoriz...
the_stack_v2_python_sparse
oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
oauthlib/oauthlib
train
1,223
fc1a5c6b55e0f1a60e4afc8804e4b9252dacbade
[ "from htk.lib.iterable.utils import get_workflow_id\nsign_up_workflow_id = get_workflow_id('account.sign_up')\nif sign_up_workflow_id is not None:\n payload = {'dataFields': {'userId': user.id, 'date_joined': user.date_joined.strftime(ITERABLE_DATE_FORMAT)}}\n self.trigger_workflow(user.profile.confirmed_emai...
<|body_start_0|> from htk.lib.iterable.utils import get_workflow_id sign_up_workflow_id = get_workflow_id('account.sign_up') if sign_up_workflow_id is not None: payload = {'dataFields': {'userId': user.id, 'date_joined': user.date_joined.strftime(ITERABLE_DATE_FORMAT)}} s...
HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla
HtkIterableAPIClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtkIterableAPIClient: """HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla""" def notify_sign_up(self, user): """Notify Iterable of a `user` sign up event Based on HTK settings, either track an event, trigger a workflow, or both""" <|body_...
stack_v2_sparse_classes_75kplus_train_002808
7,919
permissive
[ { "docstring": "Notify Iterable of a `user` sign up event Based on HTK settings, either track an event, trigger a workflow, or both", "name": "notify_sign_up", "signature": "def notify_sign_up(self, user)" }, { "docstring": "Notify Iterable of a `user` activation event", "name": "notify_acco...
3
stack_v2_sparse_classes_30k_train_053792
Implement the Python class `HtkIterableAPIClient` described below. Class description: HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla Method signatures and docstrings: - def notify_sign_up(self, user): Notify Iterable of a `user` sign up event Based on HTK settings, either track...
Implement the Python class `HtkIterableAPIClient` described below. Class description: HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla Method signatures and docstrings: - def notify_sign_up(self, user): Notify Iterable of a `user` sign up event Based on HTK settings, either track...
935c4913e33d959f8c29583825f72b238f85b380
<|skeleton|> class HtkIterableAPIClient: """HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla""" def notify_sign_up(self, user): """Notify Iterable of a `user` sign up event Based on HTK settings, either track an event, trigger a workflow, or both""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HtkIterableAPIClient: """HTK-flavored Iterable API client This extends IterableAPIClient, which is more vanilla""" def notify_sign_up(self, user): """Notify Iterable of a `user` sign up event Based on HTK settings, either track an event, trigger a workflow, or both""" from htk.lib.iterabl...
the_stack_v2_python_sparse
lib/iterable/api.py
hacktoolkit/django-htk
train
210
e50b5fba8e02c08bc0d94bc143e22793c8752d4e
[ "super().__init__(**kwargs)\nself.n = n\nself.r_s = return_sequences", "assert len(x.shape) == 3, 'Only implemented for 3D tensor input.'\nif self.n is None:\n ret_val = x\nelse:\n ret_val = x[:, :, :self.n]\nif self.r_s:\n return ret_val\nreturn ret_val[:, -1, :]", "out_shape = [k for k in input_shape...
<|body_start_0|> super().__init__(**kwargs) self.n = n self.r_s = return_sequences <|end_body_0|> <|body_start_1|> assert len(x.shape) == 3, 'Only implemented for 3D tensor input.' if self.n is None: ret_val = x else: ret_val = x[:, :, :self.n] ...
Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else only the last element of the sequence.
IdRecurrent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdRecurrent: """Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else only the last element of the sequence....
stack_v2_sparse_classes_75kplus_train_002809
13,797
no_license
[ { "docstring": "Initializes the layer. Args: n: Number of output features. return_sequences: Whether to return sequences. **kwargs: kwargs for super.", "name": "__init__", "signature": "def __init__(self, n: int=None, return_sequences: bool=True, **kwargs)" }, { "docstring": "Returns `x` unchang...
3
stack_v2_sparse_classes_30k_train_044049
Implement the Python class `IdRecurrent` described below. Class description: Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else...
Implement the Python class `IdRecurrent` described below. Class description: Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else...
76bb37bf2d23f7d047602bbdbcc4b2607df53a2b
<|skeleton|> class IdRecurrent: """Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else only the last element of the sequence....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IdRecurrent: """Dummy Layer, it passes the same values that are input into it. If `n` is specified, only a reduced number of features is returned, cannot be larger than the total number of features. If `return_sequences` is True, sequences are returned, else only the last element of the sequence.""" def ...
the_stack_v2_python_sparse
BatchRL/ml/keras_layers.py
chbauman/MasterThesis
train
0
91a8c173d38077969ad7e6248ed289583bc40360
[ "command = config.editor\nif jumpIndex:\n line = text[:jumpIndex].count('\\n')\n column = jumpIndex - (text[:jumpIndex].rfind('\\n') + 1)\nelse:\n line = column = 0\nif config.editor.startswith('kate'):\n command += ' -l %i -c %i' % (line + 1, column + 1)\nelif config.editor.startswith('gedit'):\n co...
<|body_start_0|> command = config.editor if jumpIndex: line = text[:jumpIndex].count('\n') column = jumpIndex - (text[:jumpIndex].rfind('\n') + 1) else: line = column = 0 if config.editor.startswith('kate'): command += ' -l %i -c %i' % (lin...
Text editor.
TextEditor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextEditor: """Text editor.""" def command(self, tempFilename, text, jumpIndex=None): """Return editor selected in user-config.py.""" <|body_0|> def convertLinebreaks(self, text): """Convert line-breaks.""" <|body_1|> def restoreLinebreaks(self, text...
stack_v2_sparse_classes_75kplus_train_002810
4,743
permissive
[ { "docstring": "Return editor selected in user-config.py.", "name": "command", "signature": "def command(self, tempFilename, text, jumpIndex=None)" }, { "docstring": "Convert line-breaks.", "name": "convertLinebreaks", "signature": "def convertLinebreaks(self, text)" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_016482
Implement the Python class `TextEditor` described below. Class description: Text editor. Method signatures and docstrings: - def command(self, tempFilename, text, jumpIndex=None): Return editor selected in user-config.py. - def convertLinebreaks(self, text): Convert line-breaks. - def restoreLinebreaks(self, text): R...
Implement the Python class `TextEditor` described below. Class description: Text editor. Method signatures and docstrings: - def command(self, tempFilename, text, jumpIndex=None): Return editor selected in user-config.py. - def convertLinebreaks(self, text): Convert line-breaks. - def restoreLinebreaks(self, text): R...
2461ccc6d24153790a1b1c0378348f99997c4eca
<|skeleton|> class TextEditor: """Text editor.""" def command(self, tempFilename, text, jumpIndex=None): """Return editor selected in user-config.py.""" <|body_0|> def convertLinebreaks(self, text): """Convert line-breaks.""" <|body_1|> def restoreLinebreaks(self, text...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextEditor: """Text editor.""" def command(self, tempFilename, text, jumpIndex=None): """Return editor selected in user-config.py.""" command = config.editor if jumpIndex: line = text[:jumpIndex].count('\n') column = jumpIndex - (text[:jumpIndex].rfind('\n'...
the_stack_v2_python_sparse
pywikibot/editor.py
speedydeletion/pywikibot
train
1
6a55778884f01902814ae792c7eaf01e9a3206ec
[ "s1, s2 = ([], [])\nfor v1 in S:\n if v1 != '#':\n s1.append(v1)\n elif len(s1) != 0:\n s1.pop()\nfor v2 in T:\n if v2 != '#':\n s2.append(v2)\n elif len(s2) != 0:\n s2.pop()\nreturn ''.join(s1) == ''.join(s2)", "def f(input_str):\n skip = 0\n for s in reversed(input_...
<|body_start_0|> s1, s2 = ([], []) for v1 in S: if v1 != '#': s1.append(v1) elif len(s1) != 0: s1.pop() for v2 in T: if v2 != '#': s2.append(v2) elif len(s2) != 0: s2.pop() ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> s1, s2 = ([], []) ...
stack_v2_sparse_classes_75kplus_train_002811
954
no_license
[ { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare2", "signature": "def backspaceCompare2(self, S, T)" }, { "docstring": ":type S: str :type T: str :rtype: bool", "name": "backspaceCompare", "signature": "def backspaceCompare(self, S, T)" } ]
2
stack_v2_sparse_classes_30k_train_047702
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare(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 backspaceCompare2(self, S, T): :type S: str :type T: str :rtype: bool - def backspaceCompare(self, S, T): :type S: str :type T: str :rtype: bool <|skeleton|> class Solution:...
77ee7186a918cf865a038d9da5ae71e0aa6b64dc
<|skeleton|> class Solution: def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_0|> def backspaceCompare(self, S, T): """:type S: str :type T: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def backspaceCompare2(self, S, T): """:type S: str :type T: str :rtype: bool""" s1, s2 = ([], []) for v1 in S: if v1 != '#': s1.append(v1) elif len(s1) != 0: s1.pop() for v2 in T: if v2 != '#': ...
the_stack_v2_python_sparse
874-backspace-string-compare/solution.py
GoingMyWay/LeetCode
train
2
16e509d461bbcd8e35e1a729109b639bad08f2db
[ "self.method = method\nself.url = url\nself.params = params[:]\nself.body = body\nself.headers = headers.copy()\nself.timeout = timeout\nself.stream = stream\nself.follow_redirects = follow_redirects\nself._cookies = None", "if self._cookies is None:\n self._cookies = http.cookiejar.CookieJar()\nreturn self._c...
<|body_start_0|> self.method = method self.url = url self.params = params[:] self.body = body self.headers = headers.copy() self.timeout = timeout self.stream = stream self.follow_redirects = follow_redirects self._cookies = None <|end_body_0|> <|...
Request to HttpService.
HttpRequest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_75kplus_train_002812
31,532
permissive
[ { "docstring": "Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET parameters |body| - encoded body of the request (None or str) |headers| - dict with request headers |timeout| - socket read timeout (None ...
3
stack_v2_sparse_classes_30k_train_044277
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET pa...
the_stack_v2_python_sparse
client/utils/net.py
luci/luci-py
train
84
f529c2138f65ee208fa703366b79702525e0a2d8
[ "self.x1 = x\nself.y1 = y\nself.x2 = x + w - 1\nself.y2 = y + h - 1", "x = (self.x1 + self.x2) // 2\ny = (self.y1 + self.y2) // 2\nreturn (x, y)", "width = self.x2 - self.x1\nheight = self.y2 - self.y1\nreturn int(width * height)" ]
<|body_start_0|> self.x1 = x self.y1 = y self.x2 = x + w - 1 self.y2 = y + h - 1 <|end_body_0|> <|body_start_1|> x = (self.x1 + self.x2) // 2 y = (self.y1 + self.y2) // 2 return (x, y) <|end_body_1|> <|body_start_2|> width = self.x2 - self.x1 hei...
Class representing a rectangle
Rect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rect: """Class representing a rectangle""" def __init__(self, x, y, w, h): """Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of the rectangle h -- height of the rectangle""" <|...
stack_v2_sparse_classes_75kplus_train_002813
1,003
no_license
[ { "docstring": "Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of the rectangle h -- height of the rectangle", "name": "__init__", "signature": "def __init__(self, x, y, w, h)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_test_000746
Implement the Python class `Rect` described below. Class description: Class representing a rectangle Method signatures and docstrings: - def __init__(self, x, y, w, h): Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of...
Implement the Python class `Rect` described below. Class description: Class representing a rectangle Method signatures and docstrings: - def __init__(self, x, y, w, h): Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of...
9cea1fcbc61362d930adc22293c950c0cfc3ad66
<|skeleton|> class Rect: """Class representing a rectangle""" def __init__(self, x, y, w, h): """Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of the rectangle h -- height of the rectangle""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rect: """Class representing a rectangle""" def __init__(self, x, y, w, h): """Initialize rectangle object x -- x coordinate of the top left corner of rectangle y -- y coordinate of the top left corner of rectangle w -- width of the rectangle h -- height of the rectangle""" self.x1 = x ...
the_stack_v2_python_sparse
rect.py
JarrodDoyle/Shattered-Strongholds
train
0
2b9ee447adfbf4f246bacde3fe8c34229d957ec0
[ "base.Action.__init__(self, self.__doMakeGif)\nself.__name = '{}_{}'.format(type(self).__name__, id(self))\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__panel = panel\nself.__overlayList.addListener('overlays', self.__name, self.__selectedOverlayChanged)\nself.__displayCtx.addListener('s...
<|body_start_0|> base.Action.__init__(self, self.__doMakeGif) self.__name = '{}_{}'.format(type(self).__name__, id(self)) self.__overlayList = overlayList self.__displayCtx = displayCtx self.__panel = panel self.__overlayList.addListener('overlays', self.__name, self.__se...
The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings.
MovieGifAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieGifAction: """The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings.""" def __init__(self, overlayList, displayCtx, panel): """Create a ``MovieGifAction``. :arg ov...
stack_v2_sparse_classes_75kplus_train_002814
9,924
permissive
[ { "docstring": "Create a ``MovieGifAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg panel: The :class:`.CanvasPanel` to generate the animated GIF for.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, panel)" }, ...
4
stack_v2_sparse_classes_30k_train_037418
Implement the Python class `MovieGifAction` described below. Class description: The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings. Method signatures and docstrings: - def __init__(self, overlayList,...
Implement the Python class `MovieGifAction` described below. Class description: The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings. Method signatures and docstrings: - def __init__(self, overlayList,...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class MovieGifAction: """The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings.""" def __init__(self, overlayList, displayCtx, panel): """Create a ``MovieGifAction``. :arg ov...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovieGifAction: """The ``MovieGifAction`` allows the user to save an animated gif of the currently selected overlay in a :class:`.CanvasPanel`, according to the current movie mode settings.""" def __init__(self, overlayList, displayCtx, panel): """Create a ``MovieGifAction``. :arg overlayList: Th...
the_stack_v2_python_sparse
fsleyes/actions/moviegif.py
sanjayankur31/fsleyes
train
1
176fbe5c2ac4efe16a54306dfde836c552a0cdf2
[ "person = model.Person.get(self.repo, self.params.id)\nif not person:\n return self.error(400, _('No person with ID: %(id_str)s.') % {'id_str': self.params.id})\nself.render('disable_notes.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_html=self.get_captcha_html())", "person =...
<|body_start_0|> person = model.Person.get(self.repo, self.params.id) if not person: return self.error(400, _('No person with ID: %(id_str)s.') % {'id_str': self.params.id}) self.render('disable_notes.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_ht...
Handles an author request to disable notes to a person record.
Handler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """Handles an author request to disable notes to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" <|body_0|> def post(self): """If the user passed the CAPTCHA, send the confirmation email.""" ...
stack_v2_sparse_classes_75kplus_train_002815
3,511
permissive
[ { "docstring": "Prompts the user with a CAPTCHA before proceeding the request.", "name": "get", "signature": "def get(self)" }, { "docstring": "If the user passed the CAPTCHA, send the confirmation email.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_017135
Implement the Python class `Handler` described below. Class description: Handles an author request to disable notes to a person record. Method signatures and docstrings: - def get(self): Prompts the user with a CAPTCHA before proceeding the request. - def post(self): If the user passed the CAPTCHA, send the confirmat...
Implement the Python class `Handler` described below. Class description: Handles an author request to disable notes to a person record. Method signatures and docstrings: - def get(self): Prompts the user with a CAPTCHA before proceeding the request. - def post(self): If the user passed the CAPTCHA, send the confirmat...
7e40f2783ac89b91efd1d8497f1acc5b006361fa
<|skeleton|> class Handler: """Handles an author request to disable notes to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" <|body_0|> def post(self): """If the user passed the CAPTCHA, send the confirmation email.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Handler: """Handles an author request to disable notes to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" person = model.Person.get(self.repo, self.params.id) if not person: return self.error(400, _('No person wit...
the_stack_v2_python_sparse
app/disable_notes.py
ZhengC1/personfinder
train
2
754f398ea0de11f9f48312804fa8758f38eccc35
[ "a2b = self.filter(sender=sender, recipient=recipient).select_related('sender', 'recipient')\nb2a = self.filter(sender=recipient, recipient=sender).select_related('sender', 'recipient')\nreturn a2b.union(b2a).order_by('created_at')", "try:\n qs_sent = self.filter(sender=recipient)\n qs_received = self.filte...
<|body_start_0|> a2b = self.filter(sender=sender, recipient=recipient).select_related('sender', 'recipient') b2a = self.filter(sender=recipient, recipient=sender).select_related('sender', 'recipient') return a2b.union(b2a).order_by('created_at') <|end_body_0|> <|body_start_1|> try: ...
MessageQueryset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageQueryset: def get_conversation(self, sender, recipient): """获取用户间的私信会话""" <|body_0|> def get_most_recent_conversation(self, recipient): """获取最近一次的私信互动用户,即登录用户作为接受者,判断最后一条消息是自己发出还是发送者发出""" <|body_1|> <|end_skeleton|> <|body_start_0|> a2b = sel...
stack_v2_sparse_classes_75kplus_train_002816
3,008
no_license
[ { "docstring": "获取用户间的私信会话", "name": "get_conversation", "signature": "def get_conversation(self, sender, recipient)" }, { "docstring": "获取最近一次的私信互动用户,即登录用户作为接受者,判断最后一条消息是自己发出还是发送者发出", "name": "get_most_recent_conversation", "signature": "def get_most_recent_conversation(self, recipient)...
2
stack_v2_sparse_classes_30k_train_040986
Implement the Python class `MessageQueryset` described below. Class description: Implement the MessageQueryset class. Method signatures and docstrings: - def get_conversation(self, sender, recipient): 获取用户间的私信会话 - def get_most_recent_conversation(self, recipient): 获取最近一次的私信互动用户,即登录用户作为接受者,判断最后一条消息是自己发出还是发送者发出
Implement the Python class `MessageQueryset` described below. Class description: Implement the MessageQueryset class. Method signatures and docstrings: - def get_conversation(self, sender, recipient): 获取用户间的私信会话 - def get_most_recent_conversation(self, recipient): 获取最近一次的私信互动用户,即登录用户作为接受者,判断最后一条消息是自己发出还是发送者发出 <|skel...
221f485c7ee594adc34722f14aa94730e23a8d71
<|skeleton|> class MessageQueryset: def get_conversation(self, sender, recipient): """获取用户间的私信会话""" <|body_0|> def get_most_recent_conversation(self, recipient): """获取最近一次的私信互动用户,即登录用户作为接受者,判断最后一条消息是自己发出还是发送者发出""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageQueryset: def get_conversation(self, sender, recipient): """获取用户间的私信会话""" a2b = self.filter(sender=sender, recipient=recipient).select_related('sender', 'recipient') b2a = self.filter(sender=recipient, recipient=sender).select_related('sender', 'recipient') return a2b.un...
the_stack_v2_python_sparse
zanhu/messager/models.py
AlaxHAM/qa
train
0
e733a5a81b038b0214d9a2aedc741ebf0c8aacd2
[ "super(MembreForm, self).__init__(*args, **kwargs)\nself.fields['instruments'].label = 'Instruments (choisissez-en un ou plusieurs)'\nself.fields['chant'].label = 'Chant (cochez la case si vous chantez)'", "username = self.cleaned_data.get('username')\nemail = self.cleaned_data.get('email')\nif User.objects.filte...
<|body_start_0|> super(MembreForm, self).__init__(*args, **kwargs) self.fields['instruments'].label = 'Instruments (choisissez-en un ou plusieurs)' self.fields['chant'].label = 'Chant (cochez la case si vous chantez)' <|end_body_0|> <|body_start_1|> username = self.cleaned_data.get('use...
Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre
MembreForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MembreForm: """Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre""" def __init__(self, *args, **kwargs): """Constructeur""" <|body_0|> def clean(self): """Surcharge de la méthode clean :return: les données nettoyées :rty...
stack_v2_sparse_classes_75kplus_train_002817
5,786
no_license
[ { "docstring": "Constructeur", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Surcharge de la méthode clean :return: les données nettoyées :rtype: dict", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_013080
Implement the Python class `MembreForm` described below. Class description: Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructeur - def clean(self): Surcharge de la méthode clean :return: les d...
Implement the Python class `MembreForm` described below. Class description: Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructeur - def clean(self): Surcharge de la méthode clean :return: les d...
9cae63a4bd487d58931d800b0208426862a2191d
<|skeleton|> class MembreForm: """Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre""" def __init__(self, *args, **kwargs): """Constructeur""" <|body_0|> def clean(self): """Surcharge de la méthode clean :return: les données nettoyées :rty...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MembreForm: """Classe qui permet la création d'un formulaire pour renseigner les champs d'un nouveau membre""" def __init__(self, *args, **kwargs): """Constructeur""" super(MembreForm, self).__init__(*args, **kwargs) self.fields['instruments'].label = 'Instruments (choisissez-en u...
the_stack_v2_python_sparse
lyre_d_alliez/lyre_d_alliez/forms.py
JL31/Site_Lyre_d_Alliez
train
0
1254c40e0b6cbc681cff4f11cf2c7243d23d6166
[ "dp = self._dp\nwhile len(dp) <= n:\n dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,)\nreturn dp[n]", "dp = collections.defaultdict(int)\ny = 1\nwhile y * y <= n:\n dp[y * y] = 1\n y += 1\nfor x in range(1, n + 1):\n y = 1\n while x + y * y <= n:\n if x + y * y not ...
<|body_start_0|> dp = self._dp while len(dp) <= n: dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,) return dp[n] <|end_body_0|> <|body_start_1|> dp = collections.defaultdict(int) y = 1 while y * y <= n: dp[y * y] = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_TLE(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = self._dp while len(dp) <= n: dp += (min((d...
stack_v2_sparse_classes_75kplus_train_002818
1,633
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquares_TLE", "signature": "def numSquares_TLE(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_049305
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares_TLE(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares_TLE(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numSquares(self, n): """:...
ba58ac60b32e261e43482d7e71b32587700e3719
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_TLE(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares(self, n): """:type n: int :rtype: int""" dp = self._dp while len(dp) <= n: dp += (min((dp[-i * i] for i in range(1, int(len(dp) ** 0.5 + 1)))) + 1,) return dp[n] def numSquares_TLE(self, n): """:type n: int :rtype: int""" ...
the_stack_v2_python_sparse
python/279_perfect_squares.py
lingng/Leetcode
train
0
3bd65855747ce72ddfc2746fb80b12fa7e94d008
[ "trr_pickle = dir_metadata / f'{tds}.pickle'\ntrr = cls.construct_from_pickle(trr_pickle)\nreturn trr", "relative_dict = {}\nfor k, v in dataclasses.asdict(self).items():\n if isinstance(v, pathlib.Path) and v.is_relative_to(self.dir_test):\n relative_dict[k] = str(v.relative_to(self.dir_test))\n els...
<|body_start_0|> trr_pickle = dir_metadata / f'{tds}.pickle' trr = cls.construct_from_pickle(trr_pickle) return trr <|end_body_0|> <|body_start_1|> relative_dict = {} for k, v in dataclasses.asdict(self).items(): if isinstance(v, pathlib.Path) and v.is_relative_to(se...
Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet.
TestRunResult
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRunResult: """Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet.""" def construct_from_metadata_dir(cls, dir_metadata: p...
stack_v2_sparse_classes_75kplus_train_002819
4,508
permissive
[ { "docstring": "Construct metadata object from exported object using default filenames.", "name": "construct_from_metadata_dir", "signature": "def construct_from_metadata_dir(cls, dir_metadata: pathlib.Path, tds: str)" }, { "docstring": "Overwrite the default method in scripts_lib.testdata_cls. ...
2
stack_v2_sparse_classes_30k_train_054708
Implement the Python class `TestRunResult` described below. Class description: Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet. Method signatures an...
Implement the Python class `TestRunResult` described below. Class description: Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet. Method signatures an...
51f6017b8425b14d5a4aa9abace8fe5a25ef08c8
<|skeleton|> class TestRunResult: """Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet.""" def construct_from_metadata_dir(cls, dir_metadata: p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestRunResult: """Holds metadata about a single test and its results. Most of the fields aren't actually optional to running the simulations, but they may be optional in that we haven't yet populated the field or generated the item yet.""" def construct_from_metadata_dir(cls, dir_metadata: pathlib.Path, ...
the_stack_v2_python_sparse
hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/scripts/test_run_result.py
lowRISC/opentitan
train
2,077
f6f52305967ec101fae4231c570720fee8b53b3e
[ "if root is None or (root.left is None and root.right is None):\n return True\nif root.left is None or root.right is None:\n return False\nleft = root.left\nright = root.right\nif left.val != right.val:\n return False\nreturn self.doublePointer(left, right)", "if left.left is not None and right.right is ...
<|body_start_0|> if root is None or (root.left is None and root.right is None): return True if root.left is None or root.right is None: return False left = root.left right = root.right if left.val != right.val: return False return self....
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root: TreeNode) -> bool: """type root: TreeNode rtype bool""" <|body_0|> def doublePointer(self, left: TreeNode, right: TreeNode) -> bool: """type left: TreeNode type right: TreeNode rtype bool""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_002820
1,866
permissive
[ { "docstring": "type root: TreeNode rtype bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root: TreeNode) -> bool" }, { "docstring": "type left: TreeNode type right: TreeNode rtype bool", "name": "doublePointer", "signature": "def doublePointer(self, left: TreeNode, rig...
2
stack_v2_sparse_classes_30k_train_016642
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root: TreeNode) -> bool: type root: TreeNode rtype bool - def doublePointer(self, left: TreeNode, right: TreeNode) -> bool: type left: TreeNode type right: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root: TreeNode) -> bool: type root: TreeNode rtype bool - def doublePointer(self, left: TreeNode, right: TreeNode) -> bool: type left: TreeNode type right: ...
a3423a66abcff0b06574564bb63cdc28b09ae8cc
<|skeleton|> class Solution: def isSymmetric(self, root: TreeNode) -> bool: """type root: TreeNode rtype bool""" <|body_0|> def doublePointer(self, left: TreeNode, right: TreeNode) -> bool: """type left: TreeNode type right: TreeNode rtype bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isSymmetric(self, root: TreeNode) -> bool: """type root: TreeNode rtype bool""" if root is None or (root.left is None and root.right is None): return True if root.left is None or root.right is None: return False left = root.left rig...
the_stack_v2_python_sparse
chapter_04/example_0003.py
yuchen352416/leetcode-example
train
0
c761f8ab15f8d65a354acc1814cd3da652318a6b
[ "data = label_file_line.split(' ')\ndata[1:] = [float(x) for x in data[1:]]\nself.type = data[0]\nself.truncation = data[1]\nself.occlusion = int(data[2])\nself.alpha = data[3]\nself.xmin = data[4]\nself.ymin = data[5]\nself.xmax = data[6]\nself.ymax = data[7]\nself.box2d = np.array([self.xmin, self.ymin, self.xmax...
<|body_start_0|> data = label_file_line.split(' ') data[1:] = [float(x) for x in data[1:]] self.type = data[0] self.truncation = data[1] self.occlusion = int(data[2]) self.alpha = data[3] self.xmin = data[4] self.ymin = data[5] self.xmax = data[6] ...
3d object label
Object3d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Object3d: """3d object label""" def __init__(self, label_file_line): """type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated truncated which refers to the object leaving image boundarie...
stack_v2_sparse_classes_75kplus_train_002821
23,592
no_license
[ { "docstring": "type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated truncated which refers to the object leaving image boundaries occluded: Integer (0, 1, 2, 3) indicating occlusion state: 0 = fully visible, 1 = ...
2
stack_v2_sparse_classes_30k_train_047852
Implement the Python class `Object3d` described below. Class description: 3d object label Method signatures and docstrings: - def __init__(self, label_file_line): type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated tru...
Implement the Python class `Object3d` described below. Class description: 3d object label Method signatures and docstrings: - def __init__(self, label_file_line): type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated tru...
0c28c3cd18e367fb72745ec95d8bd5c994a494ba
<|skeleton|> class Object3d: """3d object label""" def __init__(self, label_file_line): """type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated truncated which refers to the object leaving image boundarie...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Object3d: """3d object label""" def __init__(self, label_file_line): """type: 'Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram', 'Misc' or 'DontCare' truncated: Float, 0: non-truncated or 1: truncated truncated which refers to the object leaving image boundaries occluded: I...
the_stack_v2_python_sparse
visualize_kitti/utils/kitti_util.py
enginBozkurt/visualisation-perception-3D
train
0
fd8a281c394fb18221b4dbefea17e82c93c6ecf8
[ "self.id = id\nself.abbrv_name = abbrv_name\nself.logo_url = logo_url\nself.decryption_key_activated = decryption_key_activated\nself.created_date = created_date\nself.last_modified_date = last_modified_date\nself.status = status\nself.additional_properties = additional_properties", "if dictionary is None:\n r...
<|body_start_0|> self.id = id self.abbrv_name = abbrv_name self.logo_url = logo_url self.decryption_key_activated = decryption_key_activated self.created_date = created_date self.last_modified_date = last_modified_date self.status = status self.additional_...
Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name logo_url (string): Logo URL for stored logo file decryption_key_activated (boo...
AppFIStatus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppFIStatus: """Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name logo_url (string): Logo URL for stored ...
stack_v2_sparse_classes_75kplus_train_002822
3,550
permissive
[ { "docstring": "Constructor for the AppFIStatus class", "name": "__init__", "signature": "def __init__(self, id=None, decryption_key_activated=None, created_date=None, last_modified_date=None, status=None, abbrv_name=None, logo_url=None, additional_properties={})" }, { "docstring": "Creates an i...
2
stack_v2_sparse_classes_30k_train_031847
Implement the Python class `AppFIStatus` described below. Class description: Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name ...
Implement the Python class `AppFIStatus` described below. Class description: Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name ...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class AppFIStatus: """Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name logo_url (string): Logo URL for stored ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AppFIStatus: """Implementation of the 'App FI Status' model. The registration status fields for each specific OAuth financial institution Attributes: id (long|int): The finicity financial institution id abbrv_name (string): The applications abbreviated name logo_url (string): Logo URL for stored logo file dec...
the_stack_v2_python_sparse
finicityapi/models/app_fi_status.py
monarchmoney/finicity-python
train
0
01e229d56676a0cbbdc65efc3656b57d03a66cc8
[ "table_type = request.GET.get('table', '')\nfirewall_list = {'firewalls': []}\nif table_type == '' or table_type == 'filter':\n filter_table = os.popen('iptables -L --line-numbers')\n all_chain = get_chains(filter_table)\n firewall_list['firewalls'] = get_rules(all_chain, table_type)\nelif table_type == 'n...
<|body_start_0|> table_type = request.GET.get('table', '') firewall_list = {'firewalls': []} if table_type == '' or table_type == 'filter': filter_table = os.popen('iptables -L --line-numbers') all_chain = get_chains(filter_table) firewall_list['firewalls'] = ...
List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']
FirewallList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirewallList: """List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']""" def get(self, request, format=None): """Get firewall list.""" <|body_0|> def post(self, request, format=None): """1,Append one ...
stack_v2_sparse_classes_75kplus_train_002823
21,597
no_license
[ { "docstring": "Get firewall list.", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "1,Append one new firewall protocol item.", "name": "post", "signature": "def post(self, request, format=None)" }, { "docstring": "Update the firewall protocol...
4
null
Implement the Python class `FirewallList` described below. Class description: List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'] Method signatures and docstrings: - def get(self, request, format=None): Get firewall list. - def post(self, request, format...
Implement the Python class `FirewallList` described below. Class description: List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'] Method signatures and docstrings: - def get(self, request, format=None): Get firewall list. - def post(self, request, format...
7f801a569a396a27371d0831752595877c224a6b
<|skeleton|> class FirewallList: """List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']""" def get(self, request, format=None): """Get firewall list.""" <|body_0|> def post(self, request, format=None): """1,Append one ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FirewallList: """List all firewall items, or create a new one. ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']""" def get(self, request, format=None): """Get firewall list.""" table_type = request.GET.get('table', '') firewall_list = {'firewalls': []} ...
the_stack_v2_python_sparse
Python_projects/flask_projects/unicorn_project/firewall/views.py
sdtimothy8/Coding
train
0
c34185d974714df80f3598c8128d3627ecf27397
[ "if request.version == 'v6':\n return self.get_v6(request)\nelif request.version == 'v7':\n return self.get_v6(request)\nraise Http404()", "status_dict = Scheduler.objects.get_master().status\nif not status_dict:\n raise ServiceUnavailable(unicode('Status is missing. Scheduler may be down.'))\nstatus_tim...
<|body_start_0|> if request.version == 'v6': return self.get_v6(request) elif request.version == 'v7': return self.get_v6(request) raise Http404() <|end_body_0|> <|body_start_1|> status_dict = Scheduler.objects.get_master().status if not status_dict: ...
This view is the endpoint for viewing overall system information
StatusView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatusView: """This view is the endpoint for viewing overall system information""" def get(self, request): """Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Respons...
stack_v2_sparse_classes_75kplus_train_002824
7,101
permissive
[ { "docstring": "Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Response` :returns: the HTTP response to send back to the user", "name": "get", "signature": "def get(self, request)" }...
2
stack_v2_sparse_classes_30k_train_048860
Implement the Python class `StatusView` described below. Class description: This view is the endpoint for viewing overall system information Method signatures and docstrings: - def get(self, request): Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request...
Implement the Python class `StatusView` described below. Class description: This view is the endpoint for viewing overall system information Method signatures and docstrings: - def get(self, request): Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class StatusView: """This view is the endpoint for viewing overall system information""" def get(self, request): """Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Respons...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StatusView: """This view is the endpoint for viewing overall system information""" def get(self, request): """Gets high level status information :param request: the HTTP GET request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Response` :returns: ...
the_stack_v2_python_sparse
scale/scheduler/views.py
kfconsultant/scale
train
0
77ff8850abb79572c140048c4dba7e08a1b1b4de
[ "super(PointNetConv2d, self).__init__()\nself.layers = nn.ModuleList()\nprevious_out_channels = in_channels\nfor i, c_out in enumerate(out_channels_list):\n self.layers.append(MyConv2d(previous_out_channels, c_out, kernel_size=(1, 1), stride=1, padding=0, bias=True, normalization=normalization, norm_momentum=nor...
<|body_start_0|> super(PointNetConv2d, self).__init__() self.layers = nn.ModuleList() previous_out_channels = in_channels for i, c_out in enumerate(out_channels_list): self.layers.append(MyConv2d(previous_out_channels, c_out, kernel_size=(1, 1), stride=1, padding=0, bias=True...
PointNetConv2d
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointNetConv2d: def __init__(self, in_channels: int, out_channels_list: List[int], normalization: str='batch', norm_momentum: float=0.1, activation: str='relu', output_init_radius: float=None): """PointNet, i.e., a series of EquivariantLayer :param in_channels: C in input tensors :param ...
stack_v2_sparse_classes_75kplus_train_002825
38,399
no_license
[ { "docstring": "PointNet, i.e., a series of EquivariantLayer :param in_channels: C in input tensors :param out_channels_list: A list of intermediate and final output channels :param normalization: normalization method, 'batch', 'instance' :param norm_momentum: momentum in normazliation layer :param activation: ...
2
stack_v2_sparse_classes_30k_train_006761
Implement the Python class `PointNetConv2d` described below. Class description: Implement the PointNetConv2d class. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels_list: List[int], normalization: str='batch', norm_momentum: float=0.1, activation: str='relu', output_init_radius: f...
Implement the Python class `PointNetConv2d` described below. Class description: Implement the PointNetConv2d class. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels_list: List[int], normalization: str='batch', norm_momentum: float=0.1, activation: str='relu', output_init_radius: f...
c2c3c4e46620446ad0b51a5bd1f836a3c5b386d2
<|skeleton|> class PointNetConv2d: def __init__(self, in_channels: int, out_channels_list: List[int], normalization: str='batch', norm_momentum: float=0.1, activation: str='relu', output_init_radius: float=None): """PointNet, i.e., a series of EquivariantLayer :param in_channels: C in input tensors :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PointNetConv2d: def __init__(self, in_channels: int, out_channels_list: List[int], normalization: str='batch', norm_momentum: float=0.1, activation: str='relu', output_init_radius: float=None): """PointNet, i.e., a series of EquivariantLayer :param in_channels: C in input tensors :param out_channels_l...
the_stack_v2_python_sparse
models/layers_pc.py
hoboh/DeepI2P
train
0
99a558b1631fc861ec069b413f00a6f878340b49
[ "if str_prefix == 'localhost':\n prefix = cup.net.get_local_hostname()\nelse:\n prefix = str(str_prefix)\nself._prefix = prefix + str(os.getpid())\nself._lock = threading.Lock()\nself._ind = 0\nself._nlock = threading.Lock()\nself._nind = 0", "self._lock.acquire()\nstrrev = self._prefix + str(self._ind) + '...
<|body_start_0|> if str_prefix == 'localhost': prefix = cup.net.get_local_hostname() else: prefix = str(str_prefix) self._prefix = prefix + str(os.getpid()) self._lock = threading.Lock() self._ind = 0 self._nlock = threading.Lock() self._ni...
数据生成类,具体功能见函数说明
CGeneratorMan
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CGeneratorMan: """数据生成类,具体功能见函数说明""" def __init__(self, str_prefix='localhost'): """CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。""" <|body_0|> def get_uniqname(self): """获得一个线程安全的unique字符串""" <|body_1|> def get_next_uniq_num(self): ...
stack_v2_sparse_classes_75kplus_train_002826
2,336
permissive
[ { "docstring": "CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。", "name": "__init__", "signature": "def __init__(self, str_prefix='localhost')" }, { "docstring": "获得一个线程安全的unique字符串", "name": "get_uniqname", "signature": "def get_uniqname(self)" }, { "docstring": "获得线...
3
stack_v2_sparse_classes_30k_test_000026
Implement the Python class `CGeneratorMan` described below. Class description: 数据生成类,具体功能见函数说明 Method signatures and docstrings: - def __init__(self, str_prefix='localhost'): CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。 - def get_uniqname(self): 获得一个线程安全的unique字符串 - def get_next_uniq_num(self): 获得线程安全的...
Implement the Python class `CGeneratorMan` described below. Class description: 数据生成类,具体功能见函数说明 Method signatures and docstrings: - def __init__(self, str_prefix='localhost'): CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。 - def get_uniqname(self): 获得一个线程安全的unique字符串 - def get_next_uniq_num(self): 获得线程安全的...
5765ac0759cb789497e704c56aeccfa3ffb4ffe3
<|skeleton|> class CGeneratorMan: """数据生成类,具体功能见函数说明""" def __init__(self, str_prefix='localhost'): """CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。""" <|body_0|> def get_uniqname(self): """获得一个线程安全的unique字符串""" <|body_1|> def get_next_uniq_num(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CGeneratorMan: """数据生成类,具体功能见函数说明""" def __init__(self, str_prefix='localhost'): """CGeneratorMan是一个Singleton模式的类. 这样能保证同一个进程中的数字、字符串等生成函数是一致的。""" if str_prefix == 'localhost': prefix = cup.net.get_local_hostname() else: prefix = str(str_prefix) sel...
the_stack_v2_python_sparse
cup/util/generator.py
sunhai1992/CUP
train
1
6e321b6b946656a92280a91bcac135aac5539759
[ "for middleware, kwds in middleware_dicts.items():\n middleware_cls = import_object(middleware)\n middleware_obj = middleware_cls(handler, **kwds)\n middleware_obj.before_request()", "for middleware, kwds in middleware_dicts.items():\n middleware_cls = import_object(middleware)\n middleware_obj = m...
<|body_start_0|> for middleware, kwds in middleware_dicts.items(): middleware_cls = import_object(middleware) middleware_obj = middleware_cls(handler, **kwds) middleware_obj.before_request() <|end_body_0|> <|body_start_1|> for middleware, kwds in middleware_dicts.ite...
中间件处理方法
MiddlewareProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MiddlewareProcess: """中间件处理方法""" def prepare(handler, middleware_dicts): """嵌入到`prepare()`的处理流程中""" <|body_0|> def on_finish(handler, middleware_dicts): """嵌入到`on_finish()`的处理流程中""" <|body_1|> <|end_skeleton|> <|body_start_0|> for middleware, kw...
stack_v2_sparse_classes_75kplus_train_002827
4,629
no_license
[ { "docstring": "嵌入到`prepare()`的处理流程中", "name": "prepare", "signature": "def prepare(handler, middleware_dicts)" }, { "docstring": "嵌入到`on_finish()`的处理流程中", "name": "on_finish", "signature": "def on_finish(handler, middleware_dicts)" } ]
2
stack_v2_sparse_classes_30k_train_022228
Implement the Python class `MiddlewareProcess` described below. Class description: 中间件处理方法 Method signatures and docstrings: - def prepare(handler, middleware_dicts): 嵌入到`prepare()`的处理流程中 - def on_finish(handler, middleware_dicts): 嵌入到`on_finish()`的处理流程中
Implement the Python class `MiddlewareProcess` described below. Class description: 中间件处理方法 Method signatures and docstrings: - def prepare(handler, middleware_dicts): 嵌入到`prepare()`的处理流程中 - def on_finish(handler, middleware_dicts): 嵌入到`on_finish()`的处理流程中 <|skeleton|> class MiddlewareProcess: """中间件处理方法""" d...
023dc3536910221231c76c0a2bea7f4765515871
<|skeleton|> class MiddlewareProcess: """中间件处理方法""" def prepare(handler, middleware_dicts): """嵌入到`prepare()`的处理流程中""" <|body_0|> def on_finish(handler, middleware_dicts): """嵌入到`on_finish()`的处理流程中""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MiddlewareProcess: """中间件处理方法""" def prepare(handler, middleware_dicts): """嵌入到`prepare()`的处理流程中""" for middleware, kwds in middleware_dicts.items(): middleware_cls = import_object(middleware) middleware_obj = middleware_cls(handler, **kwds) middleware_...
the_stack_v2_python_sparse
app/middlewares.py
thomaszdxsn/tornado_demo
train
0
f6f602813e8d149331f616953fcebe2f7c6aa15e
[ "cu = Change_Param(username, password, prod)\ngu = cu.get_params()\nself.suffix = self.c.get_value('Member', 'members_nocice_logs')\nself.url = self.url_joint(prod) + gu[1]\nlogs.info('test url:%s' % self.url)\nreturn self.get_requests(self.url, gu[0], data)", "cu = Change_Param(username, password, prod)\ngu = cu...
<|body_start_0|> cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'members_nocice_logs') self.url = self.url_joint(prod) + gu[1] logs.info('test url:%s' % self.url) return self.get_requests(self.url, gu[0], data) <|...
Member_Notice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" <|body_0|> def del_member_nocice_logs_ids(self, ids, username=None, password=None, data=None, prod=None): ...
stack_v2_sparse_classes_75kplus_train_002828
2,683
no_license
[ { "docstring": "相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1", "name": "get_member_nocice_logs", "signature": "def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None)" }, { "docstring": "相关参数有: ids 要删除的消息主键", "name": "del_member_nocice_logs_ids", ...
3
stack_v2_sparse_classes_30k_train_016407
Implement the Python class `Member_Notice` described below. Class description: Implement the Member_Notice class. Method signatures and docstrings: - def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1 - def del_member_noci...
Implement the Python class `Member_Notice` described below. Class description: Implement the Member_Notice class. Method signatures and docstrings: - def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1 - def del_member_noci...
235200a67c1fb125f75f9771808f6655a7b14202
<|skeleton|> class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" <|body_0|> def del_member_nocice_logs_ids(self, ids, username=None, password=None, data=None, prod=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'mem...
the_stack_v2_python_sparse
business/member/member_notice.py
vothin/requsets_test
train
0
9708a0bcc62136f07ae992999373adb4eddae3bb
[ "self.path = path\nself.folders_for_building = folders_for_building\nself.name_prefix = 'random500_'\nself.store_fmt = store_fmt\nself.image_shape = image_shape\nself.crop_size = crop_size\nself.num_fold = num_fold\nself.num_imgs_per_fold = num_imgs_per_fold\nif len(self.folders_for_building) == 1:\n self.X_name...
<|body_start_0|> self.path = path self.folders_for_building = folders_for_building self.name_prefix = 'random500_' self.store_fmt = store_fmt self.image_shape = image_shape self.crop_size = crop_size self.num_fold = num_fold self.num_imgs_per_fold = num_im...
RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when testing the bad class) with size crop_size are build. The random concept images are stored...
RandomConceptBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomConceptBuilder: """RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when testing the bad class) with size crop_size...
stack_v2_sparse_classes_75kplus_train_002829
5,869
permissive
[ { "docstring": "Initializes a RandomConceptBuilder object. Args: path (str): path which leads to the directory in which the folders are laying based upon which the random concept images should be build (e.g. '/home/lukas/Documents/02_Data/FGUSS_subsets_grey/'). folders_for_building (list of str): list of string...
3
null
Implement the Python class `RandomConceptBuilder` described below. Class description: RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when tes...
Implement the Python class `RandomConceptBuilder` described below. Class description: RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when tes...
ba7e697bd10c5881cd6a87f9f877664978436597
<|skeleton|> class RandomConceptBuilder: """RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when testing the bad class) with size crop_size...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomConceptBuilder: """RandomConceptBuilder objects capsule the functionality for building random concept images necessary for using the TCAV framework in industrial usecases. For that random crops from defined sets of images (e.g. from good class when testing the bad class) with size crop_size are build. T...
the_stack_v2_python_sparse
SPACE/random_concept_building.py
Data-Science-in-Mechanical-Engineering/SPACE
train
0
b7abe2f0ca7f5ba1ac61f20e6bc44717a9eb4a46
[ "reference_id = kwargs['reference']\nself.reference = get_object_or_404(Reference, id=reference_id)\nreturn super(ItemViewSet, self).dispatch(request, *args, **kwargs)", "data = request.data.copy()\ndata['reference'] = self.reference.id\nserializer = AddItemSerializer(data=data, context={'request': request, 'stoc...
<|body_start_0|> reference_id = kwargs['reference'] self.reference = get_object_or_404(Reference, id=reference_id) return super(ItemViewSet, self).dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> data = request.data.copy() data['reference'] = self.reference.id ...
Item Viewset
ItemViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemViewSet: """Item Viewset""" def dispatch(self, request, *args, **kwargs): """Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carried on the request :param kwargs: Some Keyword arguments c...
stack_v2_sparse_classes_75kplus_train_002830
2,953
no_license
[ { "docstring": "Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carried on the request :param kwargs: Some Keyword arguments carried on the request :return: The supermethod dispath object with the actions", "name": ...
3
null
Implement the Python class `ItemViewSet` described below. Class description: Item Viewset Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carri...
Implement the Python class `ItemViewSet` described below. Class description: Item Viewset Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carri...
bd037be8a814dce554e709d851c6a96e6a41ea78
<|skeleton|> class ItemViewSet: """Item Viewset""" def dispatch(self, request, *args, **kwargs): """Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carried on the request :param kwargs: Some Keyword arguments c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemViewSet: """Item Viewset""" def dispatch(self, request, *args, **kwargs): """Inherited method to perform some actions needed before any request :param request: The resquest made by the user :param args: Some arguments carried on the request :param kwargs: Some Keyword arguments carried on the...
the_stack_v2_python_sparse
reference/views/item.py
jpcano1/tShoes
train
0
7d41496af057639223b02066655f2eabbec5c8e5
[ "post_key = ndb.Key(urlsafe=post_id)\npost = post_key.get()\nself.render('blog/post_delete.html', post=post)", "post_key = ndb.Key(urlsafe=post_id)\npost = post_key.get()\npost.key.delete()\nself.redirect('/blog/delete/post/success')" ]
<|body_start_0|> post_key = ndb.Key(urlsafe=post_id) post = post_key.get() self.render('blog/post_delete.html', post=post) <|end_body_0|> <|body_start_1|> post_key = ndb.Key(urlsafe=post_id) post = post_key.get() post.key.delete() self.redirect('/blog/delete/post...
PostDeleteHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" <|body_0|> def post(self, post_id): """Delete post if post exist and user own post""" <|body_1|> <|end_skeleton|> <|body_start_0|> post_key = ...
stack_v2_sparse_classes_75kplus_train_002831
829
no_license
[ { "docstring": "Show user confirmation on post to delete", "name": "get", "signature": "def get(self, post_id, *args, **kwargs)" }, { "docstring": "Delete post if post exist and user own post", "name": "post", "signature": "def post(self, post_id)" } ]
2
stack_v2_sparse_classes_30k_train_053290
Implement the Python class `PostDeleteHandler` described below. Class description: Implement the PostDeleteHandler class. Method signatures and docstrings: - def get(self, post_id, *args, **kwargs): Show user confirmation on post to delete - def post(self, post_id): Delete post if post exist and user own post
Implement the Python class `PostDeleteHandler` described below. Class description: Implement the PostDeleteHandler class. Method signatures and docstrings: - def get(self, post_id, *args, **kwargs): Show user confirmation on post to delete - def post(self, post_id): Delete post if post exist and user own post <|skel...
53f3094549bac448fd8f6088142b03e6e374cc02
<|skeleton|> class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" <|body_0|> def post(self, post_id): """Delete post if post exist and user own post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostDeleteHandler: def get(self, post_id, *args, **kwargs): """Show user confirmation on post to delete""" post_key = ndb.Key(urlsafe=post_id) post = post_key.get() self.render('blog/post_delete.html', post=post) def post(self, post_id): """Delete post if post exis...
the_stack_v2_python_sparse
app/post_delete_handler.py
thangthin/project-blog
train
0
5be2c6791ed776c6ae3736af06f2619b9f4645d6
[ "import heapq\nself.k = k\nself.k_nums = sorted(nums)[-k:]\nheapq.heapify(self.k_nums)", "import heapq\nif len(self.k_nums) < self.k:\n heapq.heappush(self.k_nums, val)\nelif self.k_nums[0] < val:\n heapq.heapreplace(self.k_nums, val)\nelse:\n pass\nreturn self.k_nums[0]" ]
<|body_start_0|> import heapq self.k = k self.k_nums = sorted(nums)[-k:] heapq.heapify(self.k_nums) <|end_body_0|> <|body_start_1|> import heapq if len(self.k_nums) < self.k: heapq.heappush(self.k_nums, val) elif self.k_nums[0] < val: heap...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> import heapq self.k = k self.k_nums = sort...
stack_v2_sparse_classes_75kplus_train_002832
1,814
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_025187
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
621c579c76e9f6b926354a9c25c0b0ed66890800
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" import heapq self.k = k self.k_nums = sorted(nums)[-k:] heapq.heapify(self.k_nums) def add(self, val): """:type val: int :rtype: int""" import heapq if len(sel...
the_stack_v2_python_sparse
leetcode_703.py
JayWu7/Code
train
3
c0ed0fc1d02eb3a935505baa7cbf1c416137bd39
[ "import collections\nself.d = collections.defaultdict(set)\nfor w in dictionary:\n if len(w) > 2:\n self.d[w[0] + str(len(w) - 2) + w[-1]].add(w)", "if len(word) <= 2:\n return True\nkey = word[0] + str(len(word) - 2) + word[-1]\nif key not in self.d:\n return True\nelif word in self.d[key] and le...
<|body_start_0|> import collections self.d = collections.defaultdict(set) for w in dictionary: if len(w) > 2: self.d[w[0] + str(len(w) - 2) + w[-1]].add(w) <|end_body_0|> <|body_start_1|> if len(word) <= 2: return True key = word[0] + str(...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> import collections self.d = collections.def...
stack_v2_sparse_classes_75kplus_train_002833
2,011
no_license
[ { "docstring": ":type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": ":type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" } ]
2
stack_v2_sparse_classes_30k_train_014417
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool <|skeleton|> class ValidWordAbbr: def __init_...
0127190b27862ec7e7f4f2fcce5ce958d480cdac
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" import collections self.d = collections.defaultdict(set) for w in dictionary: if len(w) > 2: self.d[w[0] + str(len(w) - 2) + w[-1]].add(w) def isUnique(self, word):...
the_stack_v2_python_sparse
288.unique-word-abbreviation.py
Iverance/leetcode
train
0
96e610726135a19eb6f822ee8ce941396166ac3a
[ "if not isinstance(process_num, int):\n raise ValueError('AKG kernel compiling process number must be of type int, but got {} with type {}'.format(process_num, type(wait_time)))\nif not isinstance(wait_time, int):\n raise ValueError('AKG kernel compiling wait time must be of type int, but got {} with type {}'...
<|body_start_0|> if not isinstance(process_num, int): raise ValueError('AKG kernel compiling process number must be of type int, but got {} with type {}'.format(process_num, type(wait_time))) if not isinstance(wait_time, int): raise ValueError('AKG kernel compiling wait time must...
akg kernel parallel process
AkgProcess
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class AkgProcess: """akg kernel parallel process""" def __init__(self, process_num, wait_time, platform): """Args: process_num: int. processes number wait_time: int. max time the function blocked""" <|body_0|> def compile(self, attrs=None): """compile kernel by multi p...
stack_v2_sparse_classes_75kplus_train_002834
7,760
permissive
[ { "docstring": "Args: process_num: int. processes number wait_time: int. max time the function blocked", "name": "__init__", "signature": "def __init__(self, process_num, wait_time, platform)" }, { "docstring": "compile kernel by multi processes Return: True for all compile success, False for so...
3
stack_v2_sparse_classes_30k_train_032746
Implement the Python class `AkgProcess` described below. Class description: akg kernel parallel process Method signatures and docstrings: - def __init__(self, process_num, wait_time, platform): Args: process_num: int. processes number wait_time: int. max time the function blocked - def compile(self, attrs=None): comp...
Implement the Python class `AkgProcess` described below. Class description: akg kernel parallel process Method signatures and docstrings: - def __init__(self, process_num, wait_time, platform): Args: process_num: int. processes number wait_time: int. max time the function blocked - def compile(self, attrs=None): comp...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class AkgProcess: """akg kernel parallel process""" def __init__(self, process_num, wait_time, platform): """Args: process_num: int. processes number wait_time: int. max time the function blocked""" <|body_0|> def compile(self, attrs=None): """compile kernel by multi p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AkgProcess: """akg kernel parallel process""" def __init__(self, process_num, wait_time, platform): """Args: process_num: int. processes number wait_time: int. max time the function blocked""" if not isinstance(process_num, int): raise ValueError('AKG kernel compiling process ...
the_stack_v2_python_sparse
mindspore/python/mindspore/_extends/parallel_compile/akg_compiler/akg_process.py
mindspore-ai/mindspore
train
4,178
8aca92ef3678f543d25f6422aa15ac6d9e4861f5
[ "self.map_dict = map_dict\nself.map_data = map_data\nself.extract_points()\npath_to_map = prepend_argos_root(map_dict['path_to_geomap'])\nself.map_image = imread(path_to_map)\nself.height, self.width, chans = self.map_image.shape", "map_data = self.map_data\nmap_alpha_beta = []\nprobability = []\nfor image_path i...
<|body_start_0|> self.map_dict = map_dict self.map_data = map_data self.extract_points() path_to_map = prepend_argos_root(map_dict['path_to_geomap']) self.map_image = imread(path_to_map) self.height, self.width, chans = self.map_image.shape <|end_body_0|> <|body_start_1|...
Generate density and point maps.
HeatMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeatMap: """Generate density and point maps.""" def __init__(self, map_dict, map_data): """Load map image, extract points.""" <|body_0|> def extract_points(self): """Extract likely target positions from map data.""" <|body_1|> def get_points(self, ma...
stack_v2_sparse_classes_75kplus_train_002835
4,907
no_license
[ { "docstring": "Load map image, extract points.", "name": "__init__", "signature": "def __init__(self, map_dict, map_data)" }, { "docstring": "Extract likely target positions from map data.", "name": "extract_points", "signature": "def extract_points(self)" }, { "docstring": "Ret...
4
stack_v2_sparse_classes_30k_train_047178
Implement the Python class `HeatMap` described below. Class description: Generate density and point maps. Method signatures and docstrings: - def __init__(self, map_dict, map_data): Load map image, extract points. - def extract_points(self): Extract likely target positions from map data. - def get_points(self, max_nu...
Implement the Python class `HeatMap` described below. Class description: Generate density and point maps. Method signatures and docstrings: - def __init__(self, map_dict, map_data): Load map image, extract points. - def extract_points(self): Extract likely target positions from map data. - def get_points(self, max_nu...
733f7eea6289f15ff22ddc37aefe8a43a468fd36
<|skeleton|> class HeatMap: """Generate density and point maps.""" def __init__(self, map_dict, map_data): """Load map image, extract points.""" <|body_0|> def extract_points(self): """Extract likely target positions from map data.""" <|body_1|> def get_points(self, ma...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HeatMap: """Generate density and point maps.""" def __init__(self, map_dict, map_data): """Load map image, extract points.""" self.map_dict = map_dict self.map_data = map_data self.extract_points() path_to_map = prepend_argos_root(map_dict['path_to_geomap']) ...
the_stack_v2_python_sparse
heat_map_visualization.py
lightscalar/argos-pipeline
train
1
3014d6cf414efeb2a4c9e797927face61ba22b6a
[ "datas = []\nif file_path != '':\n with open(file_path, encoding='utf-8') as f:\n datas = yaml.safe_load(f)\n if data_key == '':\n return datas\n else:\n return datas[data_key]\nreturn datas", "logger = logging.getLogger(log_id)\nlogger.setLevel(logging.DEBUG)\nif not logger.handlers...
<|body_start_0|> datas = [] if file_path != '': with open(file_path, encoding='utf-8') as f: datas = yaml.safe_load(f) if data_key == '': return datas else: return datas[data_key] return datas <|end_body_0|> <|b...
Utils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" <|body_0|> def log_init(self, log_id, log_name): """规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:""" <|body_1|> <|e...
stack_v2_sparse_classes_75kplus_train_002836
2,525
no_license
[ { "docstring": "yaml文件流转成json数据对象 :param file_path: :param data_key: :return:", "name": "yaml_load", "signature": "def yaml_load(self, file_path, data_key='')" }, { "docstring": "规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:", "name": "log_init", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_041251
Implement the Python class `Utils` described below. Class description: Implement the Utils class. Method signatures and docstrings: - def yaml_load(self, file_path, data_key=''): yaml文件流转成json数据对象 :param file_path: :param data_key: :return: - def log_init(self, log_id, log_name): 规范输出日志的格式 :param log_id: log内容中的标识 :p...
Implement the Python class `Utils` described below. Class description: Implement the Utils class. Method signatures and docstrings: - def yaml_load(self, file_path, data_key=''): yaml文件流转成json数据对象 :param file_path: :param data_key: :return: - def log_init(self, log_id, log_name): 规范输出日志的格式 :param log_id: log内容中的标识 :p...
955a6453d0e041a5af19f1eadaac00c15e9d5850
<|skeleton|> class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" <|body_0|> def log_init(self, log_id, log_name): """规范输出日志的格式 :param log_id: log内容中的标识 :param log_name: 生成日志的名字 :return:""" <|body_1|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Utils: def yaml_load(self, file_path, data_key=''): """yaml文件流转成json数据对象 :param file_path: :param data_key: :return:""" datas = [] if file_path != '': with open(file_path, encoding='utf-8') as f: datas = yaml.safe_load(f) if data_key == '': ...
the_stack_v2_python_sparse
classWorks/feishu1/web/utils.py
jumper0419/HogwartsStudy
train
2
530c4a2482fb1cae3e9c554469c3f423d14df91c
[ "root = self._doc.createElement('plone4bio')\nchild = self._doc.createElement('dbxrefpatterns')\nfor p in getattr(self.context, 'dbxrefs_patterns', []):\n node = self._doc.createElement('pattern')\n node.setAttribute('name', p.name)\n node.appendChild(self._doc.createTextNode(p.pattern))\n child.appendC...
<|body_start_0|> root = self._doc.createElement('plone4bio') child = self._doc.createElement('dbxrefpatterns') for p in getattr(self.context, 'dbxrefs_patterns', []): node = self._doc.createElement('pattern') node.setAttribute('name', p.name) node.appendChild(...
DbxrefPatternsToolXMLAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbxrefPatternsToolXMLAdapter: def _exportNode(self): """Export the object as a DOM node""" <|body_0|> def _importNode(self, node): """Import the object from the DOM node""" <|body_1|> <|end_skeleton|> <|body_start_0|> root = self._doc.createElement(...
stack_v2_sparse_classes_75kplus_train_002837
4,956
no_license
[ { "docstring": "Export the object as a DOM node", "name": "_exportNode", "signature": "def _exportNode(self)" }, { "docstring": "Import the object from the DOM node", "name": "_importNode", "signature": "def _importNode(self, node)" } ]
2
null
Implement the Python class `DbxrefPatternsToolXMLAdapter` described below. Class description: Implement the DbxrefPatternsToolXMLAdapter class. Method signatures and docstrings: - def _exportNode(self): Export the object as a DOM node - def _importNode(self, node): Import the object from the DOM node
Implement the Python class `DbxrefPatternsToolXMLAdapter` described below. Class description: Implement the DbxrefPatternsToolXMLAdapter class. Method signatures and docstrings: - def _exportNode(self): Export the object as a DOM node - def _importNode(self, node): Import the object from the DOM node <|skeleton|> cl...
735a4ccc749db5bfcfddb3a5728f7d4ed097deb7
<|skeleton|> class DbxrefPatternsToolXMLAdapter: def _exportNode(self): """Export the object as a DOM node""" <|body_0|> def _importNode(self, node): """Import the object from the DOM node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DbxrefPatternsToolXMLAdapter: def _exportNode(self): """Export the object as a DOM node""" root = self._doc.createElement('plone4bio') child = self._doc.createElement('dbxrefpatterns') for p in getattr(self.context, 'dbxrefs_patterns', []): node = self._doc.createEl...
the_stack_v2_python_sparse
src/plone4bio/base/tool/exportimport.py
biodec/plone4bio.base
train
0
117e75740ee7c71cd1e74773aeb9b69bb94cdc61
[ "opts = SCons.Variables.Variables()\nopts.Add(SCons.Variables.BoolVariable('test', 'test option help', False))\no = opts.options[0]\nassert o.key == 'test', o.key\nassert o.help == 'test option help (yes|no)', o.help\nassert o.default == 0, o.default\nassert o.validator is not None, o.validator\nassert o.converter ...
<|body_start_0|> opts = SCons.Variables.Variables() opts.Add(SCons.Variables.BoolVariable('test', 'test option help', False)) o = opts.options[0] assert o.key == 'test', o.key assert o.help == 'test option help (yes|no)', o.help assert o.default == 0, o.default as...
BoolVariableTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoolVariableTestCase: def test_BoolVariable(self) -> None: """Test BoolVariable creation""" <|body_0|> def test_converter(self) -> None: """Test the BoolVariable converter""" <|body_1|> def test_validator(self) -> None: """Test the BoolVariable v...
stack_v2_sparse_classes_75kplus_train_002838
3,899
permissive
[ { "docstring": "Test BoolVariable creation", "name": "test_BoolVariable", "signature": "def test_BoolVariable(self) -> None" }, { "docstring": "Test the BoolVariable converter", "name": "test_converter", "signature": "def test_converter(self) -> None" }, { "docstring": "Test the ...
3
stack_v2_sparse_classes_30k_train_018046
Implement the Python class `BoolVariableTestCase` described below. Class description: Implement the BoolVariableTestCase class. Method signatures and docstrings: - def test_BoolVariable(self) -> None: Test BoolVariable creation - def test_converter(self) -> None: Test the BoolVariable converter - def test_validator(s...
Implement the Python class `BoolVariableTestCase` described below. Class description: Implement the BoolVariableTestCase class. Method signatures and docstrings: - def test_BoolVariable(self) -> None: Test BoolVariable creation - def test_converter(self) -> None: Test the BoolVariable converter - def test_validator(s...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class BoolVariableTestCase: def test_BoolVariable(self) -> None: """Test BoolVariable creation""" <|body_0|> def test_converter(self) -> None: """Test the BoolVariable converter""" <|body_1|> def test_validator(self) -> None: """Test the BoolVariable v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoolVariableTestCase: def test_BoolVariable(self) -> None: """Test BoolVariable creation""" opts = SCons.Variables.Variables() opts.Add(SCons.Variables.BoolVariable('test', 'test option help', False)) o = opts.options[0] assert o.key == 'test', o.key assert o.he...
the_stack_v2_python_sparse
SCons/Variables/BoolVariableTests.py
SCons/scons
train
1,827
3cd644b3e8210074f84db0de9f3792795d209543
[ "input_lines = ['12\\n11\\n190\\n0', '']\nexpected = [[12, 11, 190, 0], []]\nfor index, case in enumerate(input_lines):\n ints = day17_lib.parse_input(case)\n self.assertListEqual(ints, expected[index])", "input_containers = [[20, 15, 10, 5, 5]]\ninput_capacities = [25]\nexpected = [4]\nfor index, container...
<|body_start_0|> input_lines = ['12\n11\n190\n0', ''] expected = [[12, 11, 190, 0], []] for index, case in enumerate(input_lines): ints = day17_lib.parse_input(case) self.assertListEqual(ints, expected[index]) <|end_body_0|> <|body_start_1|> input_containers = [[...
Tests for `day13_lib.py`
Day17TestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day17TestCase: """Tests for `day13_lib.py`""" def test_parse_input(self): """Tests for the parse_input method""" <|body_0|> def test_get_exact_combinations(self): """Tests for the get_exact_combinations method""" <|body_1|> def test_get_exact_min_com...
stack_v2_sparse_classes_75kplus_train_002839
1,607
permissive
[ { "docstring": "Tests for the parse_input method", "name": "test_parse_input", "signature": "def test_parse_input(self)" }, { "docstring": "Tests for the get_exact_combinations method", "name": "test_get_exact_combinations", "signature": "def test_get_exact_combinations(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_044323
Implement the Python class `Day17TestCase` described below. Class description: Tests for `day13_lib.py` Method signatures and docstrings: - def test_parse_input(self): Tests for the parse_input method - def test_get_exact_combinations(self): Tests for the get_exact_combinations method - def test_get_exact_min_combina...
Implement the Python class `Day17TestCase` described below. Class description: Tests for `day13_lib.py` Method signatures and docstrings: - def test_parse_input(self): Tests for the parse_input method - def test_get_exact_combinations(self): Tests for the get_exact_combinations method - def test_get_exact_min_combina...
aa8dc35471c57df3c952233ef5b5ba758dfc0ae3
<|skeleton|> class Day17TestCase: """Tests for `day13_lib.py`""" def test_parse_input(self): """Tests for the parse_input method""" <|body_0|> def test_get_exact_combinations(self): """Tests for the get_exact_combinations method""" <|body_1|> def test_get_exact_min_com...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Day17TestCase: """Tests for `day13_lib.py`""" def test_parse_input(self): """Tests for the parse_input method""" input_lines = ['12\n11\n190\n0', ''] expected = [[12, 11, 190, 0], []] for index, case in enumerate(input_lines): ints = day17_lib.parse_input(case)...
the_stack_v2_python_sparse
day17_test.py
Elgolfin/adventofcode-2015-py
train
0
8f7020f1b1247b60d6f0eb3a9f030ad1a8ef62a9
[ "self.spy_on(AsanaWorkspaceListView.get, owner=AsanaWorkspaceListView, call_fake=lambda self, request: HttpResponse('{}', content_type='application/json'))\nrsp = self.client.get(local_site_reverse('asana-workspace-list'))\nself.assertEqual(rsp.status_code, 200)", "self.spy_on(AsanaTaskSearchView.get, owner=Asana...
<|body_start_0|> self.spy_on(AsanaWorkspaceListView.get, owner=AsanaWorkspaceListView, call_fake=lambda self, request: HttpResponse('{}', content_type='application/json')) rsp = self.client.get(local_site_reverse('asana-workspace-list')) self.assertEqual(rsp.status_code, 200) <|end_body_0|> <|b...
Tests for Asana.
AsanaIntegrationTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsanaIntegrationTests: """Tests for Asana.""" def test_workspace_list(self): """Testing AsanaWorkspaceListView""" <|body_0|> def test_task_search(self): """Testing AsanaTaskSearchView""" <|body_1|> def test_task_search_unpublished(self): """T...
stack_v2_sparse_classes_75kplus_train_002840
4,041
permissive
[ { "docstring": "Testing AsanaWorkspaceListView", "name": "test_workspace_list", "signature": "def test_workspace_list(self)" }, { "docstring": "Testing AsanaTaskSearchView", "name": "test_task_search", "signature": "def test_task_search(self)" }, { "docstring": "Testing AsanaTask...
5
stack_v2_sparse_classes_30k_train_008315
Implement the Python class `AsanaIntegrationTests` described below. Class description: Tests for Asana. Method signatures and docstrings: - def test_workspace_list(self): Testing AsanaWorkspaceListView - def test_task_search(self): Testing AsanaTaskSearchView - def test_task_search_unpublished(self): Testing AsanaTas...
Implement the Python class `AsanaIntegrationTests` described below. Class description: Tests for Asana. Method signatures and docstrings: - def test_workspace_list(self): Testing AsanaWorkspaceListView - def test_task_search(self): Testing AsanaTaskSearchView - def test_task_search_unpublished(self): Testing AsanaTas...
52bbaecc1227764f3e9a66f03226e0013f2b0c48
<|skeleton|> class AsanaIntegrationTests: """Tests for Asana.""" def test_workspace_list(self): """Testing AsanaWorkspaceListView""" <|body_0|> def test_task_search(self): """Testing AsanaTaskSearchView""" <|body_1|> def test_task_search_unpublished(self): """T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsanaIntegrationTests: """Tests for Asana.""" def test_workspace_list(self): """Testing AsanaWorkspaceListView""" self.spy_on(AsanaWorkspaceListView.get, owner=AsanaWorkspaceListView, call_fake=lambda self, request: HttpResponse('{}', content_type='application/json')) rsp = self.c...
the_stack_v2_python_sparse
rbintegrations/asana/tests.py
reviewboard/rbintegrations
train
0
97aa8ccfe2a562375b70c38f76d9a77453d46f2d
[ "self.job_type = job_type\nself.project = project\nself.location = location\nself.gcp_resources = gcp_resources\nself.client_options = {'api_endpoint': location + '-aiplatform.googleapis.com'}\nself.client_info = gapic_v1.client_info.ClientInfo(user_agent='google-cloud-pipeline-components')\nself.job_client = aipla...
<|body_start_0|> self.job_type = job_type self.project = project self.location = location self.gcp_resources = gcp_resources self.client_options = {'api_endpoint': location + '-aiplatform.googleapis.com'} self.client_info = gapic_v1.client_info.ClientInfo(user_agent='goog...
Common module for creating and poll jobs on the Vertex Platform.
JobRemoteRunner
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobRemoteRunner: """Common module for creating and poll jobs on the Vertex Platform.""" def __init__(self, job_type, project, location, gcp_resources): """Initlizes a job client and other common attributes.""" <|body_0|> def check_if_job_exists(self) -> Optional[str]: ...
stack_v2_sparse_classes_75kplus_train_002841
6,426
permissive
[ { "docstring": "Initlizes a job client and other common attributes.", "name": "__init__", "signature": "def __init__(self, job_type, project, location, gcp_resources)" }, { "docstring": "Check if the job already exists.", "name": "check_if_job_exists", "signature": "def check_if_job_exis...
4
stack_v2_sparse_classes_30k_train_027025
Implement the Python class `JobRemoteRunner` described below. Class description: Common module for creating and poll jobs on the Vertex Platform. Method signatures and docstrings: - def __init__(self, job_type, project, location, gcp_resources): Initlizes a job client and other common attributes. - def check_if_job_e...
Implement the Python class `JobRemoteRunner` described below. Class description: Common module for creating and poll jobs on the Vertex Platform. Method signatures and docstrings: - def __init__(self, job_type, project, location, gcp_resources): Initlizes a job client and other common attributes. - def check_if_job_e...
73804f8928ce671839d34800627b6d3ea9f820a7
<|skeleton|> class JobRemoteRunner: """Common module for creating and poll jobs on the Vertex Platform.""" def __init__(self, job_type, project, location, gcp_resources): """Initlizes a job client and other common attributes.""" <|body_0|> def check_if_job_exists(self) -> Optional[str]: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JobRemoteRunner: """Common module for creating and poll jobs on the Vertex Platform.""" def __init__(self, job_type, project, location, gcp_resources): """Initlizes a job client and other common attributes.""" self.job_type = job_type self.project = project self.location =...
the_stack_v2_python_sparse
components/google-cloud/google_cloud_pipeline_components/container/experimental/gcp_launcher/job_remote_runner.py
NikeNano/pipelines
train
1
e0967f87b63018da8bb38227be7b1b6476481740
[ "oddNumber = []\nevenNUmber = []\nfor i in array:\n if i % 2 == 1:\n oddNumber.append(i)\n else:\n evenNUmber.append(i)\nreturn oddNumber + evenNUmber", "left = 0\nright = len(array) - 1\nwhile left < len(array):\n if array[right] % 2 == 0:\n right -= 1\n left += 1\n else:\...
<|body_start_0|> oddNumber = [] evenNUmber = [] for i in array: if i % 2 == 1: oddNumber.append(i) else: evenNUmber.append(i) return oddNumber + evenNUmber <|end_body_0|> <|body_start_1|> left = 0 right = len(array)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reOrderArray(self, array): """建立两个数组""" <|body_0|> def reOrderArray2(self, array): """从后往前遍历数组""" <|body_1|> <|end_skeleton|> <|body_start_0|> oddNumber = [] evenNUmber = [] for i in array: if i % 2 == 1: ...
stack_v2_sparse_classes_75kplus_train_002842
952
no_license
[ { "docstring": "建立两个数组", "name": "reOrderArray", "signature": "def reOrderArray(self, array)" }, { "docstring": "从后往前遍历数组", "name": "reOrderArray2", "signature": "def reOrderArray2(self, array)" } ]
2
stack_v2_sparse_classes_30k_train_012085
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reOrderArray(self, array): 建立两个数组 - def reOrderArray2(self, array): 从后往前遍历数组
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reOrderArray(self, array): 建立两个数组 - def reOrderArray2(self, array): 从后往前遍历数组 <|skeleton|> class Solution: def reOrderArray(self, array): """建立两个数组""" <|...
e7756162dc4848ce69f0a78d839e6a287a6ac7a3
<|skeleton|> class Solution: def reOrderArray(self, array): """建立两个数组""" <|body_0|> def reOrderArray2(self, array): """从后往前遍历数组""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reOrderArray(self, array): """建立两个数组""" oddNumber = [] evenNUmber = [] for i in array: if i % 2 == 1: oddNumber.append(i) else: evenNUmber.append(i) return oddNumber + evenNUmber def reOrderArray...
the_stack_v2_python_sparse
算法设计基础/剑指offer/python/reOrderArray.py
zzg-971030/Learn_ML_in_Python
train
0
a0097b00e0071d512d43869d16de9707a48900e8
[ "self.conf = conf\nbody_gen = get_body_generator(conf)\nbrain_gen = get_brain_generator(conf)\nsuper(TolTreeGenerator, self).__init__(body_gen, brain_gen)", "outputs = -1\ntree = None\nwhile outputs <= 0:\n tree = super(TolTreeGenerator, self).generate_tree()\n _, outputs, _ = tree.root.io_count(recursive=T...
<|body_start_0|> self.conf = conf body_gen = get_body_generator(conf) brain_gen = get_brain_generator(conf) super(TolTreeGenerator, self).__init__(body_gen, brain_gen) <|end_body_0|> <|body_start_1|> outputs = -1 tree = None while outputs <= 0: tree =...
Tree generator with some additions.
TolTreeGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TolTreeGenerator: """Tree generator with some additions.""" def __init__(self, conf): """:param conf: :return:""" <|body_0|> def generate_tree(self): """Overrides `generate_tree` to force robot planarity. Robots without output neurons are also discarded because w...
stack_v2_sparse_classes_75kplus_train_002843
2,006
no_license
[ { "docstring": ":param conf: :return:", "name": "__init__", "signature": "def __init__(self, conf)" }, { "docstring": "Overrides `generate_tree` to force robot planarity. Robots without output neurons are also discarded because we can be certain they will not be able to move. :return:", "nam...
2
stack_v2_sparse_classes_30k_train_012146
Implement the Python class `TolTreeGenerator` described below. Class description: Tree generator with some additions. Method signatures and docstrings: - def __init__(self, conf): :param conf: :return: - def generate_tree(self): Overrides `generate_tree` to force robot planarity. Robots without output neurons are als...
Implement the Python class `TolTreeGenerator` described below. Class description: Tree generator with some additions. Method signatures and docstrings: - def __init__(self, conf): :param conf: :return: - def generate_tree(self): Overrides `generate_tree` to force robot planarity. Robots without output neurons are als...
b4050f749cb8701a219a3d8383c022e7ca2cf04e
<|skeleton|> class TolTreeGenerator: """Tree generator with some additions.""" def __init__(self, conf): """:param conf: :return:""" <|body_0|> def generate_tree(self): """Overrides `generate_tree` to force robot planarity. Robots without output neurons are also discarded because w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TolTreeGenerator: """Tree generator with some additions.""" def __init__(self, conf): """:param conf: :return:""" self.conf = conf body_gen = get_body_generator(conf) brain_gen = get_brain_generator(conf) super(TolTreeGenerator, self).__init__(body_gen, brain_gen) ...
the_stack_v2_python_sparse
tol/spec/robot.py
egdman/tol-revolve
train
1
cb9979bb0a9f9cff964903c9ed136f817e24b100
[ "startTime = datetime.datetime.now()\nif trial:\n endTime = datetime.datetime.now()\n return {'start': startTime, 'end': endTime}\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate(TEAM_NAME, TEAM_NAME)\nquestionsIds = list(repo[BALLOT_QUESTIONS_NAME].find({}, {'_id': 1}))\nquestionRes...
<|body_start_0|> startTime = datetime.datetime.now() if trial: endTime = datetime.datetime.now() return {'start': startTime, 'end': endTime} client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate(TEAM_NAME, TEAM_NAME) questionsIds ...
ballotQuestionsResults
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ballotQuestionsResults: def execute(trial=False): """Retrieve ballot question results data from electionstats and insert into collection ex) { "Locality" : "Bourne", "Ward" : "-", "Pct" : "7", "Yes" : 375, "No" : 914, "Blanks" : 26, "Total Votes Cast" : 1315, "Question ID" : "7303" }""" ...
stack_v2_sparse_classes_75kplus_train_002844
6,357
no_license
[ { "docstring": "Retrieve ballot question results data from electionstats and insert into collection ex) { \"Locality\" : \"Bourne\", \"Ward\" : \"-\", \"Pct\" : \"7\", \"Yes\" : 375, \"No\" : 914, \"Blanks\" : 26, \"Total Votes Cast\" : 1315, \"Question ID\" : \"7303\" }", "name": "execute", "signature"...
3
stack_v2_sparse_classes_30k_train_038231
Implement the Python class `ballotQuestionsResults` described below. Class description: Implement the ballotQuestionsResults class. Method signatures and docstrings: - def execute(trial=False): Retrieve ballot question results data from electionstats and insert into collection ex) { "Locality" : "Bourne", "Ward" : "-...
Implement the Python class `ballotQuestionsResults` described below. Class description: Implement the ballotQuestionsResults class. Method signatures and docstrings: - def execute(trial=False): Retrieve ballot question results data from electionstats and insert into collection ex) { "Locality" : "Bourne", "Ward" : "-...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class ballotQuestionsResults: def execute(trial=False): """Retrieve ballot question results data from electionstats and insert into collection ex) { "Locality" : "Bourne", "Ward" : "-", "Pct" : "7", "Yes" : 375, "No" : 914, "Blanks" : 26, "Total Votes Cast" : 1315, "Question ID" : "7303" }""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ballotQuestionsResults: def execute(trial=False): """Retrieve ballot question results data from electionstats and insert into collection ex) { "Locality" : "Bourne", "Ward" : "-", "Pct" : "7", "Yes" : 375, "No" : 914, "Blanks" : 26, "Total Votes Cast" : 1315, "Question ID" : "7303" }""" startT...
the_stack_v2_python_sparse
ldisalvo_skeesara_vidyaap/ballotQuestionsResults.py
maximega/course-2019-spr-proj
train
2
4d8eccc05973e7f2287b34bde07d39174851f159
[ "self.tag = tag\nself.prefix = dictcm.get(kwargs, 'prefix')\nself.attr = dictcm.get(kwargs, 'attr')\nself.value = dictcm.get(kwargs, 'value')\nself.xmlns = dictcm.get(kwargs, 'xmlns')", "if self.value is None:\n self.value = []\nif sub_tag is not None:\n self.value.append(sub_tag)", "if not self.attr:\n ...
<|body_start_0|> self.tag = tag self.prefix = dictcm.get(kwargs, 'prefix') self.attr = dictcm.get(kwargs, 'attr') self.value = dictcm.get(kwargs, 'value') self.xmlns = dictcm.get(kwargs, 'xmlns') <|end_body_0|> <|body_start_1|> if self.value is None: self.val...
XML的标签类
XmlTag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XmlTag: """XML的标签类""" def __init__(self, tag, **kwargs): """XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典""" <|body_0|> def add_sub_tag(self, sub_tag): """给当前标签添加子标签 :param sub_tag: 子标签对象 :return: 无""" <...
stack_v2_sparse_classes_75kplus_train_002845
7,440
no_license
[ { "docstring": "XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典", "name": "__init__", "signature": "def __init__(self, tag, **kwargs)" }, { "docstring": "给当前标签添加子标签 :param sub_tag: 子标签对象 :return: 无", "name": "add_sub_tag", "signature": "d...
5
null
Implement the Python class `XmlTag` described below. Class description: XML的标签类 Method signatures and docstrings: - def __init__(self, tag, **kwargs): XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典 - def add_sub_tag(self, sub_tag): 给当前标签添加子标签 :param sub_tag: 子标签对象 :r...
Implement the Python class `XmlTag` described below. Class description: XML的标签类 Method signatures and docstrings: - def __init__(self, tag, **kwargs): XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典 - def add_sub_tag(self, sub_tag): 给当前标签添加子标签 :param sub_tag: 子标签对象 :r...
e5887ccf0a241b757dc4f9aa12bcb89456321a24
<|skeleton|> class XmlTag: """XML的标签类""" def __init__(self, tag, **kwargs): """XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典""" <|body_0|> def add_sub_tag(self, sub_tag): """给当前标签添加子标签 :param sub_tag: 子标签对象 :return: 无""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XmlTag: """XML的标签类""" def __init__(self, tag, **kwargs): """XML标签初始化 :param tag: 标签名 :param prefix: 前缀 :param attr: 属性字典 :param value: 值 :param xmlns: 命名空间字典""" self.tag = tag self.prefix = dictcm.get(kwargs, 'prefix') self.attr = dictcm.get(kwargs, 'attr') self.va...
the_stack_v2_python_sparse
common/xmlcm.py
elthe/LearnPythonStats
train
3
d2f70ee0a3192edae89735b0f95927983b4e3cfd
[ "assert type(n_bins) is int or n_bins in ('sqrt',)\nassert n_bins > 0\nassert isinstance(bin_boundaries_policy, BinBoundariesPolicy)\nself.n_bins = n_bins\nself.bin_boundaries_policy = bin_boundaries_policy\nsuper().__init__()", "assert hasattr(model, 'predict_proba')\nassert type(X) is np.ndarray\nassert X.ndim ...
<|body_start_0|> assert type(n_bins) is int or n_bins in ('sqrt',) assert n_bins > 0 assert isinstance(bin_boundaries_policy, BinBoundariesPolicy) self.n_bins = n_bins self.bin_boundaries_policy = bin_boundaries_policy super().__init__() <|end_body_0|> <|body_start_1|> ...
FixedBinAmountBinningPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FixedBinAmountBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy. Args: n_bins: int, number of bins used to divide the interval. bin_boundaries_p...
stack_v2_sparse_classes_75kplus_train_002846
2,092
permissive
[ { "docstring": "Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy. Args: n_bins: int, number of bins used to divide the interval. bin_boundaries_policy: BinBoundariesPolicy, defining how to split the interval into bins.", "name": "__...
2
stack_v2_sparse_classes_30k_train_029247
Implement the Python class `FixedBinAmountBinningPolicy` described below. Class description: Implement the FixedBinAmountBinningPolicy class. Method signatures and docstrings: - def __init__(self, n_bins, bin_boundaries_policy): Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins c...
Implement the Python class `FixedBinAmountBinningPolicy` described below. Class description: Implement the FixedBinAmountBinningPolicy class. Method signatures and docstrings: - def __init__(self, n_bins, bin_boundaries_policy): Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins c...
9bfa81dd7a39ebe069c5b11b8e7a9bf9017e9350
<|skeleton|> class FixedBinAmountBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy. Args: n_bins: int, number of bins used to divide the interval. bin_boundaries_p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FixedBinAmountBinningPolicy: def __init__(self, n_bins, bin_boundaries_policy): """Initializes a fixed bin amount binning policy, which sends samples into the n_bins bins created by the bin_boundaries_policy. Args: n_bins: int, number of bins used to divide the interval. bin_boundaries_policy: BinBoun...
the_stack_v2_python_sparse
explicalib/calibration/evaluation/prototype/binning/primitives.py
euranova/estimating_eces
train
4
ac260e47216c86c58c219d524861ec168863d73a
[ "self.rect = rects\nself.weight = []\nw = 0\nfor pair in rects:\n k = (pair[2] - pair[0] + 1) * (pair[3] - pair[1] + 1)\n w += k\n self.weight.append((w - k + 1, w))", "n = random.randint(1, self.weight[-1][1])\nfor i in range(len(self.weight)):\n if self.weight[i][0] <= n <= self.weight[i][1]:\n ...
<|body_start_0|> self.rect = rects self.weight = [] w = 0 for pair in rects: k = (pair[2] - pair[0] + 1) * (pair[3] - pair[1] + 1) w += k self.weight.append((w - k + 1, w)) <|end_body_0|> <|body_start_1|> n = random.randint(1, self.weight[-1][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rect = rects self.weight = [] w = 0 for pair in rect...
stack_v2_sparse_classes_75kplus_train_002847
798
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_045856
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
811a76449292016069d592fbd4ce82e3e0c2f8cc
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.rect = rects self.weight = [] w = 0 for pair in rects: k = (pair[2] - pair[0] + 1) * (pair[3] - pair[1] + 1) w += k self.weight.append((w - k + 1, w)) d...
the_stack_v2_python_sparse
Aug - Challenge/Random Point in Non-overlapping Rectangles.py
msha096/Leetcoding
train
0
d6cb250c1c8ab3c969dfd4907009f1ed1ab21ea8
[ "print('start send vcode')\ncompany_id = '1'\nchannel_id = '0'\nself.mobile = 13720002000 + self.locust.get_count()\nmobile_platform = random.choice([0, 1])\nvalidation_str = hashlib.md5(str(self.mobile).encode('utf-8')).hexdigest()[3:19]\ntimestamp = int(round(time.time() * 1000))\nheader = {'aabbcc': validation_s...
<|body_start_0|> print('start send vcode') company_id = '1' channel_id = '0' self.mobile = 13720002000 + self.locust.get_count() mobile_platform = random.choice([0, 1]) validation_str = hashlib.md5(str(self.mobile).encode('utf-8')).hexdigest()[3:19] timestamp = in...
WebsiteTasks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebsiteTasks: def vcode(self): """用户获取验证码 :return:""" <|body_0|> def register(self): """用户注册 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('start send vcode') company_id = '1' channel_id = '0' self.mobile = 1...
stack_v2_sparse_classes_75kplus_train_002848
4,460
no_license
[ { "docstring": "用户获取验证码 :return:", "name": "vcode", "signature": "def vcode(self)" }, { "docstring": "用户注册 :return:", "name": "register", "signature": "def register(self)" } ]
2
stack_v2_sparse_classes_30k_val_001212
Implement the Python class `WebsiteTasks` described below. Class description: Implement the WebsiteTasks class. Method signatures and docstrings: - def vcode(self): 用户获取验证码 :return: - def register(self): 用户注册 :return:
Implement the Python class `WebsiteTasks` described below. Class description: Implement the WebsiteTasks class. Method signatures and docstrings: - def vcode(self): 用户获取验证码 :return: - def register(self): 用户注册 :return: <|skeleton|> class WebsiteTasks: def vcode(self): """用户获取验证码 :return:""" <|bod...
7ee74233cae204afb03e3ffe07f3624819e7faa3
<|skeleton|> class WebsiteTasks: def vcode(self): """用户获取验证码 :return:""" <|body_0|> def register(self): """用户注册 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WebsiteTasks: def vcode(self): """用户获取验证码 :return:""" print('start send vcode') company_id = '1' channel_id = '0' self.mobile = 13720002000 + self.locust.get_count() mobile_platform = random.choice([0, 1]) validation_str = hashlib.md5(str(self.mobile).en...
the_stack_v2_python_sparse
script/locustfiles/user_login_test.py
xuebinxu1/locust-test
train
0
e42207d540903f7be369b693eb8097e0c5784d85
[ "liquid = OreList.convert(liquid)\nif 'deposit_name' not in kwargs:\n kwargs['deposit_name'] = f'{liquid.short_name}-{vein.name}-LAKE'\nsuper().__init__(vein, **kwargs)\nself.diameter = diameter\nself.liquid = liquid", "result = super().as_json()\nresult['generator'].update({'block': self.liquid.as_json(), 'cl...
<|body_start_0|> liquid = OreList.convert(liquid) if 'deposit_name' not in kwargs: kwargs['deposit_name'] = f'{liquid.short_name}-{vein.name}-LAKE' super().__init__(vein, **kwargs) self.diameter = diameter self.liquid = liquid <|end_body_0|> <|body_start_1|> ...
LakeDeposit creates a deposit as a shell around a small pond of some fluid.
LakeDeposit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LakeDeposit: """LakeDeposit creates a deposit as a shell around a small pond of some fluid.""" def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): """Create a new lake deposit.""" <|body_0|> def as_json(self): """Create a dict represen...
stack_v2_sparse_classes_75kplus_train_002849
1,193
no_license
[ { "docstring": "Create a new lake deposit.", "name": "__init__", "signature": "def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs)" }, { "docstring": "Create a dict representation of this deposit suitable for being converted to JSON.", "name": "as_json", "signa...
2
stack_v2_sparse_classes_30k_train_026041
Implement the Python class `LakeDeposit` described below. Class description: LakeDeposit creates a deposit as a shell around a small pond of some fluid. Method signatures and docstrings: - def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): Create a new lake deposit. - def as_json(self): C...
Implement the Python class `LakeDeposit` described below. Class description: LakeDeposit creates a deposit as a shell around a small pond of some fluid. Method signatures and docstrings: - def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): Create a new lake deposit. - def as_json(self): C...
9bd6e74cb3817eec76119978ea31cf5b04e0ed51
<|skeleton|> class LakeDeposit: """LakeDeposit creates a deposit as a shell around a small pond of some fluid.""" def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): """Create a new lake deposit.""" <|body_0|> def as_json(self): """Create a dict represen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LakeDeposit: """LakeDeposit creates a deposit as a shell around a small pond of some fluid.""" def __init__(self, vein: Vein, liquid: OreListable, diameter: int=8, **kwargs): """Create a new lake deposit.""" liquid = OreList.convert(liquid) if 'deposit_name' not in kwargs: ...
the_stack_v2_python_sparse
src/packconfig/oregen/deposits/lake_deposit.py
tungstonminer/packconfig
train
0
80c37cd98ec568cab060ce699f8620c4409dcaa2
[ "self.x = BALL_START_POS_X\nself.y = BALL_START_POS_Y\nself.velx = 0\nself.vely = 1\nself.radius = BALL_RADIUS\nself.magnitude = BALL_SPEED\nself.game_status = 'Ongoing'", "if self.x < 0 + self.radius or self.x > WIDTH_SCREEN - self.radius:\n self.velx *= -1\nif self.y < 0 + self.radius:\n self.vely *= -1\n...
<|body_start_0|> self.x = BALL_START_POS_X self.y = BALL_START_POS_Y self.velx = 0 self.vely = 1 self.radius = BALL_RADIUS self.magnitude = BALL_SPEED self.game_status = 'Ongoing' <|end_body_0|> <|body_start_1|> if self.x < 0 + self.radius or self.x > WID...
This class contains the structure of the ball object/s created.
Ball
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ball: """This class contains the structure of the ball object/s created.""" def __init__(self): """self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self.vely is the velocity in the y direction self.radius is th...
stack_v2_sparse_classes_75kplus_train_002850
4,153
no_license
[ { "docstring": "self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self.vely is the velocity in the y direction self.radius is the radius of the ball self.magnitude is the total speed the ball always will have self.game_status is the curren...
3
stack_v2_sparse_classes_30k_train_022309
Implement the Python class `Ball` described below. Class description: This class contains the structure of the ball object/s created. Method signatures and docstrings: - def __init__(self): self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self....
Implement the Python class `Ball` described below. Class description: This class contains the structure of the ball object/s created. Method signatures and docstrings: - def __init__(self): self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self....
14a140aac32397ae4b412e276488a83b730cc7b5
<|skeleton|> class Ball: """This class contains the structure of the ball object/s created.""" def __init__(self): """self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self.vely is the velocity in the y direction self.radius is th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ball: """This class contains the structure of the ball object/s created.""" def __init__(self): """self.x is the x position on the screen self.y is the y position on the screen self.velx is the velocity in the x direction self.vely is the velocity in the y direction self.radius is the radius of t...
the_stack_v2_python_sparse
Objektorientert INF-1400/oblig1/Files/Objects.py
MartinRovang/UniversityPhysics
train
3
a5048a5623ff03a9a7e278c717148999e69b8549
[ "lines = make_model()\nlog = get_logger(level='warning', encoding='utf-8')\nmodel = read_abaqus(lines, log=log, debug=False)\nmodel.write('spike.inp')\nos.remove('spike.inp')\nabaqus_filename = os.path.join(MODEL_PATH, 'abaqus.inp')\nwith open(abaqus_filename, 'w') as abaqus_file:\n abaqus_file.writelines('\\n'....
<|body_start_0|> lines = make_model() log = get_logger(level='warning', encoding='utf-8') model = read_abaqus(lines, log=log, debug=False) model.write('spike.inp') os.remove('spike.inp') abaqus_filename = os.path.join(MODEL_PATH, 'abaqus.inp') with open(abaqus_fil...
TestAbaqus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAbaqus: def test_abaqus_1(self): """simple test""" <|body_0|> def test_abaqus_2(self): """two hex blocks with duplicate node ids""" <|body_1|> <|end_skeleton|> <|body_start_0|> lines = make_model() log = get_logger(level='warning', encod...
stack_v2_sparse_classes_75kplus_train_002851
3,005
no_license
[ { "docstring": "simple test", "name": "test_abaqus_1", "signature": "def test_abaqus_1(self)" }, { "docstring": "two hex blocks with duplicate node ids", "name": "test_abaqus_2", "signature": "def test_abaqus_2(self)" } ]
2
stack_v2_sparse_classes_30k_train_033154
Implement the Python class `TestAbaqus` described below. Class description: Implement the TestAbaqus class. Method signatures and docstrings: - def test_abaqus_1(self): simple test - def test_abaqus_2(self): two hex blocks with duplicate node ids
Implement the Python class `TestAbaqus` described below. Class description: Implement the TestAbaqus class. Method signatures and docstrings: - def test_abaqus_1(self): simple test - def test_abaqus_2(self): two hex blocks with duplicate node ids <|skeleton|> class TestAbaqus: def test_abaqus_1(self): "...
d9ffdb4ac845b13bcf6aea96ff5d37cc026c5267
<|skeleton|> class TestAbaqus: def test_abaqus_1(self): """simple test""" <|body_0|> def test_abaqus_2(self): """two hex blocks with duplicate node ids""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAbaqus: def test_abaqus_1(self): """simple test""" lines = make_model() log = get_logger(level='warning', encoding='utf-8') model = read_abaqus(lines, log=log, debug=False) model.write('spike.inp') os.remove('spike.inp') abaqus_filename = os.path.joi...
the_stack_v2_python_sparse
pyNastran/converters/abaqus/test_unit_abaqus.py
ratalex/pyNastran
train
0
56af4f14d7a7bc49058f75a5ffd34e3bf122239b
[ "ss = acm.FStoredScenario.Select(\"name='{0}'\".format(title))\nif len(ss) != 1:\n raise ValueError('Could not find the specified scenario.')\nself.scenario = ss[0].Scenario()", "scen_dim = self.scenario.ExplicitDimensions()[vector_nr]\nsel_value = lambda x: str(x.Parameter('rs'))\nvec = scen_dim.ShiftVectors(...
<|body_start_0|> ss = acm.FStoredScenario.Select("name='{0}'".format(title)) if len(ss) != 1: raise ValueError('Could not find the specified scenario.') self.scenario = ss[0].Scenario() <|end_body_0|> <|body_start_1|> scen_dim = self.scenario.ExplicitDimensions()[vector_nr] ...
Contains methods that are related to FStoredScenario.
FScenarioUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" <|body_0|> def get_scenario_vector_as_list(self, v...
stack_v2_sparse_classes_75kplus_train_002852
8,293
no_license
[ { "docstring": "Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title", "name": "__init__", "signature": "def __init__(self, title)" }, { "docstring": "Returns the tuple (title, values) with the vector title and the vector items values",...
2
stack_v2_sparse_classes_30k_test_003009
Implement the Python class `FScenarioUtil` described below. Class description: Contains methods that are related to FStoredScenario. Method signatures and docstrings: - def __init__(self, title): Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title - def get...
Implement the Python class `FScenarioUtil` described below. Class description: Contains methods that are related to FStoredScenario. Method signatures and docstrings: - def __init__(self, title): Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title - def get...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" <|body_0|> def get_scenario_vector_as_list(self, v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" ss = acm.FStoredScenario.Select("name='{0}'".format(title)) ...
the_stack_v2_python_sparse
Python modules/RiskMatrixViewSimpleReport.py
webclinic017/fa-absa-py3
train
0
1e483c5bcf8960c50a64334c0f37e53490e8bb17
[ "logger = logging.getLogger(getattr(cls, 'name') or __name__)\nsupercls = super().update_settings(settings)\nlocal_settings = cls._get_local_settings()\nsettings.update(vars(local_settings))\nlogger.info('Loaded local settings file for \"{}\"'.format(cls.__name__))\nscrapy.Spider.update_settings(settings)", "kls ...
<|body_start_0|> logger = logging.getLogger(getattr(cls, 'name') or __name__) supercls = super().update_settings(settings) local_settings = cls._get_local_settings() settings.update(vars(local_settings)) logger.info('Loaded local settings file for "{}"'.format(cls.__name__)) ...
Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by spider or cli settings)
LocalSettingsSpiderMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalSettingsSpiderMixin: """Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by spider or cli settings)""" def updat...
stack_v2_sparse_classes_75kplus_train_002853
22,235
permissive
[ { "docstring": "Update settings with spider's custom_settings, taking into consideration local settings.py file, if one is present.", "name": "update_settings", "signature": "def update_settings(cls, settings)" }, { "docstring": "Search for local settings file for a scrapy.Spider class. If class...
2
stack_v2_sparse_classes_30k_train_014975
Implement the Python class `LocalSettingsSpiderMixin` described below. Class description: Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by sp...
Implement the Python class `LocalSettingsSpiderMixin` described below. Class description: Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by sp...
33235f78ae1ea6409883f312adcf8679c5bf2401
<|skeleton|> class LocalSettingsSpiderMixin: """Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by spider or cli settings)""" def updat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalSettingsSpiderMixin: """Allow spiders to load settings from a settings.py file found in same directory Local settings take priority between project settings and spider settings (local settings override project and global settings and are overriden by spider or cli settings)""" def update_settings(cl...
the_stack_v2_python_sparse
common/common/common/components.py
JuroOravec/knwldg
train
0
92df0d6fcf88658ed8b0f11e8dd703ae2a8f47b0
[ "super().__init__(f'Substation Assembly Line {num}')\nself.assigned = assigned\nself.takt_time = takt_time\nself.attach_time = attach_time\nself.target = target", "if self.env is None:\n raise AgentNotRegistered(self)\nelse:\n payload = {**kwargs, 'agent': str(self), 'action': action, 'duration': float(dura...
<|body_start_0|> super().__init__(f'Substation Assembly Line {num}') self.assigned = assigned self.takt_time = takt_time self.attach_time = attach_time self.target = target <|end_body_0|> <|body_start_1|> if self.env is None: raise AgentNotRegistered(self) ...
Substation Assembly Line Class.
SubstationAssemblyLine
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstationAssemblyLine: """Substation Assembly Line Class.""" def __init__(self, assigned, takt_time, attach_time, target, num): """Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List of assigned tasks. Can be shared with other assembly lines...
stack_v2_sparse_classes_75kplus_train_002854
9,221
permissive
[ { "docstring": "Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List of assigned tasks. Can be shared with other assembly lines. takt_time : int | float Hours required to produce one substructure. attach_time : int | float Hours required to attach a topside to the substr...
4
stack_v2_sparse_classes_30k_train_035769
Implement the Python class `SubstationAssemblyLine` described below. Class description: Substation Assembly Line Class. Method signatures and docstrings: - def __init__(self, assigned, takt_time, attach_time, target, num): Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List o...
Implement the Python class `SubstationAssemblyLine` described below. Class description: Substation Assembly Line Class. Method signatures and docstrings: - def __init__(self, assigned, takt_time, attach_time, target, num): Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List o...
d7270ebe1c554293a9d36730d67ab555c071cb17
<|skeleton|> class SubstationAssemblyLine: """Substation Assembly Line Class.""" def __init__(self, assigned, takt_time, attach_time, target, num): """Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List of assigned tasks. Can be shared with other assembly lines...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubstationAssemblyLine: """Substation Assembly Line Class.""" def __init__(self, assigned, takt_time, attach_time, target, num): """Creates an instance of `SubstructureAssemblyLine`. Parameters ---------- assigned : list List of assigned tasks. Can be shared with other assembly lines. takt_time :...
the_stack_v2_python_sparse
wisdem/orbit/phases/install/oss_install/floating.py
WISDEM/WISDEM
train
120
dc467cb6579ae18154d141c4b301c86254a44e03
[ "out = []\n\ndef dfs(node):\n if node is None:\n out.append('#')\n return\n out.append(str(node.val))\n dfs(node.left)\n dfs(node.right)\ndfs(root)\nreturn ' '.join(out)", "data = data.split()\ni = -1\n\ndef dfs():\n nonlocal i\n i += 1\n if data[i] == '#':\n return None\...
<|body_start_0|> out = [] def dfs(node): if node is None: out.append('#') return out.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ' '.join(out) <|end_body_0|> <|body_start_1|> ...
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_75kplus_train_002855
1,190
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004973
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:...
877d0fbccc684e4fd7fee2aca63d2656f71a0241
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" out = [] def dfs(node): if node is None: out.append('#') return out.append(str(node.val)) dfs(node.left) ...
the_stack_v2_python_sparse
iter2/❌297.py
xiaomi388/LeetCode
train
1
6418721c19ed2fbed5bacacf0555ad2ddfd5ce07
[ "self.S = S\nscore = 0\ni = 0\nwhile i < len(S):\n subscore, i = self._get_score(i)\n score += subscore\nreturn score", "if i_start >= len(self.S):\n return [0, len(self.S)]\nscore = 0\ni = i_start + 1\nwhile i < len(self.S) and self.S[i] != ')':\n sub_score, i = self._get_score(i)\n score += sub_s...
<|body_start_0|> self.S = S score = 0 i = 0 while i < len(S): subscore, i = self._get_score(i) score += subscore return score <|end_body_0|> <|body_start_1|> if i_start >= len(self.S): return [0, len(self.S)] score = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def scoreOfParentheses(self, S: str) -> int: """Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without stacking memory, O(max depth) with stacking memory.""" <|body_0|> def _get_score(self,...
stack_v2_sparse_classes_75kplus_train_002856
2,047
no_license
[ { "docstring": "Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without stacking memory, O(max depth) with stacking memory.", "name": "scoreOfParentheses", "signature": "def scoreOfParentheses(self, S: str) -> int" }, { "...
2
stack_v2_sparse_classes_30k_train_027983
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def scoreOfParentheses(self, S: str) -> int: Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without st...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def scoreOfParentheses(self, S: str) -> int: Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without st...
ee8237b66975fb5584a3d68b311e762c0462c8aa
<|skeleton|> class Solution: def scoreOfParentheses(self, S: str) -> int: """Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without stacking memory, O(max depth) with stacking memory.""" <|body_0|> def _get_score(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def scoreOfParentheses(self, S: str) -> int: """Time complexity. Each symbol is read once and processed in O(1) manner, so total complexity is O(n) Space complexity: O(1) without stacking memory, O(max depth) with stacking memory.""" self.S = S score = 0 i = 0 ...
the_stack_v2_python_sparse
LC856-Score-of-Parentheses.py
kate-melnykova/LeetCode-solutions
train
2
4691cb2010664871179c744c8881b133227c9830
[ "antonyms = set()\nfor syn in wordnet.synsets(word, pos=pos):\n for lemma in syn.lemmas():\n for antonym in lemma.antonyms():\n antonyms.add(antonym.name())\nif len(antonyms) == 1:\n return antonyms.pop()\nelse:\n return None", "i, l = (0, len(sent))\nwords = []\nwhile i < l:\n word ...
<|body_start_0|> antonyms = set() for syn in wordnet.synsets(word, pos=pos): for lemma in syn.lemmas(): for antonym in lemma.antonyms(): antonyms.add(antonym.name()) if len(antonyms) == 1: return antonyms.pop() else: ...
AntonymReplacer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AntonymReplacer: def replace(self, word, pos=None): """Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >>> replacer.replace('uglify') 'beautify' >>> replacer.replace('beautify') 'uglify'""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_002857
5,881
permissive
[ { "docstring": "Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >>> replacer.replace('uglify') 'beautify' >>> replacer.replace('beautify') 'uglify'", "name": "replace", "signature": "def replace(self, word, pos=None)" }, ...
2
stack_v2_sparse_classes_30k_train_038262
Implement the Python class `AntonymReplacer` described below. Class description: Implement the AntonymReplacer class. Method signatures and docstrings: - def replace(self, word, pos=None): Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >...
Implement the Python class `AntonymReplacer` described below. Class description: Implement the AntonymReplacer class. Method signatures and docstrings: - def replace(self, word, pos=None): Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >...
b34df3ceab78b3de29195a811696dcd06e77063a
<|skeleton|> class AntonymReplacer: def replace(self, word, pos=None): """Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >>> replacer.replace('uglify') 'beautify' >>> replacer.replace('beautify') 'uglify'""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AntonymReplacer: def replace(self, word, pos=None): """Returns the antonym of a word, but only if there is no ambiguity. >>> replacer = AntonymReplacer() >>> replacer.replace('good') >>> replacer.replace('uglify') 'beautify' >>> replacer.replace('beautify') 'uglify'""" antonyms = set() ...
the_stack_v2_python_sparse
Module 2/Chapter 2/7853OS_02_codes/replacers.py
PacktPublishing/Natural-Language-Processing-Python-and-NLTK
train
59
8eecd733caba30fc1f8f472ca67b76e9f2d097a8
[ "if level.get() == 'hard':\n a = 40\n return a\nelif level.get() == 'normal':\n a = 34\n return a\nelif level.get() == 'esay':\n a = 28\n return a", "print()\nprint('S', '|', '1', '2', '3', '4', '5', '6', '7', '8', '9')\nprint('-', '+', '-', '-', '-', '-', '-', '-', '-', '-', '-')\ni = 1\nfor ro...
<|body_start_0|> if level.get() == 'hard': a = 40 return a elif level.get() == 'normal': a = 34 return a elif level.get() == 'esay': a = 28 return a <|end_body_0|> <|body_start_1|> print() print('S', '|', '1...
Hogaeng
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hogaeng: def get_level(self, level): """빈칸의 갯수로 난이도를 설정""" <|body_0|> def show_board(board): """modify for gui programming""" <|body_1|> def get_integer(message, i, j): """입력받은 값이 정수인지 확인하는 함수""" <|body_2|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_002858
9,075
permissive
[ { "docstring": "빈칸의 갯수로 난이도를 설정", "name": "get_level", "signature": "def get_level(self, level)" }, { "docstring": "modify for gui programming", "name": "show_board", "signature": "def show_board(board)" }, { "docstring": "입력받은 값이 정수인지 확인하는 함수", "name": "get_integer", "si...
3
stack_v2_sparse_classes_30k_train_030176
Implement the Python class `Hogaeng` described below. Class description: Implement the Hogaeng class. Method signatures and docstrings: - def get_level(self, level): 빈칸의 갯수로 난이도를 설정 - def show_board(board): modify for gui programming - def get_integer(message, i, j): 입력받은 값이 정수인지 확인하는 함수
Implement the Python class `Hogaeng` described below. Class description: Implement the Hogaeng class. Method signatures and docstrings: - def get_level(self, level): 빈칸의 갯수로 난이도를 설정 - def show_board(board): modify for gui programming - def get_integer(message, i, j): 입력받은 값이 정수인지 확인하는 함수 <|skeleton|> class Hogaeng: ...
f347e370aaa33aba5ab233252bcd759b94615348
<|skeleton|> class Hogaeng: def get_level(self, level): """빈칸의 갯수로 난이도를 설정""" <|body_0|> def show_board(board): """modify for gui programming""" <|body_1|> def get_integer(message, i, j): """입력받은 값이 정수인지 확인하는 함수""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Hogaeng: def get_level(self, level): """빈칸의 갯수로 난이도를 설정""" if level.get() == 'hard': a = 40 return a elif level.get() == 'normal': a = 34 return a elif level.get() == 'esay': a = 28 return a def show_b...
the_stack_v2_python_sparse
exercise_2017/15th_week_teamproj_presentation/programming_team/jatoe.py
Taewan-P/python_study
train
0
bf39e15c14eb9952c126d32db38b24e14cea0c33
[ "first = second = 1\nfor i in nums:\n if first < i:\n second = first\n first = i\n elif second <= i <= first:\n second = i\nreturn (second - 1) * (first - 1)", "maxi = (nums[0] - 1) * (nums[1] - 1)\nfor i in range(len(nums) - 1):\n for j in range(i + 1, len(nums)):\n maxi = ma...
<|body_start_0|> first = second = 1 for i in nums: if first < i: second = first first = i elif second <= i <= first: second = i return (second - 1) * (first - 1) <|end_body_0|> <|body_start_1|> maxi = (nums[0] - 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> first = second = 1 for i in nums: ...
stack_v2_sparse_classes_75kplus_train_002859
745
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, nums)" } ]
2
stack_v2_sparse_classes_30k_test_002724
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def maxProduct(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def maxProduct(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxProduct(se...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" first = second = 1 for i in nums: if first < i: second = first first = i elif second <= i <= first: second = i return (second - ...
the_stack_v2_python_sparse
1464_Maximum_Product_of_Two_Element_in_an_Array.py
bingli8802/leetcode
train
0
e91fd9617ab83ab57f31b3e9297ca44ba8f8f261
[ "pre_node = None\ncur_node = head\nwhile cur_node:\n next_node = cur_node.next\n cur_node.next = pre_node\n pre_node = cur_node\n cur_node = next_node\nhead = pre_node\nreturn head", "rev, cur = (None, head)\nwhile cur:\n rev, rev.next, cur = (cur, rev, cur.next)\nreturn rev", "if not head or not...
<|body_start_0|> pre_node = None cur_node = head while cur_node: next_node = cur_node.next cur_node.next = pre_node pre_node = cur_node cur_node = next_node head = pre_node return head <|end_body_0|> <|body_start_1|> rev, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListIterative(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseListRecursive(self, head): """:type head: ListNo...
stack_v2_sparse_classes_75kplus_train_002860
1,649
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseListIterative", "signature": "def reverseListIterative(self, head)" }, { "docstring...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseListIterative(self, head): :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseListIterative(self, head): :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, ...
16e8a7935811fa71ce71998da8549e29ba68f847
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListIterative(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseListRecursive(self, head): """:type head: ListNo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" pre_node = None cur_node = head while cur_node: next_node = cur_node.next cur_node.next = pre_node pre_node = cur_node cur_node = next_node ...
the_stack_v2_python_sparse
leetcode1/reverseList.py
lizyang95/leetcode
train
0
ae9792530b8dd8daa904ef34f69d2da272b6e8ca
[ "stack = []\nlength = len(nums)\nres = [-1] * length\nfor i in range(length):\n while stack and nums[stack[-1]] < nums[i]:\n res[stack.pop()] = nums[i]\n stack.append(i)\nfor i in range(length):\n while stack and nums[stack[-1]] < nums[i]:\n res[stack.pop()] = nums[i]\n if not stack:\n ...
<|body_start_0|> stack = [] length = len(nums) res = [-1] * length for i in range(length): while stack and nums[stack[-1]] < nums[i]: res[stack.pop()] = nums[i] stack.append(i) for i in range(length): while stack and nums[stack[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreaterElements(self, nums): """time O(n) space O(n) :type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElements_short(self, nums): """time O(n) space O(n) :type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_002861
1,217
no_license
[ { "docstring": "time O(n) space O(n) :type nums: List[int] :rtype: List[int]", "name": "nextGreaterElements", "signature": "def nextGreaterElements(self, nums)" }, { "docstring": "time O(n) space O(n) :type nums: List[int] :rtype: List[int]", "name": "nextGreaterElements_short", "signatu...
2
stack_v2_sparse_classes_30k_train_049908
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements(self, nums): time O(n) space O(n) :type nums: List[int] :rtype: List[int] - def nextGreaterElements_short(self, nums): time O(n) space O(n) :type nums: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreaterElements(self, nums): time O(n) space O(n) :type nums: List[int] :rtype: List[int] - def nextGreaterElements_short(self, nums): time O(n) space O(n) :type nums: Li...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def nextGreaterElements(self, nums): """time O(n) space O(n) :type nums: List[int] :rtype: List[int]""" <|body_0|> def nextGreaterElements_short(self, nums): """time O(n) space O(n) :type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def nextGreaterElements(self, nums): """time O(n) space O(n) :type nums: List[int] :rtype: List[int]""" stack = [] length = len(nums) res = [-1] * length for i in range(length): while stack and nums[stack[-1]] < nums[i]: res[stack.p...
the_stack_v2_python_sparse
LeetCode/Stack/503_next_greater_element_ii.py
XyK0907/for_work
train
0
5f477eaf8233cc0cd2d72366b75ff88c2b2b54f7
[ "db = self.request.app['db']\ndocument = await virtool.otus.db.join_and_format(db, otu_id)\nif not document:\n raise NotFound()\nreturn json_response(document['isolates'])", "db = self.request.app['db']\nreference = await get_one_field(db.otus, 'reference', otu_id)\nif not reference:\n raise NotFound()\nif ...
<|body_start_0|> db = self.request.app['db'] document = await virtool.otus.db.join_and_format(db, otu_id) if not document: raise NotFound() return json_response(document['isolates']) <|end_body_0|> <|body_start_1|> db = self.request.app['db'] reference = awai...
IsolatesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" <|body_0|> async def post(self, otu_id: str, /, data: CreateIsolateRequest) -> Union[r201[OTUIsolate], r401, r404]: """Create an isolate. Creates ...
stack_v2_sparse_classes_75kplus_train_002862
16,946
permissive
[ { "docstring": "List isolates. Lists all the isolates and sequences for an OTU.", "name": "get", "signature": "async def get(self, otu_id: str, /)" }, { "docstring": "Create an isolate. Creates an isolate on the OTU specified by `otu_id`.", "name": "post", "signature": "async def post(se...
2
stack_v2_sparse_classes_30k_train_031302
Implement the Python class `IsolatesView` described below. Class description: Implement the IsolatesView class. Method signatures and docstrings: - async def get(self, otu_id: str, /): List isolates. Lists all the isolates and sequences for an OTU. - async def post(self, otu_id: str, /, data: CreateIsolateRequest) ->...
Implement the Python class `IsolatesView` described below. Class description: Implement the IsolatesView class. Method signatures and docstrings: - async def get(self, otu_id: str, /): List isolates. Lists all the isolates and sequences for an OTU. - async def post(self, otu_id: str, /, data: CreateIsolateRequest) ->...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" <|body_0|> async def post(self, otu_id: str, /, data: CreateIsolateRequest) -> Union[r201[OTUIsolate], r401, r404]: """Create an isolate. Creates ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" db = self.request.app['db'] document = await virtool.otus.db.join_and_format(db, otu_id) if not document: raise NotFound() return json_re...
the_stack_v2_python_sparse
virtool/otus/api.py
virtool/virtool
train
45
d8cd1b75cce7b03afbc0d6ad9782c27f1f2e1018
[ "pre_head = LinkNode(-1)\nprev = pre_head\nwhile l1 and l2:\n if l1.val <= l2.val:\n prev.next = l1\n l1 = l1.next\n else:\n prev.next = l2\n l2 = l2.next\n prev = prev.next\nprev.next = l1 if l1 else l2\nreturn pre_head.next", "if not l1:\n return l2\nelif not l2:\n ret...
<|body_start_0|> pre_head = LinkNode(-1) prev = pre_head while l1 and l2: if l1.val <= l2.val: prev.next = l1 l1 = l1.next else: prev.next = l2 l2 = l2.next prev = prev.next prev.next = l1...
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: def merge_(self, l1: 'LinkNode', l2: 'LinkNode'): """Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return:""" <|body_0|> def merge(self, l1: 'LinkNode', l2: 'LinkNode'): """Approach: DFS Time Complexity: Space Complexity: :...
stack_v2_sparse_classes_75kplus_train_002863
1,594
no_license
[ { "docstring": "Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return:", "name": "merge_", "signature": "def merge_(self, l1: 'LinkNode', l2: 'LinkNode')" }, { "docstring": "Approach: DFS Time Complexity: Space Complexity: :param l1: :param l2: :return:", "name...
2
stack_v2_sparse_classes_30k_train_017122
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def merge_(self, l1: 'LinkNode', l2: 'LinkNode'): Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return: - def merge(self, l1: 'LinkNode', l2: ...
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def merge_(self, l1: 'LinkNode', l2: 'LinkNode'): Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return: - def merge(self, l1: 'LinkNode', l2: ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class LinkedList: def merge_(self, l1: 'LinkNode', l2: 'LinkNode'): """Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return:""" <|body_0|> def merge(self, l1: 'LinkNode', l2: 'LinkNode'): """Approach: DFS Time Complexity: Space Complexity: :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LinkedList: def merge_(self, l1: 'LinkNode', l2: 'LinkNode'): """Approach: Iterative Time Complexity: Space Complexity: :param l1: :param l2: :return:""" pre_head = LinkNode(-1) prev = pre_head while l1 and l2: if l1.val <= l2.val: prev.next = l1 ...
the_stack_v2_python_sparse
revisited__2021/linked_list/merge_two_sorted_list.py
Shiv2157k/leet_code
train
1
6f2c82fb1adda565d0dc209b67f8ccf751491f32
[ "super(GameUFCMA, self).__init__()\nself.max_queries, self._tag, self._verify, self.key_len = (_max_queries, _tag, _verify, key_len)\nself.key = ''\nself.messages = []\nself.key_gen = key_gen", "if self.key_gen is None:\n self.key = random_string(self.key_len)\nelse:\n self.key = self.key_gen()\nself.messag...
<|body_start_0|> super(GameUFCMA, self).__init__() self.max_queries, self._tag, self._verify, self.key_len = (_max_queries, _tag, _verify, key_len) self.key = '' self.messages = [] self.key_gen = key_gen <|end_body_0|> <|body_start_1|> if self.key_gen is None: ...
This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle.
GameUFCMA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameUFCMA: """This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle.""" def __init__(self, _max_queries, _tag, _verify, key_len, key_gen=None): """:param _tag: This must be a callable python fun...
stack_v2_sparse_classes_75kplus_train_002864
2,591
no_license
[ { "docstring": ":param _tag: This must be a callable python function that returns message tags and takes in a key and message (key should be of length key_len). :param _verify: This must be a callable python function that returns 1 when a tag is valid and 0 when it is not. Its parameters should be key, message,...
4
stack_v2_sparse_classes_30k_train_042809
Implement the Python class `GameUFCMA` described below. Class description: This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle. Method signatures and docstrings: - def __init__(self, _max_queries, _tag, _verify, key_len, key_g...
Implement the Python class `GameUFCMA` described below. Class description: This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle. Method signatures and docstrings: - def __init__(self, _max_queries, _tag, _verify, key_len, key_g...
9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9
<|skeleton|> class GameUFCMA: """This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle.""" def __init__(self, _max_queries, _tag, _verify, key_len, key_gen=None): """:param _tag: This must be a callable python fun...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameUFCMA: """This game is meant to test the security of message authentication schemes. Adversaries playing this game have access to a tag and verify oracle.""" def __init__(self, _max_queries, _tag, _verify, key_len, key_gen=None): """:param _tag: This must be a callable python function that re...
the_stack_v2_python_sparse
src/playcrypt/games/game_ufcma.py
UCSDCSE107/playcrypt
train
2
aaf5eeaf476fef0956563f00dacee6946a723bb8
[ "super(MultiBoxLossLandm, self).__init__()\nself.neg_pos_ratio = neg_pos_ratio\nself.center_variance = center_variance\nself.size_variance = size_variance\nself.priors = priors\nself.priors.to(device)", "num_classes = confidence.size(2)\nwith torch.no_grad():\n loss = -F.log_softmax(confidence, dim=2)[:, :, 0]...
<|body_start_0|> super(MultiBoxLossLandm, self).__init__() self.neg_pos_ratio = neg_pos_ratio self.center_variance = center_variance self.size_variance = size_variance self.priors = priors self.priors.to(device) <|end_body_0|> <|body_start_1|> num_classes = confi...
MultiBoxLossLandm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiBoxLossLandm: def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device): """Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pred...
stack_v2_sparse_classes_75kplus_train_002865
2,406
no_license
[ { "docstring": "Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.", "name": "__init__", "signature": "def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device)" }, { "docstring": "Compute classificati...
2
null
Implement the Python class `MultiBoxLossLandm` described below. Class description: Implement the MultiBoxLossLandm class. Method signatures and docstrings: - def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device): Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classi...
Implement the Python class `MultiBoxLossLandm` described below. Class description: Implement the MultiBoxLossLandm class. Method signatures and docstrings: - def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device): Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classi...
40400a6ff7376f933899e7f4fead9f994c39d3fe
<|skeleton|> class MultiBoxLossLandm: def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device): """Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pred...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiBoxLossLandm: def __init__(self, priors, neg_pos_ratio, center_variance, size_variance, device): """Implement SSDLandmark Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" super(MultiBoxLossLandm, self).__init__() self.neg_pos_r...
the_stack_v2_python_sparse
models/backbone/bk/multibox_loss_landms.py
PanJinquan/torch-Slim-Detection-Landmark
train
0
52078110bacea31ec6e226bb023bd1e935fdb2c2
[ "super(DeepFactorizationMachineModel, self).__init__()\nself.fm = FMLayer(fm_dropout_p)\nself.deep = DNNLayer(output_size=1, layer_sizes=deep_layer_sizes, embed_size=embed_size, num_fields=num_fields, dropout_p=deep_dropout_p, activation=deep_activation)", "fm_first = feat_inputs.squeeze()\nfm_second = self.fm(em...
<|body_start_0|> super(DeepFactorizationMachineModel, self).__init__() self.fm = FMLayer(fm_dropout_p) self.deep = DNNLayer(output_size=1, layer_sizes=deep_layer_sizes, embed_size=embed_size, num_fields=num_fields, dropout_p=deep_dropout_p, activation=deep_activation) <|end_body_0|> <|body_star...
DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_{deep} + y_{fm}` , to gain the advantage of two different models of two different objectives, i....
DeepFactorizationMachineModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepFactorizationMachineModel: """DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_{deep} + y_{fm}` , to gain the advantag...
stack_v2_sparse_classes_75kplus_train_002866
4,125
permissive
[ { "docstring": "initialize Deep Factorization Machine Model Args: embed_size (int): embedding size num_fields (int): number of fields in inputs deep_layer_sizes (List[int]): layer sizes of deep neural network fm_dropout_p (float, optional): dropout probability after factorization machine. Defaults to 0.0. deep_...
2
stack_v2_sparse_classes_30k_train_005939
Implement the Python class `DeepFactorizationMachineModel` described below. Class description: DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_...
Implement the Python class `DeepFactorizationMachineModel` described below. Class description: DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_...
8b4cdbd5ed126a86da3bd9ef1665a6985dedc07c
<|skeleton|> class DeepFactorizationMachineModel: """DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_{deep} + y_{fm}` , to gain the advantag...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepFactorizationMachineModel: """DeepFactorizationMachineModel is a model of Deep Factorization Machine (DeepFM) proposed by Huawei in 2017, which add up outputs of factorization machine and fully-connected dense neural network directly: :math:`y_{out} = y_{deep} + y_{fm}` , to gain the advantage of two diff...
the_stack_v2_python_sparse
torecsys/models/ctr/deep_fm.py
codeants2012/torecsys
train
0
283bb5a89e0d73f6c023ca57a193429b827c8600
[ "d = defaultdict(int)\nfor i in intervals:\n for j in range(i.start, i.end + 1):\n d[j] += 1\nreturn max(d.values())", "points = []\nfor interval in intervals:\n points.append([interval.start, 1])\n points.append([interval.end, -1])\npoints = sorted(points, key=lambda x: x[0])\nans = cur = 0\nfor ...
<|body_start_0|> d = defaultdict(int) for i in intervals: for j in range(i.start, i.end + 1): d[j] += 1 return max(d.values()) <|end_body_0|> <|body_start_1|> points = [] for interval in intervals: points.append([interval.start, 1]) ...
@param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required""" def minMeetingRooms1(self, intervals): """粗暴, 超时""" <|body_0|> def minMeetingRooms(self, intervals): """起点 + 1, 终点 - 1""" <|body_...
stack_v2_sparse_classes_75kplus_train_002867
1,366
no_license
[ { "docstring": "粗暴, 超时", "name": "minMeetingRooms1", "signature": "def minMeetingRooms1(self, intervals)" }, { "docstring": "起点 + 1, 终点 - 1", "name": "minMeetingRooms", "signature": "def minMeetingRooms(self, intervals)" } ]
2
null
Implement the Python class `Solution` described below. Class description: @param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required Method signatures and docstrings: - def minMeetingRooms1(self, intervals): 粗暴, 超时 - def minMeetingRooms(self, intervals): 起点 + 1, 终点 -...
Implement the Python class `Solution` described below. Class description: @param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required Method signatures and docstrings: - def minMeetingRooms1(self, intervals): 粗暴, 超时 - def minMeetingRooms(self, intervals): 起点 + 1, 终点 -...
c34757e66163e3be7b18d23c150c463e39c98442
<|skeleton|> class Solution: """@param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required""" def minMeetingRooms1(self, intervals): """粗暴, 超时""" <|body_0|> def minMeetingRooms(self, intervals): """起点 + 1, 终点 - 1""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """@param intervals: an array of meeting time intervals @return: the minimum number of conference rooms required""" def minMeetingRooms1(self, intervals): """粗暴, 超时""" d = defaultdict(int) for i in intervals: for j in range(i.start, i.end + 1): ...
the_stack_v2_python_sparse
lintcode/meeting-rooms.py
liujunsheng0/notes
train
6
6c810e2a12557f0d67f81b44337dec49edec5e22
[ "super(CNNEncoder, self).__init__()\nassert embedding is not None\nself.input_size = embedding.embedding_size\nself.hidden_size = hidden_size\nself.filter_num = filter_num\nself.filter_sizes = filter_sizes\nself.dropout_p = dropout\nself.embedding = embedding\nself.encoder_type = 'simple_cnn'\nself.convs = nn.Modul...
<|body_start_0|> super(CNNEncoder, self).__init__() assert embedding is not None self.input_size = embedding.embedding_size self.hidden_size = hidden_size self.filter_num = filter_num self.filter_sizes = filter_sizes self.dropout_p = dropout self.embedding...
a simple CNN Encoder
CNNEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNNEncoder: """a simple CNN Encoder""" def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None): """embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,""" <|body_0|> def forward(self, src, length...
stack_v2_sparse_classes_75kplus_train_002868
10,574
no_license
[ { "docstring": "embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,", "name": "__init__", "signature": "def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None)" }, { "docstring": "input, seq_len * batch_size, time-step ...
2
stack_v2_sparse_classes_30k_train_029060
Implement the Python class `CNNEncoder` described below. Class description: a simple CNN Encoder Method signatures and docstrings: - def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None): embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,...
Implement the Python class `CNNEncoder` described below. Class description: a simple CNN Encoder Method signatures and docstrings: - def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None): embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,...
9b452326b632919c5b6a245441a57d0dd8a8b9fc
<|skeleton|> class CNNEncoder: """a simple CNN Encoder""" def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None): """embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,""" <|body_0|> def forward(self, src, length...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CNNEncoder: """a simple CNN Encoder""" def __init__(self, hidden_size, num_layers=1, filter_num=64, filter_sizes=[1, 2, 3, 4], dropout=0, embedding=None): """embed_size, hidden_size, embedder, filter=num, filter_sizes, dropout,""" super(CNNEncoder, self).__init__() assert embeddin...
the_stack_v2_python_sparse
modules/Encoder.py
AotY/DSTC7-End-to-End-Conversation-Modeling
train
5
57c5a611a28dd856921f73fbb019ef1133184adc
[ "page = self.client.get('/accounts/login/')\nself.assertEqual(page.status_code, 200)\nself.assertTemplateUsed(page, 'login.html')", "user = User.objects.create_user('username', 'myemail@test.com', 'password')\nself.client.login(username='username', password='password')\npage = self.client.get('/accounts/login/', ...
<|body_start_0|> page = self.client.get('/accounts/login/') self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, 'login.html') <|end_body_0|> <|body_start_1|> user = User.objects.create_user('username', 'myemail@test.com', 'password') self.client.login(username=...
test the login view
TestAccountViewsLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAccountViewsLogin: """test the login view""" def test_get_login_customer_page(self): """test login url directs to login.html""" <|body_0|> def test_login_view_when_someone_logged_in(self): """test trying to login when someone is already logged in""" <...
stack_v2_sparse_classes_75kplus_train_002869
15,097
no_license
[ { "docstring": "test login url directs to login.html", "name": "test_get_login_customer_page", "signature": "def test_get_login_customer_page(self)" }, { "docstring": "test trying to login when someone is already logged in", "name": "test_login_view_when_someone_logged_in", "signature": ...
4
null
Implement the Python class `TestAccountViewsLogin` described below. Class description: test the login view Method signatures and docstrings: - def test_get_login_customer_page(self): test login url directs to login.html - def test_login_view_when_someone_logged_in(self): test trying to login when someone is already l...
Implement the Python class `TestAccountViewsLogin` described below. Class description: test the login view Method signatures and docstrings: - def test_get_login_customer_page(self): test login url directs to login.html - def test_login_view_when_someone_logged_in(self): test trying to login when someone is already l...
a80148cb642cb09dac57cff18483be14fed67dfd
<|skeleton|> class TestAccountViewsLogin: """test the login view""" def test_get_login_customer_page(self): """test login url directs to login.html""" <|body_0|> def test_login_view_when_someone_logged_in(self): """test trying to login when someone is already logged in""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAccountViewsLogin: """test the login view""" def test_get_login_customer_page(self): """test login url directs to login.html""" page = self.client.get('/accounts/login/') self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, 'login.html') def test_...
the_stack_v2_python_sparse
accounts/tests_views.py
sarahbarron/Stream-3-Project
train
1
4706d237d2ee0175b52db1317cea8ac003768a34
[ "predLog = np.nan_to_num(-np.log(a))\ncEntropyMat = np.multiply(y, predLog)\nreturn 1.0 / self.nExamples * np.sum(cEntropyMat)", "if self.endNode:\n grad = np.ones(self.inputA.shape)\nelse:\n grad = np.zeros(self.inputA.shape)\n for out in self.outputs:\n grad += out.getGradient(self)\nreturn grad...
<|body_start_0|> predLog = np.nan_to_num(-np.log(a)) cEntropyMat = np.multiply(y, predLog) return 1.0 / self.nExamples * np.sum(cEntropyMat) <|end_body_0|> <|body_start_1|> if self.endNode: grad = np.ones(self.inputA.shape) else: grad = np.zeros(self.inpu...
Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation testing : bool Flag specifying if the operation is in testing (making prefictions: True) or t...
CrossEntropyCostSoftmax
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossEntropyCostSoftmax: """Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation testing : bool Flag specifying if the oper...
stack_v2_sparse_classes_75kplus_train_002870
3,898
permissive
[ { "docstring": "Perform costOperation Parameters ---------- a : np.array Predictions y : np.array Data labels Returns ------- np.array Output data", "name": "perform", "signature": "def perform(self, a, y)" }, { "docstring": "Find out the gradient with respect to the parameter Parameters -------...
2
stack_v2_sparse_classes_30k_train_007363
Implement the Python class `CrossEntropyCostSoftmax` described below. Class description: Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation tes...
Implement the Python class `CrossEntropyCostSoftmax` described below. Class description: Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation tes...
ec8488444b44d0bd54498bf917ee42d821643ee8
<|skeleton|> class CrossEntropyCostSoftmax: """Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation testing : bool Flag specifying if the oper...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CrossEntropyCostSoftmax: """Evaliate the CrossEntropy cost given the labels, works with softmax activation ONLY CrossEntropyCostSoftmax(self, inputA, labels) Attributes ---------- name : str Name of the operation result : np.array Output of the operation testing : bool Flag specifying if the operation is in t...
the_stack_v2_python_sparse
graphAttack/operations/costOperations.py
Houkime/graphAttack
train
0
21e4102d2a0018a3d6d48e4ce0e90f348a98059a
[ "super(PreactBasicBlock, self).__init__()\nself.bn1 = nn.BatchNorm2d(inplanes)\nself.conv1 = conv3x3(inplanes, planes, stride, groups=args.num_groups)\nself.relu = nn.ReLU(inplace=True)\nself.conv2 = conv3x3(planes, planes, groups=args.num_groups)\nself.bn2 = nn.BatchNorm2d(planes)\nself.downsample = downsample\nse...
<|body_start_0|> super(PreactBasicBlock, self).__init__() self.bn1 = nn.BatchNorm2d(inplanes) self.conv1 = conv3x3(inplanes, planes, stride, groups=args.num_groups) self.relu = nn.ReLU(inplace=True) self.conv2 = conv3x3(planes, planes, groups=args.num_groups) self.bn2 = n...
A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf
PreactBasicBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreactBasicBlock: """A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf""" def __init__(self, args, inplanes, planes, stride=1, downsample=None): """Initializes Arguments: inplanes(int): The depth (number of channels) of the input. plan...
stack_v2_sparse_classes_75kplus_train_002871
1,913
permissive
[ { "docstring": "Initializes Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The number of filters to use in convolutions and therefore the depth (number of channels) of the output. stride(int): The stride to use in the convolutions. downsample(func): The downsampling function...
2
null
Implement the Python class `PreactBasicBlock` described below. Class description: A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf Method signatures and docstrings: - def __init__(self, args, inplanes, planes, stride=1, downsample=None): Initializes Arguments: inplane...
Implement the Python class `PreactBasicBlock` described below. Class description: A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf Method signatures and docstrings: - def __init__(self, args, inplanes, planes, stride=1, downsample=None): Initializes Arguments: inplane...
12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054
<|skeleton|> class PreactBasicBlock: """A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf""" def __init__(self, args, inplanes, planes, stride=1, downsample=None): """Initializes Arguments: inplanes(int): The depth (number of channels) of the input. plan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PreactBasicBlock: """A wide basic block for Resnets, from "Wide Residual Networks" https://arxiv.org/pdf/1605.07146.pdf""" def __init__(self, args, inplanes, planes, stride=1, downsample=None): """Initializes Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The ...
the_stack_v2_python_sparse
onconet/models/blocks/preact_basic.py
yala/Mirai
train
66
8d2fb863d28d654b66d405c337cf97922b8ada51
[ "vk_account = user.get_vk_account()\nif vk_account is not None:\n vk_session = VkApi(token=vk_account.access_token)\n self.vk = vk_session.get_api()\n self.vk_id = vk_account.uid\nself.user = user", "friends_ids: List['User'] = []\nuser_model: 'User' = get_user_model()\nreturn user_model.objects.filter(s...
<|body_start_0|> vk_account = user.get_vk_account() if vk_account is not None: vk_session = VkApi(token=vk_account.access_token) self.vk = vk_session.get_api() self.vk_id = vk_account.uid self.user = user <|end_body_0|> <|body_start_1|> friends_ids: L...
VK.
Vk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vk: """VK.""" def __init__(self, user: 'User'): """Init.""" <|body_0|> def get_friends(self) -> QuerySet['User']: """Get friends.""" <|body_1|> def get_data(self, fields: list[str]) -> UntypedObject: """Get data.""" <|body_2|> de...
stack_v2_sparse_classes_75kplus_train_002872
3,092
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, user: 'User')" }, { "docstring": "Get friends.", "name": "get_friends", "signature": "def get_friends(self) -> QuerySet['User']" }, { "docstring": "Get data.", "name": "get_data", "signature": "d...
4
stack_v2_sparse_classes_30k_val_000068
Implement the Python class `Vk` described below. Class description: VK. Method signatures and docstrings: - def __init__(self, user: 'User'): Init. - def get_friends(self) -> QuerySet['User']: Get friends. - def get_data(self, fields: list[str]) -> UntypedObject: Get data. - def get_countries(self, country_codes: lis...
Implement the Python class `Vk` described below. Class description: VK. Method signatures and docstrings: - def __init__(self, user: 'User'): Init. - def get_friends(self) -> QuerySet['User']: Get friends. - def get_data(self, fields: list[str]) -> UntypedObject: Get data. - def get_countries(self, country_codes: lis...
04141e4cfc885ba6c53328e1222980b85d9828ef
<|skeleton|> class Vk: """VK.""" def __init__(self, user: 'User'): """Init.""" <|body_0|> def get_friends(self) -> QuerySet['User']: """Get friends.""" <|body_1|> def get_data(self, fields: list[str]) -> UntypedObject: """Get data.""" <|body_2|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Vk: """VK.""" def __init__(self, user: 'User'): """Init.""" vk_account = user.get_vk_account() if vk_account is not None: vk_session = VkApi(token=vk_account.access_token) self.vk = vk_session.get_api() self.vk_id = vk_account.uid self.u...
the_stack_v2_python_sparse
src/moviesapp/vk.py
desecho/movies
train
14
d8f74e06f3a2a5704c7aaa36351eaf501ddb315b
[ "u = UserF.create()\np = FortuitusProfile.objects.all()[0]\nself.assertEqual(u.fortuitusprofile, p)", "u1 = UserF.create(username='u1')\np1 = FortuitusProfile.objects.get(user_id=u1.pk)\nu2 = UserF.create(username='u2')\np2 = FortuitusProfile.objects.get(user_id=u2.pk)\nself.assertNotEqual(p1, p2)" ]
<|body_start_0|> u = UserF.create() p = FortuitusProfile.objects.all()[0] self.assertEqual(u.fortuitusprofile, p) <|end_body_0|> <|body_start_1|> u1 = UserF.create(username='u1') p1 = FortuitusProfile.objects.get(user_id=u1.pk) u2 = UserF.create(username='u2') p2...
ProfileTestCase
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileTestCase: def test_profile_created(self): """Tests that profile is automatically created along with User.""" <|body_0|> def test_profiles_not_conflicted(self): """Tests that second profile is created and not conflicted with the first user nor his profile.""" ...
stack_v2_sparse_classes_75kplus_train_002873
2,725
permissive
[ { "docstring": "Tests that profile is automatically created along with User.", "name": "test_profile_created", "signature": "def test_profile_created(self)" }, { "docstring": "Tests that second profile is created and not conflicted with the first user nor his profile.", "name": "test_profile...
2
stack_v2_sparse_classes_30k_train_007539
Implement the Python class `ProfileTestCase` described below. Class description: Implement the ProfileTestCase class. Method signatures and docstrings: - def test_profile_created(self): Tests that profile is automatically created along with User. - def test_profiles_not_conflicted(self): Tests that second profile is ...
Implement the Python class `ProfileTestCase` described below. Class description: Implement the ProfileTestCase class. Method signatures and docstrings: - def test_profile_created(self): Tests that profile is automatically created along with User. - def test_profiles_not_conflicted(self): Tests that second profile is ...
57f5e7d16185d91a06fc3ad9ecd26fbef1c0a84d
<|skeleton|> class ProfileTestCase: def test_profile_created(self): """Tests that profile is automatically created along with User.""" <|body_0|> def test_profiles_not_conflicted(self): """Tests that second profile is created and not conflicted with the first user nor his profile.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfileTestCase: def test_profile_created(self): """Tests that profile is automatically created along with User.""" u = UserF.create() p = FortuitusProfile.objects.all()[0] self.assertEqual(u.fortuitusprofile, p) def test_profiles_not_conflicted(self): """Tests tha...
the_stack_v2_python_sparse
fortuitus/fcore/tests.py
elegion/djangodash2012
train
0
973415825e49ea6743413cdfa55faa94ca472001
[ "BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity')\nself.v_des = v_des\nself.max_accel = car_following_params.controller_params['accel']\nself.dx_1_0 = 4.5\nself.dx_2_0 = 5.25\nself.dx_3_0 = 6.0\nself.d_1 = 1.5\nself.d_2 = 1.0\nself.d_3 = 0.5\nself.danger_edges = dang...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity') self.v_des = v_des self.max_accel = car_following_params.controller_params['accel'] self.dx_1_0 = 4.5 self.dx_2_0 = 5.25 self.dx_3_0 = 6.0 self.d_1 =...
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed of the vehicles (m/s)
FollowerStopper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ...
stack_v2_sparse_classes_75kplus_train_002874
7,700
permissive
[ { "docstring": "Instantiate FollowerStopper.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params, v_des=15, danger_edges=None)" }, { "docstring": "Find distance to intersection. Parameters ---------- env : flow.envs.Env see flow/envs/base.py Returns ------- float ...
3
stack_v2_sparse_classes_30k_train_032084
Implement the Python class `FollowerStopper` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi...
Implement the Python class `FollowerStopper` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed...
the_stack_v2_python_sparse
flow/controllers/velocity_controllers.py
parthjaggi/flow
train
6
c4a31fcb2b64d526fe57e54b478a02be5b571847
[ "w = SldPanel(None)\nyield w\nw.close()\nw = None", "assert isinstance(widget, QtWidgets.QWidget)\nassert widget.ui.editMolecularFormula.styleSheet() == ''\nassert widget.model.columnCount() == 1\nassert widget.model.rowCount() == 11\nassert widget.sizePolicy().Policy() == QtWidgets.QSizePolicy.Fixed", "widget....
<|body_start_0|> w = SldPanel(None) yield w w.close() w = None <|end_body_0|> <|body_start_1|> assert isinstance(widget, QtWidgets.QWidget) assert widget.ui.editMolecularFormula.styleSheet() == '' assert widget.model.columnCount() == 1 assert widget.model...
Test the SLDCalculator
SLDCalculatorTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_75kplus_train_002875
4,853
permissive
[ { "docstring": "Create/Destroy the SLDCalculator", "name": "widget", "signature": "def widget(self, qapp)" }, { "docstring": "Test the GUI in its default state", "name": "testDefaults", "signature": "def testDefaults(self, widget)" }, { "docstring": "Default compound calculations...
5
stack_v2_sparse_classes_30k_val_000513
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
Implement the Python class `SLDCalculatorTest` described below. Class description: Test the SLDCalculator Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the SLDCalculator - def testDefaults(self, widget): Test the GUI in its default state - def testSimpleEntry(self, widget): Default compou...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testSimpleEntry(self, widget): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SLDCalculatorTest: """Test the SLDCalculator""" def widget(self, qapp): """Create/Destroy the SLDCalculator""" w = SldPanel(None) yield w w.close() w = None def testDefaults(self, widget): """Test the GUI in its default state""" assert isinstan...
the_stack_v2_python_sparse
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
SasView/sasview
train
48
ceace6b7eefb5c13951a05d8b49a5731e61add3d
[ "if any((item is not None for item in (account_id, offset, min_id, max_id))):\n if not self.verify_minimum_version('2.8.0', cached=True):\n raise MastodonVersionError('Advanced search parameters require Mastodon 2.8.0+')", "if self.verify_minimum_version('2.4.1', cached=True):\n return self.search_v2...
<|body_start_0|> if any((item is not None for item in (account_id, offset, min_id, max_id))): if not self.verify_minimum_version('2.8.0', cached=True): raise MastodonVersionError('Advanced search parameters require Mastodon 2.8.0+') <|end_body_0|> <|body_start_1|> if self.ve...
Mastodon
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mastodon: def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): """Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified.""" <|body_0|> def search(sel...
stack_v2_sparse_classes_75kplus_train_002876
4,774
permissive
[ { "docstring": "Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified.", "name": "__ensure_search_params_acceptable", "signature": "def __ensure_search_params_acceptable(self, account_id, offset, min_id, ma...
4
stack_v2_sparse_classes_30k_train_027586
Implement the Python class `Mastodon` described below. Class description: Implement the Mastodon class. Method signatures and docstrings: - def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search tha...
Implement the Python class `Mastodon` described below. Class description: Implement the Mastodon class. Method signatures and docstrings: - def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search tha...
cd86887d88bbc07de462d1e00a8fbc3d956c0151
<|skeleton|> class Mastodon: def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): """Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified.""" <|body_0|> def search(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mastodon: def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): """Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified.""" if any((item is not None for item in (accoun...
the_stack_v2_python_sparse
mastodon/search.py
halcy/Mastodon.py
train
880
793c0aa27255372203c66f039c92fe06aace458c
[ "self.puntuacion = 0\nself.game_over = False\nself.bloque_lista = pygame.sprite.Group()\nself.listade_todoslos_sprites = pygame.sprite.Group()\nfor i in range(50):\n bloque = Bloque()\n bloque.rect.x = random.randrange(LARGO_PANTALLA)\n bloque.rect.y = random.randrange(-300, ALTO_PANTALLA)\n self.bloque...
<|body_start_0|> self.puntuacion = 0 self.game_over = False self.bloque_lista = pygame.sprite.Group() self.listade_todoslos_sprites = pygame.sprite.Group() for i in range(50): bloque = Bloque() bloque.rect.x = random.randrange(LARGO_PANTALLA) b...
Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase.
Juego
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Juego: """Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase.""" def __init__(self): """Constructor. Crea todos nuestros atributos e inicializa el juego.""" <|body_0|> def procesos...
stack_v2_sparse_classes_75kplus_train_002877
6,170
permissive
[ { "docstring": "Constructor. Crea todos nuestros atributos e inicializa el juego.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Procesa todos los eventos. Devuelve un \"True\" si precisamos cerrar la ventana.", "name": "procesos_de_eventos", "signature": "def...
4
null
Implement the Python class `Juego` described below. Class description: Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase. Method signatures and docstrings: - def __init__(self): Constructor. Crea todos nuestros atributos e ini...
Implement the Python class `Juego` described below. Class description: Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase. Method signatures and docstrings: - def __init__(self): Constructor. Crea todos nuestros atributos e ini...
314b2a958baf23ff4a393a624338ea22e70ad7d5
<|skeleton|> class Juego: """Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase.""" def __init__(self): """Constructor. Crea todos nuestros atributos e inicializa el juego.""" <|body_0|> def procesos...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Juego: """Esta clase representa una instancia del juego. Si necesitamos reiniciar el juego, solo tendríamos que crear una nueva instancia de esta clase.""" def __init__(self): """Constructor. Crea todos nuestros atributos e inicializa el juego.""" self.puntuacion = 0 self.game_ove...
the_stack_v2_python_sparse
Capítulo 12: Introducción a los sprites/juegoOrdenado.py
osmandi/programarcadegames
train
0
f44d850dddc80b2365fdf2fa825423609a47c8e6
[ "self.a = a\nself.b = b\nself.c = c", "A1, A2, B1, B2, C1, C2 = (str(self.a[0]), str(self.a[1]), str(self.b[0]), str(self.b[1]), str(self.c[0]), str(self.c[1]))\nastring = 'Point A: ' + A1 + ' ' + A2 + '\\nPoint B: ' + B1 + ' ' + B2 + '\\nPoint C: ' + C1 + ' ' + C2\nreturn astring" ]
<|body_start_0|> self.a = a self.b = b self.c = c <|end_body_0|> <|body_start_1|> A1, A2, B1, B2, C1, C2 = (str(self.a[0]), str(self.a[1]), str(self.b[0]), str(self.b[1]), str(self.c[0]), str(self.c[1])) astring = 'Point A: ' + A1 + ' ' + A2 + '\nPoint B: ' + B1 + ' ' + B2 + '\n...
Triangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triangle: def __init__(self, a, b, c): """Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates.""" <|body_0|> def __str__(self): """Returns a string representation of the triangle. The string is forma...
stack_v2_sparse_classes_75kplus_train_002878
793
no_license
[ { "docstring": "Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates.", "name": "__init__", "signature": "def __init__(self, a, b, c)" }, { "docstring": "Returns a string representation of the triangle. The string is formatted as...
2
stack_v2_sparse_classes_30k_train_046124
Implement the Python class `Triangle` described below. Class description: Implement the Triangle class. Method signatures and docstrings: - def __init__(self, a, b, c): Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates. - def __str__(self): Returns...
Implement the Python class `Triangle` described below. Class description: Implement the Triangle class. Method signatures and docstrings: - def __init__(self, a, b, c): Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates. - def __str__(self): Returns...
93ffe85ff2a733fbfebbeacdad98d559ef371bbf
<|skeleton|> class Triangle: def __init__(self, a, b, c): """Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates.""" <|body_0|> def __str__(self): """Returns a string representation of the triangle. The string is forma...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Triangle: def __init__(self, a, b, c): """Constructor for Vec4 Expects points as arrays in the form of [x, y]. All coordinates are given as cartesian coordinates.""" self.a = a self.b = b self.c = c def __str__(self): """Returns a string representation of the trian...
the_stack_v2_python_sparse
StackOverflow/Triangle.py
ChocolatePadmanaban/RandomStuff
train
0
8204b4b8fac06e19c73d8cd08c3d4cac11595798
[ "self.filename = DATA_PATH_FILE\nself.sheet = sheet\nself.wb = load_workbook(self.filename)\nif self.sheet is None:\n self.ws = self.wb.active\nelse:\n self.ws = self.wb[self.sheet]\nself.case = []\nself.first_row = tuple(self.ws.iter_rows(max_row=1, values_only=True))[0]", "for rows in self.ws.iter_rows(mi...
<|body_start_0|> self.filename = DATA_PATH_FILE self.sheet = sheet self.wb = load_workbook(self.filename) if self.sheet is None: self.ws = self.wb.active else: self.ws = self.wb[self.sheet] self.case = [] self.first_row = tuple(self.ws.iter...
ReadExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadExcel: def __init__(self, sheet=None): """:param sheet: 表单名""" <|body_0|> def get_case(self): """获取全部Excel数据 :return: 返回嵌套字典的列表""" <|body_1|> def one_case(self, row): """获取某一行Excel数据 :param row: 需要返回的行号""" <|body_2|> def write_ca...
stack_v2_sparse_classes_75kplus_train_002879
2,319
no_license
[ { "docstring": ":param sheet: 表单名", "name": "__init__", "signature": "def __init__(self, sheet=None)" }, { "docstring": "获取全部Excel数据 :return: 返回嵌套字典的列表", "name": "get_case", "signature": "def get_case(self)" }, { "docstring": "获取某一行Excel数据 :param row: 需要返回的行号", "name": "one_c...
4
stack_v2_sparse_classes_30k_test_002909
Implement the Python class `ReadExcel` described below. Class description: Implement the ReadExcel class. Method signatures and docstrings: - def __init__(self, sheet=None): :param sheet: 表单名 - def get_case(self): 获取全部Excel数据 :return: 返回嵌套字典的列表 - def one_case(self, row): 获取某一行Excel数据 :param row: 需要返回的行号 - def write_c...
Implement the Python class `ReadExcel` described below. Class description: Implement the ReadExcel class. Method signatures and docstrings: - def __init__(self, sheet=None): :param sheet: 表单名 - def get_case(self): 获取全部Excel数据 :return: 返回嵌套字典的列表 - def one_case(self, row): 获取某一行Excel数据 :param row: 需要返回的行号 - def write_c...
675962155a2e99aae81ddecd59e9b021ee665782
<|skeleton|> class ReadExcel: def __init__(self, sheet=None): """:param sheet: 表单名""" <|body_0|> def get_case(self): """获取全部Excel数据 :return: 返回嵌套字典的列表""" <|body_1|> def one_case(self, row): """获取某一行Excel数据 :param row: 需要返回的行号""" <|body_2|> def write_ca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReadExcel: def __init__(self, sheet=None): """:param sheet: 表单名""" self.filename = DATA_PATH_FILE self.sheet = sheet self.wb = load_workbook(self.filename) if self.sheet is None: self.ws = self.wb.active else: self.ws = self.wb[self.sheet...
the_stack_v2_python_sparse
script/rebulit_excel.py
yiruiwan/pytest-api-allure
train
0
0df4bc3843fd2265a9e59785adc0d85447172e7e
[ "threading.Thread.__init__(self)\nself.fileobject = fileobject\nself.lock = threading.Lock()\nself.data = ''\nself.done = False", "self.lock.acquire()\ndata = self.data\ndone = self.done\nself.data = ''\nself.lock.release()\nif isinstance(data, Exception):\n raise data\nelse:\n return (data, done)", "whil...
<|body_start_0|> threading.Thread.__init__(self) self.fileobject = fileobject self.lock = threading.Lock() self.data = '' self.done = False <|end_body_0|> <|body_start_1|> self.lock.acquire() data = self.data done = self.done self.data = '' ...
A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly support non-blocking pipes as files.
NonBlockingReaderThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonBlockingReaderThread: """A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly support non-blocking pipes as files.""" ...
stack_v2_sparse_classes_75kplus_train_002880
16,817
no_license
[ { "docstring": "Create the thread object.", "name": "__init__", "signature": "def __init__(self, fileobject)" }, { "docstring": "Get any data waiting to be read, and whether the reading is finished. Returns (data, done)", "name": "getNewData", "signature": "def getNewData(self)" }, {...
3
stack_v2_sparse_classes_30k_train_008963
Implement the Python class `NonBlockingReaderThread` described below. Class description: A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly supp...
Implement the Python class `NonBlockingReaderThread` described below. Class description: A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly supp...
3ecb875e979ecd462f0390e768b99333f0b0ef91
<|skeleton|> class NonBlockingReaderThread: """A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly support non-blocking pipes as files.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NonBlockingReaderThread: """A class to read blocking file objects and return the result. Usage: r = ReadThread(myfile) r.start() while True: newdata, done = r.getNewData() print newdata if done: break This is used mainly because windows doesn't properly support non-blocking pipes as files.""" def __init_...
the_stack_v2_python_sparse
xfp/utils/utilfuncs.py
tadegenban/RCP
train
0
d49b30156e838587d9cec7bae582c5ec07a3467e
[ "self.capacity = capacity\nself.dic = {}\nself.head = None\nself.tail = None", "val = -1\nif self.dic.has_key(key):\n element = self.dic[key]\n if element.next is not None:\n if element.pre is None:\n self.head = element.next\n element.next.pre = None\n else:\n ...
<|body_start_0|> self.capacity = capacity self.dic = {} self.head = None self.tail = None <|end_body_0|> <|body_start_1|> val = -1 if self.dic.has_key(key): element = self.dic[key] if element.next is not None: if element.pre is Non...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_002881
2,078
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_018906
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
bba614e716959afa0b52857cca7e5cd07ec022de
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.dic = {} self.head = None self.tail = None def get(self, key): """:type key: int :rtype: int""" val = -1 if self.dic.has_key(key): el...
the_stack_v2_python_sparse
LRUCache.py
lxf310/LeetCode
train
0
987c5813c7ee342ddd161b86fecf1fbb2183a3e6
[ "kwargs['pid_value'] = record['id']\nkwargs['status'] = cls.default_status\nkwargs['object_type'] = cls.object_type\nkwargs['object_uuid'] = record.model.id\nreturn super(CommunitiesIdProvider, cls).create(**kwargs)", "try:\n existing_pid = cls.get(new_value).pid\nexcept PIDDoesNotExistError:\n pass\nelse:\...
<|body_start_0|> kwargs['pid_value'] = record['id'] kwargs['status'] = cls.default_status kwargs['object_type'] = cls.object_type kwargs['object_uuid'] = record.model.id return super(CommunitiesIdProvider, cls).create(**kwargs) <|end_body_0|> <|body_start_1|> try: ...
Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.
CommunitiesIdProvider
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information abou...
stack_v2_sparse_classes_75kplus_train_002882
2,431
permissive
[ { "docstring": "Create a new commuinity identifier. For more information about parameters, see :meth:`invenio_pidstore.providers.base.BaseProvider.create`. :param record: The community record. :param kwargs: dict to hold generated pid_value and status. See :meth:`invenio_pidstore.providers.base.BaseProvider.cre...
2
stack_v2_sparse_classes_30k_train_018889
Implement the Python class `CommunitiesIdProvider` described below. Class description: Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier. Method signatures and docstrings: - def create(cls, record, **kwargs): Crea...
Implement the Python class `CommunitiesIdProvider` described below. Class description: Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier. Method signatures and docstrings: - def create(cls, record, **kwargs): Crea...
e6e032960abd5d4062a63824d6d349a6158339af
<|skeleton|> class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information abou...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information about parameters,...
the_stack_v2_python_sparse
invenio_communities/communities/records/providers.py
lnielsen/invenio-communities
train
0
100d710f61a722ae80c133b1345253115be15838
[ "super().__init__(**kwargs)\nself.type_cls = type_cls\nself.min = min\nself.max = max\nself.storage_type = type_cls", "if not isinstance(value, (str, int, float, self.type_cls)) or isinstance(value, bool):\n raise ValueError('value type %s cannot be converted to %s' % (type(value).__name__, self.type_cls.__nam...
<|body_start_0|> super().__init__(**kwargs) self.type_cls = type_cls self.min = min self.max = max self.storage_type = type_cls <|end_body_0|> <|body_start_1|> if not isinstance(value, (str, int, float, self.type_cls)) or isinstance(value, bool): raise ValueE...
Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`.
NumberField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberField: """Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`.""" def __init__(self, type_cls: type, *, min: Optional[Union[int, float]]=None, max: Optional[Union[int, float]...
stack_v2_sparse_classes_75kplus_train_002883
2,496
permissive
[ { "docstring": ":param type_cls: number type class that values will be converted to :param min: minimum value (inclusive) :param max: maximum value (inclusive)", "name": "__init__", "signature": "def __init__(self, type_cls: type, *, min: Optional[Union[int, float]]=None, max: Optional[Union[int, float]...
2
stack_v2_sparse_classes_30k_train_049458
Implement the Python class `NumberField` described below. Class description: Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`. Method signatures and docstrings: - def __init__(self, type_cls: type, *, mi...
Implement the Python class `NumberField` described below. Class description: Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`. Method signatures and docstrings: - def __init__(self, type_cls: type, *, mi...
1499ff8f00a43a592571a10666823e125d5fbc49
<|skeleton|> class NumberField: """Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`.""" def __init__(self, type_cls: type, *, min: Optional[Union[int, float]]=None, max: Optional[Union[int, float]...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumberField: """Base class for all number fields. This field should not be used directly, instead consider using :class:`~cincoconfig.IntField` or :class:`~cincoconfig.FloatField`.""" def __init__(self, type_cls: type, *, min: Optional[Union[int, float]]=None, max: Optional[Union[int, float]]=None, **kwa...
the_stack_v2_python_sparse
cincoconfig/fields/number_field.py
ameily/cincoconfig
train
6
c51c0dc1fc99895cb9c274b6a967aeb2cff4c2f1
[ "connection = [connection for connection in type(self).connections() if connection.attname == attr]\nif connection:\n return connection[0].resolver(self, {}, {})\nelse:\n raise AttributeError", "from nautilus.conventions import model_service_name\nservice_name = model_service_name(cls.service)\nobject_filte...
<|body_start_0|> connection = [connection for connection in type(self).connections() if connection.attname == attr] if connection: return connection[0].resolver(self, {}, {}) else: raise AttributeError <|end_body_0|> <|body_start_1|> from nautilus.conventions imp...
This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions.
ServiceObjectType
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceObjectType: """This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions.""" def __getattr__(self, attr): """This is overwritt...
stack_v2_sparse_classes_75kplus_train_002884
5,309
permissive
[ { "docstring": "This is overwritten to check for connection fields which don't make it to the class record.", "name": "__getattr__", "signature": "def __getattr__(self, attr)" }, { "docstring": "Returns the node with the corresponding id by querying the appropriate service.", "name": "get_no...
4
stack_v2_sparse_classes_30k_train_006300
Implement the Python class `ServiceObjectType` described below. Class description: This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions. Method signatures and doc...
Implement the Python class `ServiceObjectType` described below. Class description: This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions. Method signatures and doc...
ef7e0ea57cb7ed5c483b283603b95968adecc51e
<|skeleton|> class ServiceObjectType: """This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions.""" def __getattr__(self, attr): """This is overwritt...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceObjectType: """This object type represents data maintained by a remote service. `Connection`s to and from other `ServiceObjectType`s are resolved through a specified a connection service assuming nautilus naming conventions.""" def __getattr__(self, attr): """This is overwritten to check f...
the_stack_v2_python_sparse
nautilus/api/objectTypes/serviceObjectType.py
janjaapbos/nautilus
train
0
c665229ba39c6fe946a9810f78b848bd08d301e9
[ "self.datafake = self.datafake.astype('float')\ncorrDropVar, corrData, corrDesc = FeaLinearSelectClass(self.corrThreshold, self.vifThreshold).corr_select(self.datafake, self.target, 'iv')\nprint(corrDropVar)\nprint(corrData)\nprint(corrDesc)\nreturn (corrDropVar, corrData, corrDesc)", "self.datafake = self.datafa...
<|body_start_0|> self.datafake = self.datafake.astype('float') corrDropVar, corrData, corrDesc = FeaLinearSelectClass(self.corrThreshold, self.vifThreshold).corr_select(self.datafake, self.target, 'iv') print(corrDropVar) print(corrData) print(corrDesc) return (corrDropVa...
功能描述:缺失值处理测试类
TestFeaLinearSelectClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFeaLinearSelectClass: """功能描述:缺失值处理测试类""" def test_corr_select(self): """功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25""" <|body_0|> def test_vif_select(self): """功能描述:测试函数vif_select edited by 王文丹 at 2021/07/25""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_002885
5,452
no_license
[ { "docstring": "功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25", "name": "test_corr_select", "signature": "def test_corr_select(self)" }, { "docstring": "功能描述:测试函数vif_select edited by 王文丹 at 2021/07/25", "name": "test_vif_select", "signature": "def test_vif_select(self)" } ]
2
null
Implement the Python class `TestFeaLinearSelectClass` described below. Class description: 功能描述:缺失值处理测试类 Method signatures and docstrings: - def test_corr_select(self): 功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25 - def test_vif_select(self): 功能描述:测试函数vif_select edited by 王文丹 at 2021/07/25
Implement the Python class `TestFeaLinearSelectClass` described below. Class description: 功能描述:缺失值处理测试类 Method signatures and docstrings: - def test_corr_select(self): 功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25 - def test_vif_select(self): 功能描述:测试函数vif_select edited by 王文丹 at 2021/07/25 <|skeleton|> class ...
e1f7d1229ee82fb5cf7e5f969f24f8c61568c2c9
<|skeleton|> class TestFeaLinearSelectClass: """功能描述:缺失值处理测试类""" def test_corr_select(self): """功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25""" <|body_0|> def test_vif_select(self): """功能描述:测试函数vif_select edited by 王文丹 at 2021/07/25""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFeaLinearSelectClass: """功能描述:缺失值处理测试类""" def test_corr_select(self): """功能描述:测试函数test_vif_select edited by 王文丹 at 2021/07/25""" self.datafake = self.datafake.astype('float') corrDropVar, corrData, corrDesc = FeaLinearSelectClass(self.corrThreshold, self.vifThreshold).corr_sel...
the_stack_v2_python_sparse
J_unintest/F_SelectChar_test/test_FeaSelectProcessModule/test_FeaLinearSelectHandle.py
wenhui0331/Basic_Model_V1
train
0
399155a1af881859278f145752e4aee03833d23c
[ "fdops.check_if_file_exists(csv_path)\nself._df = pd.read_csv(csv_path)\nself.props = self._get_properties(csv_path)", "props = {}\nloc, fname, ext = fdops.get_loc_name_ext(csv_path)\nprops['loc'] = loc\nprops['name'] = fname\nprops['ext'] = ext\nprops['W'] = self._df['W'].unique().item()\nprops['H'] = self._df['...
<|body_start_0|> fdops.check_if_file_exists(csv_path) self._df = pd.read_csv(csv_path) self.props = self._get_properties(csv_path) <|end_body_0|> <|body_start_1|> props = {} loc, fname, ext = fdops.get_loc_name_ext(csv_path) props['loc'] = loc props['name'] = fna...
Processes detection data for a single video.
DetectionData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetectionData: """Processes detection data for a single video.""" def __init__(self, csv_path): """Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection information Note ---- It is assumed that the directory containin...
stack_v2_sparse_classes_75kplus_train_002886
3,827
no_license
[ { "docstring": "Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection information Note ---- It is assumed that the directory containing the detections csv file has `properties_session.cv` file. This file should contain information about current ...
5
stack_v2_sparse_classes_30k_train_001333
Implement the Python class `DetectionData` described below. Class description: Processes detection data for a single video. Method signatures and docstrings: - def __init__(self, csv_path): Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection informa...
Implement the Python class `DetectionData` described below. Class description: Processes detection data for a single video. Method signatures and docstrings: - def __init__(self, csv_path): Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection informa...
32e072c9bf53533ec38ec2c4f873f00a263421d6
<|skeleton|> class DetectionData: """Processes detection data for a single video.""" def __init__(self, csv_path): """Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection information Note ---- It is assumed that the directory containin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DetectionData: """Processes detection data for a single video.""" def __init__(self, csv_path): """Initialize an object detection data instance. Parameters ---------- csv_path : str Path to csv file containing detection information Note ---- It is assumed that the directory containing the detecti...
the_stack_v2_python_sparse
harp/data_processors/detection_data_processor.py
SravaniTeeparthi/harp
train
0
2b240565e8d891fd45f3853f3c87af73248f7457
[ "super(MockIRODSTestCaseMixin, self).setUp()\nif settings.IRODS_HOST != 'data.local.org':\n from mock import patch\n self.irods_patchers = (patch('hs_core.hydroshare.hs_bagit.delete_files_and_bag'), patch('hs_core.hydroshare.hs_bagit.create_bag'), patch('hs_core.hydroshare.hs_bagit.create_bag_files'), patch('...
<|body_start_0|> super(MockIRODSTestCaseMixin, self).setUp() if settings.IRODS_HOST != 'data.local.org': from mock import patch self.irods_patchers = (patch('hs_core.hydroshare.hs_bagit.delete_files_and_bag'), patch('hs_core.hydroshare.hs_bagit.create_bag'), patch('hs_core.hydros...
Mix in to allow for mock iRODS testing.
MockIRODSTestCaseMixin
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockIRODSTestCaseMixin: """Mix in to allow for mock iRODS testing.""" def setUp(self): """Set up iRODS patchers for testing of data bags, etc.""" <|body_0|> def tearDown(self): """Stop iRODS patchers.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_002887
40,377
permissive
[ { "docstring": "Set up iRODS patchers for testing of data bags, etc.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Stop iRODS patchers.", "name": "tearDown", "signature": "def tearDown(self)" } ]
2
stack_v2_sparse_classes_30k_train_032940
Implement the Python class `MockIRODSTestCaseMixin` described below. Class description: Mix in to allow for mock iRODS testing. Method signatures and docstrings: - def setUp(self): Set up iRODS patchers for testing of data bags, etc. - def tearDown(self): Stop iRODS patchers.
Implement the Python class `MockIRODSTestCaseMixin` described below. Class description: Mix in to allow for mock iRODS testing. Method signatures and docstrings: - def setUp(self): Set up iRODS patchers for testing of data bags, etc. - def tearDown(self): Stop iRODS patchers. <|skeleton|> class MockIRODSTestCaseMixi...
69855813052243c702c9b0108d2eac3f4f1a768f
<|skeleton|> class MockIRODSTestCaseMixin: """Mix in to allow for mock iRODS testing.""" def setUp(self): """Set up iRODS patchers for testing of data bags, etc.""" <|body_0|> def tearDown(self): """Stop iRODS patchers.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MockIRODSTestCaseMixin: """Mix in to allow for mock iRODS testing.""" def setUp(self): """Set up iRODS patchers for testing of data bags, etc.""" super(MockIRODSTestCaseMixin, self).setUp() if settings.IRODS_HOST != 'data.local.org': from mock import patch ...
the_stack_v2_python_sparse
hs_core/testing.py
hydroshare/hydroshare
train
207
a0d553eb9b46b5e4906ead8df3f7c8b439e7e946
[ "xml_root: ET.Element = ET.parse(xml_file_path).getroot()\narticles_xml_list = xml_root.findall('PubmedArticle')\npubmed_articles: [PubMedArticle] = []\nfor article_xml in articles_xml_list:\n pubmed_articles.append(PubMedArticle(article_xml))\nreturn pubmed_articles", "dict_list = []\nfor article in articles:...
<|body_start_0|> xml_root: ET.Element = ET.parse(xml_file_path).getroot() articles_xml_list = xml_root.findall('PubmedArticle') pubmed_articles: [PubMedArticle] = [] for article_xml in articles_xml_list: pubmed_articles.append(PubMedArticle(article_xml)) return pubmed...
Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.
ArticleSetParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml fil...
stack_v2_sparse_classes_75kplus_train_002888
9,548
permissive
[ { "docstring": "Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml file Returns: [PubMedArticle] -- List of pubmed article objects", "name": "extract_articles", "signature": "def extract_articles(xml_file_path: str) -> [PubMedArticle]" }, { "docstring": "Gener...
5
stack_v2_sparse_classes_30k_train_030680
Implement the Python class `ArticleSetParser` described below. Class description: Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>. Method signatures and docstrings: - def extract_articles(xml_file_path: str) -> [PubMedArticle]: Extract articles from xml file. A...
Implement the Python class `ArticleSetParser` described below. Class description: Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>. Method signatures and docstrings: - def extract_articles(xml_file_path: str) -> [PubMedArticle]: Extract articles from xml file. A...
83e36e24077169d141f25c357cb1009b79b78661
<|skeleton|> class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml fil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml file Returns: [P...
the_stack_v2_python_sparse
geniepy/src/geniepy/pubmed.py
cjflanagan/genie-1
train
0
4a9f0258a596948881080cf71face51a2d054775
[ "if id is None:\n return super(LoggerCustom, self).info(msg, *args, **kwargs)\nelse:\n return super(LoggerCustom, self).info(f'{id} - {msg}', *args, **kwargs)", "if id is None:\n return super(LoggerCustom, self).debug(msg, *args, **kwargs)\nelse:\n return super(LoggerCustom, self).debug(f'{id} - {msg}...
<|body_start_0|> if id is None: return super(LoggerCustom, self).info(msg, *args, **kwargs) else: return super(LoggerCustom, self).info(f'{id} - {msg}', *args, **kwargs) <|end_body_0|> <|body_start_1|> if id is None: return super(LoggerCustom, self).debug(msg...
Logger class that overrides the logging.Logger
LoggerCustom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggerCustom: """Logger class that overrides the logging.Logger""" def info(self, msg, id=None, *args, **kwargs): """Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the logs :param id: the input given instead of the extra param...
stack_v2_sparse_classes_75kplus_train_002889
6,784
no_license
[ { "docstring": "Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the logs :param id: the input given instead of the extra parameter :param args: :param kwargs: :return: a log with the format given", "name": "info", "signature": "def info(self, msg,...
5
stack_v2_sparse_classes_30k_train_039222
Implement the Python class `LoggerCustom` described below. Class description: Logger class that overrides the logging.Logger Method signatures and docstrings: - def info(self, msg, id=None, *args, **kwargs): Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the l...
Implement the Python class `LoggerCustom` described below. Class description: Logger class that overrides the logging.Logger Method signatures and docstrings: - def info(self, msg, id=None, *args, **kwargs): Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the l...
02ec49c655d3bd292b151a86e4d63192edf32d13
<|skeleton|> class LoggerCustom: """Logger class that overrides the logging.Logger""" def info(self, msg, id=None, *args, **kwargs): """Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the logs :param id: the input given instead of the extra param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoggerCustom: """Logger class that overrides the logging.Logger""" def info(self, msg, id=None, *args, **kwargs): """Log 'msg % args' with severity 'INFO'. This function overrides logging.Logger :param msg: msg to show in the logs :param id: the input given instead of the extra parameter :param a...
the_stack_v2_python_sparse
main/core/helpers/DefaultLogger.py
rodmandi/health_api
train
0
22af01ed6bdceb6d59321f52e9e6317731643931
[ "super().__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = t...
<|body_start_0|> super().__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(units=dm) self.layernorm1 = tf.keras.layers...
Creates a decoder block for a transformer
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """Creates a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Returns: a tensor of shape (batch, ta...
stack_v2_sparse_classes_75kplus_train_002890
13,179
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "Returns: a tensor of shape (batch, target_seq_len, dm) containing the block’s output", "name": "call", "signature": "def call(self, x, encoder_output...
2
stack_v2_sparse_classes_30k_train_015238
Implement the Python class `DecoderBlock` described below. Class description: Creates a decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Returns: a tenso...
Implement the Python class `DecoderBlock` described below. Class description: Creates a decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Returns: a tenso...
161e33b23d398d7d01ad0d7740b78dda3f27e787
<|skeleton|> class DecoderBlock: """Creates a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Returns: a tensor of shape (batch, ta...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DecoderBlock: """Creates a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" super().__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layer...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
felipeserna/holbertonschool-machine_learning
train
0
8850ed7fa96daf7095108fc25b586e7021bb3b2f
[ "if not nums:\n return\nsize = len(nums)\nk = k % size\nif not k:\n return\nremain = size - k\nfor i in range(remain // 2):\n nums[i], nums[remain - 1 - i] = (nums[remain - 1 - i], nums[i])\nfor i in range(k // 2):\n nums[i + remain], nums[size - 1 - i] = (nums[size - 1 - i], nums[i + remain])\nfor i in...
<|body_start_0|> if not nums: return size = len(nums) k = k % size if not k: return remain = size - k for i in range(remain // 2): nums[i], nums[remain - 1 - i] = (nums[remain - 1 - i], nums[i]) for i in range(k // 2): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate1(self, nums: List[int], k: int) -> None: """Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O(1)""" <|body_0|> def rotate2(self, nums: List[int], k: int) -> None: """Cac...
stack_v2_sparse_classes_75kplus_train_002891
1,450
no_license
[ { "docstring": "Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O(1)", "name": "rotate1", "signature": "def rotate1(self, nums: List[int], k: int) -> None" }, { "docstring": "Cache the first size - k numbers and replace...
2
stack_v2_sparse_classes_30k_test_001224
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate1(self, nums: List[int], k: int) -> None: Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate1(self, nums: List[int], k: int) -> None: Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def rotate1(self, nums: List[int], k: int) -> None: """Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O(1)""" <|body_0|> def rotate2(self, nums: List[int], k: int) -> None: """Cac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate1(self, nums: List[int], k: int) -> None: """Reverse solution. Reverse the first n-k and remaining k elements separately, then reverse the whole array. Time: O(n) Space: O(1)""" if not nums: return size = len(nums) k = k % size if not k: ...
the_stack_v2_python_sparse
easy/rotate-array/solution.py
hsuanhauliu/leetcode-solutions
train
0
ead78d6107264d1609a27f38e0a5edb009369176
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SubscribedSku()", "from .entity import Entity\nfrom .license_units_detail import LicenseUnitsDetail\nfrom .service_plan_info import ServicePlanInfo\nfrom .entity import Entity\nfrom .license_units_detail import LicenseUnitsDetail\nfrom...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SubscribedSku() <|end_body_0|> <|body_start_1|> from .entity import Entity from .license_units_detail import LicenseUnitsDetail from .service_plan_info import ServicePlanInfo ...
SubscribedSku
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscribedSku: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubscribedSku: """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...
stack_v2_sparse_classes_75kplus_train_002892
5,146
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: SubscribedSku", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
stack_v2_sparse_classes_30k_train_005062
Implement the Python class `SubscribedSku` described below. Class description: Implement the SubscribedSku class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubscribedSku: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `SubscribedSku` described below. Class description: Implement the SubscribedSku class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubscribedSku: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SubscribedSku: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubscribedSku: """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...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubscribedSku: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SubscribedSku: """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: SubscribedSk...
the_stack_v2_python_sparse
msgraph/generated/models/subscribed_sku.py
microsoftgraph/msgraph-sdk-python
train
135
c4e6414580b6c1facaa2159a3f542e21a592c53c
[ "max_file_size = settings.CLASSROOM_DOCUMENT_SOURCE_MAX_SIZE\nif 'filename' in data and 'size' not in data:\n raise ValidationError({'size': ['File size is required']})\nif 'size' in data and data.pop('size') > max_file_size:\n raise ValidationError({'size': [f'File too large, max size allowed is {max_file_si...
<|body_start_0|> max_file_size = settings.CLASSROOM_DOCUMENT_SOURCE_MAX_SIZE if 'filename' in data and 'size' not in data: raise ValidationError({'size': ['File size is required']}) if 'size' in data and data.pop('size') > max_file_size: raise ValidationError({'size': [f'...
A serializer to display a ClassroomDocument resource.
ClassroomDocumentSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassroomDocumentSerializer: """A serializer to display a ClassroomDocument resource.""" def to_internal_value(self, data): """Validate if the size is coherent with django settings.""" <|body_0|> def create(self, validated_data): """Force the classroom field to t...
stack_v2_sparse_classes_75kplus_train_002893
12,712
permissive
[ { "docstring": "Validate if the size is coherent with django settings.", "name": "to_internal_value", "signature": "def to_internal_value(self, data)" }, { "docstring": "Force the classroom field to the classroom of the JWT Token if any. Parameters ---------- validated_data : dictionary Dictiona...
4
null
Implement the Python class `ClassroomDocumentSerializer` described below. Class description: A serializer to display a ClassroomDocument resource. Method signatures and docstrings: - def to_internal_value(self, data): Validate if the size is coherent with django settings. - def create(self, validated_data): Force the...
Implement the Python class `ClassroomDocumentSerializer` described below. Class description: A serializer to display a ClassroomDocument resource. Method signatures and docstrings: - def to_internal_value(self, data): Validate if the size is coherent with django settings. - def create(self, validated_data): Force the...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class ClassroomDocumentSerializer: """A serializer to display a ClassroomDocument resource.""" def to_internal_value(self, data): """Validate if the size is coherent with django settings.""" <|body_0|> def create(self, validated_data): """Force the classroom field to t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassroomDocumentSerializer: """A serializer to display a ClassroomDocument resource.""" def to_internal_value(self, data): """Validate if the size is coherent with django settings.""" max_file_size = settings.CLASSROOM_DOCUMENT_SOURCE_MAX_SIZE if 'filename' in data and 'size' not...
the_stack_v2_python_sparse
src/backend/marsha/bbb/serializers.py
openfun/marsha
train
92
2f2627fd229e5362574970057b40fbdaca755406
[ "sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nreeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nsc_table = DataCleaner.rename_cols(sc_table, name_map=DataCleaner.REV_NAM...
<|body_start_0|> sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port) reeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port) sc_table = DataCleaner.rename_cols(sc_t...
Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.
ProjectGidHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gi...
stack_v2_sparse_classes_75kplus_train_002894
18,002
permissive
[ { "docstring": "Get resource gids from a single reeds supply curve build Parameters ---------- sc_table : str | pd.DataFrame reV supply curve results (CSV file path or database.schema.name) reeds_build : str | pd.DataFrame REEDS buildout file with wait : int Integer seconds to wait for DB connection to become a...
2
stack_v2_sparse_classes_30k_train_019830
Implement the Python class `ProjectGidHandler` described below. Class description: Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data. Method signatures and docstrings: - def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d...
Implement the Python class `ProjectGidHandler` described below. Class description: Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data. Method signatures and docstrings: - def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d...
2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb
<|skeleton|> class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectGidHandler: """Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.""" def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432): """Get resource gids from a sin...
the_stack_v2_python_sparse
reVX/plexos/utilities.py
NREL/reVX
train
10
221f7b858df21eaa923dee13d66b876d3ebc5f98
[ "min_context_list = []\nfor i in itertools.product([0, 1], repeat=self.n_features):\n min_context_list.append(i)\npartitions = []\nfor partition in generate_partition(min_context_list):\n partitions.append(partition)\npartition_values = []\nmax_best_rewards_p_list = []\nfor partition in partitions:\n parti...
<|body_start_0|> min_context_list = [] for i in itertools.product([0, 1], repeat=self.n_features): min_context_list.append(i) partitions = [] for partition in generate_partition(min_context_list): partitions.append(partition) partition_values = [] ...
A simple context generator that compares all possible partitions and select the one with the highest value
BruteforceContextGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BruteforceContextGenerator: """A simple context generator that compares all possible partitions and select the one with the highest value""" def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]): """Update the context structure tree by looking at ...
stack_v2_sparse_classes_75kplus_train_002895
6,509
permissive
[ { "docstring": "Update the context structure tree by looking at every possible combinations of feature without looking at the old context structure :param old_cst_root: old context structure tree :return: new context structure tree based on greedy algorithm on leaf nodes", "name": "get_context_structure", ...
4
stack_v2_sparse_classes_30k_train_053863
Implement the Python class `BruteforceContextGenerator` described below. Class description: A simple context generator that compares all possible partitions and select the one with the highest value Method signatures and docstrings: - def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[T...
Implement the Python class `BruteforceContextGenerator` described below. Class description: A simple context generator that compares all possible partitions and select the one with the highest value Method signatures and docstrings: - def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[T...
0ba1e0ee67a570bb53ad02e9481e0c58ffc69249
<|skeleton|> class BruteforceContextGenerator: """A simple context generator that compares all possible partitions and select the one with the highest value""" def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]): """Update the context structure tree by looking at ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BruteforceContextGenerator: """A simple context generator that compares all possible partitions and select the one with the highest value""" def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]): """Update the context structure tree by looking at every possibl...
the_stack_v2_python_sparse
bandit/context/BruteforceContextGenerator.py
riccardopoiani/pricing-and-advertising-machine-learning
train
3
c4dc5cc2c72a47585259ee473c469d8b31a12510
[ "user = self.context['request'].user\ntrip = self.context['trip']\nif not trip.passengers.filter(pk=user.pk).exists():\n raise serializers.ValidationError('User is not a passenger')\nprevious_rating = Rating.objects.filter(pool=self.context['pool'], trip=trip, rating_user=user)\nif previous_rating.exists():\n ...
<|body_start_0|> user = self.context['request'].user trip = self.context['trip'] if not trip.passengers.filter(pk=user.pk).exists(): raise serializers.ValidationError('User is not a passenger') previous_rating = Rating.objects.filter(pool=self.context['pool'], trip=trip, rati...
Create trip serializer.
CreateTripRatingSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateTripRatingSerializer: """Create trip serializer.""" def validate(self, data): """Verify rating hasn't been emitted before.""" <|body_0|> def create(self, data): """Create rating.""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = self....
stack_v2_sparse_classes_75kplus_train_002896
2,049
no_license
[ { "docstring": "Verify rating hasn't been emitted before.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Create rating.", "name": "create", "signature": "def create(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_045218
Implement the Python class `CreateTripRatingSerializer` described below. Class description: Create trip serializer. Method signatures and docstrings: - def validate(self, data): Verify rating hasn't been emitted before. - def create(self, data): Create rating.
Implement the Python class `CreateTripRatingSerializer` described below. Class description: Create trip serializer. Method signatures and docstrings: - def validate(self, data): Verify rating hasn't been emitted before. - def create(self, data): Create rating. <|skeleton|> class CreateTripRatingSerializer: """Cr...
ee003cd4cecbcb3ec1a490a3259e8914f78b11cd
<|skeleton|> class CreateTripRatingSerializer: """Create trip serializer.""" def validate(self, data): """Verify rating hasn't been emitted before.""" <|body_0|> def create(self, data): """Create rating.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateTripRatingSerializer: """Create trip serializer.""" def validate(self, data): """Verify rating hasn't been emitted before.""" user = self.context['request'].user trip = self.context['trip'] if not trip.passengers.filter(pk=user.pk).exists(): raise seriali...
the_stack_v2_python_sparse
grupalcar/trips/serializers/ratings.py
adnrbp/GrupalCar-API
train
1
79c78f1e08db40ba1c6250784843e0cc0da2d0f4
[ "super(BeamSearchWithSrcInfer, self).__init__()\nself.core_decoder = core_decoder\nself.register_buffer('start_idx', torch.Tensor([start_idx]))\nself.beam_width = beam_width\nself.softmax2 = nn.Softmax(dim=2)\nself.softmax1 = nn.Softmax(dim=1)\nself.device = device", "with torch.no_grad():\n batch_size = enc_c...
<|body_start_0|> super(BeamSearchWithSrcInfer, self).__init__() self.core_decoder = core_decoder self.register_buffer('start_idx', torch.Tensor([start_idx])) self.beam_width = beam_width self.softmax2 = nn.Softmax(dim=2) self.softmax1 = nn.Softmax(dim=1) self.devi...
BeamSearchWithSrcInfer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeamSearchWithSrcInfer: def __init__(self, core_decoder, start_idx, beam_width, device): """:param core_decoder: :param start_idx: :param beam_width:""" <|body_0|> def forward(self, enc_h_n, enc_c_n, enc_outputs, enc_inputs, *args): """:param enc_h_n: shape = (num_di...
stack_v2_sparse_classes_75kplus_train_002897
5,932
no_license
[ { "docstring": ":param core_decoder: :param start_idx: :param beam_width:", "name": "__init__", "signature": "def __init__(self, core_decoder, start_idx, beam_width, device)" }, { "docstring": ":param enc_h_n: shape = (num_direction*num_layers, batch_size, hidden_size) :param enc_c_n: shape = (n...
4
stack_v2_sparse_classes_30k_train_032956
Implement the Python class `BeamSearchWithSrcInfer` described below. Class description: Implement the BeamSearchWithSrcInfer class. Method signatures and docstrings: - def __init__(self, core_decoder, start_idx, beam_width, device): :param core_decoder: :param start_idx: :param beam_width: - def forward(self, enc_h_n...
Implement the Python class `BeamSearchWithSrcInfer` described below. Class description: Implement the BeamSearchWithSrcInfer class. Method signatures and docstrings: - def __init__(self, core_decoder, start_idx, beam_width, device): :param core_decoder: :param start_idx: :param beam_width: - def forward(self, enc_h_n...
56ca628b847310bc61a0cd796c0b08dc4126ec01
<|skeleton|> class BeamSearchWithSrcInfer: def __init__(self, core_decoder, start_idx, beam_width, device): """:param core_decoder: :param start_idx: :param beam_width:""" <|body_0|> def forward(self, enc_h_n, enc_c_n, enc_outputs, enc_inputs, *args): """:param enc_h_n: shape = (num_di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BeamSearchWithSrcInfer: def __init__(self, core_decoder, start_idx, beam_width, device): """:param core_decoder: :param start_idx: :param beam_width:""" super(BeamSearchWithSrcInfer, self).__init__() self.core_decoder = core_decoder self.register_buffer('start_idx', torch.Tenso...
the_stack_v2_python_sparse
source/main/model_def/beam_search_decoder.py
ductri/diacritics_restoration_contest
train
0
4e7b2d75e7903fb465f2fc40fdcfa40609bd3961
[ "self.config = ConfigParser({}, collections.OrderedDict)\nself.patterns = collections.OrderedDict()\nif not filename:\n self.patterns[re.compile('.*')] = 'total'\n self.config.add_section('total')\n return\nself.config.read(filename)\nfor section in self.config.sections():\n pattern = re.compile(self.co...
<|body_start_0|> self.config = ConfigParser({}, collections.OrderedDict) self.patterns = collections.OrderedDict() if not filename: self.patterns[re.compile('.*')] = 'total' self.config.add_section('total') return self.config.read(filename) for...
Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ```
Namespaces
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Namespaces: """Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ```""" def __init__(self, filename=N...
stack_v2_sparse_classes_75kplus_train_002898
13,270
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, filename=None)" }, { "docstring": "Return the namespace corresponding to the metric.", "name": "lookup", "signature": "def lookup(self, metric_name)" } ]
2
stack_v2_sparse_classes_30k_train_034118
Implement the Python class `Namespaces` described below. Class description: Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ``...
Implement the Python class `Namespaces` described below. Class description: Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ``...
1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30
<|skeleton|> class Namespaces: """Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ```""" def __init__(self, filename=N...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Namespaces: """Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\\.relay\\.* [carbon-cache] pattern = carbon\\.agents\\.* [carbon-aggregator] pattern = carbon\\.aggregator\\.* [prometheus] pattern = prometheus\\.* ```""" def __init__(self, filename=None): ...
the_stack_v2_python_sparse
biggraphite/cli/command_stats.py
criteo/biggraphite
train
129
cf97f49c2e28cfef04194b1368777bf4cbfbf797
[ "self.owner_name = owner_name\nself.owner_address = owner_address\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nowner_name = dictionary.get('ownerName')\nowner_address = dictionary.get('ownerAddress')\nfor key in cls._names.values():\n if key in dictionary:\n ...
<|body_start_0|> self.owner_name = owner_name self.owner_address = owner_address self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None owner_name = dictionary.get('ownerName') owner_address = dic...
Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the institution. owner_address (string): The addres...
AccountOwnerV1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the insti...
stack_v2_sparse_classes_75kplus_train_002899
2,129
permissive
[ { "docstring": "Constructor for the AccountOwnerV1 class", "name": "__init__", "signature": "def __init__(self, owner_name=None, owner_address=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repre...
2
stack_v2_sparse_classes_30k_train_013232
Implement the Python class `AccountOwnerV1` described below. Class description: Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the...
Implement the Python class `AccountOwnerV1` described below. Class description: Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the insti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountOwnerV1: """Implementation of the 'Account Owner v1' model. The account owner information for the customer account Attributes: owner_name (string): The name of the account owner. In v1 this can be multiple account owners in one string. This is how the source data is returned from the institution. owner...
the_stack_v2_python_sparse
finicityapi/models/account_owner_v_1.py
monarchmoney/finicity-python
train
0